6#ifndef __FIBER_DYNAMICSIZE_HPP
7#define __FIBER_DYNAMICSIZE_HPP
10#include <memcore/RefPtr.hpp>
11#include <memcore/Interface.hpp>
12#include <fiber/vector/MultiIndex.hpp>
45 for(Dims_t i=0; i<N; i++)
55 for(Dims_t i=0; i<N; i++)
69 for(Dims_t i=0; i<N; i++)
102 return !( (*this) !=
DS );
114 for(
int i=0; i<N; i++)
136 for(Dims_t i=0; i<N; i++)
148 bool hasIncompatibleLowerDims(
const DynamicSize&
DS)
const noexcept;
151 bool hasIncompatibleHigherDims(
const DynamicSize&
DS)
const noexcept;
154 bool hasCompatibleHigherDims(
const DynamicSize&
DS)
const noexcept
156 return !hasIncompatibleHigherDims(
DS);
183 bool hasCompatibleLowerDims(
const DynamicSize&
DS)
const noexcept
185 return !hasIncompatibleLowerDims(
DS);
204 index_t getNumberOfElements()
const
263 return nullptr != dims;
299 for(Dims_t i=0; i<
I; i++)
315 for(
int i=0; i<
rank; i++)
330 for(
int i=0; i<
rank; i++)
343 for(rank_t i=0; i<
rank; i++)
350 index_t *new_dims =
new index_t[D.rank];
351 for(rank_t i=0; i<D.rank; i++)
352 new_dims[i] = D.dims[i];
354 for(rank_t i=0; i<rank; i++)
355 new_dims[i] += dims[i];
363 for(rank_t i=0; i<D.rank; i++)
365 dims[i] += D.dims[i];
404 template <
typename T>
419 for(; i<MaxEntries; i++)
425 template <
typename T,
int N>
426 rank_t getDims(T(&Dims)[N])
const
428 return getDims(Dims, N);
441 for(Dims_t i=0; i<N; i++)
462 for(Dims_t i=0; i<N; i++)
472inline size_t ElementArraySize(
const DynamicSize&FragmentBaseSpaceDims,
const DynamicSize&DataFragmentDims)
noexcept
474 if (FragmentBaseSpaceDims.getNumberOfElements() == DataFragmentDims.getNumberOfElements())
477 if (DataFragmentDims.getRank() == FragmentBaseSpaceDims.getRank()+1 &&
478 DataFragmentDims.hasCompatibleHigherDims(FragmentBaseSpaceDims) )
480 return DataFragmentDims[ 0 ];
542 using DynamicSize::operator[];
543 using DynamicSize::operator!=;
544 using DynamicSize::operator=;
constexpr complex< _Tp > & operator+=(const complex< _Up > &)
constexpr complex< _Tp > & operator=(const _Tp &)
basic_string< char > string
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A class describing an n-dimensional space at runtime.
Definition field/DynamicSize.hpp:29
rank_t dimensionality() const
Dimensionality of the domain (same as rank).
Definition field/DynamicSize.hpp:228
bool changeSize(const MultiIndex< N > &MI)
Adjust size for lowest matching dimensions.
Definition field/DynamicSize.hpp:291
bool get(MultiIndex< N > &MI) const
Retrieve a dynamic size into a multidimensional index.
Definition field/DynamicSize.hpp:436
DynamicSize(const MultiIndex< N > &MI)
Initialize from a MultiIndex of certain dimension.
Definition field/DynamicSize.hpp:41
const index_t * dims_ptr() const
Return c pointer to dimension storage.
Definition field/DynamicSize.hpp:253
bool isValid() const
Check if some size has been defined here.
Definition field/DynamicSize.hpp:261
size_t getElementArraySize(const DynamicSize &DataFragmentDims) const noexcept
Given a base space (this), return the number of elements provided by the given data dims,...
Definition field/DynamicSize.hpp:167
DynamicSize & setSize(int N, const T values[])
Assign values from arbitrary type that is convertible into integers.
Definition field/DynamicSize.hpp:107
rank_t getRank() const
Dimensionality of the domain (same as rank).
Definition field/DynamicSize.hpp:220
DynamicSize(Dims_t N, index_t NValue)
Construct a dynamic size of N dimensions, but all extensions set to the given value.
Definition field/DynamicSize.hpp:63
MultiIndex< N > getSize() const
Provide the size stored here as a MultiIndex.
Definition field/DynamicSize.hpp:456
bool setSize(const DynamicSize &D, int FillUp=1) const
Set the size from another DynamicSize without changing the rank of this DynamicSize,...
Definition field/DynamicSize.hpp:382
bool multiply_dims(int incr)
Multiply each dimensional element by the same factor.
Definition field/DynamicSize.hpp:325
index_t nElements() const
How many elements here?
Definition field/DynamicSize.hpp:191
bool setSize(int i, index_t what)
Set the extension of this dimensional size in a certain dimension.
Definition field/DynamicSize.hpp:272
std::string str() const
Create textual version of this string.
Definition field/DynamicSize.cpp:114
bool increment_dims(int incr)
Increment each dimensional element by the same value.
Definition field/DynamicSize.hpp:310
bool operator==(const DynamicSize &DS) const noexcept
Equality Comparison.
Definition field/DynamicSize.hpp:100
index_t operator[](int i) const
Element access operator.
Definition field/DynamicSize.hpp:239
DynamicSize & resize(const MultiIndex< N > &MI)
Set a new size from the given MultiIndex.
Definition field/DynamicSize.hpp:129
DynamicSize()=default
Empty default constructor, zero rank.
rank_t Rank() const
Dimensionality of the domain (same as rank).
Definition field/DynamicSize.hpp:212
DynamicSize(Dims_t N, const T values[])
Assign values from arbitrary type that is convertible into integers.
Definition field/DynamicSize.hpp:51
An interface telling size and dimensionality of a dataset, a refcounted version of DynamicSize.
Definition field/DynamicSize.hpp:500
SizeInterface(int N, const T values[])
Assign values from arbitrary type that is convertible into integers.
Definition field/DynamicSize.hpp:519
SizeInterface(const MultiIndex< N > &MI)
Create from multidimensional index.
Definition field/DynamicSize.hpp:508
SizeInterface(int N)
Create size interface of N dimensions with zero extension.
Definition field/DynamicSize.hpp:526
SizeInterface()
Default constructor.
Definition field/DynamicSize.hpp:531
SizeInterface(const DynamicSize &DS)
Create from given dynamic size.
Definition field/DynamicSize.hpp:513
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
IndexTypeConfig< sizeof(void *)>::index_t index_t
Define the index type as according to the size of a pointer, i.e.
Definition Index.hpp:22
std::string to_string(const span< char > &s)
VAcceptInfoList_t operator+(VAcceptInfoList_t &&l, VAcceptInfoList_t &&r)
bool operator!=(const MultipleStringSelection &a, const MultipleStringSelection &b)