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.
hdf5_model_part_io.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // license: HDF5Application/license.txt
9 //
10 // Main author: Michael Andre, https://github.com/msandre
11 //
12 
13 #if !defined(KRATOS_HDF5_MODEL_PART_IO_H_INCLUDED)
14 #define KRATOS_HDF5_MODEL_PART_IO_H_INCLUDED
15 
16 // System includes
17 #include <string>
18 #include <tuple>
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/define.h"
24 #include "includes/io.h"
25 
26 // Application includes
28 #include "custom_io/hdf5_file.h"
29 
30 namespace Kratos
31 {
32 namespace HDF5
33 {
38 
40 class KRATOS_API(HDF5_APPLICATION) ModelPartIO : public IO
41 {
42 public:
45 
48 
52 
54  ModelPartIO(File::Pointer pFile, std::string const& rPrefix);
55 
59  bool ReadNodes(NodesContainerType& rNodes) override;
60 
61  std::size_t ReadNodesNumber() override;
62 
63  void WriteNodes(NodesContainerType const& rNodes) override;
64 
65  void ReadProperties(PropertiesContainerType& rThisProperties) override;
66 
67  void WriteProperties(Properties const& rThisProperties) override;
68 
69  void WriteProperties(PropertiesContainerType const& rThisProperties) override;
70 
71  void ReadElements(NodesContainerType& rNodes,
72  PropertiesContainerType& rProperties,
73  ElementsContainerType& rElements) override;
74 
75  void WriteElements(ElementsContainerType const& rElements) override;
76 
77  void ReadConditions(NodesContainerType& rNodes,
78  PropertiesContainerType& rProperties,
79  ConditionsContainerType& rConditions) override;
80 
81  void WriteConditions(ConditionsContainerType const& rConditions) override;
82 
83  void WriteModelPart(ModelPart& rModelPart) override;
84 
85  void ReadModelPart(ModelPart& rModelPart) override;
86 
88 
89 protected:
92 
93  virtual std::tuple<unsigned, unsigned> StartIndexAndBlockSize(std::string const& rPath) const;
94 
95  virtual void StoreWriteInfo(std::string const& rPath, WriteInfo const& rInfo);
96 
100 
101  File::Pointer mpFile;
102  const std::string mPrefix;
103 
105 
106 private:
109 
110  std::vector<std::size_t> ReadContainerIds(std::string const& rPath) const;
111 
112  std::vector<std::size_t> ReadEntityIds(std::string const& rPath) const;
113 
114  void WriteSubModelParts(ModelPart::SubModelPartsContainerType const& rSubModelPartsContainer, const std::string& GroupName);
115 
116  void ReadSubModelParts(ModelPart& rModelPart, const std::string& rPath);
117 
119 };
120 
123 } // namespace HDF5.
124 } // namespace Kratos.
125 
126 #endif // KRATOS_HDF5_MODEL_PART_IO_H_INCLUDED defined
A class for serial IO of a model part in HDF5.
Definition: hdf5_model_part_io.h:41
File::Pointer mpFile
Definition: hdf5_model_part_io.h:101
const std::string mPrefix
Definition: hdf5_model_part_io.h:102
KRATOS_CLASS_POINTER_DEFINITION(ModelPartIO)
Pointer definition.
IO provides different implementation of input output procedures which can be used to read and write w...
Definition: io.h:58
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
void ReadProperties(File &rFile, std::string const &rPrefix, PropertiesContainerType &rProperties)
Definition: hdf5_properties_io.cpp:15
std::tuple< unsigned, unsigned > StartIndexAndBlockSize(File &rFile, std::string const &rPath)
Definition: hdf5_data_set_partition_utility.cpp:58
void WriteProperties(File &rFile, std::string const &rPrefix, PropertiesType const &rProperties)
Definition: hdf5_properties_io.cpp:37
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
@ WriteConditions
Definition: gid_io.h:53
def ReadModelPart(model_part, inputfile)
Definition: read_modelpart_from_json.py:3
Stores information about a dataset written to HDF5.
Definition: hdf5_file.h:44