Demonstration of Creation of a scalar field on a uniform grid.
Demonstration of Creation of a scalar field on a uniform grid.
#include <bundle/Bundle.hpp>
#include <grid/CartesianChart.hpp>
#include <field/DirectProductArray.hpp>
#include <ocean/eagle/PhysicalSpace.hpp>
{
Grid &G =
B[0.0][
"UniformGrid" ];
RefPtr<Field> Coords = R[ FIBER_POSITIONS ];
RefPtr<ProcArray_t> PCrds = new ProcArray_t();
{
int X = 63,
Y = 61,
Z = 79;
PCrds->Components[0] =
new LinearArray<double>(-
B, 2*
B/(
X-1),
X);
PCrds->Components[1] =
new LinearArray<double>(-
B, 2*
B/(
Y-1),
Y);
PCrds->Components[2] =
new LinearArray<double>(-
B, 2*
B/(
Z-1),
Z);
}
Coords->setPersistentData( PCrds );
RefPtr<Field>&myField = G[ "ScalarField" ];
RefPtr<ScalarData3D_t> ScalarData = new ScalarData3D_t( PCrds->Size() );
ProcArray_t&P = *PCrds;
do
{
const Eagle::point3&Pt = P[ M ];
double S = Pt.x()*Pt.x()
+
Pt.y()*Pt.y()
+
Pt.z()*Pt.z();
ScalarArray[ M ] = S;
}
while( M.
inc( PCrds->Size() ) );
myField->setPersistentData ( ScalarData );
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
Convenience class that implements a pointer to a Bundle object but adds some useful member funtions t...
Definition Bundle.hpp:779
Chart object for cartesian coordinates.
Definition CartesianChart.hpp:15
Definition DirectProductArray.hpp:367
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
RefPtr< Chart > makeChart(const type_info &ChartType, const string &name={}, uint16_t epsg_code=0)
Make a chart on this grid with the given name, ie create one if not yet existent.
Definition Grid.cpp:272
Class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArray.hpp:34
Definition MultiArray.hpp:371
A multidimensional index that is automatically a lower-dimensional index via recursion.
Definition MultiIndex.hpp:449
bool inc(const MultiIndex &Dimens) noexcept
Increment the current index, if it is larger than the extent a given in the Dimensions parameter,...
Definition MultiIndex.hpp:830
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
Skeleton & makeVertices(int dims)
Create a Skeleton describing the vertices of a Grid.
Definition SkeletonMap.cpp:290
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2