SheafSystem  0.0.0.0
base_space_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/base_space_crg_interval.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/base_space_poset.h"
25 #include "SheafSystem/list_index_space_state.h"
26 #include "SheafSystem/index_space_iterator.h"
27 #include "SheafSystem/scoped_index.h"
28 #include "SheafSystem/std_iomanip.h"
29 #include "SheafSystem/std_string.h"
30 
31 using namespace std;
32 using namespace fiber_bundle; // Workaround for MS C++ bug.
33 
34 // ===========================================================
35 // BASE_SAPCE_CRG_INTERVAL FACET
36 // ===========================================================
37 
38 // PUBLIC MEMBER FUNCTIONS
39 
42  : _block_vertices_initialized(false),
43  _block_vertices_space_id(invalid_pod_index())
44 {
45  // Postconditions:
46 
47  ensure(invariant());
48  ensure(!is_initialized());
49 
50  return;
51 }
52 
55 {
56  // Preconditions:
57 
58  // Body:
59 
61  {
63  }
64 
65  // Postconditions:
66 
67  // Exit:
68 
69  return;
70 }
71 
72 void
74 cells_begin(scoped_index& result) const
75 {
76  // Preconditions:
77 
78  // Body:
79 
80  result.put(hub_id_space(), cells_begin());
81 
82  // Postconditions:
83 
84  ensure(result.is_hub_scope());
85 
86  // Exit:
87 
88  return;
89 }
90 
91 void
93 cells_end(scoped_index& result) const
94 {
95  // Preconditions:
96 
97  // Body:
98 
99  result.put(hub_id_space(), cells_end());
100 
101  // Postconditions:
102 
103  ensure(result.is_hub_scope());
104 
105  // Exit:
106 
107  return;
108 }
109 
110 int
112 db(pod_index_type xmbr_id) const
113 {
114  // Preconditions:
115 
116  require(contains_member(xmbr_id));
117 
118  // Body:
119 
120  is_abstract();
121 
122  int result = -1; // Just to silence compiler warnings.
123 
124  // Postconditions:
125 
126  // Exit:
127 
128  return result;
129 }
130 
131 int
133 db(const scoped_index& xmbr_id) const
134 {
135  // Preconditions:
136 
137  require(contains_member(xmbr_id));
138 
139  // Body:
140 
141  return db(xmbr_id.hub_pod());
142 }
143 
146 d_cells_space_id(int xd) const
147 {
148  // Preconditions:
149 
150  // Body:
151 
152  pod_index_type result = 0; // To silence the debugger
153  is_abstract();
154 
155  // Postconditions:
156 
157  // Exit:
158 
159  return result;
160 }
161 
162 // PROTECTED MEMBER FUNCTIONS
163 
164 // PRIVATE MEMBER FUNCTIONS
165 
166 
167 // ===========================================================
168 // BLOCK VERTICES FACET
169 // ===========================================================
170 
171 // PUBLIC MEMBER FUNCTIONS
172 
173 bool
176 {
177  // Preconditions:
178 
179  // Body:
180 
181  bool result = _block_vertices_initialized;
182 
183  // Postconditions:
184 
185  ensure(is_basic_query);
186 
187  // Exit:
188 
189  return result;
190 }
191 
195 {
196  // Preconditions:
197 
198  require(block_vertices_initialized());
199 
200  // Body:
201 
203 
204  // Postconditions:
205 
206  ensure(is_basic_query);
207 
208  // Exit:
209 
210  return result;
211 }
212 
213 // PROTECTED MEMBER FUNCTIONS
214 
215 std::string
218 {
219  // Preconditions:
220 
221  // Body:
222 
223  string result =
224  poset_path::make_reserved_name("block_vertices_", interval_member(), "");
225 
226  // Postconditions:
227 
228  ensure(!result.empty());
229 
230  // Exit:
231 
232  return result;
233 }
234 
235 // PRIVATE MEMBER FUNCTIONS
236 
237 
238 // ===========================================================
239 // DOF TUPLE FACET
240 // ===========================================================
241 
242 // PUBLIC MEMBER FUNCTIONS
243 
244 // PROTECTED MEMBER FUNCTIONS
245 
246 // PRIVATE MEMBER FUNCTIONS
247 
248 
249 // ===========================================================
250 // FACTORY FACET
251 // ===========================================================
252 
253 // PUBLIC MEMBER FUNCTIONS
254 
255 void
257 initialize(const namespace_poset& xnamespace)
258 {
259  // Preconditions:
260 
261  // Body:
262 
264 
266 
267  // Postconditions:
268 
269  ensure(is_initialized());
270 
271  // Exit:
272 
273  return;
274 }
275 
276 bool
279 {
280  bool result =
283 
284  return result;
285 }
286 
287 const std::string&
289 class_name() const
290 {
291  static const string result("base_space_crg_interval");
292  return result;
293 }
294 
295 // PROTECTED MEMBER FUNCTIONS
296 
297 // PRIVATE MEMBER FUNCTIONS
298 
299 
300 // ===========================================================
301 // ANY FACET
302 // ===========================================================
303 
304 // PUBLIC MEMBER FUNCTIONS
305 
306 bool
308 is_ancestor_of(const any* other) const
309 {
310 
311  // Preconditions:
312 
313  require(other != 0);
314 
315  // Body:
316 
317  // True if other conforms to this
318 
319  bool result = dynamic_cast<const base_space_crg_interval*>(other) != 0;
320 
321  // Postconditions:
322 
323  return result;
324 }
325 
326 bool
328 invariant() const
329 {
330  bool result = true;
331 
332  if(invariant_check())
333  {
334  // Prevent recursive calls to invariant
335 
337 
338  // Must satisfy base class invariant
339 
340  invariance(implicit_crg_interval::invariant());
341 
342  // Invariances for this class:
343 
344  // Finished, turn invariant checking back on.
345 
347  }
348 
349  // Exit
350 
351  return result;
352 }
353 
354 // PROTECTED MEMBER FUNCTIONS
355 
356 // PRIVATE MEMBER FUNCTIONS
357 
358 
359 // ===========================================================
360 // NON-MEMBER FUNCTIONS
361 // ===========================================================
362 
void initialize(const namespace_poset &xnamespace)
Sets is_initialized() == true; dummy routine provided to satisfy factory template.
index_space_family * _id_spaces
The id space family of this interval.
Definition: crg_interval.h:186
virtual bool invariant() const
Class invariant.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
const hub_index_space_handle & hub_id_space() const
The hub id space of this interval.
virtual const std::string & class_name() const
The name of this class; provided to satisfy factory template.
virtual bool is_initialized() const
True if fully initialized.
The default name space; a poset which contains other posets as members.
bool _block_vertices_initialized
True if the block vertices id space has been initialized.
STL namespace.
bool is_hub_scope() const
True if and only if the id space of this is the hub id space.
Definition: scoped_index.h:575
virtual bool is_initialized() const
True if fully initialized.
virtual pod_index_type cells_begin() const =0
The beginning of the local cells interval.
Abstract base class with useful features for all objects.
Definition: any.h:39
pod_index_type interval_member() const
The index of the interval member itself; synonym for begin().
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual pod_index_type d_cells_space_id(int xd) const =0
The id space index for the cells of dimension xd. Returns invalid_pod_index() if there is no id space...
virtual pod_index_type cells_end() const =0
The end of the local cells interval.
void put(const index_space_handle &xid_space, pod_type xpod)
Set the scope to id space, xid_space and pod() to xpod.
Definition: scoped_index.h:332
virtual int db(pod_index_type xmbr_id) const =0
The dimension of the member with id xmbr_id. Does not require access to dof tuple.
bool contains_member(pod_index_type xindex) const
True if and only if the index xindex is contained in this interval.
pod_index_type block_vertices_space_id() const
The id space index of the block vertices id space.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
Definition: any.h:97
bool block_vertices_initialized() const
True if the block vertices id space has been initialized.
pod_index_type _block_vertices_space_id
The id space index of the block vertices id space.
void delete_space(pod_type xid)
Delete the id space with index xid.
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
void initialize(const namespace_poset &xnamespace)
Sets is_initialized() == true; dummy routine provided to satisfy factory template.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Abstract emulator for a interval of implicit base space members.
virtual bool invariant() const
Class invariant.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Definition: pod_types.cc:37
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
Definition: pod_types.cc:31
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
std::string block_vertices_name() const
The name of the block vertices id space.
static std::string make_reserved_name(const std::string &xprefix, const size_t &xindex, const std::string &xsuffix)
Creates a string reserved_prefix()_xprefix_xindex_xsuffix.
Definition: poset_path.cc:733
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710