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:
Arne Morten Kvarving 2020-01-09 09:45:11 +01:00
parent 828cd2ee9a
commit 7ac2febae2
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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");
}