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

[← Previous Example] [Next Example → 046-MassiveFragments.h5.cpp ]. More...

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <fiber/field/UniformCartesianArray.hpp>
#include <fiber/bundle/StorageTransformations.hpp>

Functions

int main ()
 

Detailed Description

[← Previous Example] [Next Example → 046-MassiveFragments.h5.cpp ].

In FiberLib Tutorial

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <fiber/field/UniformCartesianArray.hpp>
#include <fiber/bundle/StorageTransformations.hpp>
using namespace Fiber;
using namespace Eagle::PhysicalSpace;
int main()
{
// Initialize I/O layers (only required for standalone binaries)
Finit();
//
// Create a bundle object with a grid at T=1.0, named "DemoGrid", in
// a three-dimensional Cartesian representation, using the default
// coordinate system.
//
Representation&myCartesianRepresentation = BP[1.0]["DemoGrid"].makeCartesianRepresentation(3);
{
std::pair<string,string> getExternalLocation( double time, const string&gridname,
const SkeletonID&Sid,
const string&RepresenterName,
const string&FieldName ) const override
{
FieldName + ".f5",
std::to_string(time) + "/" + gridname + "/" + Sid.Name()
+ "/" + RepresenterName );
}
};
//
// Save the bundle to a file, even future data
// that are added to the bundle later. This feature
// is called "binding" a file to the Bundle.
//
BP->bindToNew("045_ExternalField.f5", new MyStorage() );
//
// Create two fields, no data or fragmentation specified yet
//
RefPtr<Field>&Positions = myCartesianRepresentation[ FIBER_POSITIONS ];
Eagle::point3 BBoxMin(-1.0, -1.0, -0.5), BBoxMax( 1.0, 1.0, 0.5);
const int nTilesX = 1, nTilesY = 2;
Eagle::tvector3 FragmentDiagonal = (BBoxMax - BBoxMin).multiply( 1.0/ nTilesX, 1.0/ nTilesY, 1.0);
//
// Produce a couple of fragments
//
for(int tileY = 0; tileY < nTilesY; tileY++)
for(int tileX = 0; tileX < nTilesX; tileX++)
{
//
// Generate a unique name for the fragment
// The name is of no relevance and could also
// be just a random string.
//
string FragmentName = "tile" + std::to_string(tileX) + "x" + std::to_string(tileY);
//
// Define the size of the fragment to be used henceforth
//
const MultiIndex<3> Dims = MIndex(11,13,17);
Eagle::point3 FragmentBBoxMin = BBoxMin + FragmentDiagonal.multiply( tileX, tileY, 0.0);
//
// Produce uniform coordinates for the given fragment.
//
FragmentDiagonal.multiply(1.0/(Dims[0]-1), 1.0/(Dims[1]-1), 1.0/(Dims[2]-1) ) );
Positions->createCreator(Coordinates, FragmentName);
Positions->setFragmentOffset( FragmentName,
MIndex( tileX*Dims[0], tileY*Dims[1], 0*Dims[2] ) );
{
for(MultiIndex<3> I : Dims)
{
double& value = GridValues[ I ];
Eagle::point3 P = Pts[ I ];
//
// Some analytic function here used to produce some
// halfway interestingly looking scalar field.
//
value = P.x()*P.x() - P.y()*P.y() + P.z()*P.z();
}
Values->createCreator(GridValues, FragmentName);
}
}
return 0;
}
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
Identifier for Skeletons within a Grid.
Definition SkeletonID.hpp:24
std::string Name() const
Create a textual representation of the inherent parameters of the Skeleton ID.
Definition SkeletonID.cpp:138
Definition StorageTransformations.hpp:18
Convenience class for procedural linear arrays in cartesian coordinates.
Definition UniformCartesianArray.hpp:22
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
string to_string(const Eagle::FixedArray< ElementType, N > &A, const char *OpenBrace="{", const char *CloseBrace="}", const char *Separator=",")