VPTissue Reference Manual
MeshState.h
Go to the documentation of this file.
1 #ifndef MESHSTATE_H_INCLUDED
2 #define MESHSTATE_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 // WARNING: FILE ALSO GETS PROCESSED BY SWIG. SWIG (VERSIONS EARLY 2013) //
24 // DOES NOT ACCEPT TWO CONSECUTIVE >> TEMPLATE TYPE PARAMETERLIST ENDING //
25 // BRACKETS WITHOUT INTERVENING BLANK (EVEN THOUGH C++11 DOES ACCPT THIS) //
27 
28 #include <map>
29 #include <string>
30 #include <vector>
31 #include <boost/property_tree/ptree.hpp>
32 #include "AttributeContainer.h"
33 
34 namespace SimPT_Sim {
35 
41 class MeshState
42 {
43 public:
47  MeshState();
48 
54 
58  size_t GetNumNodes() const;
59 
65  void SetNumNodes(size_t n);
66 
70  int GetNodeID(size_t node_idx) const;
71 
75  double GetNodeX(size_t node_idx) const;
76 
80  double GetNodeY(size_t node_idx) const;
81 
85  std::vector<int> GetNodesID() const;
86 
90  std::vector<double> GetNodesX() const;
91 
95  std::vector<double> GetNodesY() const;
96 
101  {
102  return m_nodes_attr;
103  }
104 
109  {
110  return m_nodes_attr;
111  }
112 
116  void SetNodeID(size_t node_idx, int value);
117 
121  void SetNodeX(size_t node_idx, double value);
122 
126  void SetNodeY(size_t node_idx, double value);
127 
131  void SetNodesID(std::vector<int> values);
132 
136  void SetNodesX(std::vector<double> values);
137 
141  void SetNodesY(std::vector<double> values);
142 
144 
150 
154  size_t GetNumCells() const;
155 
161  void SetNumCells(size_t n);
162 
167  {
168  return m_cells_attr;
169  }
170 
175  {
176  return m_cells_attr;
177  }
178 
182  int GetCellID(size_t cell_idx) const;
183 
187  size_t GetCellNumNodes(size_t cell_idx) const;
188 
192  std::vector<int> GetCellNodes(size_t cell_idx) const;
193 
197  size_t GetCellNumWalls(size_t cell_idx) const;
198 
202  std::vector<int> GetCellWalls(size_t cell_idx) const;
203 
207  void SetCellID(size_t cell_idx, int value);
208 
212  void SetCellNodes(size_t cell_idx, std::vector<int> node_ids);
213 
217  void SetCellWalls(size_t cell_idx, std::vector<int> wall_ids);
218 
222  std::vector<int> GetCellsID() const;
223 
227  std::vector<size_t> GetCellsNumNodes() const;
228 
232  std::vector<size_t> GetCellsNumWalls() const;
233 
237  void SetCellsID(std::vector<int> values);
238 
242  std::vector<int> GetBoundaryPolygonNodes() const;
243 
247  std::vector<int> GetBoundaryPolygonWalls() const;
248 
252  void SetBoundaryPolygonNodes(std::vector<int> node_ids);
253 
257  void SetBoundaryPolygonWalls(std::vector<int> wall_ids);
259 
263 
267  size_t GetNumWalls() const;
268 
274  void SetNumWalls(size_t n);
275 
280  {
281  return m_walls_attr;
282  }
283 
288  {
289  return m_walls_attr;
290  }
291 
295  int GetWallID(size_t wall_idx) const;
296 
300  std::pair<int, int> GetWallNodes(size_t wall_idx) const;
301 
305  std::pair<int, int> GetWallCells(size_t wall_idx) const;
306 
310  void SetWallID(size_t wall_idx, int value);
311 
315  void SetWallNodes(size_t wall_idx, std::pair<int, int> nodes_ids);
316 
320  void SetWallCells(size_t wall_idx, std::pair<int, int> cells_ids);
321 
325  std::vector<int> GetWallsID() const;
326 
330  void SetWallsID(std::vector<int> values);
331 
333 
339  void PrintToStream(std::ostream& out) const;
340 
341 private:
342  size_t m_num_nodes;
343  std::vector<int> m_nodes_id;
344  std::vector<double> m_nodes_x;
345  std::vector<double> m_nodes_y;
346  AttributeContainer m_nodes_attr ;
347 
348 private:
349  size_t m_num_cells;
350  std::vector<int> m_cells_id;
351  std::vector< std::vector<int> > m_cells_nodes;
352  std::vector< std::vector<int> > m_cells_walls;
353  std::vector<int> m_boundary_polygon_nodes;
354  std::vector<int> m_boundary_polygon_walls;
355  AttributeContainer m_cells_attr;
356 
357 private:
358  size_t m_num_walls;
359  std::vector<int> m_walls_id;
360  std::vector<std::pair<int, int> > m_walls_cells;
361  std::vector<std::pair<int, int> > m_walls_nodes;
362  AttributeContainer m_walls_attr;
363 };
364 
365 } // namespace
366 
367 #endif // include guard
368 
void SetNodeY(size_t node_idx, double value)
Sets the y coordinate of a particular node.
Definition: MeshState.cpp:80
double GetNodeY(size_t node_idx) const
Returns the y coordinate of a particular node.
Definition: MeshState.cpp:65
void SetCellsID(std::vector< int > values)
Sets the IDs of all cells.
Definition: MeshState.cpp:211
int GetWallID(size_t wall_idx) const
Returns the ID of a particular wall.
Definition: MeshState.cpp:259
std::vector< double > GetNodesY() const
Returns the y coordinates of all nodes.
Definition: MeshState.cpp:95
const AttributeContainer & NodeAttributeContainer() const
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:108
size_t GetNumCells() const
Returns the number of cells in the mesh.
Definition: MeshState.cpp:131
void PrintToStream(std::ostream &out) const
Prints a textual representation of this MeshState to output stream.
Definition: MeshState.cpp:303
size_t GetCellNumWalls(size_t cell_idx) const
Returns the number of walls of a particular cell.
Definition: MeshState.cpp:161
void SetWallsID(std::vector< int > values)
Sets the IDs of all walls.
Definition: MeshState.cpp:294
size_t GetCellNumNodes(size_t cell_idx) const
Returns the number of nodes that define the polygon of a particular cell.
Definition: MeshState.cpp:151
double GetNodeX(size_t node_idx) const
Returns the x coordinate of a particular node.
Definition: MeshState.cpp:60
int GetCellID(size_t cell_idx) const
Returns the ID of a particular cell.
Definition: MeshState.cpp:146
std::vector< int > GetWallsID() const
Returns the IDs of all walls.
Definition: MeshState.cpp:289
const AttributeContainer & WallAttributeContainer() const
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:287
std::vector< double > GetNodesX() const
Returns the x coordinates of all nodes.
Definition: MeshState.cpp:90
void SetBoundaryPolygonWalls(std::vector< int > wall_ids)
Sets the IDs of the walls that form the boundary polygon of the tissue.
Definition: MeshState.cpp:235
void SetWallID(size_t wall_idx, int value)
Sets the ID of a particular wall.
Definition: MeshState.cpp:274
void SetNodeID(size_t node_idx, int value)
Sets the ID of a particular node.
Definition: MeshState.cpp:70
Namespace for the core simulator.
void SetCellID(size_t cell_idx, int value)
Sets the ID of a particular cell.
Definition: MeshState.cpp:171
std::vector< size_t > GetCellsNumNodes() const
Returns the number of nodes for all cells.
Definition: MeshState.cpp:191
std::vector< int > GetCellNodes(size_t cell_idx) const
Returns the IDs of the nodes that form the polygon of a particular cell.
Definition: MeshState.cpp:156
void SetNumNodes(size_t n)
Sets the number of nodes in the mesh.
Definition: MeshState.cpp:45
void SetNumWalls(size_t n)
Sets the number of walls in the mesh.
Definition: MeshState.cpp:249
AttributeContainer & WallAttributeContainer()
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:279
AttributeContainer & NodeAttributeContainer()
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:100
std::vector< int > GetCellsID() const
Returns the IDs of all cells.
Definition: MeshState.cpp:186
std::vector< size_t > GetCellsNumWalls() const
Returns the number of walls for all cells.
Definition: MeshState.cpp:201
void SetNumCells(size_t n)
Sets the number of cells in the mesh.
Definition: MeshState.cpp:136
MeshState()
Creates a meshstate that represents an empty mesh with no nodes / cells / walls.
Definition: MeshState.cpp:29
int GetNodeID(size_t node_idx) const
Returns the ID of a particular node.
Definition: MeshState.cpp:55
Interface of AttributeContainer.
std::vector< int > GetBoundaryPolygonWalls() const
Returns the IDs of the walls that form the boundary polygon of the tissue.
Definition: MeshState.cpp:225
Contains the state of the whole Mesh at a given simulation step.
Definition: MeshState.h:41
void SetNodesID(std::vector< int > values)
Sets the IDs of all nodes.
Definition: MeshState.cpp:100
std::vector< int > GetBoundaryPolygonNodes() const
Returns the IDs of the nodes that form the boundary polygon of the tissue.
Definition: MeshState.cpp:220
AttributeContainer & CellAttributeContainer()
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:166
void SetNodeX(size_t node_idx, double value)
Sets the x coordinate of a particular node.
Definition: MeshState.cpp:75
size_t GetNumNodes() const
Returns the number of nodes in the mesh.
Definition: MeshState.cpp:40
void SetNodesY(std::vector< double > values)
Sets the y coordinates of all nodes.
Definition: MeshState.cpp:118
void SetNodesX(std::vector< double > values)
Sets the x coordinates of all nodes.
Definition: MeshState.cpp:109
std::vector< int > GetCellWalls(size_t cell_idx) const
Returns the IDs of walls of a particular cell.
Definition: MeshState.cpp:166
void SetBoundaryPolygonNodes(std::vector< int > node_ids)
Sets the IDs of the nodes that form the boundary polygon of the tissue.
Definition: MeshState.cpp:230
void SetCellWalls(size_t cell_idx, std::vector< int > wall_ids)
Sets the IDs of walls of a particular cell.
Definition: MeshState.cpp:181
size_t GetNumWalls() const
Returns the number of walls in the mesh.
Definition: MeshState.cpp:244
const AttributeContainer & CellAttributeContainer() const
Adds a new named attribute of type T for the nodes.
Definition: MeshState.h:174
std::vector< int > GetNodesID() const
Returns the IDs of all nodes.
Definition: MeshState.cpp:85
void SetCellNodes(size_t cell_idx, std::vector< int > node_ids)
Sets the IDs of the nodes that form the polygon of a particular cell.
Definition: MeshState.cpp:176