Skip to content
Snippets Groups Projects
Commit 58fa6d69 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

added input file doc comments to src code

parent 1c2ead74
No related branches found
No related tags found
No related merge requests found
Showing
with 142 additions and 25 deletions
......@@ -55,14 +55,14 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
std::string const& project_directory,
std::string const& output_directory)
{
// geometry
std::string const geometry_file = BaseLib::copyPathToFileName(
//! \ogs_file_param{prj__geometry}
project_config.getConfParam<std::string>("geometry"), project_directory
);
detail::readGeometry(geometry_file, *_geoObjects);
// mesh
std::string const mesh_file = BaseLib::copyPathToFileName(
//! \ogs_file_param{prj__mesh}
project_config.getConfParam<std::string>("mesh"), project_directory
);
......@@ -74,26 +74,28 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
}
_mesh_vec.push_back(mesh);
// curves
//! \ogs_file_param{prj__curves}
parseCurves(project_config.getConfSubtreeOptional("curves"));
// process variables
//! \ogs_file_param{prj__process_variables}
parseProcessVariables(project_config.getConfSubtree("process_variables"));
// parameters
//! \ogs_file_param{prj__parameters}
parseParameters(project_config.getConfSubtree("parameters"));
// processes
//! \ogs_file_param{prj__processes}
parseProcesses(project_config.getConfSubtree("processes"));
// output
//! \ogs_file_param{prj__output}
parseOutput(project_config.getConfSubtree("output"), output_directory);
// timestepping
//! \ogs_file_param{prj__time_stepping}
parseTimeStepping(project_config.getConfSubtree("time_stepping"));
//! \ogs_file_param{prj__linear_solvers}
parseLinearSolvers(project_config.getConfSubtree("linear_solvers"));
//! \ogs_file_param{prj__nonlinear_solvers}
parseNonlinearSolvers(project_config.getConfSubtree("nonlinear_solvers"));
}
......@@ -156,13 +158,16 @@ void ProjectData::buildProcesses()
{
for (auto const& pc : _process_configs)
{
//! \ogs_file_param{process__type}
auto const type = pc.peekConfParam<std::string>("type");
//! \ogs_file_param{process__nonlinear_solver}
auto const nl_slv_name = pc.getConfParam<std::string>("nonlinear_solver");
auto& nl_slv = BaseLib::getOrError(_nonlinear_solvers, nl_slv_name,
"A nonlinear solver with the given name has not been defined.");
auto time_disc = NumLib::createTimeDiscretization<GlobalVector>(
//! \ogs_file_param{process__time_discretization}
pc.getConfSubtree("time_discretization")
);
......@@ -258,6 +263,7 @@ void ProjectData::parseProcessVariables(
// _process_variables.reserve(process_variables_config.size());
for (auto var_config
//! \ogs_file_param{prj__process_variables__process_variable}
: process_variables_config.getConfSubtreeList("process_variable")) {
// TODO Extend to referenced meshes.
_process_variables.emplace_back(var_config, *_mesh_vec[0], *_geoObjects);
......@@ -269,9 +275,12 @@ void ProjectData::parseParameters(BaseLib::ConfigTree const& parameters_config)
using namespace ProcessLib;
DBUG("Reading parameters:");
//! \ogs_file_param{prj__parameters__parameter}
for (auto parameter_config : parameters_config.getConfSubtreeList("parameter"))
{
//! \ogs_file_param{parameter__name}
auto name = parameter_config.getConfParam<std::string>("name");
//! \ogs_file_param{parameter__type}
auto type = parameter_config.peekConfParam<std::string>("type");
// Create parameter based on the provided type.
......@@ -300,8 +309,10 @@ void ProjectData::parseParameters(BaseLib::ConfigTree const& parameters_config)
void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config)
{
DBUG("Reading processes:");
//! \ogs_file_param{prj__processes__process}
for (auto process_config : processes_config.getConfSubtreeList("process")) {
// process type must be specified.
//! \ogs_file_param{process__type}
process_config.peekConfParam<std::string>("type");
process_config.ignoreConfParam("name");
_process_configs.push_back(std::move(process_config));
......@@ -311,6 +322,7 @@ void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config)
void ProjectData::parseOutput(BaseLib::ConfigTree const& output_config,
std::string const& output_directory)
{
//! \ogs_file_param{prj__output__type}
output_config.checkConfParam("type", "VTK");
DBUG("Parse output configuration:");
......@@ -335,8 +347,10 @@ void ProjectData::parseLinearSolvers(BaseLib::ConfigTree const& config)
{
DBUG("Reading linear solver configuration.");
//! \ogs_file_param{prj__linear_solvers__linear_solver}
for (auto conf : config.getConfSubtreeList("linear_solver"))
{
//! \ogs_file_param{prj__linear_solvers__linear_solver__name}
auto const name = conf.getConfParam<std::string>("name");
BaseLib::insertIfKeyUniqueElseError(_linear_solvers,
name,
......@@ -350,12 +364,15 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config)
{
DBUG("Reading linear solver configuration.");
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver}
for (auto conf : config.getConfSubtreeList("nonlinear_solver"))
{
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__linear_solver}
auto const ls_name = conf.getConfParam<std::string>("linear_solver");
auto& linear_solver = BaseLib::getOrError(_linear_solvers,
ls_name, "A linear solver with the given name does not exist.");
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__name}
auto const name = conf.getConfParam<std::string>("name");
BaseLib::insertIfKeyUniqueElseError(_nonlinear_solvers,
name,
......@@ -368,7 +385,9 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config)
static std::unique_ptr<MathLib::PiecewiseLinearInterpolation>
createPiecewiseLinearInterpolation(BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{prj__curves__curve__coords}
auto coords = config.getConfParam<std::vector<double>>("coords");
//! \ogs_file_param{prj__curves__curve__values}
auto values = config.getConfParam<std::vector<double>>("values");
if (coords.empty() || values.empty())
{
......@@ -393,8 +412,10 @@ void ProjectData::parseCurves(
DBUG("Reading curves configuration.");
//! \ogs_file_param{prj__curves__curve}
for (auto conf : config->getConfSubtreeList("curve"))
{
//! \ogs_file_param{prj__curves__curve__name}
auto const name = conf.getConfParam<std::string>("name");
BaseLib::insertIfKeyUniqueElseError(
_curves,
......
......@@ -231,6 +231,7 @@ template<typename Matrix, typename Vector>
std::unique_ptr<UncoupledProcessesTimeLoop<Matrix, Vector> >
createUncoupledProcessesTimeLoop(BaseLib::ConfigTree const& conf)
{
//! \ogs_file_param{prj__time_stepping__type}
auto const type = conf.peekConfParam<std::string>("type");
std::unique_ptr<NumLib::ITimeStepAlgorithm> timestepper;
......
......@@ -57,6 +57,7 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname)
std::unique_ptr<MapNameId> ply_names{new MapNameId};
std::unique_ptr<MapNameId> sfc_names{new MapNameId};
//! \ogs_file_param{gml__name}
auto geo_name = doc->getConfParam<std::string>("name");
if (geo_name.empty())
{
......@@ -64,12 +65,14 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname)
std::abort();
}
//! \ogs_file_param{gml__points}
for (auto st : doc->getConfSubtreeList("points"))
{
readPoints(st, *points, *pnt_names);
_geo_objects.addPointVec(std::move(points), geo_name, pnt_names.release());
}
//! \ogs_file_param{gml__polylines}
for (auto st : doc->getConfSubtreeList("polylines"))
{
readPolylines(st,
......@@ -79,6 +82,7 @@ bool BoostXmlGmlInterface::readFile(const std::string &fname)
*ply_names);
}
//! \ogs_file_param{gml__surfaces}
for (auto st : doc->getConfSubtreeList("surfaces"))
{
readSurfaces(st,
......@@ -103,11 +107,16 @@ void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTree const& pointsRoot,
std::vector<GeoLib::Point*>& points,
std::map<std::string, std::size_t>& pnt_names )
{
//! \ogs_file_param{gml__points__point}
for (auto const pt : pointsRoot.getConfParamList("point"))
{
//! \ogs_file_attr{gml__points__point__id}
auto const p_id = pt.getConfAttribute<std::size_t>("id");
//! \ogs_file_attr{gml__points__point__x}
auto const p_x = pt.getConfAttribute<double>("x");
//! \ogs_file_attr{gml__points__point__y}
auto const p_y = pt.getConfAttribute<double>("y");
//! \ogs_file_attr{gml__points__point__z}
auto const p_z = pt.getConfAttribute<double>("z");
auto const p_size = points.size();
......@@ -115,6 +124,7 @@ void BoostXmlGmlInterface::readPoints(BaseLib::ConfigTree const& pointsRoot,
"The point id is not unique.");
points.push_back(new GeoLib::Point(p_x, p_y, p_z, p_id));
//! \ogs_file_attr{gml__points__point__name}
if (auto const p_name = pt.getConfAttributeOptional<std::string>("name"))
{
if (p_name->empty()) {
......@@ -135,8 +145,10 @@ void BoostXmlGmlInterface::readPolylines(
std::vector<std::size_t> const& pnt_id_map,
std::map<std::string, std::size_t>& ply_names)
{
//! \ogs_file_param{gml__polylines__polyline}
for (auto const pl : polylinesRoot.getConfSubtreeList("polyline"))
{
//! \ogs_file_attr{gml__polylines__polyline__id}
auto const id = pl.getConfAttribute<std::size_t>("id");
// The id is not used but must be present in the GML file.
// That's why pl.ignore...() cannot be used.
......@@ -144,6 +156,7 @@ void BoostXmlGmlInterface::readPolylines(
polylines.push_back(new GeoLib::Polyline(points));
//! \ogs_file_attr{gml__polylines__polyline__name}
if (auto const p_name = pl.getConfAttributeOptional<std::string>("name"))
{
if (p_name->empty()) {
......@@ -154,6 +167,7 @@ void BoostXmlGmlInterface::readPolylines(
BaseLib::insertIfKeyUniqueElseError(ply_names, *p_name, polylines.size()-1,
"The polyline name is not unique.");
//! \ogs_file_param{gml__polylines__polyline__pnt}
for (auto const pt : pl.getConfParamList<std::size_t>("pnt")) {
polylines.back()->addPoint(pnt_id_map[_idx_map[pt]]);
}
......@@ -173,14 +187,17 @@ void BoostXmlGmlInterface::readSurfaces(
const std::vector<std::size_t>& pnt_id_map,
std::map<std::string, std::size_t>& sfc_names)
{
//! \ogs_file_param{gml__surfaces__surface}
for (auto const& sfc : surfacesRoot.getConfSubtreeList("surface"))
{
//! \ogs_file_attr{gml__surfaces__surface__id}
auto const id = sfc.getConfAttribute<std::size_t>("id");
// The id is not used but must be present in the GML file.
// That's why sfc.ignore...() cannot be used.
(void) id;
surfaces.push_back(new GeoLib::Surface(points));
//! \ogs_file_attr{gml__surfaces__surface__name}
if (auto const s_name = sfc.getConfAttributeOptional<std::string>("name"))
{
if (s_name->empty()) {
......@@ -191,9 +208,13 @@ void BoostXmlGmlInterface::readSurfaces(
BaseLib::insertIfKeyUniqueElseError(sfc_names, *s_name, surfaces.size()-1,
"The surface name is not unique.");
//! \ogs_file_param{gml__surfaces__surface__element}
for (auto const& element : sfc.getConfParamList("element")) {
//! \ogs_file_attr{gml__surfaces__surface__element__p1}
auto const p1_attr = element.getConfAttribute<std::size_t>("p1");
//! \ogs_file_attr{gml__surfaces__surface__element__p2}
auto const p2_attr = element.getConfAttribute<std::size_t>("p2");
//! \ogs_file_attr{gml__surfaces__surface__element__p3}
auto const p3_attr = element.getConfAttribute<std::size_t>("p3");
auto const p1 = pnt_id_map[_idx_map[p1_attr]];
......
......@@ -143,19 +143,24 @@ EigenLinearSolver::~EigenLinearSolver() = default;
void EigenLinearSolver::setOption(BaseLib::ConfigTree const& option)
{
ignoreOtherLinearSolvers(option, "eigen");
//! \ogs_file_param{linear_solver__eigen}
auto const ptSolver = option.getConfSubtreeOptional("eigen");
if (!ptSolver)
return;
//! \ogs_file_param{linear_solver__eigen__solver_type}
if (auto solver_type = ptSolver->getConfParamOptional<std::string>("solver_type")) {
_option.solver_type = _option.getSolverType(*solver_type);
}
//! \ogs_file_param{linear_solver__eigen__precon_type}
if (auto precon_type = ptSolver->getConfParamOptional<std::string>("precon_type")) {
_option.precon_type = _option.getPreconType(*precon_type);
}
//! \ogs_file_param{linear_solver__eigen__error_tolerance}
if (auto error_tolerance = ptSolver->getConfParamOptional<double>("error_tolerance")) {
_option.error_tolerance = *error_tolerance;
}
//! \ogs_file_param{linear_solver__eigen__max_iteration_step}
if (auto max_iteration_step = ptSolver->getConfParamOptional<int>("max_iteration_step")) {
_option.max_iterations = *max_iteration_step;
}
......
......@@ -44,6 +44,7 @@ struct LisOption
{
if (options) {
ignoreOtherLinearSolvers(*options, "lis");
//! \ogs_file_param{linear_solver__lis}
if (auto s = options->getConfParamOptional<std::string>("lis")) {
if (!s->empty()) {
_option_string += " " + *s;
......
......@@ -33,13 +33,16 @@ PETScLinearSolver::PETScLinearSolver(const std::string /*prefix*/,
if (option) {
ignoreOtherLinearSolvers(*option, "petsc");
//! \ogs_file_param{linear_solver__petsc}
if (auto const subtree = option->getConfSubtreeOptional("petsc"))
{
if (auto const parameters = subtree->getConfParamOptional<std::string>(
"parameters")) {
if (auto const parameters =
//! \ogs_file_param{linear_solver__petsc__parameters}
subtree->getConfParamOptional<std::string>("parameters")) {
petsc_options = *parameters;
}
//! \ogs_file_param{linear_solver__petsc__prefix}
if (auto const pre = subtree->getConfParamOptional<std::string>("prefix")) {
if (!pre->empty())
prefix = *pre + "_";
......
......@@ -133,7 +133,8 @@ CVodeSolverImpl::CVodeSolverImpl(const BaseLib::ConfigTree& config,
const unsigned num_equations)
{
if (auto const param =
config.getConfParamOptional<std::string>("linear_multistep_method"))
//! \ogs_file_param{ode_solver__CVODE__linear_multistep_method}
config.getConfParamOptional<std::string>("linear_multistep_method"))
{
DBUG("setting linear multistep method (config: %s)", param->c_str());
......@@ -152,8 +153,9 @@ CVodeSolverImpl::CVodeSolverImpl(const BaseLib::ConfigTree& config,
}
}
if (auto const param = config.getConfParamOptional<std::string>(
"nonlinear_solver_iteration"))
if (auto const param =
//! \ogs_file_param{ode_solver__CVODE__nonlinear_solver_iteration}
config.getConfParamOptional<std::string>("nonlinear_solver_iteration"))
{
DBUG("setting nonlinear solver iteration (config: %s)", param->c_str());
......
......@@ -262,8 +262,11 @@ createNonlinearSolver(MathLib::LinearSolver<Matrix, Vector>& linear_solver,
{
using AbstractNLS = NonlinearSolverBase<Matrix, Vector>;
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__type}
auto const type = config.getConfParam<std::string>("type");
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__tol}
auto const tol = config.getConfParam<double>("tol");
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__max_iter}
auto const max_iter = config.getConfParam<unsigned>("max_iter");
if (type == "Picard")
......
......@@ -24,6 +24,7 @@ createTimeDiscretization(BaseLib::ConfigTree const& config)
{
using T = std::unique_ptr<TimeDiscretization<Vector> >;
//! \ogs_file_param{process__time_discretization__type}
auto const type = config.getConfParam<std::string>("type");
if (type == "BackwardEuler") {
......@@ -33,10 +34,12 @@ createTimeDiscretization(BaseLib::ConfigTree const& config)
using ConcreteTD = ForwardEuler<Vector>;
return T(new ConcreteTD);
} else if (type == "CrankNicolson") {
//! \ogs_file_param{process__time_discretization__CrankNicolson__theta}
auto const theta = config.getConfParam<double>("theta");
using ConcreteTD = CrankNicolson<Vector>;
return T(new ConcreteTD(theta));
} else if (type == "BackwardDifferentiationFormula") {
//! \ogs_file_param{process__time_discretization__BackwardDifferentiationFormula__order}
auto const order = config.getConfParam<unsigned>("order");
using ConcreteTD = BackwardDifferentiationFormula<Vector>;
return T(new ConcreteTD(order));
......
......@@ -35,10 +35,14 @@ FixedTimeStepping::FixedTimeStepping(double t0, double tn, double dt)
std::unique_ptr<ITimeStepAlgorithm>
FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{prj__time_stepping__type}
config.checkConfParam("type", "FixedTimeStepping");
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__t_initial}
auto const t_initial = config.getConfParam<double>("t_initial");
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__t_end}
auto const t_end = config.getConfParam<double>("t_end");
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__timesteps}
auto const delta_ts = config.getConfSubtree("timesteps");
std::vector<double> timesteps;
......@@ -46,6 +50,7 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
double delta_t = 0.0;
// TODO: consider adding call "listNonEmpty" to config tree
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__timesteps__pair}
auto const range = delta_ts.getConfSubtreeList("pair");
if (range.begin() == range.end()) {
ERR("no timesteps have been given");
......@@ -53,7 +58,9 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
}
for (auto const pair : range)
{
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__timesteps__pair__repeat}
auto const repeat = pair.getConfParam<std::size_t>("repeat");
//! \ogs_file_param{prj__time_stepping__FixedTimeStepping__timesteps__pair__delta_t}
delta_t = pair.getConfParam<double>("delta_t");
if (repeat == 0) {
......
......@@ -154,18 +154,24 @@ createGroundwaterFlowProcess(
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{process__type}
config.checkConfParam("type", "GROUNDWATER_FLOW");
DBUG("Create GroundwaterFlowProcess.");
// Process variable.
auto process_variables =
findProcessVariables(variables, config, { "process_variable" });
auto process_variables = findProcessVariables(variables, config, {
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__process_variables__process_variable}
"process_variable"
});
// Hydraulic conductivity parameter.
auto& hydraulic_conductivity =
findParameter<double, MeshLib::Element const&>(
config, "hydraulic_conductivity", parameters);
config,
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__hydraulic_conductivity}
"hydraulic_conductivity",
parameters);
DBUG("Use \'%s\' as hydraulic conductivity parameter.",
hydraulic_conductivity.name.c_str());
......@@ -174,11 +180,21 @@ createGroundwaterFlowProcess(
hydraulic_conductivity
};
SecondaryVariableCollection<typename GlobalSetup::VectorType>
secondary_variables{config.getConfSubtreeOptional("secondary_variables"),
{ "darcy_velocity_x", "darcy_velocity_y", "darcy_velocity_z" }};
SecondaryVariableCollection<typename GlobalSetup::VectorType> secondary_variables {
//! \ogs_file_param{process__secondary_variables}
config.getConfSubtreeOptional("secondary_variables"),
{
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_x}
"darcy_velocity_x",
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_y}
"darcy_velocity_y",
//! \ogs_file_param_special{process__GROUNDWATER_FLOW__secondary_variables__darcy_velocity_z}
"darcy_velocity_z"
}
};
ProcessOutput<typename GlobalSetup::VectorType>
//! \ogs_file_param{process__output}
process_output{config.getConfSubtree("output"),
process_variables, secondary_variables};
......
......@@ -23,8 +23,10 @@ namespace ProcessLib
std::unique_ptr<InitialCondition> createUniformInitialCondition(
BaseLib::ConfigTree const& config, int const /*n_components*/)
{
//! \ogs_file_param{initial_condition__type}
config.checkConfParam("type", "Uniform");
//! \ogs_file_param{initial_condition__Uniform__value}
auto value = config.getConfParam<double>("value");
DBUG("Using value %g", value);
......@@ -37,6 +39,10 @@ std::unique_ptr<InitialCondition> createMeshPropertyInitialCondition(
MeshLib::Mesh const& mesh,
int const n_components)
{
//! \ogs_file_param{initial_condition__type}
config.checkConfParam("type", "MeshProperty");
//! \ogs_file_param{initial_condition__MeshProperty__field_name}
auto field_name = config.getConfParam<std::string>("field_name");
DBUG("Using field_name %s", field_name.c_str());
......
......@@ -48,8 +48,10 @@ public:
: BoundaryConditionConfig(geometry)
{
DBUG("Constructing NeumannBcConfig from config.");
//! \ogs_file_param{boundary_condition__type}
config.checkConfParam("type", "UniformNeumann");
//! \ogs_file_param{boundary_condition__UniformNeumann__value}
double const value = config.getConfParam<double>("value");
DBUG("Using value %g", value);
......
......@@ -50,13 +50,18 @@ newInstance(const BaseLib::ConfigTree &config, std::string const& output_directo
{
std::unique_ptr<Output> out{ new Output{
BaseLib::joinPaths(output_directory,
config.getConfParam<std::string>("prefix"))}};
//! \ogs_file_param{prj__output__prefix}
config.getConfParam<std::string>("prefix"))}};
//! \ogs_file_param{prj__output__timesteps}
if (auto const timesteps = config.getConfSubtreeOptional("timesteps"))
{
//! \ogs_file_param{prj__output__timesteps__pair}
for (auto pair : timesteps->getConfSubtreeList("pair"))
{
//! \ogs_file_param{prj__output__timesteps__pair__repeat}
auto repeat = pair.getConfParam<unsigned>("repeat");
//! \ogs_file_param{prj__output__timesteps__pair__each_steps}
auto each_steps = pair.getConfParam<unsigned>("each_steps");
assert(repeat != 0 && each_steps != 0);
......
......@@ -19,7 +19,9 @@ namespace ProcessLib
std::unique_ptr<ParameterBase> createConstParameter(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{parameter__type}
config.checkConfParam("type", "Constant");
//! \ogs_file_param{parameter__Constant__value}
auto value = config.getConfParam<double>("value");
DBUG("Using value %g", value);
......@@ -29,7 +31,9 @@ std::unique_ptr<ParameterBase> createConstParameter(
std::unique_ptr<ParameterBase> createMeshPropertyParameter(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh)
{
//! \ogs_file_param{parameter__type}
config.checkConfParam("type", "MeshProperty");
//! \ogs_file_param{parameter__MeshProperty__field_name}
auto field_name = config.getConfParam<std::string>("field_name");
DBUG("Using field_name %s", field_name.c_str());
......
......@@ -16,6 +16,7 @@ ProcessVariable& findProcessVariable(
BaseLib::ConfigTree const& pv_config, std::string const& tag)
{
// Find process variable name in process config.
//! \ogs_file_special
std::string const name = pv_config.getConfParam<std::string>(tag);
// Find corresponding variable by name.
......@@ -49,6 +50,7 @@ findProcessVariables(
std::vector<std::reference_wrapper<ProcessVariable>> vars;
vars.reserve(tag_names.size());
//! \ogs_file_param{process__process_variables}
auto const pv_conf = process_config.getConfSubtree("process_variables");
for (auto const& tag : tag_names) {
......
......@@ -372,6 +372,7 @@ Parameter<ParameterArgs...>& findParameter(
std::vector<std::unique_ptr<ParameterBase>> const& parameters)
{
// Find parameter name in process config.
//! \ogs_file_special
auto const name = process_config.getConfParam<std::string>(tag);
// Find corresponding parameter by name.
......
......@@ -27,8 +27,10 @@ struct ProcessOutput final
process_variables,
SecondaryVariableCollection<GlobalVector> const& secondary_variables)
{
//! \ogs_file_param{process__output__variables}
auto const out_vars = output_config.getConfSubtree("variables");
//! \ogs_file_param{process__output__variables__variable}
for (auto out_var : out_vars.getConfParamList<std::string>("variable"))
{
if (output_variables.find(out_var) != output_variables.cend())
......@@ -64,6 +66,7 @@ struct ProcessOutput final
// debug output
if (auto const param =
//! \ogs_file_param{process__output__output_iteration_results}
output_config.getConfParamOptional<bool>("output_iteration_results"))
{
DBUG("output_iteration_results: %s", (*param) ? "true" : "false");
......
......@@ -21,15 +21,20 @@ namespace ProcessLib
ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config,
MeshLib::Mesh& mesh,
GeoLib::GEOObjects const& geometries)
: _name(config.getConfParam<std::string>("name")),
_mesh(mesh),
_n_components(config.getConfParam<int>("components"))
:
//! \ogs_file_param{prj__process_variables__process_variable__name}
_name(config.getConfParam<std::string>("name")),
_mesh(mesh),
//! \ogs_file_param{prj__process_variables__process_variable__components}
_n_components(config.getConfParam<int>("components"))
{
DBUG("Constructing process variable %s", this->_name.c_str());
// Initial condition
//! \ogs_file_param{prj__process_variables__process_variable__initial_condition}
if (auto ic_config = config.getConfSubtreeOptional("initial_condition"))
{
//! \ogs_file_param{initial_condition__type}
auto const type = ic_config->peekConfParam<std::string>("type");
if (type == "Uniform")
{
......@@ -52,14 +57,18 @@ ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config,
}
// Boundary conditions
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions}
if (auto bcs_config = config.getConfSubtreeOptional("boundary_conditions"))
{
for (auto bc_config
: bcs_config->getConfSubtreeList("boundary_condition"))
for (auto bc_config :
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition}
bcs_config->getConfSubtreeList("boundary_condition"))
{
auto const geometrical_set_name =
//! \ogs_file_param{boundary_condition__geometrical_set}
bc_config.getConfParam<std::string>("geometrical_set");
auto const geometry_name =
//! \ogs_file_param{boundary_condition__geometry}
bc_config.getConfParam<std::string>("geometry");
GeoLib::GeoObject const* const geometry =
......@@ -69,6 +78,7 @@ ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config,
GeoLib::convertGeoTypeToString(geometry->getGeoType()).c_str());
// Construct type dependent boundary condition
//! \ogs_file_param{boundary_condition__type}
auto const type = bc_config.peekConfParam<std::string>("type");
if (type == "UniformDirichlet")
......
......@@ -115,6 +115,7 @@ public:
// read which variables are defined in the config
for (auto const& tag_name : tag_names) {
//! \ogs_file_special
if (auto var_name = config->getConfParamOptional<std::string>(tag_name))
{
// TODO check primary vars, too
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment