1#ifndef __FIBER_GRID_REPRESENTATION_HPP
2#define __FIBER_GRID_REPRESENTATION_HPP "Created 27.02.2001 21:42:27 by werner"
5#include <fiber/field/Field.hpp>
7#include <memcore/TypeInfo.hpp>
11#include "FiberSpace.hpp"
12#include <fiber/field/BaseSpace.hpp>
13#include "RepresentationMap.hpp"
22constexpr const char FIBER_POSITIONS[] =
"Positions";
25class GRID_API Representation;
28#define FIBER_MAP_TO_MAP
39 const string myFieldname;
49 const string &theFieldname,
73 return FieldPtr.valid();
98#ifdef FIBER_MAP_TO_MAP
106#ifdef FIBER_MAP_TO_MAP
107 using RepresentationMap::operator[];
108 using RepresentationMap::makeRepresentation;
109 using RepresentationMap::operator();
112 unsigned long RenameOperations = 0, RemovalOperations = 0;
114static constexpr unsigned long MaxOperations = -22U;
128 void extremeUnction()
override;
152 bool removeField(
const string&name);
199 bool checkIfFieldSizeIsIncompatible(
const RefPtr<Field>&FieldPtr);
202 bool AdjustAndCheckSkeletonSize(
Field&
P,
const string&FieldName);
217 void own(
Field&)
const;
245 return makeField( makeFieldID(name) );
248#ifdef FIBER_MAP_TO_MAP
261 return Field::NullPtrField();
263 return findField(
fid );
268 return findField(
string(name) );
271 template <
class FieldNameContainer>
272 const RefPtr<Field>&findField(
const FieldNameContainer&FieldNames)
const
274 for(
const auto&f : FieldNames)
276 if (
const auto&F = findField(f) )
279 return Field::NullPtrField();
291 return findField( name );
296 return findField( name );
299 const RefPtr<Field>&operator()(
const FieldID&fid)
const
301 return findField( fid );
305 const RefPtr<Field>&operator()(
const RefPtr<FieldID>&f)
const;
307 template <
class FieldNameContainer>
308 const RefPtr<Field>&operator()(
const FieldNameContainer&FieldNames)
const
310 return findField( FieldNames );
323 return F->getCreator(f);
332 return F->getCreatorByName(FragmentName);
340 return Field::NullPtrField();
394 template <
class Data, Dims_t Dims>
405 template <
class T, Dims_t N>
436 template <
class Data, Dims_t Dims>
446 template <
class T, Dims_t N>
493 [[deprecated(
"Use modern version with lambda functions instead.")]]
513 return iterate_fields(F);
521 return iterate_fields(F);
528 [[deprecated(
"Just use iterate().")]]
531 return iterate_fields(F);
572 int iterate(
const iterate_all_t&f)
const
574 return iterate_all(f);
578 template <
class Functor>
579 [[deprecated(
"Use iterate_all() with functor instead")]]
580 int Iterate_all(
const Functor&F)
const
605 return iterate( [&F](
const FieldID&theFieldID,
const Field&theField)
607 theField.iterate( [&F,&theFieldID,&theField](
const RefPtr<FragmentID>&fid,
608 const RefPtr<CreativeArrayBase>&CAB)
610 return F( theFieldID, theField, CAB, fid);
633 RefPtr<FragmentIDCollection> getFragmentIDCollection()
const override;
644 void Speak(
int indent=0,
int maxindent=-1)
const;
649 void createLinkedFields(
const Representation& linked_from );
671template <
class Functor>
702template <
class Functor>
712template <
class Functor>
718 return R->iterate(F);
strong_ordering operator(const error_code &__lhs, const error_code &__rhs) noexcept
constexpr complex< _Tp > & operator=(const _Tp &)
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp __func(_Tp)) const
Base class for spaces that may be used for mapping domains to fiber spaces.
Definition BaseSpace.hpp:38
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
Base class for fields defined on some base space.
Definition FiberSpace.hpp:33
Identifier for Fields within a Grid.
Definition FieldID.hpp:53
Class for iterating over fields, in particular those contained in a Representation object.
Definition FieldID.hpp:134
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
Convenience base class.
Definition FragmentIDCollection.hpp:153
Implementation of an Iterator to a sequence of elements, which might be contiguous or a projection of...
Definition vector/Iterator.hpp:525
T & operator[](index_t i) const
Access an element of the array, writeable.
Definition vector/Iterator.hpp:712
Constant Iterator base class to inspect all representations in a given RepresentationMap.
Definition RepresentationMap.hpp:124
A map that associates Representer objects with Representation instances.
Definition RepresentationMap.hpp:41
int iterate(ConstIterator &) const
Inspect all elements of this map.
Definition RepresentationMap.cpp:185
int iterate_all(const Functor &F) const
Definition Representation.hpp:672
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
int iterate_m(const iterator_t &F) const
Functor iterator with non-constant, modifyable field.
Definition Representation.hpp:529
void operator=(const Representation &)=delete
Prevent accidental copy assignment.
int iterate(const iterator_t &F) const
Functor iterator.
Definition Representation.hpp:519
const RefPtr< Field > & operator()(const string &name) const
Operator interface to the findField function.
Definition Representation.hpp:289
FieldProxy operator[](const string &name)
Make a field reference from a string, field ID is created if not yet existent.
Definition Representation.hpp:243
const RefPtr< Field > & Positions() const
Get the positions component of this Representation object.
Definition Representation.hpp:336
int iterate(FieldIterator &FI) const
Iterate over all fields in this Representation.
Definition Representation.cpp:548
bool setField(const string &Fieldname, const MemCore::WeakPtr< MemArray< N, T > > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set an unfragmented field direcly from a MemArray.
Definition Representation.hpp:447
bool setPositions(const MemCore::RefPtr< MemBase > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set unfragmented positions directly from some MemBase.
Definition Representation.hpp:416
const RefPtr< Field > & findField(const string &name) const
Retrieve a field by its name; usually fields should be retrieved via their field identifier instead,...
Definition Representation.hpp:257
bool setPositions(const MemCore::RefPtr< CreativeArrayBase > &CrecRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set unfragmented positions directly from some CreativeArrayBase.
Definition Representation.hpp:426
bool setPositions(const MemCore::WeakPtr< MemArray< N, T > > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set unfragmented positions directly from some MemArray.
Definition Representation.hpp:406
bool setField(const string &Fieldname, const MemCore::RefPtr< CreativeArrayBase > &CrecPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set an unfragmented field direcly from a CreativeArrayBase.
Definition Representation.hpp:468
std::function< bool(const FieldID &, Field &)> iterator_t
Note that an iterator_t can be implicitly cast into an const_iterator_t, thus functions taking an ite...
Definition Representation.hpp:502
FieldProxy operator[](const RefPtr< FieldID > &f)
Return reference to the internally stored Field pointer, which may be overwritten by the caller.
Definition Representation.hpp:234
Representation(const Representation &)=delete
Prevent accidental copy construction.
RefPtr< CreativeArrayBase > operator()(const string &name, const RefPtr< FragmentID > &f)
Shortcut function: Checks if a field exist, and if so, retrieves the data that are associated with a ...
Definition Representation.hpp:317
bool setField(const string &Fieldname, const MemCore::RefPtr< MemBase > &MemRefPtr, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set an unfragmented field direcly from a MemBase.
Definition Representation.hpp:457
bool setPositions(const Data &D, const MultiIndex< Dims > &Size, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set unfragmented positions directly from some data set, e....
Definition Representation.hpp:395
bool setField(const string &Fieldname, const Data &D, const MultiIndex< Dims > &Size, const RefPtr< FragmentIDCollection > &theFragmentIDCollection=nullptr)
Convenience function to set an unfragmented field direcly from some data that can be used for constuc...
Definition Representation.hpp:437
int iterate_const_fields(const const_iterator_t &F) const
Functor iterator with constant field.
Definition Representation.hpp:511
int iterate_all(const iterate_all_t &f) const
Definition Representation.hpp:557
const RefPtr< Field > & getPositions() const
Get the positions component of this Representation object.
Definition Representation.hpp:346
Field & operator[](const FieldID &f)
Return a Field for the given ID.
Definition Representation.hpp:225
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
MemCore::WeakPtr< VRenderContext::RenderParameter > operator<<=(const Anemone_Context_String_t &ACS, const Value &V)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
gridop_API RefPtr< Grid > DEPRECATED("Use grid/types/RegularGrid3D.hpp:UniformGrid3D instead", createUniformGrid(const string &InputGridname, const Info< Skeleton > &Level, const string &OutputGridname, const MultiIndex< 3 > &Resolution, const RefPtr< Eagle::BoundingBox > &SubBox=NullPtr()))
Create a uniform Grid from a given Grid.
A proxy object that looks like a RefPtr<Field> but equips fields with a FieldCreator and a FragmentID...
Definition Representation.hpp:37