packages/SPn/spn_driver/Problem_Builder.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Build the material ids.
 */
\brief Build the material ids.
\ brief Build the material ids .
void Problem_Builder::build_matids()
{
    using def::I; using def::J; using def::K;
    d_matids.resize(d_mesh->num_cells());
    int k_begin = 0, k_end = 0;
    TwoDArray_int axial_matids(d_gdata->num_cells(J), d_gdata->num_cells(I), 0);
    const auto &axial_mesh = d_db->get<OneDArray_int>("axial mesh");
    for (int level = 0; level < axial_mesh.size(); ++level)
    {
        calc_axial_matids(level, axial_matids);
        k_begin = k_end;
        k_end   = k_begin + axial_mesh[level];
        CHECK(k_end - k_begin == axial_mesh[level]);
        for (int k = k_begin; k < k_end; ++k)
        {
            for (int j = 0; j < d_mesh->num_cells_dim(J); ++j)
            {
                for (int i = 0; i < d_mesh->num_cells_dim(I); ++i)
                {
                    auto global = d_indexer->convert_to_global(i, j);
                    CHECK(global[I] < axial_matids.getNumCols());
                    CHECK(global[J] < axial_matids.getNumRows());
                    d_matids[d_indexer->l2l(i, j, k)] =
                        axial_matids(global[J], global[I]);
                }
            }
        }
    }
}
void Problem_Builder :: build_matids ( ) { using def :: I ; using def :: J ; using def :: K ; d_matids . resize ( d_mesh -> num_cells ( ) ) ; int k_begin = 0 , k_end = 0 ; TwoDArray_int axial_matids ( d_gdata -> num_cells ( J ) , d_gdata -> num_cells ( I ) , 0 ) ; const auto & axial_mesh = d_db -> get < OneDArray_int > ( " " ) ; for ( int level = 0 ; level < axial_mesh . size ( ) ; ++ level ) { calc_axial_matids ( level , axial_matids ) ; k_begin = k_end ; k_end = k_begin + axial_mesh [ level ] ; CHECK ( k_end - k_begin == axial_mesh [ level ] ) ; for ( int k = k_begin ; k < k_end ; ++ k ) { for ( int j = 0 ; j < d_mesh -> num_cells_dim ( J ) ; ++ j ) { for ( int i = 0 ; i < d_mesh -> num_cells_dim ( I ) ; ++ i ) { auto global = d_indexer -> convert_to_global ( i , j ) ; CHECK ( global [ I ] < axial_matids . getNumCols ( ) ) ; CHECK ( global [ J ] < axial_matids . getNumRows ( ) ) ; d_matids [ d_indexer -> l2l ( i , j , k ) ] = axial_matids ( global [ J ] , global [ I ] ) ; } } } } }
\brief Build the material ids.
\ brief Build the material ids .
// size the matids array // k-mesh levels for each axial level // global radial core map // get number of cells per axial level // process the axial levels one at a time // calculate the global matids in this level // determine the begin/end of the axial mesh for this axial level // loop over local cells // get the global IJ indices // assign the local matid