VPTissue Reference Manual
Node.h
Go to the documentation of this file.
1 #ifndef NODE_H_INCLUDED
2 #define NODE_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 #include "NodeAttributes.h"
23 #include "math/math.h"
25 
26 #include <boost/property_tree/ptree.hpp>
27 #include <array>
28 #include <iosfwd>
29 
30 namespace SimPT_Editor {
31  class EditableMesh;
32 }
33 
34 namespace SimPT_Sim {
35 
39 class Node : public NodeAttributes
40 {
41 public:
43  virtual ~Node() {};
44 
46  unsigned int GetIndex() const { return m_index; }
47 
49  bool IsAtBoundary() const { return m_at_boundary; }
50 
52  std::ostream& Print(std::ostream& os) const;
53 
55  virtual void ReadPtree(const boost::property_tree::ptree& node_pt);
56 
58  void SetAtBoundary(bool b) { m_at_boundary = b; }
59 
72  virtual boost::property_tree::ptree ToPtree() const;
73 
74 public:
76  operator std::array<double, 3>() { return m_position; }
77 
79  operator const std::array<double,3>() const { return m_position; }
80 
82  Node& operator+=(const std::array<double,3>& a)
83  {
84  m_position += a;
85  return *this;
86  }
87 
89  Node& operator-=(const std::array<double,3>& a)
90  {
91  m_position -= a;
92  return *this;
93  }
94 
96  std::array<double,3> operator+(const Node& n) const
97  {
98  return m_position + n.m_position;
99  }
100 
102  std::array<double,3> operator-(const Node& n) const
103  {
104  return m_position - n.m_position;
105  }
106 
108  double& operator[](size_t i) { return m_position[i]; }
109 
111  double operator[](size_t i) const { return m_position[i]; }
112 
113 private:
114  std::array<double, 3> m_position;
115  bool m_at_boundary;
116  unsigned int m_index;
117 
118 private:
119  friend class Mesh;
120  template<typename T, size_t N>
122  friend class SimPT_Editor::EditableMesh;
123 
124 private:
125  Node(unsigned int index, const std::array<double, 3>& src, bool at_boundary);
126  Node(const Node &src);
127  Node& operator=(const Node&);
128 };
129 
130 std::ostream& operator<<(std::ostream& os, const Node& n);
131 
132 }
133 
134 #endif //end_of_include_guard
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
Node in cell wall.
Definition: Node.h:39
Interface for NodeAttributes.
Namespace for the core simulator.
virtual void ReadPtree(const boost::property_tree::ptree &node_pt)
Read the given ptree into the attributes.
Definition: Node.cpp:43
virtual boost::property_tree::ptree ToPtree() const
Convert the node to a ptree.
Definition: Node.cpp:48
Interface and implementation for SegmentedVector class.
Structure of cells; key data structure.
Definition: Mesh.h:62
An editable mesh with actions to alter the construction of the mesh.
Definition: EditableMesh.h:35
Attributes associated with a node.
Math constants and functions header combo.
Container that stores objects "almost contiguously" and guarantees that pointers/iterators are not in...