FiberVISH  0.2
Fish-TheFiberBundleAPIfortheVishVisualizationShell
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Fiber::Grid Class Reference

A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object. More...

#include <Grid.hpp>

Inheritance diagram for Fiber::Grid:
Fiber::SkeletonMap Fiber::Ownable< Grid > MemCore::Intercube Fiber::SaveableAttributes Fiber::OwnerBase MemCore::Attributes

Public Types

typedef Fiber::SkeletonInfo SkeletonInfo
 
typedef SkeletonIterator Iterator
 Associated Iterator class.
 
- Public Types inherited from Fiber::SkeletonMap
typedef std::list< RefPtr
< Skeleton > > 
Skeletons_t
 
typedef SkeletonIterator Iterator
 Associated Iterator class.
 

Public Member Functions

 Grid (const OwnerOf< Grid > &GridOwner, const WeakPtr< GridContainer > &GC, const RefPtr< GlobalCharts > &GAtlas)
 The constructor. More...
 
 Grid (const WeakPtr< GridContainer > &GC, const RefPtr< GlobalCharts > &GAtlas)
 
 ~Grid ()
 Destructor.
 
const RefPtr< Atlas > & MyAtlas () const
 Return the Atlas of this Grid.
 
const Atlas::Atlas_t & getCharts () const
 Return the set of all charts on this Grid. More...
 
Atlas::Atlas_t getCharts (const type_info &ChartType) const
 Return the set of all charts on this Grid of a given type.
 
Atlas::Atlas_t getCartesianCharts3D () const
 Return the set of all three-dimensional cartesian charts defined on this Gri.
 
const RefPtr< ChartgetUniqueCartesianChart3D () const
 Return a chart of type cartesian of only one such exists. More...
 
string getUniqueCartesianChart3DName () const
 
RefPtr< ChartfindChart (const RefPtr< ChartID > &id) const
 Search for a chart on this grid.
 
RefPtr< ChartfindChart (const type_info &ChartType, const string &name=string()) const
 Search for a named chart of the given type and the given name, using a standard chart if no name is given.
 
RefPtr< ChartmakeChart (const type_info &ChartType, const string &name=string())
 Make a chart on this grid with the given name, ie create one if not yet existent. More...
 
bool insertSharedChart (const RefPtr< Chart > &ExistingChart)
 
RefPtr< ChartmakeCartesianChart (const string &name=string())
 Create a cartesian chart here, if not existent yet. More...
 
RefPtr< ChartfindCartesianChart (const string &name=string()) const
 Find a cartesian chart here.
 
RefPtr< RepresentationgetCartesianRepresentation (const Skeleton &Skel, const string &ChartName=string()) const
 Return the representation of the given Skeleton in cartesian coordinates on this Grid.
 
RefPtr< RepresentationgetCartesianRepresentation (const string &ChartName=string()) const
 Return the representation of the Vertices on this Grid in cartesian coordinates.
 
RefPtr< Representationoperator() () const
 Shortcut for getCartesianRepresentation().
 
RefPtr< RepresentationgetTimePolar2DRepresentation (const Skeleton &Skel) const
 Return the representation of the given Skeleton in TimePolar2D coordinates on this Grid.
 
RefPtr< RepresentationgetTimePolar2DRepresentation () const
 
RepresentationmakeCartesianRepresentation (int Dims, const string &name=string())
 Provide a representation in an n-dimensional skeleton of the vertices. More...
 
Representationoperator[] (int Dims)
 Shortcut operator function: Create a vertex representation of this Grid with the given dimensionality. More...
 
RefPtr< Fieldoperator() (const string &fieldname, const string &ChartName=string()) const
 Retrieve a field on the vertices. More...
 
RefPtr< Fieldoperator() (const string &fieldname, const RefPtr< Chart > &theChart) const
 
FieldProxy operator[] (const string &fieldname)
 Convenience shortcut function: Create a field in 3D cartesian vertices, if no vertices and no cartesian represenation yet exists.
 
RefPtr< FieldCartesianPositions () const
 Shortcut function: get the coordinates of the vertices in the default cartesian chart.
 
RefPtr< FieldTimePolar2DPositions () const
 
