...
 
Commits (1)
......@@ -71,7 +71,7 @@ private:
using ScaleAdapter = Dorie::ScalingAdapter<Traits>;
/// Storage for parameters and skaling factors
using ParameterStorage = std::unordered_map<Index,
using ParameterStorage = std::vector<
std::tuple<std::shared_ptr<Parameterization>, Scaling>
>;
......@@ -109,29 +109,28 @@ private:
public:
/// Copy constructor for flow parameters.
/** Create a level grid view of level 0, create a mapper on it, and store
* the config tree.
/** Create a deep copy of the associated parameterizations.
* \param other Object to copy from
*/
FlowParameters (
const FlowParameters& flow_param
const FlowParameters& other
):
_config(flow_param._config),
_gv(flow_param._gv),
_log(flow_param._log),
_mapper(flow_param._mapper),
_gravity(flow_param._gravity)
_config(other._config),
_gv(other._gv),
_log(other._log),
_mapper(other._mapper),
_cache(other._cache),
_gravity(other._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));
_param.reserve(other._param.size());
for (auto&& tuple : other._param) {
const auto& [p, sc] = tuple;
_param.emplace_back(std::make_tuple(p->clone(), sc));
}
}
/// Copy constructor
/// Construct a new object
/** Create a level grid view of level 0, create a mapper on it, and store
* the config tree.
* \param config Configuration file tree
......@@ -185,7 +184,7 @@ public:
entity = entity.father();
}
const auto index = _mapper.index(entity);
_cache = _param.find(index)->second;
_cache = _param[index];
}
/// Return a scaled version of the Conductivity function
......@@ -270,6 +269,7 @@ private:
_gv.grid().leafGridView());
// insert parameterization and global scaling for each element
_param.resize(element_index_map.size());
for (auto&& elem : elements(_gv))
{
// evaluate element index and position
......@@ -279,7 +279,7 @@ private:
// read values and insert
const auto p = parameterization_map.at(element_index_map.at(index));
const auto scale = scaling_adapter->evaluate(pos);
_param.emplace(index,std::make_tuple(p, scale));
_param.at(index) = std::make_tuple(p, scale);
}
// check that mapper can map to parameterization
......