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.
statistics_record.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Jordi Cotela
11 //
12 
13 #ifndef KRATOS_STATISTICS_RECORD_H_INCLUDED
14 #define KRATOS_STATISTICS_RECORD_H_INCLUDED
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 // External includes
21 
22 // Project includes
24 #include "includes/define.h"
26 #include "statistics_utilities.h"
27 
28 namespace Kratos
29 {
32 
35 
36 class ModelPart; // forward-declaring to not having to include it here
37 
39 
44 class KRATOS_API(FLUID_DYNAMICS_APPLICATION) StatisticsRecord
45 {
46 public:
49 
52 
56 
59  : mInitialized(false)
60  , mDataBufferSize(0)
61  , mRecordedSteps(0)
62  {}
63 
66  {}
67 
71 
73 
75  void AddResult(StatisticsSampler::Pointer pResult);
76 
78 
80  void AddHigherOrderStatistic(StatisticsSampler::Pointer pResult);
81 
83 
86  void InitializeStorage(ModelPart::ElementsContainerType& rElements);
87 
89 
95  void SampleIntegrationPointResults(ModelPart& rModelPart);
96 
98 
102  void UpdateStatistics(Element* pElement);
103 
105 
109  void PrintToFile(const ModelPart &rModelPart, const std::string& rOutputFileName) const;
110 
112 
113  std::vector<double> OutputForTest(ModelPart::ElementsContainerType& rElements) const;
114 
118 
120  virtual std::string Info() const
121  {
122  std::stringstream buffer;
123  buffer << "StatisticsRecord";
124  return buffer.str();
125  }
126 
128  virtual void PrintInfo(std::ostream &rOStream) const { rOStream << "StatisticsRecord"; }
129 
131  virtual void PrintData(std::ostream &rOStream) const {}
132 
134 
135 private:
138 
140  std::vector< std::vector<double> > mUpdateBuffer;
141 
143  bool mInitialized;
144 
146  std::size_t mDataBufferSize;
147 
149  std::size_t mRecordedSteps;
150 
153 
155  PointerVector<StatisticsSampler> mHigherOrderData;
156 
160 
161  friend class Serializer;
162 
163  void save(Serializer& rSerializer) const {}
164 
165  void load(Serializer& rSerializer) {}
166 
170 
172  StatisticsRecord &operator=(StatisticsRecord const &rOther) = delete;
173 
175  StatisticsRecord(StatisticsRecord const &rOther) {}
176 
178 
179 }; // Class StatisticsRecord
180 
182 
185 
187 inline std::istream &operator>>(std::istream &rIStream,
188  StatisticsRecord &rThis)
189 {
190  return rIStream;
191 }
192 
194 inline std::ostream &operator<<(std::ostream &rOStream,
195  const StatisticsRecord &rThis)
196 {
197  rThis.PrintInfo(rOStream);
198  rOStream << std::endl;
199  rThis.PrintData(rOStream);
200 
201  return rOStream;
202 }
204 
206 
207 } // namespace Kratos.
208 
209 #endif // KRATOS_STATISTICS_RECORD_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Main class for online statistics calculation.
Definition: statistics_record.h:45
virtual std::string Info() const
Turn back information as a string.
Definition: statistics_record.h:120
KRATOS_CLASS_POINTER_DEFINITION(StatisticsRecord)
Pointer definition of StatisticsRecord.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: statistics_record.h:131
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: statistics_record.h:128
virtual ~StatisticsRecord()
Destructor.
Definition: statistics_record.h:65
StatisticsRecord()
Default constructor.
Definition: statistics_record.h:58
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
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
def load(f)
Definition: ode_solve.py:307