FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FiberTypeBase.hpp
1#ifndef __FIBERTYPEBASE_HPP
2#define __FIBERTYPEBASE_HPP "Created 27.02.2001 21:42:27 by werner"
3
4#include "FieldAPI.h"
5
6#include <meta/LIST.hpp>
7#include <eagle/MetaInfo.hpp>
8#include <memcore/RefPtr.hpp>
9#include <memcore/Interface.hpp>
10#include <memcore/typemap.hpp>
11#include <memcore/stringlist.hpp>
12#include <memcore/Chunk.hpp>
13
14#include <assert.h>
15#include <string>
16
17#include "FiberTypeIndex.hpp"
18
19
23namespace Fiber
24{
25
32 , public MemCore::ReferenceBase<FiberTypeBase>
33{
34public:
36// MemCore::Interface<FiberTypeBase>::reference_domain_t>;
37
46
47 bool remember();
48
49 virtual ~FiberTypeBase();
50
54 virtual const std::type_info&getType() const = 0;
55
56 virtual bool isType(const std::type_info&theType) const = 0;
57
58 template <class ...T>
59 bool isType() const
60 {
61 return (isType(typeid(T)) or ...);
62 }
63
67 virtual MemCore::RefPtr<MemCore::ChunkBase> newChunk(size_t N) const = 0;
68
74 unsigned multiplicity() const
75 {
77 }
78
79
83 unsigned mem_size() const
84 {
86 }
87
93 using FiberTypeIndex::value_type_size;
94
102 int rank() const
103 {
105 }
106
110 int grade() const
111 {
113 }
114
120 virtual int element_index(const int i[]) const = 0;
121
129 unsigned array_element_size() const
130 {
132 }
133
134
135 virtual WeakPtr_t element_type() const = 0;
136
140 virtual std::string coordinate_component_name(int i) const = 0;
141
142 virtual const std::type_info&chart_type() const = 0;
143
144 std::string chart_name() const
145 {
147 }
148
156 std::string component_name(unsigned ComponentId) const;
157
159 int chart_dimension() const
160 {
162 }
163
165 virtual int indexing_scheme(int i) const = 0;
166
168 bool is_lower_index(int i) const
169 {
170 return indexing_scheme(i)<0;
171 }
172
174 bool is_upper_index(int i) const
175 {
176 return indexing_scheme(i)>0;
177 }
178
179 virtual const char*nontensor() const = 0;
180
181 std::string description() const;
182
183 const FiberTypeIndex&getFiberTypeIndex() const
184 {
185 return *this;
186 }
187
188static WeakPtr_t find(const FiberTypeIndex&FTI);
189static WeakPtr_t find(const std::type_info&T);
190
191#if (__cplusplus == 201703L)
192#pragma message "Compiling with C++17 does not allow for fibertype comparisons."
193#else
194 auto operator<=>(const FiberTypeBase&FTB) const
195 {
196 return FiberTypeIndex::operator<=>(FTB);
197 }
198
199 auto operator==(const FiberTypeBase&FTB) const
200 {
201 return FiberTypeIndex::operator==(FTB);
202 }
203#endif
204
205 void speak() const;
206};
207
208
209
210
211} /* namespace Fiber */
212
213namespace std
214{
215
217FIELD_API string to_string(const Fiber::FiberTypeBase&);
218
219}
220
221
222#endif /* __FIBERTYPEBASE_HPP */
constexpr _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp &__val)
basic_string< char > string
constexpr auto operator<=>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const _CharT *__rhs) noexcept -> decltype(__detail::__char_traits_cmp_cat< _Traits >(0))
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Abstract procedural description of a data element which may be used to construct arrays and fields.
Definition FiberTypeBase.hpp:33
virtual int indexing_scheme(int i) const =0
unsigned array_element_size() const
The size of an array element in memory if this type is an array.
Definition FiberTypeBase.hpp:129
unsigned multiplicity() const
How many atomic elements construct this type.
Definition FiberTypeBase.hpp:74
bool is_lower_index(int i) const
Definition FiberTypeBase.hpp:168
virtual std::string coordinate_component_name(int i) const =0
Return the textual naming scheme of the ith coordinate.
int grade() const
Grade of multivectors.
Definition FiberTypeBase.hpp:110
FiberTypeBase(const FiberTypeIndex &FTI)
Definition FiberTypeBase.hpp:42
virtual MemCore::RefPtr< MemCore::ChunkBase > newChunk(size_t N) const =0
Allocate a MemCore::Chunk with the given number of elements.
virtual int element_index(const int i[]) const =0
Information about the organization of elements of a multi-ranked object.
int rank() const
For tensorial objects, specify the rank.
Definition FiberTypeBase.hpp:102
unsigned mem_size() const
How many bytes this object occupies in memory.
Definition FiberTypeBase.hpp:83
bool is_upper_index(int i) const
Definition FiberTypeBase.hpp:174
virtual const std::type_info & getType() const =0
Type ID for this type.
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
std::string to_string(const span< char > &s)
bool operator==(const MultipleStringSelection &a, const MultipleStringSelection &b)
STL namespace.
Definition FiberTypeIndex.hpp:12
auto operator<=>(const FiberTypeIndex &) const =default
https://en.cppreference.com/w/cpp/language/default_comparisons https://devblogs.microsoft....
unsigned multiplicity
How many atomic elements construct this type.
Definition FiberTypeIndex.hpp:18
unsigned array_element_size
The size of an array element in memory if the type is an array.
Definition FiberTypeIndex.hpp:52
std::string chart_name
Return the textual naming scheme of the ith coordinate.
Definition FiberTypeIndex.hpp:64
int chart_dimension
A textual description for each member, as derived from the coordinate's component names,...
Definition FiberTypeIndex.hpp:76
int rank
For tensorial objects, specify the rank.
Definition FiberTypeIndex.hpp:32
unsigned mem_size
How many bytes this object occupies in memory.
Definition FiberTypeIndex.hpp:23
int grade
Grade of multivectors.
Definition FiberTypeIndex.hpp:46