packages/SPn/spn_driver/Problem_Builder.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Build the material data.
 *
 * For now, we build all the cross sections in the problem on every domain.
 * For the mini-app, this is not expected to be an overburdening cost.
 */
\brief Build the material data.
For now, we build all the cross sections in the problem on every domain.
For the mini-app, this is not expected to be an overburdening cost.
\ brief Build the material data . For now we build all the cross sections in the problem on every domain . For the mini - app this is not expected to be an overburdening cost .
void Problem_Builder::build_matdb()
{
    typedef profugus::XS_Builder::Matid_Map Matid_Map;
    typedef profugus::XS_Builder::RCP_XS    RCP_XS;
    REQUIRE(d_matdb->isParameter("mat list"));
    VALIDATE(d_matdb->isParameter("xs library"),
              "Inline cross sections not implemented yet.");
    const auto &mat_list = d_matdb->get<OneDArray_str>("mat list");
    Matid_Map matids;
    for (int id = 0, N = mat_list.size(); id < N; ++id)
    {
        matids.insert(Matid_Map::value_type(id, mat_list[id]));
    }
    matids.complete();
    CHECK(matids.size() == mat_list.size());
    profugus::XS_Builder builder;
    builder.open_and_broadcast(d_matdb->get<std::string>("xs library"));
    int Ng_data = builder.num_groups();
    int N_data  = builder.pn_order();
    int pn_order = d_db->get("Pn_order", N_data);
    VALIDATE(pn_order <= N_data, "Requested Pn scattering order of "
              << pn_order << " is greater than available data Pn order of "
              << N_data);
    int g_first = d_db->get("g_first", 0);
    int g_last  = d_db->get("g_last", Ng_data - 1);
    VALIDATE(1 + (g_last - g_first) <= Ng_data, "Energy group range exceeds "
              << "number of groups in data, 1 + g_last - g_first = "
              << 1 + (g_last - g_first) << " > " << Ng_data);
    builder.build(matids, pn_order, g_first, g_last);
    RCP_XS xs = builder.get_xs();
    CHECK(xs->num_mat() == matids.size());
    CHECK(xs->num_groups() == 1 + (g_last - g_first));
    d_mat = Teuchos::rcp(new profugus::Mat_DB);
    d_mat->set(xs, d_mesh->num_cells());
    d_mat->assign(d_matids);
}
void Problem_Builder :: build_matdb ( ) { typedef profugus :: XS_Builder :: Matid_Map Matid_Map ; typedef profugus :: XS_Builder :: RCP_XS RCP_XS ; REQUIRE ( d_matdb -> isParameter ( " " ) ) ; VALIDATE ( d_matdb -> isParameter ( " " ) , " " ) ; const auto & mat_list = d_matdb -> get < OneDArray_str > ( " " ) ; Matid_Map matids ; for ( int id = 0 , N = mat_list . size ( ) ; id < N ; ++ id ) { matids . insert ( Matid_Map :: value_type ( id , mat_list [ id ] ) ) ; } matids . complete ( ) ; CHECK ( matids . size ( ) == mat_list . size ( ) ) ; profugus :: XS_Builder builder ; builder . open_and_broadcast ( d_matdb -> get < std :: string > ( " " ) ) ; int Ng_data = builder . num_groups ( ) ; int N_data = builder . pn_order ( ) ; int pn_order = d_db -> get ( " " , N_data ) ; VALIDATE ( pn_order <= N_data , " " << pn_order << " " << N_data ) ; int g_first = d_db -> get ( " " , 0 ) ; int g_last = d_db -> get ( " " , Ng_data - 1 ) ; VALIDATE ( 1 + ( g_last - g_first ) <= Ng_data , " " << " " << 1 + ( g_last - g_first ) << " " << Ng_data ) ; builder . build ( matids , pn_order , g_first , g_last ) ; RCP_XS xs = builder . get_xs ( ) ; CHECK ( xs -> num_mat ( ) == matids . size ( ) ) ; CHECK ( xs -> num_groups ( ) == 1 + ( g_last - g_first ) ) ; d_mat = Teuchos :: rcp ( new profugus :: Mat_DB ) ; d_mat -> set ( xs , d_mesh -> num_cells ( ) ) ; d_mat -> assign ( d_matids ) ; }
\brief Build the material data.
\ brief Build the material data .
// get the material list off of the database // convert the matlist to a mat-id map // make a cross section builder // broadcast the raw cross section data // get the number of groups and moments in the cross section data // determine the moment order of the problem // get the number of groups required // build the cross sections // build the material database // set the cross sections // set the matids in the material database