using ParserKeywords::COMPSEGS for keywords parsing
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Compsegs.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace Opm {
|
||||
@@ -52,15 +53,15 @@ namespace Opm {
|
||||
for (size_t recordIndex = 1; recordIndex < compsegsKeyword->size(); ++recordIndex) {
|
||||
DeckRecordConstPtr record = compsegsKeyword->getRecord(recordIndex);
|
||||
// following the coordinate rule for completions
|
||||
const int I = record->getItem("I")->getInt(0) - 1;
|
||||
const int J = record->getItem("J")->getInt(0) - 1;
|
||||
const int K = record->getItem("K")->getInt(0) - 1;
|
||||
const int branch = record->getItem("BRANCH")->getInt(0);
|
||||
const int I = record->getItem<ParserKeywords::COMPSEGS::I>()->getInt(0) - 1;
|
||||
const int J = record->getItem<ParserKeywords::COMPSEGS::J>()->getInt(0) - 1;
|
||||
const int K = record->getItem<ParserKeywords::COMPSEGS::K>()->getInt(0) - 1;
|
||||
const int branch = record->getItem<ParserKeywords::COMPSEGS::BRANCH>()->getInt(0);
|
||||
|
||||
double distance_start;
|
||||
double distance_end;
|
||||
if (record->getItem("DISTANCE_START")->hasValue(0)) {
|
||||
distance_start = record->getItem("DISTANCE_START")->getSIDouble(0);
|
||||
if (record->getItem<ParserKeywords::COMPSEGS::DISTANCE_START>()->hasValue(0)) {
|
||||
distance_start = record->getItem<ParserKeywords::COMPSEGS::DISTANCE_START>()->getSIDouble(0);
|
||||
} else if (recordIndex == 1) {
|
||||
distance_start = 0.;
|
||||
} else {
|
||||
@@ -69,29 +70,29 @@ namespace Opm {
|
||||
// since basically no specific order for the completions
|
||||
throw std::runtime_error("this way to obtain DISTANCE_START not implemented yet!");
|
||||
}
|
||||
if (record->getItem("DISTANCE_END")->hasValue(0)) {
|
||||
distance_end = record->getItem("DISTANCE_END")->getSIDouble(0);
|
||||
if (record->getItem<ParserKeywords::COMPSEGS::DISTANCE_END>()->hasValue(0)) {
|
||||
distance_end = record->getItem<ParserKeywords::COMPSEGS::DISTANCE_END>()->getSIDouble(0);
|
||||
} else {
|
||||
// TODO: the distance_start plus the thickness of the grid block
|
||||
throw std::runtime_error("this way to obtain DISTANCE_END not implemented yet!");
|
||||
}
|
||||
|
||||
WellCompletion::DirectionEnum direction;
|
||||
if (record->getItem("DIRECTION")->hasValue(0)) {
|
||||
direction = WellCompletion::DirectionEnumFromString(record->getItem("DIRECTION")->getString(0));
|
||||
} else if (!record->getItem("DISTANCE_END")->hasValue(0)) {
|
||||
if (record->getItem<ParserKeywords::COMPSEGS::DIRECTION>()->hasValue(0)) {
|
||||
direction = WellCompletion::DirectionEnumFromString(record->getItem<ParserKeywords::COMPSEGS::DIRECTION>()->getString(0));
|
||||
} else if (!record->getItem<ParserKeywords::COMPSEGS::DISTANCE_END>()->hasValue(0)) {
|
||||
throw std::runtime_error("the direction has to be specified when DISTANCE_END in the record is not specified");
|
||||
}
|
||||
|
||||
if (record->getItem("END_IJK")->hasValue(0)) {
|
||||
if (!record->getItem("DIRECTION")->hasValue(0)) {
|
||||
if (record->getItem<ParserKeywords::COMPSEGS::END_IJK>()->hasValue(0)) {
|
||||
if (!record->getItem<ParserKeywords::COMPSEGS::DIRECTION>()->hasValue(0)) {
|
||||
throw std::runtime_error("the direction has to be specified when END_IJK in the record is specified");
|
||||
}
|
||||
}
|
||||
|
||||
double center_depth;
|
||||
if (!record->getItem("CENTER_DEPTH")->defaultApplied(0)) {
|
||||
center_depth = record->getItem("CENTER_DEPTH")->getSIDouble(0);
|
||||
if (!record->getItem<ParserKeywords::COMPSEGS::CENTER_DEPTH>()->defaultApplied(0)) {
|
||||
center_depth = record->getItem<ParserKeywords::COMPSEGS::CENTER_DEPTH>()->getSIDouble(0);
|
||||
} else {
|
||||
// 0.0 is also the defaulted value
|
||||
// which is used to indicate to obtain the final value through related segment
|
||||
@@ -104,14 +105,14 @@ namespace Opm {
|
||||
}
|
||||
|
||||
int segment_number;
|
||||
if (record->getItem("SEGMENT_NUMBER")->hasValue(0)) {
|
||||
segment_number = record->getItem("SEGMENT_NUMBER")->getInt(0);
|
||||
if (record->getItem<ParserKeywords::COMPSEGS::SEGMENT_NUMBER>()->hasValue(0)) {
|
||||
segment_number = record->getItem<ParserKeywords::COMPSEGS::SEGMENT_NUMBER>()->getInt(0);
|
||||
} else {
|
||||
segment_number = 0;
|
||||
// will decide the segment number based on the distance in a process later.
|
||||
}
|
||||
|
||||
if (!record->getItem("END_IJK")->hasValue(0)) { // only one compsegs
|
||||
if (!record->getItem<ParserKeywords::COMPSEGS::END_IJK>()->hasValue(0)) { // only one compsegs
|
||||
CompsegsPtr new_compsegs = std::make_shared<Compsegs>(I, J, K, branch, distance_start, distance_end,
|
||||
direction, center_depth, segment_number);
|
||||
compsegs.push_back(new_compsegs);
|
||||
|
||||
Reference in New Issue
Block a user