Chaste  Build::
Part< DIM > Class Template Reference

#include <Part.hpp>

+ Collaboration diagram for Part< DIM >:

Public Member Functions

 Part ()
 
 ~Part ()
 
boost::shared_ptr< Polygon< DIM > > AddCircle (units::quantity< unit::length > radius, DimensionalChastePoint< DIM > centre, unsigned numSegments=24)
 
void AddCylinder (units::quantity< unit::length > radius, units::quantity< unit::length > depth, DimensionalChastePoint< DIM > centre, unsigned numSegments=24)
 
void AddCuboid (units::quantity< unit::length > sizeX, units::quantity< unit::length > sizeY, units::quantity< unit::length > sizeZ, DimensionalChastePoint< DIM > origin)
 
void AddHoleMarker (DimensionalChastePoint< DIM > location)
 
boost::shared_ptr< Polygon< DIM > > AddPolygon (std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > vertices, bool newFacet=false, boost::shared_ptr< Facet< DIM > > pFacet=boost::shared_ptr< Facet< DIM > >())
 
boost::shared_ptr< Polygon< DIM > > AddPolygon (boost::shared_ptr< Polygon< DIM > > pPolygon, bool newFacet=false, boost::shared_ptr< Facet< DIM > > pFacet=boost::shared_ptr< Facet< DIM > >())
 
boost::shared_ptr< Polygon< DIM > > AddRectangle (units::quantity< unit::length > sizeX, units::quantity< unit::length > sizeY, DimensionalChastePoint< DIM > origin)
 
void AddVesselNetwork (boost::shared_ptr< VesselNetwork< DIM > > pVesselNetwork, bool surface=false)
 
void BooleanWithNetwork (boost::shared_ptr< VesselNetwork< DIM > > pVesselNetwork)
 
void Extrude (boost::shared_ptr< Polygon< DIM > > pPolygon, units::quantity< unit::length > distance)
 
std::vector< units::quantity< unit::length > > GetBoundingBox ()
 
std::vector< unsigned > GetContainingGridIndices (unsigned num_x, unsigned num_y, unsigned num_z, units::quantity< unit::length > spacing)
 
std::vector< DimensionalChastePoint< DIM > > GetHoleMarkers ()
 
std::vector< boost::shared_ptr< Facet< DIM > > > GetFacets ()
 
boost::shared_ptr< Facet< DIM > > GetFacet (const DimensionalChastePoint< DIM > &rLocation)
 
std::vector< boost::shared_ptr< Polygon< DIM > > > GetPolygons ()
 
units::quantity< unit::length > GetReferenceLengthScale ()
 
std::vector< std::pair< unsigned, unsigned > > GetSegmentIndices ()
 
std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > GetVertices ()
 
std::vector< DimensionalChastePoint< DIM > > GetVertexLocations ()
 
vtkSmartPointer< vtkPolyData > GetVtk ()
 
bool IsPointInPart (DimensionalChastePoint< DIM > location)
 
std::vector< boolIsPointInPart (const std::vector< DimensionalChastePoint< DIM > > &location)
 
void MergeCoincidentVertices ()
 
void SetReferenceLengthScale (units::quantity< unit::length > referenceLength)
 
void Translate (DimensionalChastePoint< DIM > vector)
 
void Write (const std::string &rFilename, GeometryFormat::Value format=GeometryFormat::VTP)
 

Static Public Member Functions

static boost::shared_ptr< Part< DIM > > Create ()
 

Private Attributes

std::vector< boost::shared_ptr< Facet< DIM > > > mFacets
 
vtkSmartPointer< vtkPolyData > mVtkPart
 
std::vector< DimensionalChastePoint< DIM > > mHoleMarkers
 
std::vector< DimensionalChastePoint< DIM > > mRegionMarkers
 
units::quantity< unit::length > mReferenceLength
 
bool mVtkIsUpToDate
 

Detailed Description

template<unsigned DIM>
class Part< DIM >

