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

[← Previous Example] [Next Example → 030-SimpleFileBinding.cpp ]. More...

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <fiber/bundle/StorageTransformations.hpp>
#include <random>
#include <filesystem>
#include <chrono>
#include <thread>

Macros

#define array_size   2

Functions

void createData (Grid &G)
BundlePtr myLoad (const string InFile)
int main ()

Variables

std::random_device rd
std::mt19937 e2 (rd())
std::uniform_real_distribution dist (100, 50)

Detailed Description

[← Previous Example] [Next Example → 030-SimpleFileBinding.cpp ].

In FiberLib Tutorial

#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <fiber/bundle/StorageTransformations.hpp>
#include <random>
#include <filesystem>
#include <chrono>
#include <thread>
using namespace Fiber;
using namespace std;
using namespace Eagle::PhysicalSpace;
#define array_size 2
std::mt19937 e2(rd());
// ######################################################
// LOAD
//#######################################################
void createData(Grid&G)
{
RefPtr<Field> F = G[FIBER_POSITIONS];
const uint32_t FragNr = 0;
RefPtr<MemArray<1,point> > DataPtr = new MemArray<1,point>( array_size );
for (uint32_t i = 0; i <DataPtr->nElements(); i++)
DataPtr[i] = {dist(e2),dist(e2),dist(e2)} ;
RefPtr<FragmentID> FragID =F->makeFragmentID("Frag" + to_string(FragNr) );
F->setPersistentData(DataPtr,FragID);
}
// ######################################################
// LOAD
//#######################################################
BundlePtr myLoad(const string InFile)
{
bool success;
Ref<LoaderParameters> LP( InFile );
BundlePtr BP=new Bundle();
Bundle::load( success, LP, BP );
Assert(success);
return BP;
}
// ######################################################
// LOAD
//#######################################################
int main()
{
// Initialize I/O layers
Finit();
for (uint32_t Nr = 0; Nr < 10000; Nr++)
{
BundlePtr BP = new Bundle;
Grid&G = BP[0.0]["A"];
createData(G);
Grid&G1 = BP[0.0]["B"];
createData(G1);
BP->save( "F" + to_string(Nr) + ".f5" );
AppVerbose("wd",0) << "Nr " << Nr;
}
for (uint32_t Nr = 0; Nr < 10000; Nr++)
{
BundlePtr BP = myLoad( "F" + to_string(Nr) + ".f5" );
Grid&G2 = BP[0.0]["C"];
createData(G2);
BP->save( "F2_" + to_string(Nr) + ".f5" );
AppVerbose("wd",0) << "Nr2 " << Nr;
}
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
mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL > mt19937
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
The main entity holding all information.
Definition Bundle.hpp:173
static RefPtr< Bundle > load(bool &success, const RefPtr< LoaderParameters > &ld, const RefPtr< Bundle > &B=nullptr)
Load a Bundle object or append new data to an existing Bundle.
Definition Bundle.cpp:139
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
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.hpp:34
StrongPtr< Object, ObjectBase > RefPtr
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
STL namespace.