OGS
Properties.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 #include <cstdlib>
16 #include <string>
17 #include <map>
18 
19 
20 #include "Location.h"
21 
22 #include "PropertyVector.h"
23 
24 namespace MeshLib
25 {
26 
36 {
37 public:
51  template <typename T>
53  MeshItemType mesh_item_type,
54  std::size_t n_components = 1);
55 
72  template <typename T>
74  std::string const& name,
75  std::size_t n_prop_groups,
76  std::vector<std::size_t> const& item2group_mapping,
77  MeshItemType mesh_item_type,
78  std::size_t n_components = 1);
79 
83  template <typename T>
84  bool existsPropertyVector(std::string const& name) const;
85 
88  template <typename T>
89  bool existsPropertyVector(std::string const& name,
90  MeshItemType const mesh_item_type,
91  int const number_of_components) const;
92 
95  template <typename T>
96  PropertyVector<T> const* getPropertyVector(std::string const& name) const;
97 
100  template <typename T>
102 
106  template <typename T>
107  PropertyVector<T> const* getPropertyVector(std::string const& name,
108  MeshItemType const item_type,
109  int const n_components) const;
110 
114  template <typename T>
116  MeshItemType const item_type,
117  int const n_components);
118 
119  void removePropertyVector(std::string const& name);
120 
124  bool hasPropertyVector(std::string const& name) const;
125 
126  std::vector<std::string> getPropertyVectorNames() const;
127  std::vector<std::string> getPropertyVectorNames(
128  MeshLib::MeshItemType t) const;
129 
135  std::vector<std::size_t> const& exclude_elem_ids,
136  std::vector<std::size_t> const& exclude_node_ids) const;
137 
142  std::vector<MeshItemType> const& exclude_mesh_item_types) const;
143 
144  Properties() = default;
145 
146  Properties(Properties const& properties);
147  Properties(Properties&& properties) = default;
148  Properties& operator=(Properties const& properties);
149  Properties& operator=(Properties&& properties) = default;
150 
151  ~Properties();
152 
153  std::map<std::string, PropertyVectorBase*>::const_iterator begin() const;
154  std::map<std::string, PropertyVectorBase*>::const_iterator end() const;
155  std::map<std::string, PropertyVectorBase*>::iterator begin();
156  std::map<std::string, PropertyVectorBase*>::iterator end();
157  std::map<std::string, PropertyVectorBase*>::size_type size() const;
158  // Counts properties of given mesh item type.
159  std::map<std::string, PropertyVectorBase*>::size_type size(
160  MeshItemType const mesh_item_type) const;
161 
162 private:
165  std::map<std::string, PropertyVectorBase*> _properties;
166 }; // end class
167 
168 #include "Properties-impl.h"
169 
170 } // end namespace MeshLib
Implemenatiom of the template part of the class Properties.
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
Definition: Properties.h:36
bool existsPropertyVector(std::string const &name, MeshItemType const mesh_item_type, int const number_of_components) const
bool hasPropertyVector(std::string const &name) const
Definition: Properties.cpp:30
std::vector< std::string > getPropertyVectorNames() const
Definition: Properties.cpp:35
std::map< std::string, PropertyVectorBase * > _properties
Definition: Properties.h:165
void removePropertyVector(std::string const &name)
Definition: Properties.cpp:17
std::map< std::string, PropertyVectorBase * >::size_type size() const
Definition: Properties.cpp:165
Properties excludeCopyProperties(std::vector< std::size_t > const &exclude_elem_ids, std::vector< std::size_t > const &exclude_node_ids) const
Definition: Properties.cpp:58
std::map< std::string, PropertyVectorBase * >::const_iterator begin() const
Definition: Properties.cpp:143
PropertyVector< T > const * getPropertyVector(std::string const &name) const
std::map< std::string, PropertyVectorBase * >::const_iterator end() const
Definition: Properties.cpp:149
PropertyVector< T > * createNewPropertyVector(std::string const &name, std::size_t n_prop_groups, std::vector< std::size_t > const &item2group_mapping, MeshItemType mesh_item_type, std::size_t n_components=1)
Properties(Properties &&properties)=default
PropertyVector< T > const * getPropertyVector(std::string const &name, MeshItemType const item_type, int const n_components) const
bool existsPropertyVector(std::string const &name) const
Properties & operator=(Properties const &properties)
Definition: Properties.cpp:116
PropertyVector< T > * getPropertyVector(std::string const &name)
PropertyVector< T > * getPropertyVector(std::string const &name, MeshItemType const item_type, int const n_components)
Properties & operator=(Properties &&properties)=default
PropertyVector< T > * createNewPropertyVector(std::string const &name, MeshItemType mesh_item_type, std::size_t n_components=1)
MeshItemType
Definition: Location.h:21