Demonstrating how to modify coordinates and have their range, and respectively the bounding box, updated accordingly.
Demonstrating how to modify coordinates and have their range, and respectively the bounding box, updated accordingly.
#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <eagle/ColorSpace.hpp>
#include <fiber/fiberop/Range.hpp>
#include <fiber/baseop/ExpandBBox.hpp>
#include <memcore/Timer.hpp>
#include <memcore/Console.hpp>
{
Finit();
unlink("outfile.f5");
BP->bindTo("outfile.f5");
Representation&myCartesianRepresentation = BP[1.0][
"DemoGrid"].makeCartesianRepresentation(3);
RefPtr<Field>&Positions = myCartesianRepresentation[ FIBER_POSITIONS ];
{
for(auto I : GridDims)
{
point&P = Coordinates[ I ];
P.x() = I[0]*0.83;
P.y() = I[1]*0.04*I[1];
P.z() = I[2]*0.01*I[2]*I[1];
}
if (auto CoordinateCreator = Positions->createCreator(Coordinates) )
{
Console() <<
"Bounding box of " << GridDims <<
" coordinates is " << *BBox;
Console() <<
"Range of " << GridDims <<
" coordinates is " << *
Range;
Console() <<
" Creator Age: " << CoordinateCreator->getAge()
<<
" vs. Range age: " <<
Range->getAge();
}
for(auto I : GridDims)
{
point&P = Coordinates[ I ];
P.x() = I[0]*0.83 *2.0 - 10.0;
P.y() = I[1]*0.04*I[1] *2.0 - 10.0;
P.z() = I[2]*0.01*I[2]*I[1]*2.0 - 10.0;
}
if (auto CoordinateCreator = Positions->getCreator())
{
Console() <<
" TOUCH BBOX Creator Age: " << CoordinateCreator->getAge() <<
" vs. Range age: "
<< DataRange<point>::get_cached_range_if_older_than_data(*CoordinateCreator)->getAge();
Assert( DataRange<point>::get_cached_range_if_older_than_data(*CoordinateCreator) );
CoordinateCreator->touch();
Assert( !DataRange<point>::get_cached_range_if_older_than_data(*CoordinateCreator) );
Console() <<
" RETRIEVE BBOX Creator Age: " << CoordinateCreator->getAge() <<
", no more range available.";
Console() <<
"Modified Range of " << GridDims <<
" coordinates is " << *
Range;
}
Console() <<
"Final Bounding box of " << GridDims <<
" coordinates is " << *BBox;
}
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
An array reference class, which is a convenience class for reference pointers to multidimensional mem...
Definition ArrayRef.hpp:28
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
The main entity holding all information.
Definition Bundle.hpp:173
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
DomainVector< Vector< color16_t, 3 >, RGB > rgb16_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
RefPtr< BoundingBox > ComputeBBox(const RefPtr< MemBase > &CoordBase)
Compute the bounding box from a given mem array of coordinates.
Definition ExpandBBox.cpp:27
static RefPtr< DataRange > retrieve(CreativeArrayBase &CAB, bool AsynchRequest=false, bool AvoidDataLoading=false, const RefPtr< MemBase > &PossibleData=nullptr)
Provide a data range on a given CreativeArrayBase from the attribute, if such exists and is older tha...
Definition Range.hpp:880