1#ifndef __BASEOP_ISOSURFACE_HPP
2#define __BASEOP_ISOSURFACE_HPP
4#include "gridopDllApi.h"
6#include <eagle/PhysicalSpace.hpp>
8#include <vector/MultiIndex.hpp>
10#include <field/Cell.hpp>
12#include <grid/Grid.hpp>
13#include <grid/CartesianChart.hpp>
14#include <grid/RegularTopology.hpp>
16#include <bundle/Slice.hpp>
21template <
class ArrayType>
24template <Dims_t Dims,
class ValueType>
37 return Field[
I ] < Isolevel;
40 template <
class ResultType>
60 if (r<0.0)
return 0.0;
61 if (r>1.0)
return 1.0;
72template <
class ValueType, Dims_t Dims,
class ResultType>
101extern gridop_API
const int edgeTable[256];
102extern gridop_API
const int triTable[256][16];
109template <
class ArrayType>
152 for(
int i=0; i< (1<<3); i++)
161 for(
int i=0; i< (1<<3); i++)
166 if (
FE.isBelowThreshold(
I ) )
177 -1u, -1u, -1u, -1u };
206 for(
int E=0; E<12; E++)
228 for (
int i=0;triTable[
cubeindex][i]!=-1; i+=3)
236 for(
int k=0; k<3; k++)
244 IsosurfaceVerticesAsEdges_t::const_iterator it =
245 IsosurfaceVerticesAsEdges.find( edge );
246 if (it == IsosurfaceVerticesAsEdges.end() )
262 IsoSurfaceTriangles.
push_back( Triangle );
274template <
class VertexFieldType>
288 enum Dims_t { Dims = VertexFieldType::Dims };
289 typedef typename VertexFieldType::value_type value_type;
313template <
class VertexField_t,
class ArrayType>
314inline gridop_API TriangleSurface_t
315 ComputeIsosurfaceT(
const FieldExplorer<ArrayType>&FE,
316 const VertexField_t&VertexField,
327map<index_t, index_t> IsosurfaceVerticesAsEdges;
329MultiIndex<3> NumberOfCells = FE.Field.Size() - MIndex(1,1,1);
333 for(MultiIndex<3> CellIndex : NumberOfCells )
339 IsosurfaceVerticesAsEdges,
348 printf(
"ComputeIsosurfaceT(): INTERNAL ERROR\n"); fflush(stdout);
361 IsoVertices( IsoVertexEdge.size() );
367 IsoVertexEdge.std_vector(),
368 IsoVertexWeight.std_vector(),
383 const MultiArray<3,double>&ScalarField,
384 const MultiArray<3,::Eagle::PhysicalSpace::point>&VertexField,
constexpr void push_back(const value_type &__x)
constexpr size_type size() const noexcept
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Identify the edges on a skeleton within a Grid.
Definition Edges.hpp:35
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Definition MultiArray.hpp:371
index_t BitIndex() const
From this given multiindex which is supposed to have index values of either 0 or 1 in each direction,...
Definition MultiIndex.hpp:489
std::pair< MultiIndex< Dims >, MultiIndex< Dims > > ComputeEdgeVertices(index_t EdgeIndex, const MultiIndex< Dims > &NumberOfVertices)
Compute the both vertices that correspond to a certain edge, where the edge is linearly numbered over...
Definition RegularTopology.hpp:122
index_t ComputeEdgeIDfromVertexAndOrientation(const MultiIndex< Dims > &Vertex, int Orientation, const MultiIndex< Dims > &NumberOfVertices)
Given a vertex and an orientation (i.e.
Definition RegularTopology.hpp:152
index_t NumberOfEdges(const MultiIndex< Dims > &NumberOfVertices)
Compute the number of edges on a regular grid that consists of the given number of vertices.
Definition RegularTopology.hpp:24
int EdgeOrientation(index_t EdgeIndex, const MultiIndex< Dims > &NumberOfVertices)
Compute the orientation of a given edge index in a regular grid, given the number of vertices in the ...
Definition RegularTopology.hpp:46
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
int Polygonize(std::vector< index_t > &IsoVertexEdge, std::vector< double > &IsoVertexWeight, std::vector< TriangleCell > &IsoSurfaceTriangles, map< index_t, index_t > &IsosurfaceVerticesAsEdges, const FieldExplorer< ArrayType > &FE, const MultiIndex< 3 > &CellIndex, double precision, index_t EdgeOffset=0)
Create polygons out of a given field to be explored, based on the algorithm described by http://local...
Definition Isosurface.hpp:110
void EvalVertexFieldOnEdges(std::vector< typename VertexFieldType::value_type > &EvaluatedField, const std::vector< index_t > &Edges, const std::vector< double > &Weights, const VertexFieldType &RegularField, const MultiIndex< 3 > &FragmentSize, const MultiIndex< 3 > &FragmentOffset, index_t StartEvaluationAtVertex=0, index_t EdgeOffset=0)
Given a set of edge indices and weights on them, plus a field defined on the vertices of a regular gr...
Definition Isosurface.hpp:275
void ComputeInterpolationEdgeAndWeight(index_t &EdgeID, int &EdgeOrientation, ResultType &Weight, const FieldExplorer< MultiArray< Dims, ValueType > > &FE, const MultiIndex< Dims > &FirstVertex, const MultiIndex< Dims > &SecondVertex, const ResultType &precision)
Given an value, and field with two vertices to evaluate at, compute the weight that each of the verti...
Definition Isosurface.hpp:73
RefPtr< MemArray< 1, T > > makeMemArray1D(const RefPtr< MemCore::TypedChunk< T > > &DataChunk, const MemBase::Creator_t &C=MemCore::NullPtr())
Create one-dimensional MemArray from provided data chunk.
Definition MemArray.hpp:357
Grid & ComputeIsosurface(double Isolevel, const Ageable &Trigger, const Grid &RegularGrid, const string &fieldname, Slice &timeStep, const string &isosurfacename, double precision)
Compute an isosurface as a new Grid object from a scalar field given on a regular grid.
Definition GridIsosurface.cpp:262
IndexTypeConfig< sizeof(void *)>::index_t index_t
Define the index type as according to the size of a pointer, i.e.
Definition Index.hpp:22
Definition Isosurface.hpp:22
A type describing an n-dimensional simplex cell.
Definition Cell.hpp:70