FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
TriangularSurface.hpp
1#ifndef __FIBER_GRID_TYPES_TRIANGULARSURFACE_HPP
2#define __FIBER_GRID_TYPES_TRIANGULARSURFACE_HPP
3
4#include "gridtypesDllApi.h"
5#include "fish/fiber/grid/Grid.hpp"
6#include "elementary/eagle/PhysicalSpace.hpp"
7#include "fish/fiber/field/Cell.hpp"
8#include "LineSet.hpp"
9
10
11namespace Fiber
12{
13
43{
46
49
52
55
56
57
60
64
67
72
97
99// TriangularSurface&operator=(const TriangularSurface&);
100
103
108static bool addVerticesAndConnectivity(Grid&G,
109 const RefPtr<CoordsArray_t>& Vertices,
110 const RefPtr<CellArray_t>& Connectivity);
114static Eagle::PhysicalSpace::bivector NormalVector(const TriangleCell&T,
116
118 computeVertexNormals(const RefPtr<CoordsArray_t>&Pts,
119 const RefPtr<CellArray_t> &Cells,
120 const MemBase::Creator_t&Crec = NullPtr() );
121
122
132 {
133 return SkeletonID(2,1);
134 }
135
140static RefPtr<Skeleton> getFaceSkeleton(const RefPtr<Grid>&G, bool CreateIfNotFound);
141
146static const char NormalVectorFieldName[];
147
148 RefPtr<CreativeArrayBase> newVertexNormalCreator() const;
149
155 RefPtr<Field> getVertexNormalField(const string&FieldName = NormalVectorFieldName);
156
157 RefPtr<NormalVectorArray_t> getVertexNormals(const string&FieldName = NormalVectorFieldName)
158 {
159 RefPtr<Field> F = getVertexNormalField(NormalVectorFieldName);
160 if (!F)
161 return NullPtr();
162
163 return F->getData();
164 }
165
171 {
172 if (!CoordField)
173 return NullPtr();
174
175 return CoordField->getData();
176 }
177
183 {
184 if (!CellField)
185 return NullPtr();
186
187 return CellField->getData();
188 }
189
190
191static TriangularSurface create(Grid&theGrid,
192 const RefPtr<MemBase>&Vertices,
196
197
198
199static TriangularSurface create(Grid&theGrid,
200 const RefPtr<MemBase>&Vertices,
202 bool Discardable = false)
203 {
204 return create(theGrid, Vertices, Triangles, Discardable, Discardable);
205 }
206
207
208 template<int N, class T>
209 RefPtr<Fiber::MemBase> getTriangularFieldData(const std::string& fieldname,
210 RefPtr<FragmentID> fragID = NullPtr())
211 {
212 RefPtr<Fiber::Field> f = (*CellsAsVertices)(fieldname);
213 if(!f)
214 {
215 Verbose(0) << fieldname << ": NullPtr() in TriangularSurface::getTriangularFieldData [f]";
216 return NullPtr();
217 }
218
219 RefPtr<Fiber::MemArray<N,T> > mem = f->getData(fragID);
220 if(!mem)
221 {
222 Verbose(0) << fieldname << ": NullPtr() in TriangularSurface::getTriangularFieldData [mem]";
223 return NullPtr();
224 }
225
226 return mem;
227 }
228
229 RefPtr<CoordsArray_t> getNormals(const string&FieldName = NormalVectorFieldName)
230 {
231 RefPtr<Field> N = getVertexNormalField( FieldName );
232 if (!N)
233 return NullPtr();
234
235 return N->getData();
236 }
237
238 RefPtr<Field> getTriangleBaryCenters();
239
240static RefPtr<CoordsArray_t>
241 computeBaryCenters(const RefPtr<CoordsArray_t>&Pts,
242 const RefPtr<CellArray_t> &Cells,
243 const MemBase::Creator_t&Crec = NullPtr() );
244
245static RefPtr<CoordsArray_t>
246 computeCircumCircleCenter(const RefPtr<CoordsArray_t>&Pts,
247 const RefPtr<CellArray_t> &Cells,
248 const MemBase::Creator_t&Crec = NullPtr() );
249
250static RefPtr<CoordsArray_t>
251 computeInCircleCenter(const RefPtr<CoordsArray_t>&Pts,
252 const RefPtr<CellArray_t> &Cells,
253 const MemBase::Creator_t&Crec = NullPtr() );
254
255static bool containtedEdgeInArray( uint32_t A, uint32_t B, const std::vector< Edges::EdgeCell_t >& edges );
256
257static void addIfEdgeOfNotContained( const Edges::EdgeCell_t& edge, std::vector< Edges::EdgeCell_t >& edges );
258
259static RefPtr<LineSet::LinesetArray_t>
260 computeOutLinesViaTriangles( const RefPtr<CoordsArray_t>&Pts,
261 const RefPtr<CellArray_t> &Cells,
262 const MemBase::Creator_t&Crec = NullPtr() );
263
267 LineSet OutLines(const RefPtr<Grid>&OutputGrid);
268};
269
270
271} // namespace Fiber
272
273namespace std
274{
275 string to_string(const Fiber::TriangularSurface&);
276}
277
278
279#endif // __FIBER_GRID_TYPES_TRIANGULARSURFACE_HPP
constexpr complex< _Tp > & operator=(const _Tp &)
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.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
std::string to_string(const span< char > &s)
STL namespace.
A type describing an n-dimensional simplex cell.
Definition Cell.hpp:70
A triangular surface stored on a Grid.
Definition TriangularSurface.hpp:43
RefPtr< Representation > CellsAsVertices
Collection of all fields given on triangles.
Definition TriangularSurface.hpp:71
RefPtr< Field > CellField
Field for the triangle indices.
Definition TriangularSurface.hpp:66
static SkeletonID ID()
2D objects of index depth 1 .
Definition TriangularSurface.hpp:131
RefPtr< CoordsArray_t > getCoords() const
Get the coordinate data array.
Definition TriangularSurface.hpp:170
RefPtr< CellArray_t > getCells() const
Get the triangle data array.
Definition TriangularSurface.hpp:182
RefPtr< Field > CoordField
Field for the vertex coordinates.
Definition TriangularSurface.hpp:59
RefPtr< Representation > CartesianVertices
Collection of all fields given on vertices relative to cartesian coordinates.
Definition TriangularSurface.hpp:69
RefPtr< Field > VertexNormalField
internal storage of the vertex normal field if existent Use getVertexNormalField() to compute the nor...
Definition TriangularSurface.hpp:63