[Richards] Add copy constructor to parameterization

parent 0139cf86
......@@ -78,7 +78,7 @@ private:
/// Need this gruesome typedef because 'map::value_type' has const key
using Cache = std::tuple<std::shared_ptr<Parameterization>, Scaling>;
using ConstCache = std::tuple<const std::shared_ptr<const Parameterization>, const Scaling>;
using ConstCache = std::tuple<std::shared_ptr<const Parameterization>, Scaling>;
/// Configuration file tree
const Dune::ParameterTree& _config;
/// Grid view of the coarsest grid configuration (level 0)
......@@ -108,7 +108,30 @@ private:
}
public:
/// Create this object and load the data.
/// Copy constructor for flow parameters.
/** Create a level grid view of level 0, create a mapper on it, and store
* the config tree.
*/
FlowParameters (
const FlowParameters& flow_param
):
_config(flow_param._config),
_gv(flow_param._gv),
_log(flow_param._log),
_mapper(flow_param._mapper),
_gravity(flow_param._gravity)
{
// copy parameterization map
this->_param.clear();
for(const auto& [index, tuple] : flow_param._param) {
const auto& [p, sk] = tuple;
// make a hard copy of parameterization
std::shared_ptr<RichardsParameterization<Traits>> _p = p->clone();
this->_param.emplace(index,std::make_tuple(_p,sk));
}
}
/// Copy constructor
/** Create a level grid view of level 0, create a mapper on it, and store
* the config tree.
* \param config Configuration file tree
......@@ -134,8 +157,8 @@ public:
/// Return normalized gravity vector
const Vector& gravity() const { return _gravity; }
/// Return the current cache
const ConstCache& cache() const
/// Return a copy of the current cache with constant parameterization
ConstCache cache() const
{
verify_cache();
return _cache;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment