79 std::string
Info()
const override {
80 return "SetParameterFieldProcess";
102 template <
typename T>
103 static void SetValueAtElement(
Element & rElement,
const Variable<T>&rVar,
const T & Value)
108 Properties::Pointer p_new_prop = Kratos::make_shared<Properties>(r_prop);
111 p_new_prop->SetValue(rVar, Value);
119 void SetParameterFieldUsingInputFunction(
const Variable<double>&rVar);
120 void SetParameterFieldUsingInputFunction(
const Variable<Vector>&rVar);
126 void SetParameterFieldUsingParametersClass(
const Variable<double>&rVar,
const Parameters & rParameters);
127 void SetParameterFieldUsingParametersClass(
const Variable<Vector>&rVar,
const Parameters & rParameters);
133 template <
typename T>
134 void SetParameterFieldUsingJsonFile(
const Variable<T>&rVar)
137 const std::string& field_file_name = mParameters[
"dataset_file_name"].
GetString();
139 <<
"The parameter field file specified with name \"" << field_file_name <<
"\" does not exist!" << std::endl;
141 std::ifstream ifs(field_file_name);
142 this->SetParameterFieldUsingParametersClass(rVar, Parameters{ ifs });
149 template <
typename T>
150 void SetParameterFieldUsingJsonString(
const Variable<T>&rVar)
153 const std::string& r_dataset = mParameters[
"dataset"].
GetString();
154 Parameters new_data{ r_dataset };
155 this->SetParameterFieldUsingParametersClass(rVar, new_data);
162 template <
typename T>
163 void SetParameterFieldForVariableType(
const Variable<T>&r_var)
165 if (mParameters[
"func_type"].GetString() ==
"input") {
166 this->SetParameterFieldUsingInputFunction(r_var);
168 else if (mParameters[
"func_type"].GetString() ==
"json_string") {
169 this->SetParameterFieldUsingJsonString(r_var);
171 else if (mParameters[
"func_type"].GetString() ==
"json_file") {
172 this->SetParameterFieldUsingJsonFile(r_var);
176 std::vector<IndexType> GetVectorIndices()
const;
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
Base class for all Elements.
Definition: element.h:60
PropertiesType & GetProperties()
Definition: element.h:1024
void SetProperties(PropertiesType::Pointer pProperties)
Definition: element.h:1040
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
The base class for all processes in Kratos.
Definition: process.h:49
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Process to set a parameter field.
Definition: set_parameter_field_process.hpp:45
KRATOS_CLASS_POINTER_DEFINITION(SetParameterFieldProcess)
std::string Info() const override
Turn back information as a string.
Definition: set_parameter_field_process.hpp:79
std::size_t SizeType
Definition: set_parameter_field_process.hpp:50
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
bool exists(const std::string &rPath)
Definition: kratos_filesystem.cpp:27
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21