changed: allow disabling sanity check in Dimension constructor
while this makes sense to do in general, it causes issues when reconstructing after deserialization. we have dimensions with '/' and '*' in the name that was constructed through newComposite.
This commit is contained in:
parent
828cd2ee9a
commit
7ac2febae2
@ -27,7 +27,8 @@ namespace Opm {
|
||||
class Dimension {
|
||||
public:
|
||||
Dimension();
|
||||
Dimension(const std::string& name, double SIfactor, double SIoffset = 0.0);
|
||||
Dimension(const std::string& name, double SIfactor,
|
||||
double SIoffset = 0.0, bool sanityCheck = true);
|
||||
|
||||
double getSIScaling() const;
|
||||
double getSIScalingRaw() const;
|
||||
|
@ -33,9 +33,10 @@ namespace Opm {
|
||||
|
||||
}
|
||||
|
||||
Dimension::Dimension(const std::string& name, double SIfactor, double SIoffset)
|
||||
Dimension::Dimension(const std::string& name, double SIfactor,
|
||||
double SIoffset, bool sanityCheck)
|
||||
{
|
||||
for (auto iter = name.begin(); iter != name.end(); ++iter) {
|
||||
for (auto iter = name.begin(); iter != name.end() && sanityCheck; ++iter) {
|
||||
if (!isalpha(*iter) && (*iter) != '1')
|
||||
throw std::invalid_argument("Invalid dimension name");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user