Chaste  Build::
RegularGrid< DIM > Class Template Reference

#include <RegularGrid.hpp>

+ Collaboration diagram for RegularGrid< DIM >:

Public Member Functions

 RegularGrid ()
 
 ~RegularGrid ()
 
void CalculateNeighbourData ()
 
void GenerateFromPart (boost::shared_ptr< Part< DIM > > pPart, units::quantity< unit::length > gridSize)
 
unsigned Get1dGridIndex (unsigned xIndex, unsigned yIndex, unsigned zIndex)
 
unsigned GetNearestGridIndex (const DimensionalChastePoint< DIM > &rLocation)
 
const std::vector< std::vector< unsigned > > & GetNeighbourData ()
 
std::vector< unsigned > GetExtents ()
 
DimensionalChastePoint< DIM > GetLocation (unsigned xIndex, unsigned yIndex, unsigned zIndex)
 
DimensionalChastePoint< DIM > GetLocationOf1dIndex (unsigned gridIndex)
 
std::vector< DimensionalChastePoint< DIM > > GetLocations ()
 
unsigned GetNumberOfPoints ()
 
DimensionalChastePoint< DIM > GetOrigin ()
 
std::vector< std::vector< unsigned > > GetPointPointMap (std::vector< DimensionalChastePoint< DIM > > inputPoints)
 
const std::vector< std::vector< CellPtr > > & GetPointCellMap (bool update=true)
 
const std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > & GetPointNodeMap (bool update=true)
 
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > GetPointSegmentMap (bool update=true, bool useVesselSurface=false)
 
bool IsSegmentAtLatticeSite (unsigned index, bool update)
 
units::quantity< unit::length > GetSpacing ()
 
units::quantity< unit::length > GetReferenceLengthScale ()
 
vtkSmartPointer< vtkImageData > GetVtkGrid ()
 
std::vector< double > InterpolateGridValues (std::vector< DimensionalChastePoint< DIM > > locations, std::vector< double > values, bool useVtk=false)
 
bool IsLocationInPointVolume (DimensionalChastePoint< DIM > point, unsigned gridIndex)
 
bool IsOnBoundary (unsigned gridIndex)
 
bool IsOnBoundary (unsigned xIndex, unsigned yIndex, unsigned zIndex)
 
void SetCellPopulation (AbstractCellPopulation< DIM > &rCellPopulation, units::quantity< unit::length > cellPopulationLengthScale)
 
void SetExtents (std::vector< unsigned > extents)
 
void SetOrigin (DimensionalChastePoint< DIM > origin)
 
void SetPointValues (std::vector< double > pointSolution)
 
void SetSpacing (units::quantity< unit::length > spacing)
 
void SetUpVtkGrid ()
 
void SetVesselNetwork (boost::shared_ptr< VesselNetwork< DIM > > pNetwork)
 
void Write (boost::shared_ptr< OutputFileHandler > pFileHandler)
 

Static Public Member Functions

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

Private Attributes

units::quantity< unit::length > mSpacing
 
std::vector< unsigned > mExtents
 
DimensionalChastePoint< DIM > mOrigin
 
boost::shared_ptr< VesselNetwork< DIM > > mpNetwork
 
AbstractCellPopulation< DIM > * mpCellPopulation
 
units::quantity< unit::length > mCellPopulationReferenceLength
 
std::vector< std::vector< CellPtr > > mPointCellMap
 
std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > mPointNodeMap
 
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > mPointSegmentMap
 
std::vector< double > mPointSolution
 
vtkSmartPointer< vtkImageData > mpVtkGrid
 
bool mVtkGridIsSetUp
 
std::vector< std::vector< unsigned > > mNeighbourData
 
bool mHasCellPopulation
 
units::quantity< unit::length > mReferenceLength
 

Detailed Description

template<unsigned DIM>
class RegularGrid< DIM >

A class for describing regular grids, calculating point and line to grid point relationships and storing cell and vessel to grid point maps.

Definition at line 59 of file RegularGrid.hpp.

Constructor & Destructor Documentation

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

Constructor

Definition at line 52 of file RegularGrid.cpp.

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

Desctructor

Definition at line 80 of file RegularGrid.cpp.

Member Function Documentation

template<unsigned DIM>
void RegularGrid< DIM >::CalculateNeighbourData ( )
template<unsigned DIM>
boost::shared_ptr< RegularGrid< DIM > > RegularGrid< DIM >::Create ( )
static

Factory constructor method

Returns
a shared pointer to a new grid

Definition at line 72 of file RegularGrid.cpp.

Referenced by NetworkToImage< DIM >::Update().

template<unsigned DIM>
void RegularGrid< DIM >::GenerateFromPart ( boost::shared_ptr< Part< DIM > >  pPart,
units::quantity< unit::length >  gridSize 
)

Generate a grid based on the bounding box of the supplied part

Parameters
pPartthe part from which to get the bounding box
gridSizethe grid spacing

Definition at line 152 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
unsigned RegularGrid< DIM >::Get1dGridIndex ( unsigned  xIndex,
unsigned  yIndex,
unsigned  zIndex 
)

Get the 1-D grid index for given x,y,z indices

Parameters
xIndexthe grid x index
yIndexthe grid y index
zIndexthe grid z index
Returns
the grid 1-d index

Definition at line 171 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents.

Referenced by RegularGrid< DIM >::CalculateNeighbourData(), and RegularGrid< DIM >::GetNearestGridIndex().

template<unsigned DIM>
std::vector< unsigned > RegularGrid< DIM >::GetExtents ( )

Return the grid extents in x, y, z. Always dimension 3.

Returns
the grid extents

Definition at line 479 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents.

template<unsigned DIM>
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetLocation ( unsigned  xIndex,
unsigned  yIndex,
unsigned  zIndex 
)

Get the location of a point on the grid for given x, y ,z indices

Parameters
xIndexthe grid x index
yIndexthe grid y index
zIndexthe grid z index
Returns
the location of the point

Definition at line 485 of file RegularGrid.cpp.

References RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

Referenced by RegularGrid< DIM >::GetNearestGridIndex(), RegularGrid< DIM >::GetPointNodeMap(), and RegularGrid< DIM >::GetPointPointMap().

template<unsigned DIM>
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetLocationOf1dIndex ( unsigned  gridIndex)

Get the location of a point on the grid for given 1-d grid index

Parameters
gridIndexthe 1d grid index
Returns
the location of the point

Definition at line 503 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

Referenced by RegularGrid< DIM >::GetLocations(), and RegularGrid< DIM >::GetPointSegmentMap().

template<unsigned DIM>
std::vector< DimensionalChastePoint< DIM > > RegularGrid< DIM >::GetLocations ( )

Get all of the grid locations

Returns
a vector containing all grid locations in grid order

Definition at line 526 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetLocationOf1dIndex(), and RegularGrid< DIM >::GetNumberOfPoints().

template<unsigned DIM>
unsigned RegularGrid< DIM >::GetNearestGridIndex ( const DimensionalChastePoint< DIM > &  rLocation)

Get the 1-D grid index for given x,y,z indices

Parameters
rLocationthe point to get the nearest index to
Returns
the 1-d index of the nearest grid point

Definition at line 136 of file RegularGrid.cpp.

References RegularGrid< DIM >::Get1dGridIndex(), RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
const std::vector< std::vector< unsigned > > & RegularGrid< DIM >::GetNeighbourData ( )

Calculate neighbour indices for each grid point

Returns
a vector of neighbour indices for each grid point

Definition at line 126 of file RegularGrid.cpp.

References RegularGrid< DIM >::CalculateNeighbourData(), RegularGrid< DIM >::GetNumberOfPoints(), and RegularGrid< DIM >::mNeighbourData.

template<unsigned DIM>
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetOrigin ( )

Return the origin in x, y, z

Returns
the grid origin

Definition at line 543 of file RegularGrid.cpp.

References RegularGrid< DIM >::mOrigin.

template<unsigned DIM>
const std::vector< std::vector< CellPtr > > & RegularGrid< DIM >::GetPointCellMap ( bool  update = true)
template<unsigned DIM>
const std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > & RegularGrid< DIM >::GetPointNodeMap ( bool  update = true)
template<unsigned DIM>
std::vector< std::vector< unsigned > > RegularGrid< DIM >::GetPointPointMap ( std::vector< DimensionalChastePoint< DIM > >  inputPoints)

Return a vector of input point indices which in the bounding boxes of each grid point

Parameters
inputPointsa vector of point locations
Returns
the indices of input points in the bounding box of each grid point

Definition at line 189 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > RegularGrid< DIM >::GetPointSegmentMap ( bool  update = true,
bool  useVesselSurface = false 
)

Return the point segments map

Parameters
updateupdate the map
useVesselSurfaceuse the vessel surface for distance calculations
Returns
the point segment map

Definition at line 386 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mpNetwork, RegularGrid< DIM >::mPointSegmentMap, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

Referenced by RegularGrid< DIM >::IsSegmentAtLatticeSite().

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

Return the reference length scale

Returns
the reference length scale

Definition at line 183 of file RegularGrid.cpp.

References RegularGrid< DIM >::mReferenceLength.

template<unsigned DIM>
units::quantity< unit::length > RegularGrid< DIM >::GetSpacing ( )

Return the grid spacing

Returns
the grid spacing

Definition at line 549 of file RegularGrid.cpp.

References RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
vtkSmartPointer< vtkImageData > RegularGrid< DIM >::GetVtkGrid ( )
template<unsigned DIM>
std::vector< double > RegularGrid< DIM >::InterpolateGridValues ( std::vector< DimensionalChastePoint< DIM > >  locations,
std::vector< double >  values,
bool  useVtk = false 
)

Sample a function specified on the grid at the specified locations

Parameters
locationsthe sample locations
valuesthe known values at the grid points
useVtkuse VTK to do the sampling, faster but algorithm not clearly documented
Returns
the grid spacing

Definition at line 215 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mpVtkGrid, RegularGrid< DIM >::mReferenceLength, RegularGrid< DIM >::mVtkGridIsSetUp, and RegularGrid< DIM >::SetUpVtkGrid().

template<unsigned DIM>
bool RegularGrid< DIM >::IsLocationInPointVolume ( DimensionalChastePoint< DIM >  point,
unsigned  gridIndex 
)

Is the input location in the bounding box of the grid point

Parameters
pointthe location of interest
gridIndexthe grid point of interest
Returns
is the input location in the bounding box of the grid point

Definition at line 587 of file RegularGrid.cpp.

References DimensionalChastePoint< DIM >::GetLocation(), RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
bool RegularGrid< DIM >::IsOnBoundary ( unsigned  gridIndex)

Is the point on the outer boundary of the domain

Parameters
gridIndexthe 1d grid index gridIndex
Returns
is the point on the outer boundary of the domain

Definition at line 555 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents.

template<unsigned DIM>
bool RegularGrid< DIM >::IsOnBoundary ( unsigned  xIndex,
unsigned  yIndex,
unsigned  zIndex 
)

Is the point on the outer boundary of the domain

Parameters
xIndexthe grid x index
yIndexthe grid y index
zIndexthe grid z index
Returns
is the point on the outer boundary of the domain

Definition at line 566 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents.

template<unsigned DIM>
bool RegularGrid< DIM >::IsSegmentAtLatticeSite ( unsigned  index,
bool  update 
)

Return true if the segment is at a lattice site

Parameters
indexthe lattice index
updateupdate the segment-grid map
Returns
true if the segment is at a lattice site

Definition at line 371 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetPointSegmentMap(), and RegularGrid< DIM >::mPointSegmentMap.

template<unsigned DIM>
void RegularGrid< DIM >::SetCellPopulation ( AbstractCellPopulation< DIM > &  rCellPopulation,
units::quantity< unit::length >  cellPopulationLengthScale 
)

Set the cell population

Parameters
rCellPopulationa reference to the cell population

Definition at line 629 of file RegularGrid.cpp.

References RegularGrid< DIM >::mCellPopulationReferenceLength, and RegularGrid< DIM >::mpCellPopulation.

template<unsigned DIM>
void RegularGrid< DIM >::SetExtents ( std::vector< unsigned >  extents)

Set the grid extents in x, y, z

Parameters
extentsthe grid extents

Definition at line 636 of file RegularGrid.cpp.

References RegularGrid< DIM >::mExtents.

template<unsigned DIM>
void RegularGrid< DIM >::SetOrigin ( DimensionalChastePoint< DIM >  origin)

Set the origin in x, y, z

Parameters
originthe grid origin

Definition at line 646 of file RegularGrid.cpp.

References RegularGrid< DIM >::mOrigin.

template<unsigned DIM>
void RegularGrid< DIM >::SetPointValues ( std::vector< double >  pointSolution)

Set the values of a field at all points on the grid

Parameters
pointSolutionthe value of the field

Definition at line 177 of file RegularGrid.cpp.

References RegularGrid< DIM >::mPointSolution.

template<unsigned DIM>
void RegularGrid< DIM >::SetSpacing ( units::quantity< unit::length >  spacing)

Set the grid spacing

Parameters
spacingthe grid spacing

Definition at line 652 of file RegularGrid.cpp.

References RegularGrid< DIM >::mSpacing.

template<unsigned DIM>
void RegularGrid< DIM >::SetVesselNetwork ( boost::shared_ptr< VesselNetwork< DIM > >  pNetwork)

Set the vessel network

Parameters
pNetworkthe vessel network

Definition at line 685 of file RegularGrid.cpp.

References RegularGrid< DIM >::mpNetwork.

template<unsigned DIM>
void RegularGrid< DIM >::Write ( boost::shared_ptr< OutputFileHandler >  pFileHandler)

Write the grid and any field to file as a VTI file

Parameters
pFileHandlera file handler for the write location

Definition at line 714 of file RegularGrid.cpp.

References RegularGrid< DIM >::GetVtkGrid(), RegularGridWriter::SetFilename(), RegularGridWriter::SetImage(), and RegularGridWriter::Write().

Member Data Documentation

template<unsigned DIM>
units::quantity<unit::length> RegularGrid< DIM >::mCellPopulationReferenceLength
private

The reference length scale for the cellpopulation.

Definition at line 89 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetPointCellMap(), and RegularGrid< DIM >::SetCellPopulation().

template<unsigned DIM>
bool RegularGrid< DIM >::mHasCellPopulation
private

Has a cell population

Definition at line 129 of file RegularGrid.hpp.

template<unsigned DIM>
std::vector<std::vector<unsigned> > RegularGrid< DIM >::mNeighbourData
private

A vector of neighbour indices

Definition at line 124 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::CalculateNeighbourData(), and RegularGrid< DIM >::GetNeighbourData().

template<unsigned DIM>
AbstractCellPopulation<DIM>* RegularGrid< DIM >::mpCellPopulation
private

The cell population. This memory pointed to is not managed in this class.

Definition at line 84 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetPointCellMap(), and RegularGrid< DIM >::SetCellPopulation().

template<unsigned DIM>
boost::shared_ptr<VesselNetwork<DIM> > RegularGrid< DIM >::mpNetwork
private
template<unsigned DIM>
std::vector<std::vector<CellPtr> > RegularGrid< DIM >::mPointCellMap
private

A map of cells corresponding to a point on the grid

Definition at line 94 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetPointCellMap().

template<unsigned DIM>
std::vector<std::vector<boost::shared_ptr<VesselNode<DIM> > > > RegularGrid< DIM >::mPointNodeMap
private

A map of vessel nodes corresponding to a point on the grid

Definition at line 99 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetPointNodeMap().

template<unsigned DIM>
std::vector<std::vector<boost::shared_ptr<VesselSegment<DIM> > > > RegularGrid< DIM >::mPointSegmentMap
private

A map of vessel segments corresponding to a point on the grid

Definition at line 104 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetPointSegmentMap(), and RegularGrid< DIM >::IsSegmentAtLatticeSite().

template<unsigned DIM>
std::vector<double> RegularGrid< DIM >::mPointSolution
private

A field with specified value at each point in the grid

Definition at line 109 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetVtkGrid(), and RegularGrid< DIM >::SetPointValues().

template<unsigned DIM>
vtkSmartPointer<vtkImageData> RegularGrid< DIM >::mpVtkGrid
private

The grid in the form of vtk image data

Definition at line 114 of file RegularGrid.hpp.

Referenced by RegularGrid< DIM >::GetVtkGrid(), RegularGrid< DIM >::InterpolateGridValues(), and RegularGrid< DIM >::SetUpVtkGrid().

template<unsigned DIM>
bool RegularGrid< DIM >::mVtkGridIsSetUp
private

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