FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
RepresentationMap.hpp
1#ifndef __FIBER_GRID_REPRESENTATIONMAP_HPP
2#define __FIBER_GRID_REPRESENTATIONMAP_HPP "Created 16.07.2009 19:45:27 by werner"
3
4#include "GridAPI.h"
5#include <fiber/field/Field.hpp>
6#include "FieldID.hpp"
7#include <memcore/TypeInfo.hpp>
8#include <set>
9#include <list>
10#include <mutex>
11
12#include "FiberSpace.hpp"
13#include <fiber/field/BaseSpace.hpp>
14
15namespace Fiber
16{
17 using MemCore::WeakPtr;
18 using MemCore::NullPtr;
19 using std::set;
20 using std::list;
21
29
31
34
35
41{
43 Representations_t Representations;
44
45mutable std::recursive_mutex RepresentationsMutex;
46
47public:
48
51
52 void clear();
53
54 RefPtrRepresentation_t makeRepresentation(const Representer&D);
55
58
60 {
61 const Representer&R = D.self();
62 return (*this)[R];
63 }
64
66 RefPtrRepresentation_t findRepresentation(const Representer&D) const;
67
69 RefPtrRepresentation_t findRepresentation(const BaseSpace&D);
70
72 RefPtrRepresentation_t operator()(const Representer&D) const;
73
75 RefPtrRepresentation_t operator()(const BaseSpace&D);
76
77 int DataRank() const;
78
84 RefPtr<SizeInterface> getSize() const;
85 RefPtr<SizeInterface> getFragmentSize(const RefPtr<FragmentID>&Fid) const;
86
87
89 int size() const;
90
93 {
94 return size();
95 }
96
103 RefPtr<FragmentIDCollection> getFragmentIDCollection() const override;
104
106 getFragmentIDCollectionRepresentation() const;
107
108 RefPtr<FragmentID> findFragmentIDByName(const std::string&FragmentName) const
109 {
110 if (RefPtr<FragmentIDCollection> FIC = getFragmentIDCollection() )
111 return FIC->findFragmentIDByName(FragmentName);
112
113 return nullptr;
114 }
115
116 DynamicSize getFragmentLayout() const;
117
124 {
125 public:
126 virtual ~ConstIterator();
127
128 virtual bool apply(const Representer&d, const Representation&R) = 0;
129 };
130
137 {
138 public:
139 virtual ~Iterator();
140
141 virtual bool apply(const Representer&d, Representation&R) = 0;
142 };
143
147 int iterate(ConstIterator&) const;
148
152 int iterate(Iterator&);
153
155 int iterate(const std::function<bool(const Representer&, const Representation&)>&F) const;
156
158 int iterate(const std::function<bool(const Representer&, Representation&)>&F);
159
176 template <class Functor>
178 {
179 struct MyF : ConstIterator
180 {
181 const Functor&f;
182 MyF(const Functor&F)
183 : f(F)
184 {}
185
186 bool apply(const Representer&theRepresenter, const Representation&R) override
187 {
188 return f(theRepresenter,R);
189 }
190 }
191 mf(F);
192 return iterate(mf);
193 }
194
208 template <class Functor>
209 inline int iterate_all(const Functor&F) const;
210
214 int getMemoryUsage(memsize_t&UsedMemory, memsize_t&WantedMemory) const;
215
216
220 void Speak(int indent=0, int maxindent=-1) const;
221
222 string xml() const;
223
224
225#ifdef __ALLOW_DEPRECATED_FUNCTIONS
226
236 [[deprecated("Try to avoid code that relies on a unique representation")]]
238
247 [[deprecated("Try to avoid relying on a first representation as the result is quite random")]]
249#endif
250
251};
252
253
254} /* namespace Fiber */
255
256#endif /* __FIBER_GRID_REPRESENTATIONMAP_HPP */
valarray< size_t > size() const
_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
Convenience base class.
Definition FragmentIDCollection.hpp:153
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
Mutable Iterator base class to inspect all representations in a given RepresentationMap.
Definition RepresentationMap.hpp:137
A map that associates Representer objects with Representation instances.
Definition RepresentationMap.hpp:41
int iterate_representations(const Functor &F) const
Definition RepresentationMap.hpp:177
int getNumberOfRepresentations() const
Return the number of representations available here.
Definition RepresentationMap.hpp:92
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
WeakPtr< BaseSpace > Representer
The type used to reference other objects, which is the anchor of representations of a Skeleton.
Definition RepresentationMap.hpp:28
std::nullptr_t NullPtr