mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 10:40:21 -06:00
adding hasTable() method to the VFP properties
and give a clear message about non-accessible table ID in the function isVFPActive() in WellInterface.
This commit is contained in:
parent
cf2eb1c336
commit
bf967e50a7
@ -557,6 +557,15 @@ const T* getTable(const std::map<int, T*> tables, int table_id) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether we have a table with the table number
|
||||
*/
|
||||
template <typename T>
|
||||
bool hasTable(const std::map<int, T*> tables, int table_id) {
|
||||
const auto entry = tables.find(table_id);
|
||||
return (entry != tables.end() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type variable for FLO/GFR/WFR for production tables
|
||||
|
@ -91,9 +91,12 @@ double VFPInjProperties::thp(int table_id,
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
const VFPInjTable* VFPInjProperties::getTable(const int table_id) const {
|
||||
return detail::getTable(m_tables, table_id);
|
||||
}
|
||||
|
||||
bool VFPInjProperties::hasTable(const int table_id) const {
|
||||
return detail::hasTable(m_tables, table_id);
|
||||
}
|
||||
|
||||
} //Namespace Opm
|
||||
|
@ -109,6 +109,11 @@ public:
|
||||
*/
|
||||
const VFPInjTable* getTable(const int table_id) const;
|
||||
|
||||
/**
|
||||
* Check whether there is table associated with ID
|
||||
*/
|
||||
bool hasTable(const int table_id) const;
|
||||
|
||||
/**
|
||||
* Returns true if no vfp tables are in the current map
|
||||
*/
|
||||
|
@ -105,5 +105,9 @@ const VFPProdTable* VFPProdProperties::getTable(const int table_id) const {
|
||||
return detail::getTable(m_tables, table_id);
|
||||
}
|
||||
|
||||
bool VFPProdProperties::hasTable(const int table_id) const {
|
||||
return detail::hasTable(m_tables, table_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -158,6 +158,11 @@ public:
|
||||
*/
|
||||
const VFPProdTable* getTable(const int table_id) const;
|
||||
|
||||
/**
|
||||
* Check whether there is table associated with ID
|
||||
*/
|
||||
bool hasTable(const int table_id) const;
|
||||
|
||||
/**
|
||||
* Returns true if no vfp tables are in the current map
|
||||
*/
|
||||
|
@ -994,8 +994,11 @@ namespace Opm
|
||||
if (table_id <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (vfp_properties_->getProd()->getTable(table_id)) {
|
||||
if (vfp_properties_->getProd()->hasTable(table_id)) {
|
||||
return true;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "VFPPROD table " << std::to_string(table_id) << " is specfied,"
|
||||
<< " for well " << name() << ", while we could not access it during simulation");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1004,8 +1007,11 @@ namespace Opm
|
||||
if (table_id <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (vfp_properties_->getInj()->getTable(table_id)) {
|
||||
if (vfp_properties_->getInj()->hasTable(table_id)) {
|
||||
return true;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "VFPINJ table " << std::to_string(table_id) << " is specfied,"
|
||||
<< " for well " << name() << ", while we could not access it during simulation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user