Chaste  Build::
VesselNode.hpp
1 /*
2 
3 Copyright (c) 2005-2016, University of Oxford.
4  All rights reserved.
5 
6  University of Oxford means the Chancellor, Masters and Scholars of the
7  University of Oxford, having an administrative office at Wellington
8  Square, Oxford OX1 2JD, UK.
9 
10  This file is part of Chaste.
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34  */
35 
36 #ifndef VESSELNODE_HPP_
37 #define VESSELNODE_HPP_
38 
39 #include <vector>
40 #include <string>
41 #include <map>
42 #include <boost/enable_shared_from_this.hpp>
43 #include "ChasteSerialization.hpp"
44 #include "SmartPointers.hpp"
45 #include "DimensionalChastePoint.hpp"
46 #include "AbstractVesselNetworkComponent.hpp"
47 #include "NodeFlowProperties.hpp"
48 #include "UblasVectorInclude.hpp"
49 #include "UnitCollection.hpp"
50 #include "VesselSegment.hpp"
51 
55 template<unsigned DIM>
57 
64 template<unsigned DIM>
65 class VesselNode : public boost::enable_shared_from_this<VesselNode<DIM> >, public AbstractVesselNetworkComponent<DIM>
66 {
67 private:
68 
74 
80  template<class Archive>
81  void serialize(Archive & ar, const unsigned int version)
82  {
83  ar & boost::serialization::base_object<AbstractVesselNetworkComponent<DIM> >(*this);
84  ar & mLocation;
85  ar & mIsMigrating;
86  ar & mpFlowProperties;
87  ar & mPtrComparisonId;
88  }
89 
93  friend class VesselSegment<DIM> ;
94 
99 
103  std::vector<boost::weak_ptr<VesselSegment<DIM> > > mSegments;
104 
109 
113  boost::shared_ptr<NodeFlowProperties<DIM> > mpFlowProperties;
114 
120 
121 public:
122 
132  VesselNode(double v1, double v2, double v3, units::quantity<unit::length> referenceLength);
133 
142  VesselNode(double v1 = 0.0, double v2 = 0.0, double v3 = 0.0);
143 
150  VesselNode(const DimensionalChastePoint<DIM>& location);
151 
156  VesselNode(const VesselNode<DIM>& rExistingNode);
157 
161  ~VesselNode();
162 
171  static boost::shared_ptr<VesselNode<DIM> > Create(double v1 = 0.0, double v2 = 0.0, double v3 = 0.0);
172 
182  static boost::shared_ptr<VesselNode<DIM> > Create(double v1, double v2, double v3, units::quantity<unit::length> referenceLength);
183 
190  static boost::shared_ptr<VesselNode<DIM> > Create(const DimensionalChastePoint<DIM>& location);
191 
198  static boost::shared_ptr<VesselNode<DIM> > Create(const VesselNode<DIM>& rExistingNode);
199 
206  static boost::shared_ptr<VesselNode<DIM> > Create(boost::shared_ptr<VesselNode<DIM> > pExistingNode);
207 
212  unsigned GetComparisonId();
213 
220  units::quantity<unit::length> GetDistance(const DimensionalChastePoint<DIM>& rLocation) const;
221 
227  boost::shared_ptr<NodeFlowProperties<DIM> > GetFlowProperties() const;
228 
235 
241  unsigned GetNumberOfSegments() const;
242 
248  std::map<std::string, double> GetOutputData();
249 
255  units::quantity<unit::length> GetReferenceLengthScale() const;
256 
262  boost::shared_ptr<VesselSegment<DIM> > GetSegment(unsigned index) const;
263 
269  std::vector<boost::shared_ptr<VesselSegment<DIM> > > GetSegments() const;
270 
277  bool IsAttachedTo(const boost::shared_ptr<VesselSegment<DIM> > pSegment) const;
278 
285  bool IsCoincident(const DimensionalChastePoint<DIM>& rLocation) const;
286 
293  bool IsMigrating() const;
294 
302  void SetComparisonId(unsigned id);
303 
309  void SetFlowProperties(const NodeFlowProperties<DIM>& rFlowProperties);
310 
316  void SetIsMigrating(bool isMigrating);
317 
324  void SetLocation(const DimensionalChastePoint<DIM>& rLocation);
325 
335  void SetLocation(double x, double y, double z=0.0, units::quantity<unit::length> referenceLength = 1.e-6*unit::metres);
336 
344  void SetReferenceLengthScale(units::quantity<unit::length> lenthScale);
345 
346 private:
347 
353  void AddSegment(boost::shared_ptr<VesselSegment<DIM> > pVesselSegment);
354 
360  void RemoveSegment(boost::shared_ptr<VesselSegment<DIM> > pVesselSegment);
361 };
362 
363 #include "SerializationExportWrapper.hpp"
364 EXPORT_TEMPLATE_CLASS1(VesselNode, 2)
365 EXPORT_TEMPLATE_CLASS1(VesselNode, 3)
366 #endif /* VESSELNODE_HPP_ */
bool IsCoincident(const DimensionalChastePoint< DIM > &rLocation) const
Definition: VesselNode.cpp:228
unsigned GetNumberOfSegments() const
Definition: VesselNode.cpp:171
static boost::shared_ptr< VesselNode< DIM > > Create(double v1=0.0, double v2=0.0, double v3=0.0)
Definition: VesselNode.cpp:100
DimensionalChastePoint< DIM > mLocation
Definition: VesselNode.hpp:98
void SetComparisonId(unsigned id)
Definition: VesselNode.cpp:254
bool IsMigrating() const
Definition: VesselNode.cpp:234
unsigned GetComparisonId()
Definition: VesselNode.cpp:147
void SetLocation(const DimensionalChastePoint< DIM > &rLocation)
Definition: VesselNode.cpp:266
bool IsAttachedTo(const boost::shared_ptr< VesselSegment< DIM > > pSegment) const
Definition: VesselNode.cpp:221
void RemoveSegment(boost::shared_ptr< VesselSegment< DIM > > pVesselSegment)
Definition: VesselNode.cpp:240
units::quantity< unit::length > GetDistance(const DimensionalChastePoint< DIM > &rLocation) const
Definition: VesselNode.cpp:153
std::vector< boost::shared_ptr< VesselSegment< DIM > > > GetSegments() const
Definition: VesselNode.cpp:209
boost::shared_ptr< NodeFlowProperties< DIM > > mpFlowProperties
Definition: VesselNode.hpp:113
void AddSegment(boost::shared_ptr< VesselSegment< DIM > > pVesselSegment)
Definition: VesselNode.cpp:132
bool mIsMigrating
Definition: VesselNode.hpp:108
boost::shared_ptr< NodeFlowProperties< DIM > > GetFlowProperties() const
Definition: VesselNode.cpp:159
std::map< std::string, double > GetOutputData()
Definition: VesselNode.cpp:177
VesselNode(double v1, double v2, double v3, units::quantity< unit::length > referenceLength)
Definition: VesselNode.cpp:41
const DimensionalChastePoint< DIM > & rGetLocation() const
Definition: VesselNode.cpp:165
units::quantity< unit::length > GetReferenceLengthScale() const
Definition: VesselNode.cpp:189
unsigned mPtrComparisonId
Definition: VesselNode.hpp:119
void SetReferenceLengthScale(units::quantity< unit::length > lenthScale)
Definition: VesselNode.cpp:284
void serialize(Archive &ar, const unsigned int version)
Definition: VesselNode.hpp:81
std::vector< boost::weak_ptr< VesselSegment< DIM > > > mSegments
Definition: VesselNode.hpp:103
void SetIsMigrating(bool isMigrating)
Definition: VesselNode.cpp:278
friend class boost::serialization::access
Definition: VesselNode.hpp:73
void SetFlowProperties(const NodeFlowProperties< DIM > &rFlowProperties)
Definition: VesselNode.cpp:260
boost::shared_ptr< VesselSegment< DIM > > GetSegment(unsigned index) const
Definition: VesselNode.cpp:195