SheafSystem  0.0.0.0
standard_member_hack_crg_interval.cc
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 #include "SheafSystem/standard_member_hack_crg_interval.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/explicit_index_space_interval.h"
25 #include "SheafSystem/factory.h"
26 #include "SheafSystem/index_space_family.h"
27 #include "SheafSystem/index_space_iterator.h"
28 
29 using namespace std;
30 
31 // ===========================================================
32 // STANDARD_MEMBER_HACK_CRG_INTERVAL FACET
33 // ===========================================================
34 
35 // PUBLIC DATA MEMBERS
36 
39 {
40  // Preconditions:
41 
42  // Body:
43 
44  // Postconditions:
45 
46  ensure(invariant());
47  ensure(!is_initialized());
48 }
49 
52 {
53  // Preconditions:
54 
55  // Body:
56 
57  // Postconditions:
58 
59  // Exit:
60 
61  return;
62 }
63 
64 // PROTECTED DATA MEMBERS
65 
66 // PRIVATE DATA MEMBERS
67 
68 
69 // ===========================================================
70 // EXPLICIT_CRG_INTERVAL FACET
71 // ===========================================================
72 
73 // PUBLIC DATA MEMBERS
74 
75 // PROTECTED DATA MEMBERS
76 
77 // PRIVATE DATA MEMBERS
78 
79 
80 // ===========================================================
81 // CRG_INTERVAL FACET
82 // ===========================================================
83 
84 // PUBLIC DATA MEMBERS
85 
86 // PROTECTED DATA MEMBERS
87 
88 // PRIVATE DATA MEMBERS
89 
90 
91 // ===========================================================
92 // COVER_SET FACET
93 // ===========================================================
94 
95 // PUBLIC DATA MEMBERS
96 
97 // PROTECTED DATA MEMBERS
98 
99 void
102 {
103  // Preconditions:
104 
105  require(id_spaces_initialized());
106  require(local_id_space_initialized());
107  require(!covers_initialized(LOWER));
108 
109  // Body:
110 
111  // Only supports covers for top and bottom.
112 
113  _lower_covers_begin =
114  explicit_index_space_interval::new_space(*_id_spaces, 2).begin();
115 
116  _lower_covers_initialized = true;
117 
118  // Posconditions:
119 
120  ensure(covers_initialized(LOWER));
121 
122  // Exit:
123 
124  return;
125 }
126 
127 void
130 {
131  // Preconditions:
132 
133  require(id_spaces_initialized());
134  require(local_id_space_initialized());
135  require(!covers_initialized(UPPER));
136 
137  // Body:
138 
139  // Only supports covers for top and bottom.
140 
141  _upper_covers_begin =
142  explicit_index_space_interval::new_space(*_id_spaces, 2).begin();
143 
144  _upper_covers_initialized = true;
145 
146  // Posconditions:
147 
148  ensure(covers_initialized(UPPER));
149 
150  // Exit:
151 
152  return;
153 }
154 
155 // PRIVATE DATA MEMBERS
156 
157 
158 // ===========================================================
159 // EXPLICIT COVER SET FACET
160 // ===========================================================
161 
162 // PUBLIC DATA MEMBERS
163 
164 // PROTECTED DATA MEMBERS
165 
166 // PRIVATE DATA MEMBERS
167 
168 
169 // ===========================================================
170 // FACTORY FACET
171 // ===========================================================
172 
173 // PUBLIC DATA MEMBERS
174 
175 const std::string&
177 class_name() const
178 {
179  static const string result("standard_member_hack_crg_interval");
180  return result;
181 }
182 
183 // PROTECTED DATA MEMBERS
184 
185 // PRIVATE DATA MEMBERS
186 
187 bool
188 sheaf::standard_member_hack_crg_interval::
189 make_prototype()
190 {
191  // Preconditions:
192 
193 
194  // Body:
195 
197 
198  interval_factory().insert_prototype(lproto);
199 
200  // Postconditions:
201 
202 
203  // Exit:
204 
205  return true;
206 }
207 
208 
209 // ===========================================================
210 // ANY FACET
211 // ===========================================================
212 
213 // PUBLIC DATA MEMBERS
214 
215 bool
217 is_ancestor_of(const any* other) const
218 {
219 
220  // Preconditions:
221 
222  require(other != 0);
223 
224  // Body:
225 
226  // True if other conforms to this
227 
228  bool result = dynamic_cast<const standard_member_hack_crg_interval*>(other) != 0;
229 
230  // Postconditions:
231 
232  return result;
233 }
234 
237 clone() const
238 {
239  // Preconditions:
240 
241  // Body:
242 
244 
245  // Postconditions:
246 
247  ensure(result != 0);
248  ensure(is_same_type(result));
249 
250  // Exit:
251 
252  return result;
253 }
254 
255 bool
257 invariant() const
258 {
259  bool result = true;
260 
261  if(invariant_check())
262  {
263  // Prevent recursive calls to invariant
264 
265  disable_invariant_check();
266 
267  // Must satisfy base class invariant
268 
269  invariance(crg_interval::invariant());
270 
271  // Invariances for this class:
272 
273  // Finished, turn invariant checking back on.
274 
275  enable_invariant_check();
276  }
277 
278  // Exit
279 
280  return result;
281 }
282 
283 // PROTECTED DATA MEMBERS
284 
285 // PRIVATE DATA MEMBERS
286 
287 
288 // ===========================================================
289 // NON-MEMBER FUNCTIONS
290 // ===========================================================
291 
292 size_t
293 sheaf::deep_size(const standard_member_hack_crg_interval& xp, bool xinclude_shallow)
294 {
295  size_t result;
296 
297  // Preconditions:
298 
299  // Body:
300 
301  result = xinclude_shallow ? sizeof(xp) : 0;
302 
303  // Postconditions:
304 
305  ensure(result >= 0);
306 
307  // Exit
308 
309  return result;
310 }
311 
virtual void initialize_upper_covers()
Initialize the upper covers for this interval.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual void initialize_lower_covers()
Initialize the lower covers for this interval.
STL namespace.
Implementation of explicit_crg_interval intended only to support the product poset hack in section_sp...
standard_member_hack_crg_interval()
Default Constructor; constructs an uninitialized interval.
Abstract base class with useful features for all objects.
Definition: any.h:39
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.
const bool UPPER
Selector for upper cover.
Definition: sheaf.h:72
const bool LOWER
Selector for lower cover.
Definition: sheaf.h:67
virtual standard_member_hack_crg_interval * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual const std::string & class_name() const
The name of this class; provided to satisfy factory template.