KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
apply_double_table_process.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosPoromechanicsApplication $
3 // Last modified by: $Author: Ignasi de Pouplana $
4 // Date: $Date: June 2016 $
5 // Revision: $Revision: 1.0 $
6 //
7 
8 #if !defined(KRATOS_APPLY_DOUBLE_TABLE_PROCESS )
9 #define KRATOS_APPLY_DOUBLE_TABLE_PROCESS
10 
11 
12 #include "custom_processes/apply_component_table_process.hpp"
14 
15 namespace Kratos
16 {
17 
18 class ApplyDoubleTableProcess : public ApplyComponentTableProcess
19 {
20 
21 public:
22 
24 
26 
29  Parameters rParameters
30  ) : ApplyComponentTableProcess(model_part, rParameters) {}
31 
33 
36 
38 
40  void Execute() override
41  {
42  }
43 
46  void ExecuteInitialize() override
47  {
48  KRATOS_TRY;
49 
51 
52  const int nnodes = static_cast<int>(mr_model_part.Nodes().size());
53 
54  if(nnodes != 0)
55  {
56  ModelPart::NodesContainerType::iterator it_begin = mr_model_part.NodesBegin();
57 
58  #pragma omp parallel for
59  for(int i = 0; i<nnodes; i++)
60  {
61  ModelPart::NodesContainerType::iterator it = it_begin + i;
62 
63  if(mis_fixed)
64  {
65  it->Fix(var);
66  }
67 
68  it->FastGetSolutionStepValue(var) = minitial_value;
69  }
70  }
71 
72  KRATOS_CATCH("");
73  }
74 
77  {
78  KRATOS_TRY;
79 
81 
82  const double Time = mr_model_part.GetProcessInfo()[TIME]/mTimeUnitConverter;
83  double value = mpTable->GetValue(Time);
84 
85  const int nnodes = static_cast<int>(mr_model_part.Nodes().size());
86 
87  if(nnodes != 0)
88  {
89  ModelPart::NodesContainerType::iterator it_begin = mr_model_part.NodesBegin();
90 
91  #pragma omp parallel for
92  for(int i = 0; i<nnodes; i++)
93  {
94  ModelPart::NodesContainerType::iterator it = it_begin + i;
95 
96  it->FastGetSolutionStepValue(var) = value;
97  }
98  }
99 
100  KRATOS_CATCH("");
101  }
102 
104  std::string Info() const override
105  {
106  return "ApplyDoubleTableProcess";
107  }
108 
110  void PrintInfo(std::ostream& rOStream) const override
111  {
112  rOStream << "ApplyDoubleTableProcess";
113  }
114 
116  void PrintData(std::ostream& rOStream) const override
117  {
118  }
119 
121 
122 protected:
123 
125 
127 
128 private:
129 
131  ApplyDoubleTableProcess& operator=(ApplyDoubleTableProcess const& rOther);
132 
134  //ApplyDoubleTableProcess(ApplyDoubleTableProcess const& rOther);
135 
136 }; // Class ApplyDoubleTableProcess
137 
139 inline std::istream& operator >> (std::istream& rIStream,
140  ApplyDoubleTableProcess& rThis);
141 
143 inline std::ostream& operator << (std::ostream& rOStream,
144  const ApplyDoubleTableProcess& rThis)
145 {
146  rThis.PrintInfo(rOStream);
147  rOStream << std::endl;
148  rThis.PrintData(rOStream);
149 
150  return rOStream;
151 }
152 
153 } // namespace Kratos.
154 
155 #endif /* KRATOS_APPLY_DOUBLE_TABLE_PROCESS defined */
Definition: apply_component_table_process.hpp:28
std::string mvariable_name
Definition: apply_component_table_process.hpp:167
double minitial_value
Definition: apply_component_table_process.hpp:169
bool mis_fixed
Definition: apply_component_table_process.hpp:168
double mTimeUnitConverter
Definition: apply_component_table_process.hpp:173
TableType::Pointer mpTable
Definition: apply_component_table_process.hpp:172
ModelPart & mr_model_part
Member Variables.
Definition: apply_component_table_process.hpp:166
Definition: apply_double_table_process.hpp:25
void ExecuteInitializeSolutionStep() override
this function will be executed at every time step BEFORE performing the solve phase
Definition: apply_double_table_process.hpp:76
~ApplyDoubleTableProcess() override
Destructor.
Definition: apply_double_table_process.hpp:35
void Execute() override
Execute method is used to execute the ApplyDoubleTableProcess algorithms.
Definition: apply_double_table_process.hpp:40
std::string Info() const override
Turn back information as a string.
Definition: apply_double_table_process.hpp:104
ApplyDoubleTableProcess(ModelPart &model_part, Parameters rParameters)
Constructor.
Definition: apply_double_table_process.hpp:28
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: apply_double_table_process.hpp:110
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: apply_double_table_process.hpp:116
KRATOS_CLASS_POINTER_DEFINITION(ApplyDoubleTableProcess)
void ExecuteInitialize() override
Definition: apply_double_table_process.hpp:46
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
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
model_part
Definition: face_heat.py:14
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17