Demonstration how to equip a multidimensional array with on-demand creation of data slices.
Demonstration how to equip a multidimensional array with on-demand creation of data slices. This function will output the following information:
(3000 3001 3002 3003 3004 3005 3006 )(3007 3008 3009 3010 3011 3012 3013 )(3014 3015 3016 3017 3018 3019 3020 )
Full 3D array, slices created on demand:
(0 1 2 3 4 5 6 )(7 8 9 10 11 12 13 )(14 15 16 17 18 19 20 )
(1000 1001 1002 1003 1004 1005 1006 )(1007 1008 1009 1010 1011 1012 1013 )(1014 1015 1016 1017 1018 1019 1020 )
(2000 2001 2002 2003 2004 2005 2006 )(2007 2008 2009 2010 2011 2012 2013 )(2014 2015 2016 2017 2018 2019 2020 )
(3000 3001 3002 3003 3004 3005 3006 )(3007 3008 3009 3010 3011 3012 3013 )(3014 3015 3016 3017 3018 3019 3020 )
(4000 4001 4002 4003 4004 4005 4006 )(4007 4008 4009 4010 4011 4012 4013 )(4014 4015 4016 4017 4018 4019 4020 )
#include <vector/MultiArray.hpp>
{
public:
{
SliceData.resize( DataSpace.
maxidx() );
for(int i=0; i<SliceData.size(); i++)
SliceData[i] = 0;
}
{
double *d = SliceData[ slice_index ];
index_t length = DataSpace.
subidx().size();
if (!d)
{
d = new double[ length ];
SliceData[ slice_index ] = d;
for(int i=0; i<length; i++)
{
d[i] = 1000*slice_index + i;
}
}
}
{
for(int i=0; i < SliceData.size(); i++)
delete [] SliceData[i];
}
{
if (Dim==2)
{
}
}
double&getElement(index_t) override
{
}
};
int DataCreatorExample()
{
cout <<
" Full 3D array, slices created on demand:" <<
endl;
return 1;
}
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Implementation of an Iterator to a sequence of elements, which might be contiguous or a projection of...
Definition vector/Iterator.hpp:525
A recursively defined multidimensional index.
Definition MultiIndex.hpp:331
constexpr const MultiIndex< Dims-1 > & subidx() const noexcept
Return associated constant dimensionator of one dimension less.
Definition MultiIndex.hpp:615
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Definition CreativeIterator.hpp:84
Definition CreatorExample.cpp:25