22#ifndef HYBRID_NEWTON_CONFIG_HPP
23#define HYBRID_NEWTON_CONFIG_HPP
40 enum class Type { None, Standard, MinMax } type = Type::None;
46 double scale(
double raw_value)
const
50 return (std == 0.0) ? mean : (raw_value - mean) / std;
52 double denom = max - min;
53 return (denom == 0.0) ? min : (raw_value - min) / denom;
61 double unscale(
double scaled_value)
const
64 case Type::Standard:
return scaled_value * std + mean;
65 case Type::MinMax:
return scaled_value * (max - min) + min;
67 default:
return scaled_value;
80 enum class Type { None, Log, Log10, Log1p } type = Type::None;
82 Transform() =
default;
83 explicit Transform(
const std::string& name)
85 if (name ==
"log10") type = Type::Log10;
86 else if (name ==
"log") type = Type::Log;
87 else if (name ==
"log1p") type = Type::Log1p;
88 else type = Type::None;
91 double apply(
double raw_value)
const
94 case Type::Log10:
return std::log10(raw_value);
95 case Type::Log:
return std::log(raw_value);
96 case Type::Log1p:
return std::log1p(raw_value);
98 default:
return raw_value;
102 double applyInverse(
double transformed_value)
const
105 case Type::Log10:
return std::pow(10.0, transformed_value);
106 case Type::Log:
return std::exp(transformed_value);
107 case Type::Log1p:
return std::expm1(transformed_value);
109 default:
return transformed_value;
123 bool is_delta =
false;
124 std::string actual_name;
126 FeatureSpec() =
default;
135class HybridNewtonConfig
138 std::string model_path;
139 std::string cell_indices_file;
140 std::vector<int> cell_indices;
141 std::size_t n_cells = 0;
142 std::vector<double> apply_times;
143 std::vector<std::pair<std::string, FeatureSpec>> input_features;
144 std::vector<std::pair<std::string, FeatureSpec>> output_features;
147 HybridNewtonConfig() =
default;
155 explicit HybridNewtonConfig(
const PropertyTree& model_config);
157 bool hasInputFeature(
const std::string& name)
const;
159 bool hasOutputFeature(
const std::string& name)
const;
176 std::vector<int> loadCellIndicesFromFile(
const std::string& filename)
const;
188 void parseFeatures(
const PropertyTree& pt,
const std::string& path,
189 std::vector<std::pair<std::string, FeatureSpec>>& features);
void validateConfig(bool compositionSwitchEnabled) const
Validate feature compatibility with simulator settings.
Definition HybridNewtonConfig.cpp:82
Hierarchical collection of key/value pairs.
Definition PropertyTree.hpp:39
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45
Represents scaling information for a feature.
Definition HybridNewtonConfig.hpp:39