Internalize PPCWMAX as vector of structs

This commit is contained in:
Svenn Tveit
2023-06-07 15:29:07 +02:00
parent 90497b745b
commit ccc010c8d3
7 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
/*
Copyright (C) 2023 NORCE
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PPCWMAX_HPP
#define PPCWMAX_HPP
#include <cstddef>
#include <vector>
namespace Opm {
class Deck;
struct PpcwmaxRecord {
double max_cap_pres;
bool option;
PpcwmaxRecord() = default;
PpcwmaxRecord(double pres, bool optn) :
max_cap_pres(pres),
option(optn)
{};
bool operator==(const PpcwmaxRecord& other) const {
return this->max_cap_pres == other.max_cap_pres &&
this->option == other.option;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(max_cap_pres);
serializer(option);
}
};
class Ppcwmax {
public:
Ppcwmax() = default;
explicit Ppcwmax(const Deck& deck);
static Ppcwmax serializationTestObject();
std::size_t size() const;
bool empty() const;
const PpcwmaxRecord& operator[](const std::size_t index) const;
bool operator==(const Ppcwmax& other) const {
return this->data == other.data;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(data);
}
private:
std::vector<PpcwmaxRecord> data;
};
}
#endif

View File

@@ -57,6 +57,7 @@
#include <opm/input/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/input/eclipse/EclipseState/Tables/Regdims.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TLMixpar.hpp>
#include <opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp>
namespace Opm {
@@ -78,6 +79,7 @@ namespace Opm {
const Aqudims& getAqudims() const;
const Regdims& getRegdims() const;
const TLMixpar& getTLMixpar() const;
const Ppcwmax& getPpcwmax() const;
/*
WIll return max{ Tabdims::NTFIP , Regdims::NTFIP }.
*/
@@ -260,6 +262,7 @@ namespace Opm {
serializer(m_rtemp);
serializer(m_salinity);
serializer(m_tlmixpar);
serializer(m_ppcwmax);
if (!serializer.isSerializing()) {
m_simpleTables = simpleTables;
if (split.plyshMax > 0) {
@@ -391,6 +394,7 @@ namespace Opm {
Eqldims m_eqldims;
Aqudims m_aqudims;
TLMixpar m_tlmixpar;
Ppcwmax m_ppcwmax;
bool hasImptvd = false;// if deck has keyword IMPTVD
bool hasEnptvd = false;// if deck has keyword ENPTVD