VPTissue Reference Manual
Node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "Node.h"
21 
22 #include "NodeAttributes.h"
23 
24 #include <list>
25 
26 
27 using namespace std;
28 using boost::property_tree::ptree;
29 
30 namespace SimPT_Sim {
31 
32 Node::Node(unsigned int index, const array<double, 3>& src, bool at_boundary)
33  : m_position(src), m_at_boundary(at_boundary), m_index(index)
34 {}
35 
36 ostream& Node::Print(ostream& os) const
37 {
38  os << "Node: ";
39  os << m_index << " {" << (*this)[0] << ", " << (*this)[1] << ", " << (*this)[2] << "}";
40  return os;
41 }
42 
43 void Node::ReadPtree(const ptree& node_pt)
44 {
45  NodeAttributes::ReadPtree(node_pt.get_child("attributes"));
46 }
47 
48 ptree Node::ToPtree() const
49 {
50  ptree ret;
51  ret.put("id", GetIndex());
52  ret.put("x", (*this)[0]);
53  ret.put("y", (*this)[1]);
54  ret.put("boundary", IsAtBoundary());
55  ret.put_child("attributes", NodeAttributes::ToPtree());
56  return ret;
57 }
58 
59 ostream& operator<<(ostream& os, Node const& n)
60 {
61  n.Print(os);
62  return os;
63 }
64 
65 }
STL namespace.
Node in cell wall.
Definition: Node.h:39
Interface for NodeAttributes.
Namespace for the core simulator.
Interface for Node.