RefPtr< FieldgetCartesianPositions () const
 Shortcut function: get the coordinates of the vertices in the default cartesian chart. More...
 
template<class SkeletonFunctor >
int iterate_skeletons (const SkeletonFunctor &F) const
 Lambda functor iteration over skeletons: More...
 
RefPtr< FieldgetField (const RefPtr< ChartID > &theChartID, const string &fieldname, const RefPtr< Skeleton > &theSkeleton) const
 Get a field of the specified Skeleton, which must reside on the Grid, in the given Chart. More...
 
RefPtr< FieldgetVertexField (const RefPtr< ChartID > &theChartID, const string &fieldname) const
 Get a field of the Grid's vertices in the given Chart. More...
 
RefPtr< FieldgetPositions (const RefPtr< ChartID > &theChartID, const RefPtr< Skeleton > &theSkeleton) const
 Get the positional field of the specified Skeleton, which must reside on the Grid, in the given Chart. More...
 
RefPtr< FieldgetVertexPositions (const RefPtr< ChartID > &theChartID) const
 Get the positional field of the vertices of this Grid for the specified chart. More...
 
RefPtr< RepresentationgetRepresentation (const RefPtr< ChartID > &theChartID, const RefPtr< Skeleton > &theSkeleton) const
 Get the representation of this Grid's Skeleton in the specified Chart. More...
 
RefPtr< RepresentationgetRepresentation (const RefPtr< Chart > &theChart, const SkeletonID &theSkeletonID) const
 Get the representation of a Skeleton in the specified Chart. More...
 
RefPtr< RepresentationgetRepresentation (const RefPtr< ChartID > &theChartID, const SkeletonID &theSkeletonID) const
 
RefPtr< RepresentationgetVertexRepresentation (const RefPtr< ChartID > &theChartID) const
 Get the representation of this Grid's vertices in the specified Chart. More...
 
RefPtr< SkeletonfindHighestHomogenousRefinement (int MaxLevel, int IndexDepth, int Dimensionality) const
 Find the refinement of the highest homogeneous refinement level with the given index depth and dimensionality, i.e. More...
 
RefPtr< SkeletonfindHighestHomogenousVertexRefinement (int MaxLevel) const
 Find the vertex refinement of the highest homogeneous refinement level, i.e. More...
 
string xml () const
 
RefPtr< SkeletonfindSkeleton (const RefPtr< FragmentID > &fID)
 Investigation function to find the skeleton that corresponds to a certain fragment ID. More...
 
- Public Member Functions inherited from Fiber::SkeletonMap
RefPtr< SkeletonfindVertices (int TotalRefinement=-1) const
 Find the Skeleton describing the Vertices on this Grid.
 
RefPtr< SkeletongetVerticesInfo (int TotalRefinement=-1) const
 Find the skeleton describing the vertices of this Grid.
 
RefPtr< SkeletongetEdgeInfo (int TotalRefinement=-1) const
 Find the skeleton describing the faces of this Grid.
 
RefPtr< SkeletongetFaceInfo (int TotalRefinement=-1) const
 Find the skeleton describing the edges of this Grid.
 
double NumberOfHoles (int TotalRefinement=-1) const
 Implements the Euler-Poincare formula to determine the topological number of holes within some surface. More...
 
SkeletonmakeVertices (int dims)
 Create a Skeleton describing the vertices of a Grid. More...
 
Skeletonoperator[] (const SkeletonID &Sid)
 Create a Skeleton.
 
RefPtr< SkeletongetSkeleton (const SkeletonID &Sid) const
 Find a Skeleton.
 
RefPtr< Skeletonoperator() (const SkeletonID &Sid) const
 Find a Skeleton.
 
RefPtr< RepresentationCellsAsVertices (int dims) const
 
int MinLevel (int IndexDepth=0) const
 Get a Skeleton that would describe the topology of the fragments of a given Skeleton, which is corresponds to a skeleton of index depth two larger. More...
 
int MaxLevel (int IndexDepth=0) const
 Find the maximal refinement level for the given index depth.
 
RefPtr< SkeletonfindMaxHomogenousRefinement (int IndexDepth) const
 Find the skeleton with the maximal homogenous refinement level. More...
 
