Added method to query for number of components.
This commit is contained in:
parent
32dbe00516
commit
84a827e847
@ -174,6 +174,11 @@ namespace Opm {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t SimulationDataContainer::numCellDataComponents( const std::string& name ) const {
|
||||
const auto& data = getCellData( name );
|
||||
return data.size() / m_num_cells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This is very deprecated. */
|
||||
|
@ -63,6 +63,14 @@ namespace Opm {
|
||||
std::vector<double>& getFaceData( const std::string& name );
|
||||
const std::vector<double>& getFaceData( const std::string& name ) const;
|
||||
|
||||
/// Will return the number of components of the celldata with
|
||||
/// name @name:
|
||||
///
|
||||
/// numCellDataComponents( "PRESSURE" ) -> 1
|
||||
/// numCellDataComponents( "SATURATION" ) -> 3
|
||||
///
|
||||
/// for a three phase model.
|
||||
size_t numCellDataComponents( const std::string& name ) const;
|
||||
bool equal(const SimulationDataContainer& other) const;
|
||||
|
||||
|
||||
|
@ -55,9 +55,11 @@ BOOST_AUTO_TEST_CASE(TestRegisterDefaults) {
|
||||
{
|
||||
auto pressure = container.getCellData("PRESSURE");
|
||||
BOOST_CHECK_EQUAL( pressure.size() , 1000U );
|
||||
BOOST_CHECK_EQUAL( container.numCellDataComponents( "PRESSURE") , 1U);
|
||||
|
||||
auto sat = container.getCellData("SATURATION");
|
||||
BOOST_CHECK_EQUAL( sat.size() , 1000U*2 );
|
||||
BOOST_CHECK_EQUAL( container.numCellDataComponents( "SATURATION") , 2U);
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user