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.
gid_eigen_io.h
Go to the documentation of this file.
1 // KRATOS ___| | | |
2 // \___ \ __| __| | | __| __| | | __| _` | |
3 // | | | | | ( | | | | ( | |
4 // _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS
5 //
6 // License: BSD License
7 // license: StructuralMechanicsApplication/license.txt
8 //
9 // Main authors: Philipp Bucher
10 //
11 
12 #pragma once
13 
14 // System includes
15 
16 // External includes
17 
18 // Project includes
19 #include "includes/gid_io.h"
20 
21 namespace Kratos
22 {
25 
29 
33 
37 
41 
43 
48 class GidEigenIO : public GidIO<>
49 {
50  public:
53 
56 
57  typedef std::size_t SizeType;
58 
62 
64  GidEigenIO( const std::string& rDatafilename,
65  GiD_PostMode Mode,
66  MultiFileFlag use_multiple_files_flag,
67  WriteDeformedMeshFlag write_deformed_flag,
68  WriteConditionsFlag write_conditions_flag) :
69  GidIO<>(rDatafilename,
70  Mode,
71  use_multiple_files_flag,
72  write_deformed_flag,
73  write_conditions_flag) { }
74 
78 
79 
83 
89  void WriteEigenResults( ModelPart& rModelPart,
90  const Variable<double>& rVariable,
91  std::string Label,
92  const SizeType NumberOfAnimationStep )
93  {
94  Label += "_" + rVariable.Name();
95  GiD_fBeginResult( mResultFile, (char*)Label.c_str() , "EigenVector_Animation",
96  NumberOfAnimationStep, GiD_Scalar,
97  GiD_OnNodes, NULL, NULL, 0, NULL );
98 
99  for (const auto& r_node : rModelPart.Nodes())
100  {
101  const double& nodal_result = r_node.FastGetSolutionStepValue(rVariable);
102  GiD_fWriteScalar( mResultFile, r_node.Id(), nodal_result );
103  }
104 
105  GiD_fEndResult(mResultFile);
106  }
107 
113  void WriteEigenResults( ModelPart& rModelPart,
114  const Variable<array_1d<double, 3>>& rVariable,
115  std::string Label,
116  const SizeType NumberOfAnimationStep)
117  {
118  Label += "_" + rVariable.Name();
119  GiD_fBeginResult( mResultFile, (char*)Label.c_str() , "EigenVector_Animation",
120  NumberOfAnimationStep, GiD_Vector,
121  GiD_OnNodes, NULL, NULL, 0, NULL );
122 
123  for (auto& r_node : rModelPart.Nodes())
124  {
125  const array_1d<double, 3>& nodal_result = r_node.FastGetSolutionStepValue(rVariable);
126  GiD_fWriteVector(mResultFile, r_node.Id(), nodal_result[0], nodal_result[1], nodal_result[2]);
127  }
128 
129  GiD_fEndResult(mResultFile);
130  }
131 
132 
136 
137 
141 
142 
146 
148  std::string Info() const override
149  {
150  std::stringstream buffer;
151  buffer << "GidEigenIO" ;
152  return buffer.str();
153  }
154 
156  void PrintInfo(std::ostream& rOStream) const override {rOStream << "GidEigenIO";}
157 
159  void PrintData(std::ostream& rOStream) const override {}
160 
161 
165 
166 
168 
169  protected:
172 
173 
177 
178 
182 
183 
187 
188 
192 
193 
197 
198 
202 
203 
205 
206  private:
209 
210 
214 
215 
219 
220 
224 
225 
229 
230 
234 
235 
239 
240 
242 
243 }; // Class GidEigenIO
244 
246 
249 
250 
254 
255 
257 
259 
260 } // namespace Kratos.
261 
GidIO extended for writting Eigenvalue Results.
Definition: gid_eigen_io.h:49
GidEigenIO(const std::string &rDatafilename, GiD_PostMode Mode, MultiFileFlag use_multiple_files_flag, WriteDeformedMeshFlag write_deformed_flag, WriteConditionsFlag write_conditions_flag)
Default constructor.
Definition: gid_eigen_io.h:64
KRATOS_CLASS_POINTER_DEFINITION(GidEigenIO)
Pointer definition of GidEigenIO.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: gid_eigen_io.h:159
std::size_t SizeType
Definition: gid_eigen_io.h:57
std::string Info() const override
Turn back information as a string.
Definition: gid_eigen_io.h:148
void WriteEigenResults(ModelPart &rModelPart, const Variable< array_1d< double, 3 >> &rVariable, std::string Label, const SizeType NumberOfAnimationStep)
Definition: gid_eigen_io.h:113
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: gid_eigen_io.h:156
void WriteEigenResults(ModelPart &rModelPart, const Variable< double > &rVariable, std::string Label, const SizeType NumberOfAnimationStep)
Definition: gid_eigen_io.h:89
This class defines an interface to the GiDPost library in order to provide GiD compliant I/O function...
Definition: gid_io.h:112
GiD_FILE mResultFile
Definition: gid_io.h:1512
std::size_t SizeType
Definition: io.h:97
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
const std::string & Name() const
Definition: variable_data.h:201
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
WriteDeformedMeshFlag
Flags for mesh writing.
Definition: gid_io.h:52
MultiFileFlag
Definition: gid_io.h:54
WriteConditionsFlag
Definition: gid_io.h:53