simplify collection
This commit is contained in:
@@ -127,7 +127,7 @@ namespace Opm {
|
||||
, m_inputNnc( m_inputGrid, deck)
|
||||
, m_gridDims( deck )
|
||||
, field_props( deck, m_runspec.phases(), m_inputGrid, m_tables)
|
||||
, m_inputLgrs( deck)
|
||||
, m_lgrs( deck)
|
||||
, m_simulationConfig( m_eclipseConfig.init().restartRequested(), deck, field_props)
|
||||
, aquifer_config( m_tables, m_inputGrid, deck, field_props)
|
||||
, m_transMult( GridDims(deck), deck, field_props)
|
||||
@@ -236,6 +236,10 @@ namespace Opm {
|
||||
return m_faults;
|
||||
}
|
||||
|
||||
const LgrCollection& EclipseState::getLgrs() const {
|
||||
return m_lgrs;
|
||||
}
|
||||
|
||||
const MICPpara& EclipseState::getMICPpara() const {
|
||||
return m_micppara;
|
||||
}
|
||||
|
||||
@@ -13,21 +13,15 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/input/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/input/eclipse/Deck/DeckSection.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/Carfin.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/CarfinManager.hpp>
|
||||
#include <opm/input/eclipse/Parser/ParserKeywords/C.hpp>
|
||||
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -35,84 +29,34 @@ namespace Opm {
|
||||
LgrCollection::LgrCollection()
|
||||
{}
|
||||
|
||||
/*
|
||||
This class stores all LGR's. At this moment we only support lgr's input from CARFIN blocks
|
||||
TODO: Collect also lgrs from RADFIN blocks...
|
||||
*/
|
||||
|
||||
LgrCollection::LgrCollection(const GRIDSection& gridSection,
|
||||
const GridDims& grid) {
|
||||
const auto& lgrKeywords = gridSection.getKeywordList<ParserKeywords::CARFIN>();
|
||||
|
||||
for (auto keyword_iter = lgrKeywords.begin(); keyword_iter != lgrKeywords.end(); ++keyword_iter) {
|
||||
const auto& lgrsKeyword = *keyword_iter;
|
||||
OpmLog::info(OpmInputError::format("\nLoading faults from {keyword} in {file} line {line}", lgrsKeyword->location()));
|
||||
OpmLog::info(OpmInputError::format("\nLoading lgrs from {keyword} in {file} line {line}", lgrsKeyword->location()));
|
||||
|
||||
for (auto iter = lgrsKeyword->begin(); iter != lgrsKeyword->end(); ++iter) {
|
||||
const auto& lgrRecord = *iter;
|
||||
const std::string& lgrName = lgrRecord.getItem(0).get< std::string >(0);
|
||||
|
||||
addLgr(grid, lgrRecord, lgrName);
|
||||
//addLgr(lgrName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LgrCollection LgrCollection::serializationTestObject()
|
||||
{
|
||||
LgrCollection result;
|
||||
result.m_lgrs.insert({"test", Carfin::serializationTestObject()});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LgrCollection::addFaultFaces(const GridDims& grid,
|
||||
const DeckRecord& lgrRecord,
|
||||
const std::string& lgrName)
|
||||
{
|
||||
int I1 = faultRecord.getItem(1).get<int>(0) - 1;
|
||||
int I2 = faultRecord.getItem(2).get<int>(0) - 1;
|
||||
int J1 = faultRecord.getItem(3).get<int>(0) - 1;
|
||||
int J2 = faultRecord.getItem(4).get<int>(0) - 1;
|
||||
int K1 = faultRecord.getItem(5).get<int>(0) - 1;
|
||||
int K2 = faultRecord.getItem(6).get<int>(0) - 1;
|
||||
FaceDir::DirEnum faceDir = FaceDir::FromString(faultRecord.getItem(7).get<std::string>(0));
|
||||
FaultFace face { grid.getNX(), grid.getNY(), grid.getNZ(),
|
||||
size_t(I1), size_t(I2),
|
||||
size_t(J1), size_t(J2),
|
||||
size_t(K1), size_t(K2),
|
||||
faceDir };
|
||||
|
||||
if (!hasFault(faultName))
|
||||
addFault(faultName);
|
||||
|
||||
getFault( faultName ).addFace( face );
|
||||
}
|
||||
|
||||
size_t LgrCollection::size() const {
|
||||
return m_lgrs.size();
|
||||
}
|
||||
|
||||
bool LgrCollection::hasFault(const std::string& faultName) const {
|
||||
return m_flgrs.count( faultName ) > 0;
|
||||
bool LgrCollection::hasLgr(const std::string& lgrName) const {
|
||||
return m_lgrs.count( lgrName ) > 0;
|
||||
}
|
||||
|
||||
const Fault& FaultCollection::getFault(const std::string& faultName) const {
|
||||
return m_lgrs.get( faultName );
|
||||
}
|
||||
|
||||
Fault& LgrCollection::getFault(const std::string& faultName) {
|
||||
return m_lgrs.get( faultName );
|
||||
}
|
||||
|
||||
Fault& LgrCollection::getFault(size_t faultIndex) {
|
||||
return m_lgrs.iget( faultIndex );
|
||||
}
|
||||
|
||||
const Fault& LgrCollection::getFault(size_t faultIndex) const {
|
||||
return m_lgrs.iget( faultIndex );
|
||||
}
|
||||
|
||||
void LgrCollection::addLgr(const std::string& lgrName) {
|
||||
Carfin lgr(lgrName);
|
||||
m_lgrs.insert(std::make_pair(lgr.getName() , lgr));
|
||||
}
|
||||
|
||||
bool LgrCollection::operator==(const LgrCollection& data) const {
|
||||
return this->m_lgrs == data.m_lgrs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user