#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/UniformCartesianArray.hpp>
#include <fiber/baseop/Resample.hpp>
{
Finit();
const int kB = 1024, MB = kB*kB;
theGlobalCache->setMaxCost( 3*MB );
Grid&InputGrid = BP[1.0][
"DemoGrid"];
BP->bindTo("070_RegularSample_LowRes.f5");
Verbose(0) << "Creating low-resolution Grid of dimension " << DemoGridSize
<< " bound to " << BP->boundUrl();
RefPtr<UniformCartesianArray>
RefPtr<MemBase> M = CoordsP;
#if 1
myCartesianRepresentation[
"scalardata"] =
new Field( ScalarData );
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 ###################";
{
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
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