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

[← Previous Example] [Next Example → 131-RepresentSortedAsUnsorted.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 → 131-RepresentSortedAsUnsorted.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 uint32_t MySize = 5e6;
//
// Create a coordinate field and fill it with values
//
RefPtr<Field>&Positions = myCartesianRepresentation[ FIBER_POSITIONS ];
Positions = new Field();
for(uint32_t i = 0; i < MySize; i++)
{
point P ={0,0,0};
(*Mem)[i] = P;;
}
Positions->setPersistentData(Mem);
{
/**
1) Fastest run
*/
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
RefPtr<MemArray<1,point> > Mem = CAB->create();
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
M[i] = P;
}
g_fastest = mytime.secs();
Verbose(0) << "Fastest run: " << g_fastest << " TotalCreationTime " <<
CAB->TotalCreationTime << " NumberOfCreations " << CAB->NumberOfCreations;
}
{
/**
1) Fast run
*/
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
RefPtr<MemArray<1,point> > Mem = CAB->create();
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
(*Mem)[i] = P;
}
g_fast = mytime.secs();
Verbose(0) << "Fast run: " << g_fast <<" ration (fastest) " << g_fast/g_fastest << " TotalCreationTime " <<
CAB->TotalCreationTime << " NumberOfCreations " << CAB->NumberOfCreations;
}
{
/**
1) wSlow run
*/
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
// RefPtr<CreativeArray> CA = CAB;
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
const RefPtr<MemArray<1,point> >&Mem = CAB->create(true);
(*Mem)[i] = P;
}
g_wslow = mytime.secs();
Verbose(0) << "wSlow run: " << g_wslow <<" ration (fastest) " << g_wslow/g_fastest
<< " TotalCreationTime " << CAB->TotalCreationTime << " NumberOfCreations " << CAB->NumberOfCreations;
}
{
/**
1) Slow run
*/
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
const RefPtr<MemArray<1,point> >&Mem = CAB->create();
(*Mem)[i] = P;
}
g_slow = mytime.secs();
Verbose(0) << "Slow run: " << g_slow <<" ration (fastest) " << g_slow/g_fastest
<< " TotalCreationTime " << CAB->TotalCreationTime << " NumberOfCreations " << CAB->NumberOfCreations;
}
{
/**
1) Slower run
*/
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
RefPtr<MemArray<1,point> > Mem = CAB->create();
(*Mem)[i] = P;
}
g_slower = mytime.secs();
Verbose(0) << "Slower run: " << g_slower <<" ration (fastest) " << g_slower/g_fastest
<< " TotalCreationTime " << CAB->TotalCreationTime << " NumberOfCreations " << CAB->NumberOfCreations;
}
{
/**
1) Slowest run
*/
point P = {1,1,1};
for(uint32_t i = 0; i < MySize; i++)
{
RefPtr<CreativeArrayBase> CAB = Positions->getCreator();
RefPtr<MemArray<1,point> > Mem = CAB->create();
(*Mem)[i] = P;
}
g_slowest = mytime.secs();
Verbose(0) << "Slow run: " << g_slowest <<" ration (fastest) " << g_slowest/g_fastest;
}
BP.save("130_PerformanceCreator.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

Function Documentation

◆ main()

int main ( )

1) Fastest run

1) Fast run

1) wSlow run

1) Slow run

1) Slower run

1) Slowest run

References Fiber::BundlePtr::save().