36 #include "SmartPointers.hpp"    37 #include "UblasIncludes.hpp"    38 #include "VesselNode.hpp"    40 #include "VesselSegment.hpp"    41 #include "GeometryTools.hpp"    43 template<
unsigned DIM>
    52 template<
unsigned DIM>
    62 template<
unsigned DIM>
    70         EXCEPTION(
"Attempted to assign the same node to both ends of a vessel segment.");
    74     pNode1->AddSegment(pSelf->shared_from_this());
    75     pNode2->AddSegment(pSelf->shared_from_this());
    79 template<
unsigned DIM>
    84         EXCEPTION(
"A Null pointer cannot be used when copying segments.");
    89     pSelf->GetNode(0)->AddSegment(pSelf->shared_from_this());
    90     pSelf->GetNode(1)->AddSegment(pSelf->shared_from_this());
    94 template<
unsigned DIM>
    99 template<
unsigned DIM>
   105 template<
unsigned DIM>
   108     this->
mOutputData = pTargetSegment->GetOutputData();
   109     this->
SetRadius(pTargetSegment->GetRadius());
   113 template<
unsigned DIM>
   116     return GetDistanceToLineSegment(
mNodes.first->rGetLocation(), 
mNodes.second->rGetLocation(), location);
   119 template<
unsigned DIM>
   125 template<
unsigned DIM>
   128     return mNodes.second->GetDistance(
mNodes.first->rGetLocation());
   131 template<
unsigned DIM>
   135     std::map<std::string, double> flow_data = this->
mpFlowProperties->GetOutputData();
   136     this->
mOutputData.insert(flow_data.begin(), flow_data.end());
   142 template<
unsigned DIM>
   145     return mNodes.first->rGetLocation().GetMidPoint(
mNodes.second->rGetLocation());
   148 template<
unsigned DIM>
   155     else if (index == 1u)
   161         EXCEPTION(
"A node index other than 0 or 1 has been requested for a Vessel Segment.");
   165 template<
unsigned DIM>
   168     if(pInputNode == 
mNodes.first)
   172     else if(pInputNode == 
mNodes.second)
   178         EXCEPTION(
"Input node is not on the segment");
   182 template<
unsigned DIM>
   188 template<
unsigned DIM>
   191     return GetPointProjectionOnLineSegment(
mNodes.first->rGetLocation(), 
mNodes.second->rGetLocation(), location, projectToEnds);
   194 template<
unsigned DIM>
   197     return mNodes.first->rGetLocation().GetUnitTangent(
mNodes.second->rGetLocation());
   200 template<
unsigned DIM>
   209         EXCEPTION(
"A vessel has been requested but this segment doesn't have one.");
   213 template<
unsigned DIM>
   219 template<
unsigned DIM>
   222     bool isConnectedToSegment = 
false;
   223     if (this->
GetNode(0) == otherSegment->GetNode(0) || this->
GetNode(0) == otherSegment->GetNode(1)
   224             || this->
GetNode(1) == otherSegment->GetNode(0) || this->
GetNode(1) == otherSegment->GetNode(1))
   226         isConnectedToSegment = 
true;
   229     return isConnectedToSegment;
   232 template<
unsigned DIM>
   235     mVessel = boost::weak_ptr<Vessel<DIM> >();
   238 template<
unsigned DIM>
   246 template<
unsigned DIM>
   249     if (oldNodeIndex == 0u)
   255     else if (oldNodeIndex == 1u)
   263         EXCEPTION(
"A node index other than 0 or 1 has been requested for a Vessel Segment.");
   272 template<
unsigned DIM>
   278 template<
unsigned DIM>
   281     boost::shared_ptr<VesselSegment<DIM> > pSegment = this->shared_from_this();
 VesselSegment(boost::shared_ptr< VesselNode< DIM > > pNode1, boost::shared_ptr< VesselNode< DIM > > pNode2)
void SetFlowProperties(const SegmentFlowProperties< DIM > &rFlowProperties)
std::pair< boost::shared_ptr< VesselNode< DIM > >, boost::shared_ptr< VesselNode< DIM > > > mNodes
boost::shared_ptr< VesselNode< DIM > > GetOppositeNode(boost::shared_ptr< VesselNode< DIM > > pInputNode) const 
void ReplaceNode(unsigned oldNodeIndex, boost::shared_ptr< VesselNode< DIM > > pNewNode)
std::pair< boost::shared_ptr< VesselNode< DIM > >, boost::shared_ptr< VesselNode< DIM > > > GetNodes() const 
boost::shared_ptr< SegmentFlowProperties< DIM > > mpFlowProperties
boost::shared_ptr< SegmentFlowProperties< DIM > > GetFlowProperties() const 
c_vector< double, DIM > GetUnitTangent() const 
boost::shared_ptr< VesselSegment< DIM > > Shared()
bool IsConnectedTo(boost::shared_ptr< VesselSegment< DIM > > pOtherSegment) const 
DimensionalChastePoint< DIM > GetMidPoint() const 
std::map< std::string, double > mOutputData
boost::weak_ptr< Vessel< DIM > > mVessel
boost::shared_ptr< Vessel< DIM > > GetVessel() const 
static boost::shared_ptr< VesselSegment< DIM > > Create(boost::shared_ptr< VesselNode< DIM > > pNode1, boost::shared_ptr< VesselNode< DIM > > pNode2)
units::quantity< unit::length > GetDistance(const DimensionalChastePoint< DIM > &location) const 
virtual unsigned GetId() const 
void AddVessel(boost::shared_ptr< Vessel< DIM > > pVessel)
boost::shared_ptr< VesselNode< DIM > > GetNode(unsigned index) const 
virtual units::quantity< unit::length > GetRadius() const 
virtual void SetRadius(units::quantity< unit::length > radius)
units::quantity< unit::length > GetLength() const 
DimensionalChastePoint< DIM > GetPointProjection(const DimensionalChastePoint< DIM > &location, bool projectToEnds=false) const 
void CopyDataFromExistingSegment(const boost::shared_ptr< VesselSegment< DIM > > pTargetSegment)
bool HasNode(boost::shared_ptr< VesselNode< DIM > > pNode) const 
std::map< std::string, double > GetOutputData()