FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Related Symbols | List of all members
Fiber::LineSet Class Reference

A set of lines stored on a Grid. More...

#include <LineSet.hpp>

Inheritance diagram for Fiber::LineSet:
Fiber::LineSetWithEdges

Classes

struct  FunctorFragmentIterator
 
struct  FunctorPerFrag
 
struct  FunctorPerFrag< LineSet::TComputeScalarDerivative >
 
struct  FunctorPerFrag< LineSet::TComputeTVectorDerivative >
 
struct  FunctorPerFrag< LineSet::TComputeUnitTVectorDerivative >
 
struct  NumberOfLinesIterator
 
struct  PredefinedFieldNames
 Predefined field names on linesets. More...
 
struct  SetupStandardFieldIterator
 
struct  TComputeScalarDerivative
 
struct  TComputeTVectorDerivative
 
struct  TComputeUnitTVectorDerivative
 

Public Types

typedef TypedArray< Eagle::PhysicalSpace::pointCoordsArray_t
 
typedef MemArray< 1, Eagle::PhysicalSpace::pointCoordsMemArray_t
 
typedef uint32_t LineIndex_t
 The index type used for line set indices.
 
typedef std::vector< LineSet::LineIndex_tLineIndices_t
 A vector of line indices.
 
typedef MemArray< 1, LineIndices_tLinesetArray_t
 An array of line indices.
 
typedef MemArray< 1, Eagle::tvector3 > TangentialVector_t
 
using CoordinateFragmentIterator = std::function< bool(const RefPtr< CoordsArray_t > &, const RefPtr< LinesetArray_t > &, const RefPtr< FragmentID > &LineFragmentID)>
 
using CoordinateFragmentIteratorWithVertexID = std::function< bool(const RefPtr< CoordsArray_t > &, const RefPtr< FragmentID > &VertexFragmentID, const RefPtr< LinesetArray_t > &, const RefPtr< FragmentID > &LineFragmentID)>
 
using LineVertexIterator = std::function< bool(const CreativeIterator< Eagle::PhysicalSpace::point > &Vertices, const RefPtr< FragmentID > &VertexFragmentID, const LineIndices_t &Line, const RefPtr< FragmentID > &LineFragmentID)>
 

Public Member Functions

 LineSet (const WeakPtr< Grid > &G=NullPtr())
 Retrieve a LineSet from a Grid object.
 
 LineSet (const RefPtr< Grid > &G, const RefPtr< CoordsArray_t > &Coords, const RefPtr< LinesetArray_t > &Lineset, const RefPtr< TangentialVector_t > &Tangents=NullPtr())
 Create a new LineSet within a Grid object.
 
 LineSet (Grid &G, const RefPtr< CoordsArray_t > &Coords, const RefPtr< LinesetArray_t > &Lineset, const RefPtr< TangentialVector_t > &Tangents=NullPtr())
 
bool operator= (const WeakPtr< Grid > &G)
 Assign from Grid pointer, will overwrite all members.
 
LineSetoperator= (const LineSet &LS)
 Assigning from existing LineSet - faster than assigning from Grid pointer since it is just copying pointers.
 
 ~LineSet ()
 Destructor, cleans up references.
 
 operator bool () const
 Return true if line indices are defined, thus this is a set of lines.
 
bool operator! () const
 Inverse operator of the line indices check.
 
RefPtr< CoordsArray_tgetCoords (const RefPtr< FragmentID > &f=NullPtr()) const
 Return coordinate array.
 
RefPtr< MemCore::ChunkBasegetCoordsAsMemChunk () const
 Return Mem ChunkBase of Coordinates Added by Bidur.
 
RefPtr< MemCore::ChunkBasegetTangentsAsMemChunk () const
 Return Mem ChunkBase of Tangential Vectors Added by Bidur.
 
RefPtr< LinesetArray_tgetLineset (const RefPtr< FragmentID > &f=NullPtr()) const
 Return edges information.
 
template<int N, class T >
RefPtr< Fiber::MemBaseextractDataFromField (const std::string &fieldname, RefPtr< FragmentID > fragID=NullPtr())
 Return data arrays stored on the line.
 
index_t NumberOfLines (const RefPtr< FragmentID > &f) const
 Return the number of lines stored here.
 
index_t NumberOfLines () const
 
void iterateCompatibleFragmentation (const CoordinateFragmentIterator &)
 
void iterateCompatibleFragmentation (const CoordinateFragmentIteratorWithVertexID &)
 
void iterateCompatibleFragmentation (const LineVertexIterator &)
 
RefPtr< TangentialVector_tgetTangentialVectors (const RefPtr< FragmentID > &f=NullPtr(), const string &FieldName=TangentialVectorFieldName)
 Compute tangential vectors in a grid object, which has a set of lines defined.
 
RefPtr< TangentialVector_tgetNormalVectors (const string &FieldName=NormalVectorFieldName)
 Get the normal vectors, the projected acceleration vectors, for this line set.
 
