SheafSystem  0.0.0.0
section_space_schema_crg_range.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/section_space_schema_crg_range.h"
22 #include "SheafSystem/assert_contract.h"
23 #include "SheafSystem/base_space_poset.h"
24 
25 // ===========================================================
26 // SECTION_SPACE_SCHEMA_CRG_RANGE FACET
27 // ===========================================================
28 
29 // PUBLIC MEMBER FUNCTIONS
30 
33  : _base_space(0),
34  _fiber_schema(0)
35 {
36  // Preconditions:
37 
38  // Body:
39 
40  // Postconditions:
41 
42  ensure(invariant());
43 
44  // Exit:
45 
46  return;
47 }
48 
51 {
52  // Preconditions:
53 
54  // Body:
55 
56  // Postconditions:
57 
58  // Exit:
59 
60  return;
61 }
62 
66 {
67  // Preconditions:
68 
69  require(base_space_initialized());
70 
71  // Body:
72 
73  base_space_poset& result = *_base_space;
74 
75  // Postconditions:
76 
77  ensure(is_basic_query);
78 
79  // Exit:
80 
81  return result;
82 }
83 
86 base_space() const
87 {
88  // Preconditions:
89 
90  require(base_space_initialized());
91 
92  // Body:
93 
94  const base_space_poset& result = *_base_space;
95 
96  // Postconditions:
97 
98  ensure(is_basic_query);
99 
100  // Exit:
101 
102  return result;
103 }
104 
105 bool
108 {
109  // Preconditions:
110 
111  // Body:
112 
113  bool result = (_base_space != 0);
114 
115  // Postconditions:
116 
117  ensure(is_basic_query);
118 
119  // Exit:
120 
121  return result;
122 }
123 
127 {
128  // Preconditions:
129 
130  require(fiber_schema_initialized());
131 
132  // Body:
133 
135 
136  // Postconditions:
137 
138  ensure(is_basic_query);
139 
140  // Exit:
141 
142  return result;
143 }
144 
148 {
149  // Preconditions:
150 
151  require(fiber_schema_initialized());
152 
153  // Body:
154 
155  const poset_state_handle& result = *_fiber_schema;
156 
157  // Postconditions:
158 
159  ensure(is_basic_query);
160 
161  // Exit:
162 
163  return result;
164 }
165 
166 bool
169 {
170  // Preconditions:
171 
172  // Body:
173 
174  bool result = (_fiber_schema != 0);
175 
176  // Postconditions:
177 
178  ensure(is_basic_query);
179 
180  // Exit:
181 
182  return result;
183 }
184 
185 bool
188  pod_index_type xfiber_schema_id) const
189 {
190  // Preconditions:
191 
192  // Body:
193 
194  bool result = false; // Just to silence compiler
195 
196  is_abstract();
197 
198  // Postconditions:
199 
200  ensure(is_basic_query);
201 
202  // Exit:
203 
204  return result;
205 }
206 
207 void
210  pod_index_type& xbase_space_id,
211  pod_index_type& xfiber_schema_id) const
212 {
213  // Preconditions:
214 
215  require(local_id_space().contains_hub(xindex));
216 
217  // Body:
218 
219  is_abstract();
220 
221  // Postconditions:
222 
223  ensure(contains_member(xbase_space_id, xfiber_schema_id));
224 
225  // Exit:
226 
227  return;
228 }
229 
230 void
232 ordinal(pod_index_type xbase_space_id,
233  pod_index_type xfiber_schema_id,
234  pod_index_type& xindex) const
235 {
236  // Preconditions:
237 
238  require(contains_member(xbase_space_id, xfiber_schema_id));
239 
240  // Body:
241 
242  is_abstract();
243 
244  // Postconditions:
245 
246  ensure(local_id_space().contains_hub(xindex));
247 
248  // Exit:
249 
250  return;
251 }
252 
253 // PROTECTED MEMBER FUNCTIONS
254 
255 void
258 {
259  // Preconditions:
260 
261  require(!base_space_initialized());
262 
263  // Body:
264 
265  _base_space = &xbase_space;
266 
267  // Postconditions:
268 
269  ensure(base_space_initialized());
270 
271  // Exit:
272 
273  return;
274 }
275 
276 void
279 {
280  // Preconditions:
281 
282  require(!fiber_schema_initialized());
283 
284  // Body:
285 
286  _fiber_schema = &xfiber_schema;
287 
288  // Postconditions:
289 
290  ensure(fiber_schema_initialized());
291 
292  // Exit:
293 
294  return;
295 }
296 
297 // PRIVATE MEMBER FUNCTIONS
298 
299 
300 // ===========================================================
301 // IMPLICIT_CRG_RANGE FACET
302 // ===========================================================
303 
304 // PUBLIC MEMBER FUNCTIONS
305 
306 // PROTECTED MEMBER FUNCTIONS
307 
308 // PRIVATE MEMBER FUNCTIONS
309 
310 
311 // ===========================================================
312 // COVER SET FACET
313 // ===========================================================
314 
315 // PUBLIC MEMBER FUNCTIONS
316 
317 // PROTECTED MEMBER FUNCTIONS
318 
319 bool
322  pod_index_type xmbr_index,
323  const cover_set_iterator& xitr) const
324 {
325  // Preconditions:
326 
327  require(contains_member(xmbr_index));
328 
329  // Body:
330 
331  // Postconditions:
332 
333  ensure(is_basic_query);
334 
335  // Exit:
336 
337  return false;
338 }
339 
340 bool
342 implicit_cover_is_singleton(bool xlower, pod_index_type xmbr_index) const
343 {
344  // Preconditions:
345 
346  require(contains_member(xmbr_index));
347 
348  // Body:
349 
350  bool result = (cover_size(xlower, xmbr_index) == 1);
351 
352  // Postconditions:
353 
354  ensure(is_basic_query);
355 
356  // Exit:
357 
358  return result;
359 }
360 
361 // PRIVATE MEMBER FUNCTIONS
362 
363 
364 // ===========================================================
365 // FACTORY FACET
366 // ===========================================================
367 
368 // PUBLIC MEMBER FUNCTIONS
369 
370 const std::string&
372 class_name() const
373 {
374  // Preconditions:
375 
376  // Body:
377 
378  static const string result("section_space_schema_crg_range");
379 
380  // Postconditions:
381 
382  // Exit:
383 
384  return result;
385 }
386 
387 // PROTECTED MEMBER FUNCTIONS
388 
389 // PRIVATE MEMBER FUNCTIONS
390 
391 
392 // ===========================================================
393 // ANY FACET
394 // ===========================================================
395 
396 // PUBLIC MEMBER FUNCTIONS
397 
398 bool
400 is_ancestor_of(const any *other) const
401 {
402  // Preconditions:
403 
404  require(other != 0);
405 
406  // Body:
407 
408  // True if other conforms to this
409 
410  bool result = dynamic_cast<const section_space_schema_crg_range*>(other) != 0;
411 
412  // Postconditions:
413 
414  // Exit:
415 
416  return result;
417 }
418 
421 clone() const
422 {
423  // Preconditions:
424 
425  // Body:
426 
427  section_space_schema_crg_range* result = 0;
428 
429  is_abstract();
430 
431  // Postconditions:
432 
433  ensure(result != 0);
434  ensure(is_same_type(result));
435 
436  // Exit:
437 
438  return result;
439 }
440 
441 bool
443 invariant() const
444 {
445  bool result = true;
446 
447  if(invariant_check())
448  {
449  // Prevent recursive calls to invariant
450 
451  disable_invariant_check();
452 
453  // Must satisfy base class invariant
454 
455  invariance(implicit_crg_range::invariant());
456 
457  // Invariances for this class:
458 
459  // Finished, turn invariant checking back on.
460 
461  enable_invariant_check();
462  }
463 
464  // Exit
465 
466  return result;
467 }
468 
469 // PROTECTED MEMBER FUNCTIONS
470 
471 // PRIVATE MEMBER FUNCTIONS
472 
473 
474 // ===========================================================
475 // NON-MEMBER FUNCTIONS
476 // ===========================================================
477 
virtual const std::string & class_name() const
The name of this class; provided to satisfy factory template.
virtual section_space_schema_crg_range * clone() const
Virtual constructor, makes a new instance of the same type as this.
void initialize_fiber_schema(poset_state_handle &xfiber_schema)
Sets the fiber schema for section spaces on this schema to xfiber_schema.
base_space_poset & base_space()
The base space for section spaces on this schema (mutable version).
A client handle for a general, abstract partially order set.
virtual void ordinal(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id, pod_index_type &xindex) const =0
The ordinal conversion from base space id xbase_space_id and fiber schema id xfiber_schema_id to sect...
virtual void tuple(pod_index_type xindex, pod_index_type &xbase_space_id, pod_index_type &xfiber_schema_id) const =0
The tuple conversion from section space schema id xindex to the base space id xbase_space_id and fibe...
virtual bool implicit_cover_is_singleton(bool xlower, pod_index_type xmbr_index) const
True if and only if the lower (xlower true) or upper (xlower false) cover set contains exactly one me...
poset_state_handle & fiber_schema()
The fiber schema for section spaces on this schema (mutable version).
void initialize_base_space(base_space_poset &xbase_space)
Sets the base space for section spaces on this schema to xbase_space.
Abstract base class with useful features for all objects.
Definition: any.h:39
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
bool base_space_initialized() const
True if the base space has been initialized.
virtual bool contains_member(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id) const =0
True if this range contains the member with base space id xbase_space_id and fiber schema id xfiber_s...
virtual bool implicit_cover_contains_iterator(bool xlower, pod_index_type xmbr_index, const cover_set_iterator &xitr) const
True if and only if the lower (xlower true) or upper (xlower false) cover set of the member with inde...
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
base_space_poset * _base_space
The base space for section spaces on this schema.
bool fiber_schema_initialized() const
True if the fiber schema has been initialized.
poset_state_handle * _fiber_schema
The fiber schema for section spaces on this schema.
Abstract emulator for a range of implicit section space schema members.