SheafSystem  0.0.0.0
ij_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 IJ_PRODUCT_STRUCTURE_H
22 #define IJ_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 
42 class SHEAF_DLL_SPEC ij_product_structure : public abstract_product_structure
43 {
44 
45  // ===========================================================
47  // ===========================================================
49 
50 public:
51 
56 
61 
65  ij_product_structure& operator=(const ij_product_structure& xother);
66 
70  virtual ~ij_product_structure();
71 
72 protected:
73 
78 
82  size_type _i_ub;
83 
88 
89 private:
90 
92 
93 
94  // ===========================================================
96  // ===========================================================
98 
99 public:
100 
105  virtual ij_product_structure* clone() const;
106 
110  virtual ij_product_structure& operator=(const abstract_product_structure& xother);
111 
115  virtual bool operator==(const abstract_product_structure& xother) const;
116 
117 protected:
118 
119 private:
120 
122 
123 
124  // ===========================================================
126  // ===========================================================
128 
129 public:
130 
134  virtual size_type d() const;
135 
139  virtual size_type ub(pod_type xi) const;
140 
144  size_type i_ub() const;
145 
149  size_type j_ub() const;
150 
154  void ordinal(pod_type xi, pod_type xj, pod_type& xordinal) const;
155 
159  virtual void ordinal(pod_type* xtuple, pod_type& xordinal) const;
160 
164  void tuple(pod_type xordinal, pod_type& xi, pod_type& xj) const;
165 
169  virtual void tuple(pod_type xordinal, pod_type* xtuple) const;
170 
174  void put_ubs(size_type xi_ub, size_type xj_ub);
175 
179  virtual void put_ubs(size_type* xubs);
180 
181 protected:
182 
183 private:
184 
186 
187 
188  // ===========================================================
190  // ===========================================================
192 
193 public:
194 
198  virtual bool is_ancestor_of(const any *other) const;
199 
203  virtual bool invariant() const;
204 
205 protected:
206 
207 private:
208 
210 
211 };
212 
213 // ===========================================================
214 // NON-MEMBER FUNCTIONS
215 // ===========================================================
216 
221  pod_index_type xj,
222  size_type xj_ub)
223 {
224  return xi*xj_ub+xj;
225 };
226 
230 inline void tuple(pod_index_type x,
231  size_type xj_ub,
232  pod_index_type& xi,
233  pod_index_type& xj)
234 {
235  // x = xi*xj_ub + xj.
236 
237  xj = x % xj_ub;
238  xi = x / xj_ub;
239 };
240 
244 SHEAF_DLL_SPEC
245 size_t deep_size(const ij_product_structure& xn, bool xinclude_shallow = true);
246 
247 } // end namespace sheaf
248 
249 #endif // ifndef IJ_PRODUCT_STRUCTURE_H
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
ij_product_structure()
Default constructor; disabled.
size_type _j_ub
The upper bound in the j-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.
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.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
A 2D implementation of abstract_product_structure.
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.