packages/MC/geometry/RTK_Cell.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Build volumes in the pin.
 */
\brief Build volumes in the pin.
\ brief Build volumes in the pin .
void RTK_Cell::build_volumes(Vec_Dbl &v,
                             int      offset) const
{
    using profugus::constants::pi;
    REQUIRE(v.size() >= offset + d_num_cells);
    Vec_Dbl vr(d_num_regions);
    int     ctr = 0;
    double last = 0.0;
    for (auto r : d_r)
    {
        double cyl_v = pi * r*r * d_z;
        vr[ctr] = cyl_v - last;
        last = cyl_v;
        ++ctr;
    }
    CHECK(ctr == d_num_regions - 1);
    vr[ctr] = d_xy[0] * d_xy[1] * d_z - last;
    double seg_correction = 1.0 / static_cast<double>(d_segments);
    for (int s = 0; s < d_segments; ++s)
    {
        for (int r = 0; r < d_num_regions; ++r)
        {
            int id = cell(r, s) + offset;
            CHECK(id < v.size());
            v[id] = vr[r] * seg_correction;
        }
    }
}
void RTK_Cell :: build_volumes ( Vec_Dbl & v , int offset ) const { using profugus :: constants :: pi ; REQUIRE ( v . size ( ) >= offset + d_num_cells ) ; Vec_Dbl vr ( d_num_regions ) ; int ctr = 0 ; double last = 0.0 ; for ( auto r : d_r ) { double cyl_v = pi * r * r * d_z ; vr [ ctr ] = cyl_v - last ; last = cyl_v ; ++ ctr ; } CHECK ( ctr == d_num_regions - 1 ) ; vr [ ctr ] = d_xy [ 0 ] * d_xy [ 1 ] * d_z - last ; double seg_correction = 1.0 / static_cast < double > ( d_segments ) ; for ( int s = 0 ; s < d_segments ; ++ s ) { for ( int r = 0 ; r < d_num_regions ; ++ r ) { int id = cell ( r , s ) + offset ; CHECK ( id < v . size ( ) ) ; v [ id ] = vr [ r ] * seg_correction ; } } }
\brief Build volumes in the pin.
\ brief Build volumes in the pin .
// volume of each region // regions counter and last volume // iterate through shells // calculate the volume of this cylinder // assign the volume of the shell // update the last cyclinder volume // increment the ctr // get the volume outside the shells // segment-volume correction // assign the volumes // correct the volume in the regions when multiple segments