#include <fiber/bundle/Bundle.hpp>
#include <fiber/finit/FinitAPI.h>
#include <fiber/field/ArrayRef.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <fiber/bundle/StorageTransformations.hpp>
#define NumberOfBundles 1
#define array_size 1e3
#define NumberOfFragments 1
{
};
void createData()
{
const uint32_t BPNr = 0;
RefPtr<Field> F = R[FIBER_POSITIONS];
const uint32_t FragNr = 0;
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);
BP.
save(
"File" + to_string(BPNr)+
".f5",
nullptr);
}
bool myLoad(const string InFile, const string OutFile, const bool IsBindTo)
{
uint32_t BPNr = 0;
bool success;
if (IsBindTo) BP->bindToNew(OutFile + to_string(BPNr)+ ".f5");
if (!success)
{
std::cerr <<
"Error: CANNOT load file because of "
<< LP->load_failure
return false;
}
if (!IsBindTo) BP->
save(OutFile + to_string(BPNr)+
".f5",
nullptr);
return true;
}
{
Finit();
createData();
if (!myLoad("File" , "OtherFile" , false))
{
return 42;
}
unlink("File0.f5");
perror("File0.f5");
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
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
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
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.hpp:34
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