<commit_before>//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// GRINS - General Reacting Incompressible Navier-Stokes
//
// Copyright (C) 2014-2015 <NAME>, <NAME>
// Copyright (C) 2010-2013 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA  02110-1301  USA
//
//-----------------------------------------------------------------------el-

// This class
#include "grins/solver_factory.h"

// GRINS
#include "grins/grins_steady_solver.h"
#include "grins/grins_unsteady_solver.h"
#include "grins/steady_mesh_adaptive_solver.h"
#include "grins/displacement_continuation_solver.h"

// libMesh
#include "libmesh/getpot.h"

namespace GRINS
{
  SharedPtr<Solver> SolverFactory::build(const GetPot& input)
  {
    bool mesh_adaptive = input("MeshAdaptivity/mesh_adaptive", false );

    bool transient = input("unsteady-solver/transient", false );

    SharedPtr<Solver> solver;  // Effectively NULL

    std::string solver_type = input("SolverOptions/solver_type", "DIE!");

    if( solver_type == std::string("displacement_continuation") )
      {
        solver.reset( new DisplacementContinuationSolver(input) );
      }
    else if(transient && !mesh_adaptive)
      {
        solver.reset( new UnsteadySolver(input) );
      }
    else if( !transient && !mesh_adaptive )
      {
        solver.reset( new SteadySolver(input) );
      }
    else if( !transient && mesh_adaptive )
      {
        solver.reset( new SteadyMeshAdaptiveSolver(input) );
      }
    else if( transient && mesh_adaptive )
      {
        libmesh_not_implemented();
      }
    else
      {
        std::cerr << "Invalid solver options!" << std::endl;
      }

    return solver;
  }

} // namespace GRINS
<commit_msg>Factor out parsing from SolverFactory<commit_after>//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// GRINS - General Reacting Incompressible Navier-Stokes
//
// Copyright (C) 2014-2015 <NAME>, <NAME>
// Copyright (C) 2010-2013 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA  02110-1301  USA
//
//-----------------------------------------------------------------------el-

// This class
#include "grins/solver_factory.h"

// GRINS
#include "grins/solver_names.h"
#include "grins/solver_parsing.h"
#include "grins/grins_steady_solver.h"
#include "grins/grins_unsteady_solver.h"
#include "grins/steady_mesh_adaptive_solver.h"
#include "grins/displacement_continuation_solver.h"

// libMesh
#include "libmesh/getpot.h"

namespace GRINS
{
  SharedPtr<Solver> SolverFactory::build(const GetPot& input)
  {
    std::string solver_type = SolverParsing::solver_type(input);

    SharedPtr<Solver> solver;  // Effectively NULL

    if( solver_type == SolverNames::displacement_continuation() )
      {
        solver.reset( new DisplacementContinuationSolver(input) );
      }
    else if(solver_type == SolverNames::unsteady_solver() )
      {
        solver.reset( new UnsteadySolver(input) );
      }
    else if( solver_type == SolverNames::steady_solver() )
      {
        solver.reset( new SteadySolver(input) );
      }
    else if( solver_type == SolverNames::steady_mesh_adaptive_solver() )
      {
        solver.reset( new SteadyMeshAdaptiveSolver(input) );
      }
    else if( solver_type == SolverNames::unsteady_mesh_adaptive_solver() )
      {
        libmesh_not_implemented();
      }
    else
      {
        libmesh_error_msg("Invalid solver_type: "+solver_type);
      }

    return solver;
  }

} // namespace GRINS

{'fraction_non_alphanumeric': 0.18630637952052012, 'fraction_numerical': 0.011783827712312069, 'mean_word_length': 2.301810865191147, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3494863', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1390, 'n_words': 403}