FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
CellCluster.hpp
1#ifndef __FIBER_GRID_TYPES_CELLCLUSTER_HPP
2#define __FIBER_GRID_TYPES_CELLCLUSTER_HPP
3
4#include "gridtypesDllApi.h"
5#include <grid/Grid.hpp>
6#include <eagle/PhysicalSpace.hpp>
7
8//#define VERBOSE
9
10namespace Fiber
11{
12
32template <int CellDims, int ClusterDepth = 2>
34{
35public:
38
47
52
59
60
70
76 {
78 }
79
83static SkeletonID ID()
84 {
85 return ClusterSkeletonID();
86 }
87
88 RefPtr<Skeleton> Vertices,
89 Cells,
90 Clusters;
91
92 RefPtr<Representation> CartesianVertices,
93 ClustersAsCartesianVertices,
94 ClustersAsCells;
95
96 RefPtr<Field> Coords,
97 ClusterCoordinates, // coordinates for each cluster
98 ClusterAsVertexIndices, // vertex indices for each cluster
99
104
105
110
111
112
117 {
118 if (!G)
119 return;
120
121 Clusters = (*G)( ClusterSkeletonID() );
122
123 // mandatory
124 if (!Clusters)
125 {
126 return;
127 }
128
129 // optional
130 Vertices = G->findVertices();
131 Cells = (*G)( CellSkeletonID() );
132
133 if (Vertices)
134 CartesianVertices = G->getCartesianRepresentation(*Vertices );
135
136 if (CartesianVertices)
137 Coords = CartesianVertices->Positions();
138
139 ClustersAsCartesianVertices = (*Clusters)(Vertices);
140 if (ClustersAsCartesianVertices)
141 ClusterAsVertexIndices = ClustersAsCartesianVertices->Positions();
142
143
144 if (Cells)
145 {
146 ClustersAsCells = (*Clusters)(Cells);
147 if (ClustersAsCells)
148 ClusterAsCellIndices = ClustersAsCells->Positions();
149 }
150 }
151
158 bool operator=(const WeakPtr<Grid>&G);
159
166
169
174 operator bool() const
175 {
176 return ClusterAsCellIndices || ClusterAsVertexIndices;
177 }
178
182 bool operator!() const
183 {
184 return !operator bool();
185 }
186
187
188};
189
190} // namespace Fiber
191
192#endif // __FIBER_GRID_TYPES_CELLCLUSTER_HPP
A set of cells stored on a Grid.
Definition CellCluster.hpp:34
CellCluster(const WeakPtr< Grid > &G=NullPtr())
Retrieve a CellCluster from a Grid object.
Definition CellCluster.hpp:116
static SkeletonID CellSkeletonID()
The Skeleton ID of the objects that are going to be clustered here.
Definition CellCluster.hpp:75
~CellCluster()
Destructor, cleans up references.
static SkeletonID ID()
A Skeleton ID that is supposed to be typical for this Grid Type.
Definition CellCluster.hpp:83
RefPtr< Field > ClusterAsCellIndices
Which cells constitute a cluster.
Definition CellCluster.hpp:103
std::vector< CellIndex_t > CellIndices_t
A vector of cell indices.
Definition CellCluster.hpp:51
static SkeletonID ClusterSkeletonID()
A Skeleton ID for clusters of cells.
Definition CellCluster.hpp:66
CellCluster & operator=(const CellCluster &LS)
Assigning from existing LineSet - faster than assigning from Grid pointer since it is just copying po...
uint32_t CellIndex_t
The index type used for line set indices.
Definition CellCluster.hpp:46
bool operator!() const
Inverse operator of the line indices check.
Definition CellCluster.hpp:182
bool operator=(const WeakPtr< Grid > &G)
Assign from Grid pointer, will overwrite all members.
MemArray< 1, CellIndices_t > CellClusterArray_t
An array of line indices.
Definition CellCluster.hpp:58
RefPtr< Field > CellsAsCluster
Which clusters are at each cell.
Definition CellCluster.hpp:109
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
std::nullptr_t NullPtr