1#ifndef __FIBER_REGULARLY_FRAGMENTED_FIELD_HPP
2#define __FIBER_REGULARLY_FRAGMENTED_FIELD_HPP
6#include "DynamicSize.hpp"
25template <Dims_t DIMS=3>
42 <<
" with linear index "
48 if (
int(
FragNumber.linear( myNumberOfFragments ) ) !=
51 Verbose(0) <<
" Multidimensional fragment index "
53 <<
" does not match numerical fragment ID"
63 using Field::operator();
64 using Field::operator[];
74 Assert( this->getFragmentIDCollection() );
76 if (! this->getFragmentIDCollection()->getFragmentLayout().isValid() )
91 RegularlyFragmentedField(
const MultiIndex<DIMS>&FragmentNumbers,
92 const WeakPtr<Field>&SimilarField,
93 const string&FragmentNamePrefix)
94 :
Field( SimilarField )
95 , myNumberOfFragments( FragmentNumbers )
101 Assert(
false &&
"cannot set fragment layout of virginal field!?");
108 const RefPtr<FragmentIDCollection>&theFragmentIDCollection,
109 const string&FragmentNamePrefix)
110 :
Field(theFragmentIDCollection)
111 , myNumberOfFragments( FragmentNumbers )
113 if (!theFragmentIDCollection)
116 Assert(
false &&
"cannot set fragment layout of virginal field!?");
123 const MultiIndex<DIMS>&getNumberOfFragments()
const
125 return myNumberOfFragments;
144static RefPtr<RegularlyFragmentedField>
162 !=
FC->NumberOfFragmentIDs() )
203 :
Field(
RFF.getFragmentIDCollection() )
204 , myNumberOfFragments(
RFF.myNumberOfFragments )
223 if (
I[i] >= myNumberOfFragments[i])
241 return getCreatorReferenceViaFragmentIndex(
FragNumber );
288 return newRegularFragmentationArray();
294 return "<REGULARLYFRAGMENTIONDIMENSIONS>" +
std::to_string(
int(DIMS)) +
295 "</REGULARLYFRAGMENTIONDIMENSIONS>\n"
306extern FIELD_API RefPtr<Field> newRegularlyFragmentedField(
const DynamicSize&Sz);
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
bool validate(FragmentIndex_t FragmentNumber) const
Check if a given fragment number is valid within this field.
Definition Field.cpp:419
Field()
Default constructor, no data or fragments.
Definition Field.cpp:122
RefPtr< FragmentID > & makeFragmentID(const string &fragmentname)
Create a new fragment ID if not existent yet.
Definition Field.cpp:386
RefPtr< MemBase > newFragmentationArray() const
For fields with a fragment layout provide such in a MultiArray.
Definition Field.cpp:1467
bool setFragmentLayout(const MultiIndex< DIMS > &NumberOfFragments, const string &FragmentNamePrefix)
Add a multi-dimensional regular layout for the fragments if it had no layout yet.
Definition Field.hpp:394
A convenience class for optimized handling of fields that are fragmented in a regular manner (n-dimen...
Definition RegularlyFragmentedField.hpp:27
RefPtr< FragmentID > getFragmentID(const MultiIndex< DIMS > &I) const
Get the associated FragmentID.
Definition RegularlyFragmentedField.hpp:216
static RefPtr< RegularlyFragmentedField > newField(const MultiIndex< DIMS > &FragmentNumbers, const WeakPtr< Field > &SimilarField, const string &FragmentNamePrefix="RegularFragment")
Create a new regularly fragmented Field from an existing Field that is sufficiently fragmented.
Definition RegularlyFragmentedField.hpp:145
RegularlyFragmentedField(const MultiIndex< DIMS > &FragmentNumbers, const string &FragmentNamePrefix="RegularFragment")
Create a field that consists out of a regular distribution of fragments.
Definition RegularlyFragmentedField.hpp:70
static RefPtr< RegularlyFragmentedField > newField(const MultiIndex< DIMS > &FragmentNumbers, const RefPtr< FragmentIDCollection > &theFragmentIDCollection, const string &FragmentNamePrefix="RegularFragment")
Create a regularly fragmented Field from a multidimensional size and an existing fragment ID collecti...
Definition RegularlyFragmentedField.hpp:178
RefPtr< CreativeArrayBase > & operator[](const MultiIndex< DIMS > &I)
Return a writable pointer with the data container for this multiindex.
Definition RegularlyFragmentedField.hpp:238
bool validate(const MultiIndex< DIMS > &I) const
Check if the given multidimensional index is valid.
Definition RegularlyFragmentedField.hpp:209
RefPtr< CreativeArrayBase > operator()(const MultiIndex< DIMS > &I) const
Search for a fragment, return NullPtr if no such fragment is contained in this field.
Definition RegularlyFragmentedField.hpp:253
RegularlyFragmentedField(const RegularlyFragmentedField &RFF)
Create a new regularly fragmented field from the same fragmentation as the given field.
Definition RegularlyFragmentedField.hpp:202
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
string to_string(const Eagle::FixedArray< ElementType, N > &A, const char *OpenBrace="{", const char *CloseBrace="}", const char *Separator=",")