Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Related Functions

Fiber::LineSet Class Reference
[Predefined Grid Types]

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

#include <LineSet.hpp>

List of all members.

Classes

Public Types

Public Member Functions

Static Public Member Functions

Public Attributes

Static Public Attributes

Related Functions

(Note that these are not member functions.)


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:

   RefPtr<Grid> G;
        if (LineSet L = G)
        {
                ... yes is a lineset ...
        }

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

typedef uint32_t Fiber::LineSet::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

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; 
        

           Ref<LineSet::CoordsMemArray_t> CoordsArray( 4000 );
           std::vector<point>&Crds = CoordsArray->myChunk()->get_vector();

                        ... do something with Crds[i] ...

           Ref<LineSet::LinesetArray_t>     LinesetArray(4);
           MultiArray<1, std::vector<LineSet::LineIndex_t> >&LineIndices = *LinesetArray; 
                       //
                       // 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, EdgesArray );
See also:
HelicalLines.cpp

Member Function Documentation

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.

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:
FieldName The 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.

Examples:
ColoredLines.cpp, and GlossyLines.cpp.
template<class Iterator >
void Fiber::LineSet::IterateLineSetFragment ( Iterator IC,
const RefPtr< FragmentID > &  f 
) const [inline]

Template iterator for inline traversal.

The provided template argument class must provide a member function of the type

                void apply(const CreativeIterator<Eagle::PhysicalSpace::point>&Vertices,
                           const std::vector<LineSet::LineIndex_t>&Line);

which will be called for each curve in the LineSet.

Todo:
More complete support fragmented edges and more. Now same fragmentataion is assumed for lines and vertices, also same names! This should be checked if this is the case.
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.

static SkeletonID Fiber::LineSet::PerLineSkeletonID (  )  [inline, static]

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().

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.

Examples:
ColoredLines.cpp, and HelicalLines.cpp.

Friends And Related Function Documentation

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:
B The Bundle that carries the time evolution of the input Grid and which will be used to host the output Grid.
SelectedGridName The name of the evolving Grid
TrajectoryGridName Name of the new Grid that will carry the trajectories as a LineSet. It will be cached in the Bundle.
StartTime When shall we start the trajectories? Note that the trajectories run backward in time, thus they are rather a trail.
ComaLength How long shall the trajectories be?
IterateOnlyLoadedSlices Flag 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.

Member Data Documentation

const char Fiber::LineSet::ArcLengthFieldName = "ArcLength" [static]

A default name for the field that holds the respective values of a curve parameter.

It will just be "ArcLength".

http://en.wikipedia.org/wiki/Arc_length

const char Fiber::LineSet::NormalVectorFieldName = "NormalVectors" [static]

A default name for the field that holds the normal vectors of a grid describing lines.

It will just be "NormalVectors";

const char Fiber::LineSet::TangentialVectorFieldName = "Tangents" [static]

A set of pre-defined names used for standard fields on lines

A default name for the field that holds the tangential vectors of a grid describing lines. It will just be "Tangents";

Referenced by ~LineSet().