SheafSystem  0.0.0.0
local_base_space_member.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/local_base_space_member.h"
22 
23 #include "SheafSystem/chart_point.h"
24 #include "SheafSystem/namespace_poset.h"
25 #include "SheafSystem/poset_path.h"
26 #include "SheafSystem/preorder_iterator.h"
27 #include "SheafSystem/assert_contract.h"
28 
29 
30 using namespace fiber_bundle; // Workaround for MS C++ bug.
31 
32 // ===========================================================
33 // LOCAL_BASE_SPACE_MEMBER FACET
34 // ===========================================================
35 
36 // PUBLIC MEMBER FUNCTIONS
37 
40 refine_point(const chart_point& xpt) const
41 {
42  chart_point* result;
43 
44  // Preconditions:
45 
46  require(state_is_read_accessible());
47  require(xpt.db() == db());
48 
49  // Body:
50 
52 
53  chart_point& lpt = const_cast<chart_point&>(xpt);
54 
55  result = lpt.clone();
56  refine_point_pa(xpt, *result);
57 
58  // Postconditions:
59 
60  ensure(covers(result->chart_id()));
61 
62  // Exit:
63 
64  return result;
65 }
66 
67 void
69 refine_point_pa(const chart_point& xpt, chart_point& result) const
70 {
71  // Preconditions:
72 
73  require(state_is_read_accessible());
74  require(result.is_same_type(&xpt));
75 
76  require(xpt.chart_id() == index().pod());
77 
78  require(xpt.db() == db());
79 
80  // Body:
81 
82  is_abstract();
83 
84  // Postconditions:
85 
86  ensure(covers(result.chart_id()));
87 
88  // Exit:
89 
90  return;
91 }
92 
95 unrefine_point(const chart_point& xpt) const
96 {
97  chart_point* result;
98 
99  // Preconditions:
100 
101  require(state_is_read_accessible());
102  require(covers(xpt.chart_id()));
103  require(xpt.db() == db());
104 
105 
106  // Body:
107 
109 
110  chart_point& lpt = const_cast<chart_point&>(xpt);
111 
112  result = lpt.clone();
113  unrefine_point_pa(xpt, *result);
114 
115  // Postconditions:
116 
117  ensure(result->chart_id() == index().pod());
118 
119  // Exit:
120 
121  return result;
122 }
123 
124 void
126 unrefine_point_pa(const chart_point& xpt, chart_point& result) const
127 {
128  // Preconditions:
129 
130  require(state_is_read_accessible());
131 
132  require(covers(xpt.chart_id()));
133 
134  require(result.is_same_type(&xpt));
135 
136  // Body:
137 
138  is_abstract();
139 
140  // Postconditions:
141 
142  ensure(result.chart_id() == index().pod());
143 
144  // Exit:
145 
146  return;
147 }
148 
149 void
152 {
153  // Preconditions:
154 
155  require(state_is_read_write_accessible());
156  require(is_jim());
157 
158  // Body:
159 
160  is_abstract();
161 
162  // Postconditions:
163 
164  ensure(!is_jim());
165 
166  // Exit:
167 
168  return;
169 }
170 
171 
172 void
175 {
176  // Preconditions:
177 
178  require(state_is_read_write_accessible());
179  require(!is_jim());
180 
181  // Body:
182 
183  is_abstract();
184 
185  // Postconditions:
186 
187  ensure(is_jim());
188 
189  // Exit:
190 
191  return;
192 }
193 
194 void
197 {
198  // Preconditions:
199 
200  require(state_is_read_write_accessible());
201  require(is_jim());
202 
203  // Body:
204 
205  is_abstract();
206 
207  // Postconditions:
208 
209  ensure(!is_jim());
210 
211  // Exit:
212 
213  return;
214 }
215 
216 void
219 {
220  // Preconditions:
221 
222  require(state_is_read_write_accessible());
223  require(!is_jim());
224 
225  // Body:
226 
227  is_abstract();
228 
229  // Postconditions:
230 
231  ensure(is_jim());
232 
233  // Exit:
234 
235  return;
236 }
237 
238 // PROTECTED MEMBER FUNCTIONS
239 
242 {
243  // Preconditions:
244 
245  // Body:
246 
247  // Postconditions:
248 
249  ensure(invariant());
250  ensure(!is_attached());
251 }
252 
253 // PRIVATE MEMBER FUNCTIONS
254 
255 
256 // ===========================================================
257 // BASE_SPACE_MEMBER FACET
258 // ===========================================================
259 
260 // PUBLIC MEMBER FUNCTIONS
261 
262 // PROTECTED MEMBER FUNCTIONS
263 
264 // PRIVATE MEMBER FUNCTIONS
265 
266 
267 // ===========================================================
268 // TOTAL_POSET_MEMBER FACET
269 // ===========================================================
270 
271 // PUBLIC MEMBER FUNCTIONS
272 
273 // PROTECTED MEMBER FUNCTIONS
274 
275 // PRIVATE MEMBER FUNCTIONS
276 
277 
278 // ===========================================================
279 // ABSTRACT_POSET_MEMBER FACET
280 // ===========================================================
281 
282 // PUBLIC MEMBER FUNCTIONS
283 
284 // PROTECTED MEMBER FUNCTIONS
285 
286 // PRIVATE MEMBER FUNCTIONS
287 
288 
289 // ===========================================================
290 // POSET_COMPONENT FACET
291 // ===========================================================
292 
293 // PUBLIC MEMBER FUNCTIONS
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 invariant() const
309 {
310  // Preconditions:
311 
312  // Body:
313 
314  // Must satisfy base class invariant
315 
316 
317  if(invariant_check())
318  {
319  // Prevent recursive calls to invariant
320 
321  disable_invariant_check();
322 
323  invariance(base_space_member::invariant());
324 
327 
328  // Finished, turn invariant checking back on.
329 
330  enable_invariant_check();
331  }
332 
333  // Postconditions:
334 
335  // Exit
336 
337  return true;
338 }
339 
340 bool
342 is_ancestor_of(const any* xother) const
343 {
344  bool result;
345 
346  // Preconditions:
347 
348  // Body:
349 
350  result = dynamic_cast<const local_base_space_member*>(xother) != 0;
351 
352  // Postconditions:
353 
354  // Exit
355 
356  return result;
357 }
358 
362 {
363  // Preconditions:
364 
365  // Body:
366 
367  attach_to_state(&xother);
368 
369  // Postconditions:
370 
371  ensure(is_same_state(&xother));
372 
373  // Exit
374 
375  return *this;
376 }
377 
381 {
382 
383  // Preconditions:
384 
385  require(is_ancestor_of(&xother));
386 
387  // Body
388 
389  not_implemented();
390 
391  // Postconditions
392 
393  ensure(invariant());
394 
395  // Exit
396 
397  return *this;
398 
399 }
400 
401 // PROTECTED MEMBER FUNCTIONS
402 
403 // PRIVATE MEMBER FUNCTIONS
virtual void unrefine_point_pa(const chart_point &xpt, chart_point &result) const =0
The point in this which is the same as xpt in the direct refinement of this; pre-allocated version...
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
A client handle for a member of a base space poset.
virtual void refine_point_pa(const chart_point &xpt, chart_point &result) const =0
The point in the direct refinement of this which is the same as xpt; pre-allocated version...
virtual void unrefine()=0
Removes the standard refinement of this from its lower cover and changes this from a jrm to a jim...
chart_point * refine_point(const chart_point &xpt) const
The point in the direct refinement of this which is the same as xpt; auto-allocated version...
virtual bool invariant() const
Class invariant.
virtual int db() const =0
The dimension of this chart.
Definition: chart_point.cc:141
A point in chart space.
Definition: chart_point.h:52
pod_index_type chart_id() const
The id of the chart this point is in.
Definition: chart_point.cc:96
local_base_space_member()
Default constructor; creates a new, unattached local_base_space_member handle.
virtual void simplify()=0
Inserts the standard simplex refinement of this into its lower cover and changes this from a jim to a...
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual chart_point * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
virtual bool invariant() const
Class invariant.
virtual local_base_space_member & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
virtual void unsimplify()=0
Removes the standard simplex refinement of this from its lower cover and changes this from a jrm to a...
chart_point * unrefine_point(const chart_point &xpt) const
The point in this which is the same as xpt in the direct refinement of this; auto-allocated version...
virtual void refine()=0
Inserts the standard refinement of this into its lower cover and changes this from a jim to a jrm...
An abstract client handle for a member of a poset.
Namespace for the fiber_bundles component of the sheaf system.
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79