SheafSystem  0.0.0.0
ijk_product_structure.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef IJK_PRODUCT_STRUCTURE_H
22 #define IJK_PRODUCT_STRUCTURE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ABSTRACT_PRODUCT_STRUCTURE_H
29 #include "SheafSystem/abstract_product_structure.h"
30 #endif
31 
32 #ifndef POD_TYPES_H
33 #include "SheafSystem/pod_types.h"
34 #endif
35 
36 namespace sheaf
37 {
38 
43 {
44 
45  // ===========================================================
47  // ===========================================================
49 
50 public:
51 
56 
61 
65  ijk_product_structure& operator=(const ijk_product_structure& xother);
66 
70  virtual ~ijk_product_structure();
71 
72 protected:
73 
78 
82  size_type _i_ub;
83 
88 
93 
94 private:
95 
97 
98 
99  // ===========================================================
101  // ===========================================================
103 
104 public:
105 
110  virtual ijk_product_structure* clone() const;
111 
115  virtual ijk_product_structure& operator=(const abstract_product_structure& xother);
116 
120  virtual bool operator==(const abstract_product_structure& xother) const;
121 
122 protected:
123 
124 private:
125 
127 
128 
129  // ===========================================================
131  // ===========================================================
133 
134 public:
135 
139  virtual size_type d() const;
140 
144  virtual size_type ub(pod_type xi) const;
145 
149  size_type i_ub() const;
150 
154  size_type j_ub() const;
155 
159  size_type k_ub() const;
160 
164  void ordinal(pod_type xi, pod_type xj, pod_type xk, pod_type& xordinal) const;
165 
169  virtual void ordinal(pod_type* xtuple, pod_type& xordinal) const;
170 
174  void tuple(pod_type xordinal, pod_type& xi, pod_type& xj, pod_type& xk) const;
175 
179  virtual void tuple(pod_type xordinal, pod_type* xtuple) const;
180 
184  void put_ubs(size_type xi_ub, size_type xj_ub, size_type xk_ub);
185 
189  virtual void put_ubs(size_type* xubs);
190 
191 protected:
192 
193 private:
194 
196 
197 
198  // ===========================================================
200  // ===========================================================
202 
203 public:
204 
208  virtual bool is_ancestor_of(const any *other) const;
209 
213  virtual bool invariant() const;
214 
215 protected:
216 
217 private:
218 
220 
221 };
222 
223 // ===========================================================
224 // NON-MEMBER FUNCTIONS
225 // ===========================================================
226 
231  pod_index_type x1,
232  pod_index_type x2,
233  pod_index_type x1_end,
234  pod_index_type x2_end)
235 {
236  return (x0*x1_end+x1)*x2_end + x2;
237 };
238 
242 inline void tuple(pod_index_type x,
243  pod_index_type x1_end,
244  pod_index_type x2_end,
245  pod_index_type& x0,
246  pod_index_type& x1,
247  pod_index_type& x2)
248 {
249  // x == (x0*x1_end + x1)*x2_end + x2;
250 
251  x2 = x % x2_end;
252 
253  x /= x2_end;
254 
255  // now x = x0*x1_end + x1.
256 
257  x1 = x % x1_end;
258  x0 = x / x1_end;
259 };
260 
264 SHEAF_DLL_SPEC
265 size_t deep_size(const ijk_product_structure& xn, bool xinclude_shallow = true);
266 
267 } // end namespace sheaf
268 
269 #endif // ifndef IJK_PRODUCT_STRUCTURE_H
A 3D implementation of abstract_product_structure.
An abstract class that defines the product structure for an id space.
pod_index_type ordinal(pod_index_type xi, pod_index_type xj, size_type xj_ub)
2-tuple to ordinal conversion.
Abstract base class with useful features for all objects.
Definition: any.h:39
size_type _k_ub
The upper bound in the k-direction.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
pod_index_type pod_type
The "plain old data" index type for this.
ijk_product_structure()
Default constructor; disabled.
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
size_type _j_ub
The upper bound in the j-direction.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
void tuple(pod_index_type x, size_type xj_ub, pod_index_type &xi, pod_index_type &xj)
Ordinal to 2-tuple conversion.