packages/Matprop/xs/XS.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Add scattering cross sections to the database.
 */
\brief Add scattering cross sections to the database.
\ brief Add scattering cross sections to the database .
void XS::add(int              matid,
             int              pn,
             const TwoDArray &data)
{
    REQUIRE(data.getNumRows() == data.getNumCols());
    REQUIRE(data.getNumRows() == d_Ng);
    REQUIRE(pn <= d_pn);
    REQUIRE(d_scatter.size() == d_pn + 1);
    REQUIRE(!d_inst_scat[d_pn].count(matid));
    RCP_Matrix m = Teuchos::rcp(new Matrix(d_Ng, d_Ng, true));
    Matrix    &s = *m;
    for (int j = 0; j < d_Ng; ++j)
    {
        for (int i = 0; i < d_Ng; ++i)
        {
            s(i, j) = data(i, j);
        }
    }
    d_scatter[pn].insert(Hash_Matrix::value_type(matid, m));
    d_inst_scat[pn].insert(matid);
    ENSURE(d_inst_scat[pn].count(matid));
}
void XS :: add ( int matid , int pn , const TwoDArray & data ) { REQUIRE ( data . getNumRows ( ) == data . getNumCols ( ) ) ; REQUIRE ( data . getNumRows ( ) == d_Ng ) ; REQUIRE ( pn <= d_pn ) ; REQUIRE ( d_scatter . size ( ) == d_pn + 1 ) ; REQUIRE ( ! d_inst_scat [ d_pn ] . count ( matid ) ) ; RCP_Matrix m = Teuchos :: rcp ( new Matrix ( d_Ng , d_Ng , true ) ) ; Matrix & s = * m ; for ( int j = 0 ; j < d_Ng ; ++ j ) { for ( int i = 0 ; i < d_Ng ; ++ i ) { s ( i , j ) = data ( i , j ) ; } } d_scatter [ pn ] . insert ( Hash_Matrix :: value_type ( matid , m ) ) ; d_inst_scat [ pn ] . insert ( matid ) ; ENSURE ( d_inst_scat [ pn ] . count ( matid ) ) ; }
\brief Add scattering cross sections to the database.
\ brief Add scattering cross sections to the database .
// make a new matrix to hold data // the 2Darray is internally ROW-MAJOR, whereas Matrix is COLUMN-MAJOR, so // we have to do element-by-element copy // insert into the hash table // indicate that this data has been inserted