Skip to content
Snippets Groups Projects
Commit 1d8d8db0 authored by Tom Fischer's avatar Tom Fischer
Browse files

[ParamLib] Make FunctionParameter independent from mesh.

parent a401e5af
No related branches found
No related tags found
No related merge requests found
...@@ -11,13 +11,11 @@ ...@@ -11,13 +11,11 @@
#include "FunctionParameter.h" #include "FunctionParameter.h"
#include "BaseLib/ConfigTree.h" #include "BaseLib/ConfigTree.h"
#include "MeshLib/Mesh.h"
namespace ParameterLib namespace ParameterLib
{ {
std::unique_ptr<ParameterBase> createFunctionParameter( std::unique_ptr<ParameterBase> createFunctionParameter(
std::string const& name, BaseLib::ConfigTree const& config, std::string const& name, BaseLib::ConfigTree const& config)
MeshLib::Mesh const& mesh)
{ {
//! \ogs_file_param{prj__parameters__parameter__type} //! \ogs_file_param{prj__parameters__parameter__type}
config.checkConfigParameter("type", "Function"); config.checkConfigParameter("type", "Function");
...@@ -31,8 +29,7 @@ std::unique_ptr<ParameterBase> createFunctionParameter( ...@@ -31,8 +29,7 @@ std::unique_ptr<ParameterBase> createFunctionParameter(
vec_expressions.emplace_back(expression_str); vec_expressions.emplace_back(expression_str);
} }
return std::make_unique<FunctionParameter<double>>(name, mesh, return std::make_unique<FunctionParameter<double>>(name, vec_expressions);
vec_expressions);
} }
} // namespace ParameterLib } // namespace ParameterLib
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
#include <exprtk.hpp> #include <exprtk.hpp>
#include "MeshLib/Elements/Element.h"
#include "MeshLib/Node.h"
#include "Parameter.h" #include "Parameter.h"
#include "Utils.h" #include "Utils.h"
...@@ -40,14 +37,12 @@ struct FunctionParameter final : public Parameter<T> ...@@ -40,14 +37,12 @@ struct FunctionParameter final : public Parameter<T>
* Constructing from a vector of expressions * Constructing from a vector of expressions
* *
* @param name the parameter's name * @param name the parameter's name
* @param mesh the parameter's domain of definition.
* @param vec_expression_str a vector of mathematical expressions * @param vec_expression_str a vector of mathematical expressions
* The vector size specifies the number of components of the parameter. * The vector size specifies the number of components of the parameter.
*/ */
FunctionParameter(std::string const& name, FunctionParameter(std::string const& name,
MeshLib::Mesh const& mesh,
std::vector<std::string> const& vec_expression_str) std::vector<std::string> const& vec_expression_str)
: Parameter<T>(name, &mesh), _vec_expression_str(vec_expression_str) : Parameter<T>(name, nullptr), _vec_expression_str(vec_expression_str)
{ {
_symbol_table.add_constants(); _symbol_table.add_constants();
_symbol_table.create_variable("x"); _symbol_table.create_variable("x");
...@@ -89,14 +84,6 @@ struct FunctionParameter final : public Parameter<T> ...@@ -89,14 +84,6 @@ struct FunctionParameter final : public Parameter<T>
y = coords[1]; y = coords[1];
z = coords[2]; z = coords[2];
} }
else if (pos.getNodeID())
{
auto const& node =
*ParameterBase::_mesh->getNode(pos.getNodeID().get());
x = node[0];
y = node[1];
z = node[2];
}
for (unsigned i = 0; i < _vec_expression.size(); i++) for (unsigned i = 0; i < _vec_expression.size(); i++)
{ {
...@@ -118,7 +105,6 @@ private: ...@@ -118,7 +105,6 @@ private:
}; };
std::unique_ptr<ParameterBase> createFunctionParameter( std::unique_ptr<ParameterBase> createFunctionParameter(
std::string const& name, BaseLib::ConfigTree const& config, std::string const& name, BaseLib::ConfigTree const& config);
MeshLib::Mesh const& mesh);
} // namespace ParameterLib } // namespace ParameterLib
...@@ -59,7 +59,7 @@ std::unique_ptr<ParameterBase> createParameter( ...@@ -59,7 +59,7 @@ std::unique_ptr<ParameterBase> createParameter(
if (type == "Function") if (type == "Function")
{ {
INFO("FunctionParameter: {:s}", name); INFO("FunctionParameter: {:s}", name);
return createFunctionParameter(name, config, mesh); return createFunctionParameter(name, config);
} }
if (type == "Group") if (type == "Group")
{ {
......
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