Skip to content
Snippets Groups Projects
Commit eb10bff7 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL] Add an optional mesh tag to parameters.

parent 6751042b
No related branches found
No related tags found
No related merge requests found
The domain of definition of the parameter.
The parameter's domain of definition is implicitly the main mesh.
It needs to be specified explicitly for parameters defined on boundary
or subdomain meshes. A notable exception is the Constant parameter,
which has an arbitrary domain of definition.
......@@ -33,6 +33,17 @@ std::unique_ptr<ParameterBase> createParameter(
//! \ogs_file_param{prj__parameters__parameter__type}
auto const type = config.peekConfigParameter<std::string>("type");
// Either the mesh name is given, or the first mesh's name will be
// taken.
auto const mesh_name =
//! \ogs_file_param{prj__parameters__parameter__mesh}
config.getConfigParameter<std::string>("mesh", meshes[0]->getName());
auto const& mesh = *BaseLib::findElementOrError(
begin(meshes), end(meshes),
[&mesh_name](auto const& m) { return m->getName() == mesh_name; },
"Expected to find a mesh named " + mesh_name + ".");
// Create parameter based on the provided type.
if (type == "Constant")
{
......@@ -49,25 +60,25 @@ std::unique_ptr<ParameterBase> createParameter(
if (type == "Function")
{
INFO("FunctionParameter: %s", name.c_str());
auto param = createFunctionParameter(name, config, *meshes.front());
auto param = createFunctionParameter(name, config, mesh);
return param;
}
if (type == "Group")
{
INFO("GroupBasedParameter: %s", name.c_str());
auto param = createGroupBasedParameter(name, config, *meshes.front());
auto param = createGroupBasedParameter(name, config, mesh);
return param;
}
if (type == "MeshElement")
{
INFO("MeshElementParameter: %s", name.c_str());
auto param = createMeshElementParameter(name, config, *meshes.front());
auto param = createMeshElementParameter(name, config, mesh);
return param;
}
if (type == "MeshNode")
{
INFO("MeshNodeParameter: %s", name.c_str());
auto param = createMeshNodeParameter(name, config, *meshes.front());
auto param = createMeshNodeParameter(name, config, mesh);
return param;
}
......
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