packages/SPn/spn_driver/Problem_Builder.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Calculate material ids in an axial level.
 */
\brief Calculate material ids in an axial level.
\ brief Calculate material ids in an axial level .
void Problem_Builder::calc_axial_matids(int            level,
                                        TwoDArray_int &matids)
{
    using def::I; using def::J;
    int aoff_x = 0, poff_x = 0;
    int aoff_y = 0, poff_y = 0;
    const auto &axial_list  = d_coredb->get<OneDArray_str>("axial list");
    const auto &assbly_list = d_assblydb->get<OneDArray_str>("assembly list");
    const auto &core_map = d_coredb->get<TwoDArray_int>(axial_list[level]);
    CHECK(core_map.getNumCols() == d_Na[I]);
    CHECK(core_map.getNumRows() == d_Na[J]);
    int radial_mesh = d_db->get<int>("radial mesh");
    CHECK(matids.getNumCols() == d_Na[I] * d_Np[I] * radial_mesh);
    CHECK(matids.getNumRows() == d_Na[J] * d_Np[J] * radial_mesh);
    int matid = 0;
    for (int aj = 0; aj < d_Na[J]; ++aj)
    {
        aoff_y = (radial_mesh * d_Np[J]) * aj;
        for (int ai = 0; ai < d_Na[I]; ++ai)
        {
            CHECK(core_map(aj, ai) < assbly_list.size());
            CHECK(d_assblydb->isParameter(assbly_list[core_map(aj, ai)]));
            const auto &assbly_map = d_assblydb->get<TwoDArray_int>(
                assbly_list[core_map(aj, ai)]);
            CHECK(assbly_map.getNumCols() == d_Np[I]);
            CHECK(assbly_map.getNumRows() == d_Np[J]);
            aoff_x = (radial_mesh * d_Np[I]) * ai;
            for (int pj = 0; pj < d_Np[J]; ++pj)
            {
                poff_y = aoff_y + radial_mesh * pj;
                for (int pi = 0; pi < d_Np[I]; ++pi)
                {
                    poff_x = aoff_x + radial_mesh * pi;
                    matid = assbly_map(pj, pi);
                    CHECK(matid <
                           d_matdb->get<OneDArray_str>("mat list").size());
                    for (int j = 0; j < radial_mesh; ++j)
                    {
                        for (int i = 0; i < radial_mesh; ++i)
                        {
                            CHECK(i + poff_x < matids.getNumCols());
                            CHECK(j + poff_y < matids.getNumRows());
                            matids(j + poff_y, i + poff_x) = matid;
                        }
                    }
                }
            }
        }
    }
}
void Problem_Builder :: calc_axial_matids ( int level , TwoDArray_int & matids ) { using def :: I ; using def :: J ; int aoff_x = 0 , poff_x = 0 ; int aoff_y = 0 , poff_y = 0 ; const auto & axial_list = d_coredb -> get < OneDArray_str > ( " " ) ; const auto & assbly_list = d_assblydb -> get < OneDArray_str > ( " " ) ; const auto & core_map = d_coredb -> get < TwoDArray_int > ( axial_list [ level ] ) ; CHECK ( core_map . getNumCols ( ) == d_Na [ I ] ) ; CHECK ( core_map . getNumRows ( ) == d_Na [ J ] ) ; int radial_mesh = d_db -> get < int > ( " " ) ; CHECK ( matids . getNumCols ( ) == d_Na [ I ] * d_Np [ I ] * radial_mesh ) ; CHECK ( matids . getNumRows ( ) == d_Na [ J ] * d_Np [ J ] * radial_mesh ) ; int matid = 0 ; for ( int aj = 0 ; aj < d_Na [ J ] ; ++ aj ) { aoff_y = ( radial_mesh * d_Np [ J ] ) * aj ; for ( int ai = 0 ; ai < d_Na [ I ] ; ++ ai ) { CHECK ( core_map ( aj , ai ) < assbly_list . size ( ) ) ; CHECK ( d_assblydb -> isParameter ( assbly_list [ core_map ( aj , ai ) ] ) ) ; const auto & assbly_map = d_assblydb -> get < TwoDArray_int > ( assbly_list [ core_map ( aj , ai ) ] ) ; CHECK ( assbly_map . getNumCols ( ) == d_Np [ I ] ) ; CHECK ( assbly_map . getNumRows ( ) == d_Np [ J ] ) ; aoff_x = ( radial_mesh * d_Np [ I ] ) * ai ; for ( int pj = 0 ; pj < d_Np [ J ] ; ++ pj ) { poff_y = aoff_y + radial_mesh * pj ; for ( int pi = 0 ; pi < d_Np [ I ] ; ++ pi ) { poff_x = aoff_x + radial_mesh * pi ; matid = assbly_map ( pj , pi ) ; CHECK ( matid < d_matdb -> get < OneDArray_str > ( " " ) . size ( ) ) ; for ( int j = 0 ; j < radial_mesh ; ++ j ) { for ( int i = 0 ; i < radial_mesh ; ++ i ) { CHECK ( i + poff_x < matids . getNumCols ( ) ) ; CHECK ( j + poff_y < matids . getNumRows ( ) ) ; matids ( j + poff_y , i + poff_x ) = matid ; } } } } } } }
\brief Calculate material ids in an axial level.
\ brief Calculate material ids in an axial level .
// (x, y) global offsets into the mesh by assembly and pin // get the list of core maps and assembly types // get the core-map for this axial level // mesh cells per pin // loop over all assemblies, get the pin-maps, and assign the material ids // to the matids array (remember, all "core arrays" are ordered // COLUMN-MAJOR, which means matids[j, i]) // material id of a pin // loop over assemblies in J // set the y-offset for this assembly // loop over assemblies in I // get the pin-map for this assembly // set the x-offset for this assembly // loop over pins in J // set the y-offset for this pin // set the x-offset for this pin // get the material id for this pin // loop over the mesh cells in this pin