Commit 9c0c39eb authored by Lukas Riedel's avatar Lukas Riedel

Improve BoundaryConditionFactory

* Make methods non-static and require to instantiate
  BoundaryConditionFactory to store the logger instance.
* Improve handling of optional BC parameters.
* Improve error handling of unsupported BC parameters.
parent 7b33e3f3
......@@ -77,6 +77,9 @@ private:
/// The logger of this object
const std::shared_ptr<spdlog::logger> _log;
/// The BoundaryConditionFactory instance
BCF _bcf;
/// The complete boundary condition storage
const BCStorage _bc_storage;
......@@ -103,6 +106,7 @@ public:
const std::shared_ptr<spdlog::logger> log=get_logger(log_richards))
:
_log(log),
_bcf(_log),
_bc_storage(build_bc_storage(config, boundary_index_map)),
_bc_cache(build_bc_cache(_bc_storage))
{ }
......@@ -234,7 +238,7 @@ private:
const auto time_begin = config.get<RF>("time.start");
const auto time_end = config.get<RF>("time.end");
// Read the boundary conditions from the YAML file
// Read the boundary conditions from the YAML file.
// Store BCs in a list for every boundary index. Indices may be
// missing, in which case the default BC is inserted.
std::map<int, BCList> bc_association_map;
......@@ -257,10 +261,9 @@ private:
_log->trace(" Creating boundary condition. "
"Mapping index: {}, Name: {}",
index, name);
conditions_list.push_back(BCF::create(name,
conditions_list.push_back(_bcf.create(name,
condition.second,
time_end,
_log));
time_end));
}
if (conditions_list.empty()) {
......@@ -274,7 +277,7 @@ private:
bc_association_map.emplace(index, conditions_list);
}
// sanitize the assiciation map
// sanitize the association map
_log->debug(" Filling gaps in boundary condition specs with "
"default boundary condition");
for (auto&& it : bc_association_map)
......@@ -409,10 +412,9 @@ private:
// face the 'time' node in the YAML file
cfg_default["time"] = t_begin;
return BCF::create("default",
return _bcf.create("default",
cfg_default,
t_end,
_log);
t_end);
}
};
......
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