Segment: Make Type Predicates Free Functions
That way, we won't have to pollute the Segment API when adding new segment types. While here, also reduce header file coupling by forward-declaring SpiralICD and Valve in Segment.hpp.
This commit is contained in:
@@ -22,8 +22,11 @@
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class SpiralICD;
|
||||
class Valve;
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -54,21 +57,6 @@ namespace Opm {
|
||||
|
||||
SegmentType segmentType() const;
|
||||
|
||||
bool isRegular() const
|
||||
{
|
||||
return this->segmentType() == SegmentType::REGULAR;
|
||||
}
|
||||
|
||||
bool isSpiralICD() const
|
||||
{
|
||||
return this->segmentType() == SegmentType::SICD;
|
||||
}
|
||||
|
||||
bool isValve() const
|
||||
{
|
||||
return this->segmentType() == SegmentType::VALVE;
|
||||
}
|
||||
|
||||
void setVolume(const double volume_in);
|
||||
void setDepthAndLength(const double depth_in, const double length_in);
|
||||
|
||||
@@ -135,7 +123,7 @@ namespace Opm {
|
||||
bool m_data_ready;
|
||||
|
||||
// indicate the type of the segment
|
||||
// regular or spiral ICD
|
||||
// regular, spiral ICD, or Valve.
|
||||
SegmentType m_segment_type = SegmentType::REGULAR;
|
||||
|
||||
// information related to SpiralICD. It is nullptr for segments are not
|
||||
@@ -151,8 +139,22 @@ namespace Opm {
|
||||
// They are not used in the simulations and we are not supporting the plotting.
|
||||
// There are other three properties for segment related to thermal conduction,
|
||||
// while they are not supported by the keyword at the moment.
|
||||
|
||||
};
|
||||
|
||||
inline bool isRegular(const Segment& segment)
|
||||
{
|
||||
return segment.segmentType() == Segment::SegmentType::REGULAR;
|
||||
}
|
||||
|
||||
inline bool isSpiralICD(const Segment& segment)
|
||||
{
|
||||
return segment.segmentType() == Segment::SegmentType::SICD;
|
||||
}
|
||||
|
||||
inline bool isValve(const Segment& segment)
|
||||
{
|
||||
return segment.segmentType() == Segment::SegmentType::VALVE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class SpiralICD;
|
||||
class Valve;
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckKeyword;
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
#include <opm/output/eclipse/VectorItems/msw.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
@@ -452,11 +453,11 @@ namespace {
|
||||
const std::size_t baseIndex,
|
||||
ISegArray& iSeg)
|
||||
{
|
||||
if (segment.isSpiralICD()) {
|
||||
if (isSpiralICD(segment)) {
|
||||
assignSpiralICDCharacteristics(segment, baseIndex, iSeg);
|
||||
}
|
||||
|
||||
if (segment.isValve()) {
|
||||
if (isValve(segment)) {
|
||||
assignValveCharacteristics(baseIndex, iSeg);
|
||||
}
|
||||
}
|
||||
@@ -488,7 +489,7 @@ namespace {
|
||||
iSeg[iS + 7] = sumConnectionsSegment(completionSet, welSegSet, ind);
|
||||
iSeg[iS + 8] = iSeg[iS+0];
|
||||
|
||||
if (! segment.isRegular()) {
|
||||
if (! isRegular(segment)) {
|
||||
assignSegmentTypeCharacteristics(segment, iS, iSeg);
|
||||
}
|
||||
}
|
||||
@@ -617,11 +618,11 @@ namespace {
|
||||
const int baseIndex,
|
||||
RSegArray& rSeg)
|
||||
{
|
||||
if (segment.isSpiralICD()) {
|
||||
if (isSpiralICD(segment)) {
|
||||
assignSpiralICDCharacteristics(segment, usys, baseIndex, rSeg);
|
||||
}
|
||||
|
||||
if (segment.isValve()) {
|
||||
if (isValve(segment)) {
|
||||
assignValveCharacteristics(segment, usys, baseIndex, rSeg);
|
||||
}
|
||||
}
|
||||
@@ -773,7 +774,7 @@ namespace {
|
||||
rSeg[iS + 109] = 1.0;
|
||||
rSeg[iS + 110] = 1.0;
|
||||
|
||||
if (! segment.isRegular()) {
|
||||
if (! isRegular(segment)) {
|
||||
assignSegmentTypeCharacteristics(segment, units, iS, rSeg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Opm {
|
||||
@@ -194,4 +197,3 @@ namespace Opm {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
const std::string& WellSegments::wellName() const {
|
||||
|
||||
@@ -46,8 +46,10 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
|
||||
@@ -29,11 +29,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user