Enable Empty Structural Copies of Deck Items and Deck Keywords
This commit adds a new member function, X emptyStructuralCopy() const to the DeckKeyword and DeckItem classes. This member function will form a "structural" copy of "*this", thus preserving aspects such as the currently active "Dimensions", but removing all data values. This is in preparation of adding low-pressure table expansion for the gas PVT tables (i.e., keywords 'PVDG' and 'PVTG').
This commit is contained in:
parent
d736136acc
commit
0c168d67fd
@ -47,6 +47,7 @@ namespace Opm {
|
||||
DeckItem( const std::string&, double, const std::vector<Dimension>& active_dim, const std::vector<Dimension>& default_dim);
|
||||
|
||||
static DeckItem serializationTestObject();
|
||||
DeckItem emptyStructuralCopy() const;
|
||||
|
||||
const std::string& name() const;
|
||||
|
||||
@ -151,6 +152,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
void reserve_additionalRawString(std::size_t);
|
||||
|
||||
private:
|
||||
mutable std::vector< double > dval;
|
||||
std::vector< int > ival;
|
||||
|
@ -51,7 +51,7 @@ namespace Opm {
|
||||
const std::string& name() const;
|
||||
void setFixedSize();
|
||||
const KeywordLocation& location() const;
|
||||
|
||||
DeckKeyword emptyStructuralCopy() const;
|
||||
|
||||
size_t size() const;
|
||||
bool empty() const;
|
||||
|
@ -130,6 +130,22 @@ DeckItem DeckItem::serializationTestObject()
|
||||
return result;
|
||||
}
|
||||
|
||||
DeckItem DeckItem::emptyStructuralCopy() const
|
||||
{
|
||||
auto ret = *this;
|
||||
|
||||
ret.dval .clear();
|
||||
ret.ival .clear();
|
||||
ret.sval .clear();
|
||||
ret.rsval.clear();
|
||||
ret.uval .clear();
|
||||
|
||||
ret.value_status.clear();
|
||||
ret.raw_data = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const std::string& DeckItem::name() const {
|
||||
return this->item_name;
|
||||
}
|
||||
|
@ -65,6 +65,15 @@ namespace Opm {
|
||||
return result;
|
||||
}
|
||||
|
||||
DeckKeyword DeckKeyword::emptyStructuralCopy() const
|
||||
{
|
||||
auto ret = *this;
|
||||
|
||||
ret.m_recordList.clear();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
void add_deckvalue( DeckItem deck_item, DeckRecord& deck_record, const ParserItem& parser_item, const std::vector<DeckValue>& input_record, size_t j) {
|
||||
|
Loading…
Reference in New Issue
Block a user