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

[← Previous Example] [Next Example → 130-PerformanceCreator.cpp ]. More...

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/UniformCartesianArray.hpp>
#include <fiber/baseop/Resample.hpp>

Functions

int main ()

Detailed Description

[← Previous Example] [Next Example → 130-PerformanceCreator.cpp ].

In FiberLib Tutorial

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/UniformCartesianArray.hpp>
#include <fiber/baseop/Resample.hpp>
using namespace Fiber;
using namespace Eagle;
using namespace Eagle::PhysicalSpace;
int main()
{
// Initialize I/O layers
Finit();
RefPtr<Cache>&theGlobalCache = Cache::MemCache();
const int kB = 1024, MB = kB*kB;
theGlobalCache->setMaxCost( 3*MB );
Grid&InputGrid = BP[1.0]["DemoGrid"];
Representation&myCartesianRepresentation = InputGrid.makeCartesianRepresentation(3);
BP->bindTo("070_RegularSample_LowRes.f5");
//MultiIndex<3> DemoGridSize = {8,16,12};
MultiIndex<3> DemoGridSize = {3,2,2};
Verbose(0) << "Creating low-resolution Grid of dimension " << DemoGridSize
<< " bound to " << BP->boundUrl();
RefPtr<UniformCartesianArray>
CoordsP = new UniformCartesianArray( {-1.0,-1.0,-1.0} , DemoGridSize, point{+1.0, +1.0, +1.0} );
RefPtr<MemBase> M = CoordsP;
myCartesianRepresentation.setPositions( new Field( M ) );
// myCartesianRepresentation.setPositions( new Field( CoordsP ) );
#if 1
Ref<MemArray<3, double>> ScalarData( DemoGridSize );
myCartesianRepresentation[ "scalardata"] = new Field( ScalarData );
const UniformCartesianArray&Coords= *CoordsP;
for(auto&value : ScalarData->myChunk()->get_vector())
value = -1.0;
for(auto I : ScalarData->Size() )
{
const point&P = Coords[I];
double x = P.x(), y = P.y(), z = P.z();
(*ScalarData)[ I ] += x*x + y*y - z*z;
}
#endif
#if 1
Verbose(0) << "#################### CREATE OUTPUT GRID AND ASSOCIATE WITH FILE ###################";
{
BundlePtr OutputBP;
Grid&OutputGrid = OutputBP[0.1]["ResampledDemoGrid"];
OutputBP->bindTo("070_RegularSample_HighRes.f5");
Verbose(0) << "#################### RESAMPLE AND SAVE VIA DESTRUCTION ###################";
RefPtr<Field>
ResampledField = ResampleRegularGrid3D(OutputGrid, InputGrid,
"scalardata",
{2.0, 2.0, 2.0} );
}
#endif
Verbose(0) << "Demo done.";
return true;
}
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
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
A multidimensional index that is automatically a lower-dimensional index via recursion.
Definition MultiIndex.hpp:449
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
Convenience class for procedural linear arrays in cartesian coordinates.
Definition UniformCartesianArray.hpp:15
static RefPtr< Cache, CacheBase > & MemCache()
StrongPtr< Object, ObjectBase > RefPtr
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2