bool replaceSkeletonID (const SkeletonID &old_id, const SkeletonID &new_id)
 
RefPtr< SkeletonfindIsotropicRefinementFactor (int Factor, int IndexDepth) const
 Find a Skeleton that corresponds to isotropic refinement by the given factor. More...
 
int iterate (ConstSkeletonIterator &) const
 Iterate over all skeletons of this Grid.
 
int iterate (SkeletonIterator &)
 Iterate over all skeletons of this Grid.
 
template<class SkeletonFunctor >
int Iterate (const SkeletonFunctor &F) const
 Lambda functor iteration over skeletons: More...
 
template<class Functor >
int iterate_all (const Functor &F) const
 
int nSkeletons () const
 Return the number of skeletons defined on this grid.
 
int nSkeletons (int IndexDepth) const
 
int getMemoryUsage (memsize_t &UsedMemory, memsize_t &WantedMemory) const
 Get the memory occupied by this Grid (and all of its fields). More...
 
void Speak (int indent=0, int maxindent=-1) const
 Informative debug message.
 
string xml () const
 
- Public Member Functions inherited from Fiber::Ownable< Grid >
void updateOwnershipAge (const MemCore::Ageable &theNewAge) override
 Forward some age to all Owners.
 
void insertOwner (const Container &theOwner)
 Add some owner.
 
bool insertOwner (const MemCore::WeakPtr< Container > &theOwner)
 Add some owner.
 
void addOwner (const Container &theOwner, const MemCore::Ageable &theNewAge)
 Add some owner and broadcast a new age to all Ownerrs.
 
void addOwner (const MemCore::WeakPtr< Container > &theOwner, const MemCore::Ageable &theNewAge)
 Add some owner and broadcast a new age to all Ownerrs.
 
 Ownable ()
 Default constructor, empty Ownership list.
 
 Ownable (const Ownable &)
 Copy constructor, does NOT copy any ownership information, the new Ownable will be unowned.
 
 Ownable (const MemCore::WeakPtr< Container > &theOwner, const MemCore::Ageable &theNewAge)
 Construct an Ownable with an initial owner.
 
 Ownable (const Container &theOwner, const MemCore::Ageable &theNewAge)
 Construct an Ownable with an initial owner.
 
Ownableoperator= (const Ownable &)
 Assignment, does NOT copy any ownership information, the assigned Ownable will retain all its ownership information.
 
MemCore::WeakPtr< Container > getPrimaryOwner () const
 Get the first valid owner.
 
size_t getNumberOfValidOwners () const
 Get the first valid owner.
 
bool processOwnership (MemCore::Intercube &Output, const MemCore::Intercube &Input) const override
 Process some ownership action.
 
- Public Member Functions inherited from Fiber::SaveableAttributes
void attributesHaveBeenSaved () const
 
bool attributesNeedSaving () const
 
- Public Member Functions inherited from MemCore::Attributes
MemCore::RefPtr
< MemCore::ChunkBase
getAttribute (const std::string &name) const
 
attributes_t & getAttributeValues ()
 
const attributes_t & getAttributeValues () const
 
size_t getNumberOfAttributes () const
 
bool hasAttribute (const std::string &name) const
 
int iterate (Iterator &it) const
 
int Iterate (const Functor &L) const
 
int iterate_attributes (const Functor &L) const
 
size_t NumberOfAttributes () const
 
void setAttribute (const std::string &name, const MemCore::RefPtr< MemCore::ChunkBase > &AttribData)
 
ResizableChunk< T > & setAttributeValue (const std::string &name, const T &AttribData)
 
ResizableChunk< T > & setAttributeValues (const std::string &name, const std::initializer_list< T > &AttribData)
 
string toString () const
 
const AgeabletouchAttributes () const
 
const AgeableupdateAttributeAge (const Ageable &A) const
 

Static Public Member Functions

static string getChartName (const type_info &ChartType, const string &name)
 
static RefPtr< RepresentationgetRepresentation (const RefPtr< Chart > &theChart, const RefPtr< Skeleton > &theSkeleton)
 Get the representation of a Skeleton in the specified Chart. More...
 

Additional Inherited Members

- Public Attributes inherited from Fiber::SkeletonMap
Skeletons_t Skeletons
 