RefPtr< FieldIDComputeTVectorDerivative (const RefPtr< Grid > &theGrid, const string &F, const string &dF="")
 
RefPtr< FieldIDComputeScalarDerivative (const RefPtr< Grid > &theGrid, const string &F, const string &dF="")
 
RefPtr< FieldIDComputeUnitTVectorDerivative (const RefPtr< Grid > &theGrid, const string &F, const string &dF="")
 
bool setupStandardFields (const RefPtr< Grid > &theGrid)
 Setup some standard fields suitable for lines on this Grid.
 
RefPtr< FieldgetFieldOnLines (const string &field_name) const
 
LineSet orient (bool CounterClockWise)
 

Static Public Member Functions

static SkeletonID PerLineSkeletonID ()
 A Skeleton ID for sets of edges, thereby defining lines.
 
static SkeletonID ID ()
 
static SkeletonID IDFragmented ()
 
static void ComputeCurveTangents (MultiArray< 1, Eagle::tvector3 > &Tangents, const CreativeIterator< Eagle::PhysicalSpace::point > &Vertices, const LineIndices_t &Line)
 
static RefPtr< TangentialVector_tComputeTangentialVectors (const CoordsArray_t &Vertices, const LinesetArray_t &LinesetArray)
 Compute tangential vectors along a set of lines.
 
static RefPtr< TangentialVector_tComputeArcLength (const CoordsArray_t &Vertices, const LinesetArray_t &LinesetArray)
 
static uint32_t getNumberOfDistinctIndices (const LineSet::LinesetArray_t &lines)
 
static std::string unfragment (const Grid &GridIn, Grid &GridOut)
 

Public Attributes

RefPtr< SkeletonVertices
 
RefPtr< SkeletonLineset
 
RefPtr< RepresentationCartesianVertices
 
RefPtr< RepresentationLinesAsVertices
 
RefPtr< FieldCoords
 
RefPtr< FieldTangentialVectors
 
RefPtr< FieldLineIndices
 
PredefinedFieldNames FieldNames
 

Static Public Attributes

static const char TangentialVectorFieldName [] = "Tangents"
 A default name for the field that holds the tangential vectors of a grid describing lines.
 
static const char NormalVectorFieldName [] = "NormalVectors"
 A default name for the field that holds the normal vectors of a grid describing lines.
 
static const char ArcLengthFieldName [] = "ArcLength"
 A default name for the field that holds the respective values of a curve parameter.
 

Related Symbols

(Note that these are not member symbols.)

gridop_API RefPtr< GridExtractTrajectories (Bundle &B, const string &SelectedGridName, double StartTime, double ComaLength, const string &TrajectoryGridName, bool IterateOnlyLoadedSlices)
 Extract trajectories of the vertices of a Grid over time.
 

Detailed Description

A set of lines stored on a Grid.

The Grid must carry Vertices in Cartesian coordinates and a (1,2) Skeleton (dimension 1, depth 2) is a set of edges.

The positions field of this edge set is a set of vector<index_t> which describes the vertices that make up a curve each. This class supports computation of quantities such as defined at http://en.wikipedia.org/wiki/Differential_geometry_of_curves

A Grid object can be easily tested whether it is ("conforms to the concept of") a LineSet:

if (LineSet L = G)
{
... yes is a lineset ...
}
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A set of lines stored on a Grid.
Definition LineSet.hpp:55

If the reason for not being a LineSet need to be inspected further, then the members of the LineSet can be investigated.

