Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Functions
020-CreateBundleAndSave.cpp File Reference

[← Previous Example] [Next Example → 021_CreateMultiBundlesAndSave.cpp ]. More...

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

Functions

int main ()
 

Detailed Description

[← Previous Example] [Next Example → 021_CreateMultiBundlesAndSave.cpp ].

In FiberLib Tutorial

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.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.
//
Representation&myCartesianRepresentation = BP[1.0]["myGrid"].makeCartesianRepresentation(3);
//
// Define the size of the grid to be used hereforth
//
const MultiIndex<3> GridDims = MIndex(11,13,17);
//
// Create a coordinate field and fill it with values
//
RefPtr<Field>&Positions = myCartesianRepresentation[ FIBER_POSITIONS ];
Positions = new Field();
{
{
P.x() = I[0]*0.3;
P.y() = I[1]*0.2;
P.z() = I[2]*0.1;
}
Positions->setPersistentData(Coordinates);
}
Assert( Positions->isUnfragmented() );
//
// Define a scalar field called "values" and set numbers
// to it using some formula based on the indices, just to
// get something non-trivial here.
//
Values = new Field();
{
{
double& value = GridValues[ I ];
value = (I[0]*0.3)*(I[0]*0.3) +
(I[1]*0.2)*(I[0]*0.2) -
(I[2]*0.1)*(I[2]*0.1);
}
Values->setPersistentData( GridValues );
}
Assert( Values->isUnfragmented() );
//
// Save the bundle to a file.
//
BP.save("020_CreateBundleAndSave.f5");
return 0;
}
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
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2