- Public Attributes inherited from Fiber::Ownable< Grid >
std::unordered_set
< MemCore::WeakPtr< Container > > 
Owners
 The (internal) list of owners. More...
 
- Public Attributes inherited from Fiber::SaveableAttributes
MemCore::Ageable LastSavedAttributes
 
- Protected Member Functions inherited from Fiber::SkeletonMap
 ~SkeletonMap ()
 Destructor.
 
void extremeUnction () override
 

Detailed Description

A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.

The Grid class that describes a geometrical entity at a certain point within a parameter space. It is the host of geometrical and topological information together with fields on each set describing these components. The geometrical shape as well as any fields is available in multiple coordinate systems. Topological information includes relationships among edges, vertices, polygons etc. as well as multi-level refinement information originating from adaptive mesh refinements (AMR) and also relationships relative to other grids on the same parameter space point.

Examples:
EvolutionSurface.cpp, HelicalLines.cpp, Sphere.cpp, trimesh.cpp, uniform_scalar.cpp, XF_LineSetFragmented.cpp, XF_LineSetHierarchical.cpp, and XF_LineSetHierarchicalRegularized.cpp.

Constructor & Destructor Documentation

Fiber::Grid::Grid ( const OwnerOf< Grid > &  GridOwner,
const WeakPtr< GridContainer > &  GC,
const RefPtr< GlobalCharts > &  GAtlas 
)

The constructor.

Give it an object that may hold Grid objects, which is weakly stored as backlink - i.e. when the GridContainer is destroyed by external means this backlink pointer will automatically become invalid. The Grid object also requires an Atlas of global charts.

References Fiber::Ownable< Grid >::insertOwner().

Member Function Documentation

RefPtr< Skeleton > Fiber::Grid::findHighestHomogenousRefinement ( int  MaxLevel,
int  IndexDepth,
int  Dimensionality 
) const

Find the refinement of the highest homogeneous refinement level with the given index depth and dimensionality, i.e.

the highest resolution available for this Skeleton.

See also
findMaxHomogenousRefinement(int IndexDepth) const;

References Fiber::SkeletonID::getHomogeneousLevel(), Fiber::SkeletonID::getRank(), Fiber::SkeletonID::IndexDepth(), Fiber::SkeletonMap::iterate(), and Fiber::SkeletonMap::MaxLevel().

RefPtr< Skeleton > Fiber::Grid::findHighestHomogenousVertexRefinement ( int  MaxLevel) const

Find the vertex refinement of the highest homogeneous refinement level, i.e.

the highest resolution available for vertices.

See also
findMaxHomogenousRefinement(int IndexDepth) const;

References Fiber::SkeletonID::getHomogeneousLevel(), Fiber::SkeletonID::IndexDepth(), Fiber::SkeletonMap::iterate(), and Fiber::SkeletonMap::MaxLevel().

RefPtr< Skeleton > Fiber::Grid::findSkeleton ( const RefPtr< FragmentID > &  fID)

Investigation function to find the skeleton that corresponds to a certain fragment ID.

This is a slow search function and should not be used in production code.

RefPtr<Field> Fiber::Grid::getCartesianPositions ( ) const
inline

Shortcut function: get the coordinates of the vertices in the default cartesian chart.

Same as CartesianPositions().

Referenced by Fiber::RegularlyFragmentedGridWithCartesianVertices< 3 >::create().

const Atlas::Atlas_t & Fiber::Grid::getCharts ( ) const

Return the set of all charts on this Grid.

for(const auto&theChart : MyGrid.getCharts() )
{
Verbose(0) << "Have Chart: " << theChart->Name();
}

Referenced by getCartesianCharts3D().

RefPtr< Field > Fiber::Grid::getField ( const RefPtr< ChartID > &  theChartID,
const string &  fieldname,
const RefPtr< Skeleton > &  theSkeleton 
) const

Get a field of the specified Skeleton, which must reside on the Grid, in the given Chart.

This function might invoke coordinate transformations.

References findChart().

Referenced by getPositions(), and getVertexPositions().

RefPtr< Field > Fiber::Grid::getPositions ( const RefPtr< ChartID > &  theChartID,
const RefPtr< Skeleton > &  theSkeleton 
) const

Get the positional field of the specified Skeleton, which must reside on the Grid, in the given Chart.

This function might invoke coordinate transformations.

References getField().

RefPtr< Representation > Fiber::Grid::getRepresentation ( const RefPtr< ChartID > &  theChartID,
const RefPtr< Skeleton > &  theSkeleton 
) const

Get the representation of this Grid's Skeleton in the specified Chart.

Note that the Skeleton rather be one on this Grid, otherwise this function will return something which is no good.

References findChart().

Referenced by getRepresentation().

RefPtr< Representation > Fiber::Grid::getRepresentation ( const RefPtr< Chart > &  theChart,
const RefPtr< Skeleton > &  theSkeleton 
)
static

Get the representation of a Skeleton in the specified Chart.

This function is independent of a grid and resides here as mere convenience function providing a shortcut.

RefPtr< Representation > Fiber::Grid::getRepresentation ( const RefPtr< Chart > &  theChart,
const SkeletonID theSkeletonID 
) const

Get the representation of a Skeleton in the specified Chart.

This function is independent of a grid and resides here as mere convenience function providing a shortcut.

References getRepresentation(), and Fiber::SkeletonMap::getSkeleton().

const RefPtr< Chart > Fiber::Grid::getUniqueCartesianChart3D ( ) const

Return a chart of type cartesian of only one such exists.

Otherwise return a nullptr.

References getCartesianCharts3D().

RefPtr<Field> Fiber::Grid::getVertexField ( const RefPtr< ChartID > &  theChartID,
const string &  fieldname 
) const
inline

Get a field of the Grid's vertices in the given Chart.

This function might invoke coordinate transformations.

RefPtr< Field > Fiber::Grid::getVertexPositions ( const RefPtr< ChartID > &  theChartID) const

Get the positional field of the vertices of this Grid for the specified chart.

This function might invoke coordinate transformations.

References Fiber::SkeletonMap::findVertices(), and getField().

RefPtr<Representation> Fiber::Grid::getVertexRepresentation ( const RefPtr< ChartID > &  theChartID) const
inline

Get the representation of this Grid's vertices in the specified Chart.

This function will not invoke coordinate transformations, the returned Representation will only contain fields that already exist on this Representation. Calling the getField() member function is recommendable as it might compute Fields from different Representations.

template<class SkeletonFunctor >
int Fiber::Grid::iterate_skeletons ( const SkeletonFunctor &  F) const
inline

Lambda functor iteration over skeletons:

g.iterate_skeletons( [](const SkeletonID&id, const Skeleton&S)
{
return true;
}
);

References Fiber::SkeletonMap::Iterate().

RefPtr< Chart > Fiber::Grid::makeCartesianChart ( const string &  name = string())

Create a cartesian chart here, if not existent yet.

This is a convenience call to:

makeChart( typeid(CartesianChart3D) );
Examples:
XF_LineSetHierarchical.cpp, and XF_LineSetHierarchicalRegularized.cpp.

References makeChart().

Representation & Fiber::Grid::makeCartesianRepresentation ( int  Dims,
const string &  name = string() 
)

Provide a representation in an n-dimensional skeleton of the vertices.

Creates one if not existent yet.

Examples:
XF_LineSetFragmented.cpp.

References findChart(), makeChart(), and Fiber::SkeletonMap::makeVertices().

Referenced by Fiber::TriangularSurface::addVerticesAndConnectivity(), Fiber::FragmentedUniformGrid3DPoints::create(), Fiber::LoadImageSequence(), and Fiber::PointSearch::PointSearch().

RefPtr< Chart > Fiber::Grid::makeChart ( const type_info &  ChartType,
const string &  name = string() 
)
RefPtr< Field > Fiber::Grid::operator() ( const string &  fieldname,
const string &  ChartName = string() 
) const

Retrieve a field on the vertices.

Shortcut function for convenience, it queries the vertices Skeleton and employs its default chart.

References getCartesianRepresentation().

Representation& Fiber::Grid::operator[] ( int  Dims)
inline

Shortcut operator function: Create a vertex representation of this Grid with the given dimensionality.

This function is provided for convenience.