AFF --- A container for numbers (array) by Friederich and Forbriger.

◆ setup_from_size()

void aff::Strided::setup_from_size ( const TSizeVec size,
const Tsubscript first = 1,
const Tsubscript shift = 0 
)
private

setup to given size and first index

Definition at line 75 of file strided.cc.

References AFF_assert, calculate_base(), first(), aff::inline_anylarger(), Mfirst, Mlast, Mmax_dimen, Mstride, shift(), and size().

Referenced by Strided().

78  {
79  TSizeVec one(1);
81  "ERROR (Strided::setup_from_size): size must be at least one");
82  Mfirst=first;
83  Mstride[0]=1;
84  Mlast[0]=Mfirst[0]+size[0]-1;
85  for(Tdim i=1; i<Mmax_dimen; i++)
86  {
87  Mstride[i]=Mstride[i-1]*size[i-1];
88  Mlast[i]=Mfirst[i]+size[i]-1;
89  }
91  }
TIndexVec Mlast
Definition: strided.h:288
const TIndexVec & first() const
return vector of first index values
Definition: strided.h:206
Strided & shift(const Tdim &i, const Tsubscript &index)
shift
Definition: strided.cc:250
bool inline_anylarger(const SimpleRigidArray< T, N > &A, const SimpleRigidArray< T, N > &B)
Returns true if any of A is larger than corresponding B.
Definition: simplearray.h:194
static const Tdim Mmax_dimen
instantiate static member (otherwise the linker won&#39;t find it)
Definition: strided.h:123
SimpleRigidArray< Tsize, Mmax_dimen > TSizeVec
type of size and stride array (always positive)
Definition: strided.h:126
#define AFF_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:162
void calculate_base(const Tsubscript &offset)
construct do given first and last index
Definition: strided.cc:128
Tsize size() const
total number of mapped elements
Definition: strided.cc:140
TSizeVec Mstride
Definition: strided.h:286
unsigned short int Tdim
Type to hold an array dimensionality.
Definition: types.h:49
TIndexVec Mfirst
Definition: strided.h:287
Here is the call graph for this function:
Here is the caller graph for this function: