Chaste  Build::
Vessel.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 VESSEL_HPP_
37 #define VESSEL_HPP_
38 
39 #include <vector>
40 #include <string>
41 #include <map>
42 #include <boost/enable_shared_from_this.hpp>
43 #include "VesselSegment.hpp"
44 #include "VesselNode.hpp"
45 #include "DimensionalChastePoint.hpp"
46 #include "UnitCollection.hpp"
47 #include "VesselFlowProperties.hpp"
48 
53 {
57  enum Value
58  {
59  Start, End
60  };
61 };
62 
68 template<unsigned DIM>
69 class Vessel : public boost::enable_shared_from_this<Vessel<DIM> >, public AbstractVesselNetworkComponent<DIM>
70 {
71 private:
72 
76  std::vector<boost::shared_ptr<VesselSegment<DIM> > > mSegments;
77 
81  std::vector<boost::shared_ptr<VesselNode<DIM> > > mNodes;
82 
87 
91  boost::shared_ptr<VesselFlowProperties<DIM> > mpFlowProperties;
92 
99  Vessel(boost::shared_ptr<VesselSegment<DIM> > pSegment);
100 
107  Vessel(std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments);
108 
115  Vessel(std::vector<boost::shared_ptr<VesselNode<DIM> > > nodes);
116 
123  Vessel(boost::shared_ptr<VesselNode<DIM> > pStartNode, boost::shared_ptr<VesselNode<DIM> > pEndNode);
124 
125 public:
126 
132  static boost::shared_ptr<Vessel<DIM> > Create(boost::shared_ptr<VesselSegment<DIM> > pSegment);
133 
139  static boost::shared_ptr<Vessel<DIM> > Create(std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments);
140 
146  static boost::shared_ptr<Vessel<DIM> > Create(std::vector<boost::shared_ptr<VesselNode<DIM> > > nodes);
147 
154  static boost::shared_ptr<Vessel<DIM> > Create(boost::shared_ptr<VesselNode<DIM> > pStartNode,
155  boost::shared_ptr<VesselNode<DIM> > pEndNode);
156 
160  ~Vessel();
161 
166  void AddSegment(boost::shared_ptr<VesselSegment<DIM> > pSegment);
167 
172  void AddSegments(std::vector<boost::shared_ptr<VesselSegment<DIM> > > pSegments);
173 
178  void CopyDataFromExistingVessel(boost::shared_ptr<Vessel<DIM> > pTargetVessel);
179 
186  boost::shared_ptr<VesselNode<DIM> > DivideSegment(const DimensionalChastePoint<DIM>& rLocation,
187  double distanceTolerance = 1.e-6);
188 
194  units::quantity<unit::length> GetClosestEndNodeDistance(const DimensionalChastePoint<DIM>& rLocation);
195 
201  units::quantity<unit::length> GetDistance(const DimensionalChastePoint<DIM>& rLocation) const;
202 
206  std::vector<boost::shared_ptr<Vessel<DIM> > > GetConnectedVessels();
207 
211  boost::shared_ptr<VesselNode<DIM> > GetEndNode();
212 
218  boost::shared_ptr<VesselFlowProperties<DIM> > GetFlowProperties() const;
219 
225  boost::shared_ptr<VesselNode<DIM> > GetNodeAtOppositeEnd(boost::shared_ptr<VesselNode<DIM> > pQueryNode);
226 
232  units::quantity<unit::length> GetLength() const;
233 
239  units::quantity<unit::length> GetRadius() const;
240 
246  boost::shared_ptr<VesselNode<DIM> > GetNode(unsigned index);
247 
253  std::vector<boost::shared_ptr<VesselNode<DIM> > > GetNodes();
254 
260  const std::vector<boost::shared_ptr<VesselNode<DIM> > >& rGetNodes();
261 
266  unsigned GetNumberOfNodes();
267 
271  unsigned GetNumberOfSegments();
272 
277  std::map<std::string, double> GetOutputData();
278 
283  boost::shared_ptr<VesselSegment<DIM> > GetSegment(unsigned index);
284 
288  std::vector<boost::shared_ptr<VesselSegment<DIM> > > GetSegments();
289 
293  boost::shared_ptr<VesselNode<DIM> > GetStartNode();
294 
299  bool IsConnectedTo(boost::shared_ptr<Vessel<DIM> > pOtherVessel);
300 
304  void Remove();
305 
310  void RemoveSegments(SegmentLocation::Value location);
311 
316  void SetRadius(units::quantity<unit::length> radius);
317 
323  void SetFlowProperties(const VesselFlowProperties<DIM>& rFlowProperties);
324 
328  void UpdateNodes();
329 
330 
331 private:
332 
336  boost::shared_ptr<Vessel<DIM> > Shared();
337 };
338 
339 #endif /* VESSEL_HPP_ */
std::vector< boost::shared_ptr< VesselSegment< DIM > > > mSegments
Definition: Vessel.hpp:76
std::vector< boost::shared_ptr< VesselNode< DIM > > > mNodes
Definition: Vessel.hpp:81
bool mNodesUpToDate
Definition: Vessel.hpp:86
boost::shared_ptr< VesselFlowProperties< DIM > > mpFlowProperties
Definition: Vessel.hpp:91