packages/SPn/spn_driver/Manager.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Setup the problem.
 * \param xml_file
 */
\brief Setup the problem.
\ brief Setup the problem .
void Manager::setup(const std::string &xml_file)
{
    SCOPED_TIMER("Manager.setup");
    SCREEN_MSG("Reading xml file -> " << xml_file);
    SCREEN_MSG("Building and initializing mesh");
    Problem_Builder builder;
    builder.setup(xml_file);
    d_db = builder.problem_db();
    d_problem_name = d_db->get("problem_name", std::string("SPn"));
    d_db->setName(d_problem_name + "-PROBLEM");
    d_mesh    = builder.mesh();
    d_indexer = builder.indexer();
    d_gdata   = builder.global_data();
    d_mat = builder.mat_db();
    d_external_source = builder.source();
    d_dim = Teuchos::rcp(new profugus::Dimensions(d_db->get("SPn_order", 1)));
    std::string prob_type = d_external_source.is_null() ? "eigenvalue" :
                            "fixed";
    if (d_db->isSublist("timestep control"))
    {
        INSIST(prob_type == "fixed",
                "Cannot do time-dependent eigenproblems.");
        prob_type = "fixed_tdep";
    }
    d_db->set("problem_type", prob_type);
    SCREEN_MSG("Building " << prob_type << " solver");
    d_db->get("solver_type", std::string("stratimikos"));
    d_solver_base =
        profugus::SpnSolverBuilder::build(prob_type,d_db);
    bool adjoint = d_db->get("adjoint", false);
    d_solver_base->setup(d_dim, d_mat, d_mesh, d_indexer, d_gdata, adjoint);
    d_state = Teuchos::rcp(
        new profugus::State(d_mesh, d_mat->xs().num_groups()));
    ENSURE(!d_mesh.is_null());
    ENSURE(!d_indexer.is_null());
    ENSURE(!d_gdata.is_null());
    ENSURE(!d_mat.is_null());
    ENSURE(!d_dim.is_null());
    ENSURE(!d_state.is_null());
}
void Manager :: setup ( const std :: string & xml_file ) { SCOPED_TIMER ( " " ) ; SCREEN_MSG ( " " << xml_file ) ; SCREEN_MSG ( " " ) ; Problem_Builder builder ; builder . setup ( xml_file ) ; d_db = builder . problem_db ( ) ; d_problem_name = d_db -> get ( " " , std :: string ( " " ) ) ; d_db -> setName ( d_problem_name + " " ) ; d_mesh = builder . mesh ( ) ; d_indexer = builder . indexer ( ) ; d_gdata = builder . global_data ( ) ; d_mat = builder . mat_db ( ) ; d_external_source = builder . source ( ) ; d_dim = Teuchos :: rcp ( new profugus :: Dimensions ( d_db -> get ( " " , 1 ) ) ) ; std :: string prob_type = d_external_source . is_null ( ) ? " " : " " ; if ( d_db -> isSublist ( " " ) ) { INSIST ( prob_type == " " , " " ) ; prob_type = " " ; } d_db -> set ( " " , prob_type ) ; SCREEN_MSG ( " " << prob_type << " " ) ; d_db -> get ( " " , std :: string ( " " ) ) ; d_solver_base = profugus :: SpnSolverBuilder :: build ( prob_type , d_db ) ; bool adjoint = d_db -> get ( " " , false ) ; d_solver_base -> setup ( d_dim , d_mat , d_mesh , d_indexer , d_gdata , adjoint ) ; d_state = Teuchos :: rcp ( new profugus :: State ( d_mesh , d_mat -> xs ( ) . num_groups ( ) ) ) ; ENSURE ( ! d_mesh . is_null ( ) ) ; ENSURE ( ! d_indexer . is_null ( ) ) ; ENSURE ( ! d_gdata . is_null ( ) ) ; ENSURE ( ! d_mat . is_null ( ) ) ; ENSURE ( ! d_dim . is_null ( ) ) ; ENSURE ( ! d_state . is_null ( ) ) ; }
\brief Setup the problem.
\ brief Setup the problem .
// use the problem builder to setup the problem // get the problem database from the problem-builder // store the problem name // get the mesh objects from the builder // get the material database from the problem builder // get the source (it will be null for eigenvalue problems) // build the problem dimensions // problem type // if a timestep control is defined then this is a time-dependent problem // set the problem type in the final db // default linear solver type (stratimikios) // build the solver // set default as a forward (not adjoint) run // setup the solver // make the state