A geometric feature described using a PLC (piecewise linear complex) description (see the tetgen manual for details:http://wias-berlin.de/software/tetgen/). These descriptions allow parts to be meshed using triangle or tetgen.

Definition at line 60 of file Part.hpp.

Constructor & Destructor Documentation

template<unsigned DIM>
Part< DIM >::Part ( )

Constructor

Definition at line 52 of file Part.cpp.

template<unsigned DIM>
Part< DIM >::~Part ( )

Destructor

Definition at line 70 of file Part.cpp.

Member Function Documentation

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Part< DIM >::AddCircle ( units::quantity< unit::length >  radius,
DimensionalChastePoint< DIM >  centre,
unsigned  numSegments = 24 
)

Add a circle to the part. If a target facet is not specified the default position is normal to the z-axis.

Parameters
radiusthe circle radius
centrethe centre of the circle
numSegmentsthe number of linear segments the circle is described with
Returns
polygon corresponding to the circle, useful for further operations, such as extrusion.

Definition at line 76 of file Part.cpp.

References Part< DIM >::AddPolygon(), DimensionalChastePoint< DIM >::GetLocation(), DimensionalChastePoint< DIM >::GetReferenceLengthScale(), Part< DIM >::mReferenceLength, and Part< DIM >::mVtkIsUpToDate.

Referenced by Part< DIM >::AddCylinder().

template<unsigned DIM>
void Part< DIM >::AddCuboid ( units::quantity< unit::length >  sizeX,
units::quantity< unit::length >  sizeY,
units::quantity< unit::length >  sizeZ,
DimensionalChastePoint< DIM >  origin 
)

Add a cuboid to the part.

Parameters
sizeXthe dimension in x
sizeYthe dimension in y
sizeZthe dimension in z
originthe bottom, left, front corner

Definition at line 111 of file Part.cpp.

References Part< DIM >::AddRectangle(), Part< DIM >::Extrude(), and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::AddCylinder ( units::quantity< unit::length >  radius,
units::quantity< unit::length >  depth,
DimensionalChastePoint< DIM >  centre,
unsigned  numSegments = 24 
)

Add a cylinder to the part.

Parameters
radiusthe radius
depththe depth
centrethe centre of the base
numSegmentsthe number of line segments the base is described with

Definition at line 100 of file Part.cpp.

References Part< DIM >::AddCircle(), Part< DIM >::Extrude(), and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::AddHoleMarker ( DimensionalChastePoint< DIM >  location)

Add a hole marker to the part

Parameters
locationthe location of the hole

Definition at line 122 of file Part.cpp.

References Part< DIM >::mHoleMarkers.

Referenced by Part< DIM >::AddVesselNetwork().

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Part< DIM >::AddPolygon ( std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > >  vertices,
bool  newFacet = false,
boost::shared_ptr< Facet< DIM > >  pFacet = boost::shared_ptr<Facet<DIM> >() 
)

Add a polygon described by a vector or vertices. The vertices should be planar. This is not checked.

Parameters
verticesa vector of vertices making up the polygon
newFacetwhether to add a new facet
pFacetan optional facet that the circle can be generated on
Returns
the new polygon, useful for further operations, such as extrusion.

Definition at line 128 of file Part.cpp.

References Polygon< DIM >::Create(), and Part< DIM >::mVtkIsUpToDate.

Referenced by Part< DIM >::AddCircle(), Part< DIM >::AddRectangle(), and VesselSurfaceGenerator< DIM >::GetVtkSurface().

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Part< DIM >::AddPolygon ( boost::shared_ptr< Polygon< DIM > >  pPolygon,
bool  newFacet = false,
boost::shared_ptr< Facet< DIM > >  pFacet = boost::shared_ptr<Facet<DIM> >() 
)

Add a polygon

Parameters
pPolygona polygon to add to the part
newFacetwhether to add a new facet
pFacetan optional facet that the polygon can be generated on
Returns
the new polygon, useful for further operations, such as extrusion.

Definition at line 138 of file Part.cpp.

References Part< DIM >::mFacets, and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
boost::shared_ptr< Polygon< DIM > > Part< DIM >::AddRectangle ( units::quantity< unit::length >  sizeX,
units::quantity< unit::length >  sizeY,
DimensionalChastePoint< DIM >  origin 
)

Add a rectangle to the part, oriented by default with out of plane direction along the z-axis.

Parameters
sizeXthe dimension in the x direction
sizeYthe dimension in the y direction
originthe bottom left corner
Returns
the new polygon, useful for further operations, such as extrusion.

Definition at line 161 of file Part.cpp.

References Part< DIM >::AddPolygon(), DimensionalChastePoint< DIM >::GetLocation(), Part< DIM >::mReferenceLength, and Part< DIM >::mVtkIsUpToDate.

Referenced by Part< DIM >::AddCuboid().

template<unsigned DIM>
void Part< DIM >::AddVesselNetwork ( boost::shared_ptr< VesselNetwork< DIM > >  pVesselNetwork,
bool  surface = false 
)

Add a vessel network to the part.

Parameters
pVesselNetworkthe vessel network to be added
surfacetrue if a surface representation of the network is required

Definition at line 189 of file Part.cpp.

References Part< DIM >::AddHoleMarker(), Polygon< DIM >::Create(), VesselSurfaceGenerator< DIM >::GetHoles(), VesselSurfaceGenerator< DIM >::GetSurfacePolygons(), Part< DIM >::mFacets, and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::BooleanWithNetwork ( boost::shared_ptr< VesselNetwork< DIM > >  pVesselNetwork)

Remove vessels outside the part

Parameters
pVesselNetworkthe vessel network to be pruned

Definition at line 323 of file Part.cpp.

References Part< DIM >::IsPointInPart().

template<unsigned DIM>
boost::shared_ptr< Part< DIM > > Part< DIM >::Create ( )
static
template<unsigned DIM>
void Part< DIM >::Extrude ( boost::shared_ptr< Polygon< DIM > >  pPolygon,
units::quantity< unit::length >  distance 
)

Extrude the part along the z-axis, inserting planar faces in place of edges.

Parameters
pPolygonthe polygon to extrude
distancethe extrusion distance

Definition at line 274 of file Part.cpp.

References Polygon< DIM >::Create(), Part< DIM >::mFacets, Part< DIM >::mReferenceLength, and Part< DIM >::mVtkIsUpToDate.

Referenced by Part< DIM >::AddCuboid(), and Part< DIM >::AddCylinder().

template<unsigned DIM>
std::vector< units::quantity< unit::length > > Part< DIM >::GetBoundingBox ( )

Return the bounding box

Returns
the bounding box of the part (xmin, xmax, ymin, ymax, zmin, zmax)

Definition at line 433 of file Part.cpp.

References Part< DIM >::GetVertices(), and Part< DIM >::mReferenceLength.

template<unsigned DIM>
std::vector< unsigned > Part< DIM >::GetContainingGridIndices ( unsigned  num_x,
unsigned  num_y,
unsigned  num_z,
units::quantity< unit::length >  spacing 
)

Return the indices of the grid that are inside the part

Parameters
num_xnumber of grid points in x
num_ynumber of grid points in y
num_znumber of grid points in z
spacingthe grid spacing
Returns
a vector of grid indices

Definition at line 386 of file Part.cpp.

References Part< DIM >::IsPointInPart(), and Part< DIM >::mReferenceLength.

template<unsigned DIM>
boost::shared_ptr< Facet< DIM > > Part< DIM >::GetFacet ( const DimensionalChastePoint< DIM > &  rLocation)

Return the FIRST facet found on the point. Strict method, returns exception if there is no facet at the point.

Parameters
rLocationthe probe point
Returns
the FIRST found facet on the point.

Definition at line 351 of file Part.cpp.

References Part< DIM >::mFacets.

template<unsigned DIM>
std::vector< boost::shared_ptr< Facet< DIM > > > Part< DIM >::GetFacets ( )

Return the facets

Returns
the facets

Definition at line 472 of file Part.cpp.

References Part< DIM >::mFacets.

template<unsigned DIM>
std::vector< DimensionalChastePoint< DIM > > Part< DIM >::GetHoleMarkers ( )

Return the hole marker locations

Returns
the hole marker locations

Definition at line 339 of file Part.cpp.

References Part< DIM >::mHoleMarkers.

template<unsigned DIM>
std::vector< boost::shared_ptr< Polygon< DIM > > > Part< DIM >::GetPolygons ( )

Return the polygons

Returns
the polygons

Definition at line 421 of file Part.cpp.

References Part< DIM >::mFacets.

Referenced by Part< DIM >::GetVertices(), Part< DIM >::GetVtk(), and Part< DIM >::MergeCoincidentVertices().

template<unsigned DIM>
units::quantity< unit::length > Part< DIM >::GetReferenceLengthScale ( )

Return the reference length scale

Returns
the reference length scale

Definition at line 345 of file Part.cpp.

References Part< DIM >::mReferenceLength.

template<unsigned DIM>
std::vector< std::pair< unsigned, unsigned > > Part< DIM >::GetSegmentIndices ( )

Return the segment indexes, used for 2D meshing

Returns
the indices of vertices corresponding to segments (edges) in the part

Definition at line 478 of file Part.cpp.

References Part< DIM >::GetVertices(), and Part< DIM >::mFacets.

template<unsigned DIM>
std::vector< DimensionalChastePoint< DIM > > Part< DIM >::GetVertexLocations ( )

Return the vertex locations

Returns
the vertex locations

Definition at line 409 of file Part.cpp.

References Part< DIM >::GetVertices().

template<unsigned DIM>
std::vector< boost::shared_ptr< DimensionalChastePoint< DIM > > > Part< DIM >::GetVertices ( )

Return the unique vertices

Returns
the unique vertices

Definition at line 364 of file Part.cpp.

References Part< DIM >::GetPolygons().

Referenced by Part< DIM >::GetBoundingBox(), Part< DIM >::GetSegmentIndices(), Part< DIM >::GetVertexLocations(), and Part< DIM >::Translate().

template<unsigned DIM>
vtkSmartPointer< vtkPolyData > Part< DIM >::GetVtk ( )

Return the a vtk polydata representation of the part

Returns
a vtk representation of the part

Definition at line 511 of file Part.cpp.

References Part< DIM >::GetPolygons(), Part< DIM >::mReferenceLength, Part< DIM >::mVtkIsUpToDate, and Part< DIM >::mVtkPart.

Referenced by VesselSurfaceGenerator< DIM >::GetVtkSurface(), Part< DIM >::IsPointInPart(), and Part< DIM >::Write().

template<unsigned DIM>
bool Part< DIM >::IsPointInPart ( DimensionalChastePoint< DIM >  location)

Is the point inside the part

Parameters
locationthe location of the point
Returns
bool true if the point is inside the part

Definition at line 564 of file Part.cpp.

References DimensionalChastePoint< DIM >::GetLocation(), Part< DIM >::GetVtk(), and Part< DIM >::mReferenceLength.

Referenced by Part< DIM >::BooleanWithNetwork(), and Part< DIM >::GetContainingGridIndices().

template<unsigned DIM>
std::vector< bool > Part< DIM >::IsPointInPart ( const std::vector< DimensionalChastePoint< DIM > > &  location)

Is the point inside the part

Parameters
locationthe location of the point
Returns
bool true if the point is inside the part

Definition at line 599 of file Part.cpp.

References Part< DIM >::GetVtk(), and Part< DIM >::mReferenceLength.

template<unsigned DIM>
void Part< DIM >::MergeCoincidentVertices ( )

Merge vertices that overlap in polygons and facets

Definition at line 644 of file Part.cpp.

References Part< DIM >::GetPolygons(), Part< DIM >::mFacets, and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::SetReferenceLengthScale ( units::quantity< unit::length >  referenceLength)

Set the reference length scale

Parameters
referenceLengththe reference length scale

Definition at line 678 of file Part.cpp.

References Part< DIM >::mReferenceLength, and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::Translate ( DimensionalChastePoint< DIM >  vector)

Move the part along the translation vector

Parameters
vectorthe vector to move the part along

Definition at line 685 of file Part.cpp.

References Part< DIM >::GetVertices(), and Part< DIM >::mVtkIsUpToDate.

template<unsigned DIM>
void Part< DIM >::Write ( const std::string &  rFilename,
GeometryFormat::Value  format = GeometryFormat::VTP 
)

Write the part to file in vtk format

Parameters
rFilenamethe path to the file to be written, without extension
formatthe output format

Definition at line 698 of file Part.cpp.

References Part< DIM >::GetVtk(), GeometryWriter::SetFileName(), GeometryWriter::SetInput(), GeometryWriter::SetOutputFormat(), and GeometryWriter::Write().

Member Data Documentation

template<unsigned DIM>
std::vector<boost::shared_ptr<Facet<DIM> > > Part< DIM >::mFacets
private
template<unsigned DIM>
std::vector<DimensionalChastePoint<DIM> > Part< DIM >::mHoleMarkers
private

The locations of hole markers (see PLC definition)

Definition at line 75 of file Part.hpp.

Referenced by Part< DIM >::AddHoleMarker(), and Part< DIM >::GetHoleMarkers().

template<unsigned DIM>
std::vector<DimensionalChastePoint<DIM> > Part< DIM >::mRegionMarkers
private

The locations of region markers (see PLC definition)

Definition at line 80 of file Part.hpp.

template<unsigned DIM>
vtkSmartPointer<vtkPolyData> Part< DIM >::mVtkPart
private

A vtk representation of the part

Definition at line 70 of file Part.hpp.

Referenced by Part< DIM >::GetVtk().


The documentation for this class was generated from the following files: