23 #include <boost/algorithm/string.hpp>
28 class ApplyComponentTableProcess :
public Process
47 "model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
48 "variable_name": "PLEASE_PRESCRIBE_VARIABLE_NAME",
57 rParameters[
"variable_name"];
58 rParameters[
"model_part_name"];
60 mIsFixedProvided = rParameters.
Has(
"is_fixed");
68 unsigned int TableId = rParameters[
"table"].
GetInt();
85 <<
"Variable '" <<
mVariableName <<
"' is not defined!" << std::endl;
89 auto variable_name_1 =
mpTable->NameOfX();
90 boost::to_upper(variable_name_1);
91 if (variable_name_1 ==
"TIME") {
93 if (mIsFixed) rNode.Fix(var);
94 else if (mIsFixedProvided) rNode.Free(var);
95 rNode.FastGetSolutionStepValue(var) = mInitialValue;
98 else if (variable_name_1 ==
"X") {
100 node.FastGetSolutionStepValue(var) = mpTable->GetValue(node.X());
104 KRATOS_ERROR <<
"Failed to initialize ApplyComponentTableProcess: got unknown table variable '"
105 << variable_name_1 <<
"'";
118 auto variable_name_1 =
mpTable->NameOfX();
119 boost::to_upper(variable_name_1);
120 if (variable_name_1 ==
"TIME") {
122 const double value =
mpTable->GetValue(Time);
124 rNode.FastGetSolutionStepValue(var) = value;
132 std::string
Info()
const override
134 return "ApplyComponentTableProcess";
142 bool mIsFixedProvided;
Definition: apply_component_table_process.hpp:28
ModelPart & mrModelPart
Member Variables.
Definition: apply_component_table_process.hpp:168
ApplyComponentTableProcess & operator=(const ApplyComponentTableProcess &)=delete
ApplyComponentTableProcess(ModelPart &model_part, Parameters rParameters)
Definition: apply_component_table_process.hpp:38
ApplyComponentTableProcess(const ApplyComponentTableProcess &)=delete
double mTimeUnitConverter
Definition: apply_component_table_process.hpp:173
void ExecuteInitializeSolutionStep() override
this function will be executed at every time step BEFORE performing the solve phase
Definition: apply_component_table_process.hpp:112
TableType::Pointer mpTable
Definition: apply_component_table_process.hpp:172
~ApplyComponentTableProcess() override=default
void ExecuteInitialize() override
Definition: apply_component_table_process.hpp:80
std::string Info() const override
Turn back information as a string.
Definition: apply_component_table_process.hpp:132
bool mIsFixed
Definition: apply_component_table_process.hpp:170
double mInitialValue
Definition: apply_component_table_process.hpp:171
std::string mVariableName
Definition: apply_component_table_process.hpp:169
KRATOS_CLASS_POINTER_DEFINITION(ApplyComponentTableProcess)
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
bool Has(const std::string &rEntry) const
This method checks if the Parameter contains a certain entry.
Definition: kratos_parameters.cpp:520
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
model_part
Definition: face_heat.py:14
Definition: mesh_converter.cpp:38