Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
132-RepresentSortedAsUnsortedCartesianChart.cpp File Reference

[← Previous Example] [Next Example → 141-LambdaBinding.cpp ]. More...

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <fiber/grid/types/RegularlyFragmentedGrid.hpp>

Functions

int main ()

Detailed Description

[← Previous Example] [Next Example → 141-LambdaBinding.cpp ].

In FiberLib Tutorial

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <fiber/grid/types/RegularlyFragmentedGrid.hpp>
using namespace Fiber;
using namespace Eagle::PhysicalSpace;
int main()
{
// Initialize I/O layers
Finit();
//
// Create a bundle object with a grid at T=1.0, named "myGrid", in
// a three-dimensional cartesian representation, using the default
// coordinate system.
//
BundlePtr BP = new Bundle();
Slice&mySlice = BP[0];
Grid&GridOfUnsortedPoints = mySlice["UnsortedPoints"];
Representation&CartesianRepresentationOfUnsortedPoints =
GridOfUnsortedPoints.makeCartesianRepresentation(3);
Ref< MemArray<1,point> > Coordinates(80);
for(auto P : *Coordinates )
{
index_t i = P.getIndex();
P->x() = 0.001 * i;
P->y() = 0.002 * i;
P->z() = 0.003 * i;
}
CartesianRepresentationOfUnsortedPoints.setPositions( new Field( Coordinates ));
RefPtr<Skeleton> VertexSkeletonOfUnsortedPoints = GridOfUnsortedPoints.findVertices();
Assert(VertexSkeletonOfUnsortedPoints);
/**
######### Index List #######
*/
Grid&GridOfSortedPoints = mySlice["SortedPoints"];
Skeleton&VertexSkeletonOfSortedPoints = GridOfSortedPoints[ SkeletonID(3,0) ]; // 3d neighbourhood expected, 0 index depth ->point
/**
Representation of Skeleton Sorted to Skeleton Unsorted
*/
Representation&RepresentSortedAsUnsorted = VertexSkeletonOfSortedPoints[ VertexSkeletonOfUnsortedPoints ];
bool Unfragmented = true;
if (Unfragmented)
{
Ref< MemArray<1,index_t> > Indices(80);
for(auto I : *Indices)
{
I = I.getIndex();
}
RepresentSortedAsUnsorted.setPositions(new Field(Indices ));
}
else
{
RefPtr<RegularlyFragmentedField<3> > FieldPositionsOfSortedAsUnsorted= new RegularlyFragmentedField<3>({2,2,2});
for(auto&F :FieldPositionsOfSortedAsUnsorted->getNumberOfFragments() )
{
RefPtr< MemArray<1,index_t> > MB = new MemArray<1,index_t>(10);
(*FieldPositionsOfSortedAsUnsorted)[F] = new CreativeArray(MB, MemCore::Cache::MemCache() );
}
RepresentSortedAsUnsorted.setPositions(FieldPositionsOfSortedAsUnsorted);
}
BP.save("132_RepresentSortedAsUnsortedCartesianChart.f5");
Verbose(0) << BP->xml();
return 0;
}
int main()
Demonstrates minimal usage of the FiberLib Create Bundle, insert a time slice, and safe it to a file.
Definition 010-SimpleSave.cpp:13
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
int save(const string &url, const RefPtr< LoaderProgress > &SaveProgress=nullptr, const RefPtrStorageTransformations &ST=nullptr)
Definition Bundle.cpp:1142
The main entity holding all information.
Definition Bundle.hpp:173
A helper class that keeps objects in memory all time.
Definition CreativeArray.hpp:25
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
Representation & makeCartesianRepresentation(int Dims, const string &name={}, uint16_t epsg_code=0)
Provide a representation in an n-dimensional skeleton of the vertices.
Definition Grid.cpp:124
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.hpp:34
A convenience class for optimized handling of fields that are fragmented in a regular manner (n-dimen...
Definition RegularlyFragmentedField.hpp:27
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
bool setPositions(const RefPtr< Field > &P)
Set the positional component of this Representation object.
Definition Representation.cpp:519
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
RefPtr< Skeleton > findVertices(int TotalRefinement=-1) const
Find the Skeleton describing the Vertices on this Grid.
Definition SkeletonMap.cpp:285
Information per time slice, mainly a set of Grid objects that are accessed via GridID objects.
Definition Slice.hpp:36
static RefPtr< Cache, CacheBase > & MemCache()
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
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

Function Documentation

◆ main()