Todo:
Yet to be done:
  1. Do really support all differential geometric curve properties
  2. Support fragmented edge fields
  3. Support fragmented coordinate fields (not easy, need to take care of global indices and fragment ID's, if a curve if split among coordinate fragments, might not be able to continue at all, but rather require some recombination routine to be called)
  4. Support other point types than the default one, such to support double and float coordinates, also other dimensionalities and coordinate systems (this is going to become a template nightmare).
  5. Support a parallelization interface such that each curve in the line set can be computed independently by some Thread.
Examples
ColoredLines.cpp, GlossyLines.cpp, and HelicalLines.cpp.

Member Typedef Documentation

◆ LineIndex_t

The index type used for line set indices.

This is a 32 bit unsigned integer because of OpenGL, mostly. OpenGL cannot render 64bit indices, and we want to be able to shuffle the line set indices stored here directly to the graphics card.

Constructor & Destructor Documentation

◆ LineSet()

Fiber::LineSet::LineSet ( const RefPtr< Grid > &  G,
const RefPtr< CoordsArray_t > &  Coords,
const RefPtr< LinesetArray_t > &  Lineset,
const RefPtr< TangentialVector_t > &  Tangents = NullPtr() 
)

Create a new LineSet within a Grid object.

The Grid object will be modified, and existing information most likely destroyed.

For creating a line set, the following code may be used:

RefPtr<Bundle> myBundle;
std::vector<point>&Crds = CoordsArray->myChunk()->get_vector();
... do something with Crds[i] ...
//
// Put vertex indices into LineIndices array.
// The following code will define four lines,
// each constructed by 1000 vertices.
//
{for(index_t j=0; j<4; j++)
{
std::vector<LineSet::LineIndex_t>&E = LineIndices[ j ];
E.resize(1000);
for(index_t i=0; i<1000; i++)
{
E[i] = i + j*1000;
}
}}
RefPtr<Grid> G = myBundle->newGrid();
LineSet theLines(G, CoordsArray, LinesetArray );
constexpr void resize(size_type __new_size)
LineSet(const WeakPtr< Grid > &G=NullPtr())
Retrieve a LineSet from a Grid object.
Definition LineSet.cpp:31
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.hpp:34
See also
HelicalLines.cpp

References max(), std::max(), MemCore::Cache::MemCache(), min(), std::min(), PerLineSkeletonID(), and TangentialVectorFieldName.

Member Function Documentation

◆ ComputeTangentialVectors()

RefPtr< LineSet::TangentialVector_t > Fiber::LineSet::ComputeTangentialVectors ( const CoordsArray_t Vertices,
const LinesetArray_t LinesetArray 
)
static

Compute tangential vectors along a set of lines.

This function is computationally intensive.

References Fiber::HyperslabParameters::count().

Referenced by getTangentialVectors().

◆ getTangentialVectors()

RefPtr< LineSet::TangentialVector_t > Fiber::LineSet::getTangentialVectors ( const RefPtr< FragmentID > &  f = NullPtr(),
const string &  FieldName = TangentialVectorFieldName 
)

Compute tangential vectors in a grid object, which has a set of lines defined.

The resulting field is stored at the Grid.

Parameters
FieldNameThe name of the field under which the tangents shall be stored in the current Grid. It may be set to an empty string to disable storage. Even then, it will be stored in this LineSet object (but vanish once the LineSet object dies).
Todo:

Make use of timestamps of the involved fields (whatever this means)

Define an exception class here to indicate the many reasons of failures here, instead of just returning a NullPtr.

References ComputeTangentialVectors(), std::cout, std::endl(), getCoords(), and getLineset().

◆ iterateCompatibleFragmentation()

void Fiber::LineSet::iterateCompatibleFragmentation ( const LineVertexIterator &  It)
iterateCompatibleFragmentation( [](const CreativeIterator<Eagle::PhysicalSpace::point>&Vertices,
{
for(unsigned i=1; i<Line.size(); i++)
{
Eagle::point3 PointOnLine = Vertices[ Line[i] ];
...
}
}

References Fiber::HyperslabParameters::count().

◆ operator=()

bool Fiber::LineSet::operator= ( const WeakPtr< Grid > &  G)

Assign from Grid pointer, will overwrite all members.

Will inspect the new Grid object for comformance to the LineSet properties.

References PerLineSkeletonID().

◆ PerLineSkeletonID()

static SkeletonID Fiber::LineSet::PerLineSkeletonID ( )
inlinestatic

A Skeleton ID for sets of edges, thereby defining lines.

This skeleton bundles the vertices and edges per line together. See also the ID() function.

Referenced by LineSet(), LineSet(), and operator=().

◆ setupStandardFields()

bool Fiber::LineSet::setupStandardFields ( const RefPtr< Grid > &  theGrid)

Setup some standard fields suitable for lines on this Grid.

Actually nothing is computed yet, just fields will be defined. They come with deferred creation (see class OnDemandCreator ) and will be computed once accessed via a Field's create() function.

Friends And Related Symbol Documentation

◆ ExtractTrajectories()

gridop_API RefPtr< Grid > ExtractTrajectories ( Bundle B,
const string &  SelectedGridName,
double  StartTime,
double  ComaLength,
const string &  TrajectoryGridName,
bool  IterateOnlyLoadedSlices 
)
related

Extract trajectories of the vertices of a Grid over time.

Parameters
BThe Bundle that carries the time evolution of the input Grid and which will be used to host the output Grid.
SelectedGridNameThe name of the evolving Grid
TrajectoryGridNameName of the new Grid that will carry the trajectories as a LineSet. It will be cached in the Bundle.
StartTimeWhen shall we start the trajectories? Note that the trajectories run \i backward in time, thus they are rather a trail.
ComaLengthHow long shall the trajectories be?
IterateOnlyLoadedSlicesFlag to specify if timesteps that have not yet been loaded into memory should be inspected. This will make the result more precise, but will significantly slow down the process if disc access is required.
Returns
A pointer to the Grid object containing the trajectories. It is safe to ignore the return value, since if the procedure was successfull the Grid is stored in the Bundle anyway. However, the pointer can be used to check if the routine was unsuccessful.
Todo:
Implement option to interrupt the computation, especcially when slow disc access is enabled.

References MemCore::Intercube::addInterface().