SheafSystem  0.0.0.0
explicit_index_space_state.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 EXPLICIT_INDEX_SPACE_STATE_H
22 #define EXPLICIT_INDEX_SPACE_STATE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ANY_H
29 #include "SheafSystem/any.h"
30 #endif
31 
32 #ifndef FACTORY_H
33 #include "SheafSystem/factory.h"
34 #endif
35 
36 #ifndef POD_TYPES_H
37 #include "SheafSystem/pod_types.h"
38 #endif
39 
40 namespace sheaf
41 {
42 
43 class abstract_product_structure;
44 class explicit_index_space_handle;
45 class explicit_index_space_iterator;
46 class hub_index_space_handle;
47 class index_space_collection;
48 class index_space_family;
49 class index_space_handle;
50 class index_space_iterator;
51 class scoped_index;
52 
57 class SHEAF_DLL_SPEC explicit_index_space_state : public any
58 {
59 
61  friend class explicit_index_space_interval;
62  friend class index_space_family;
63 
64  // ===========================================================
66  // ===========================================================
68 
69 public:
70 
75 
79  virtual ~explicit_index_space_state();
80 
84  virtual bool operator==(const explicit_index_space_state& xother) const;
85 
89  const index_space_collection& host() const;
90 
94  index_space_collection& host();
95 
99  pod_type index() const;
100 
104  virtual size_type deep_size(bool xinclude_shallow) const;
105 
106 protected:
107 
112 
117 
121  virtual explicit_index_space_state& operator=(const explicit_index_space_state& xother);
122 
128  void new_state(index_space_family& xid_spaces,
129  const std::string& xname,
130  bool xis_persistent);
131 
137  void new_state(index_space_family& xid_spaces,
138  pod_type xid,
139  const std::string& xname,
140  bool xis_persistent);
141 
146 
150  pod_type _index;
151 
152 private:
153 
155 
156 
157  // ===========================================================
159  // ===========================================================
161 
162 public:
163 
167  const index_space_family& id_spaces() const;
168 
172  index_space_family& id_spaces();
173 
177  const hub_index_space_handle& hub_id_space() const;
178 
182  size_type ct() const;
183 
187  bool is_empty() const;
188 
192  pod_type begin() const;
193 
197  pod_type end() const;
198 
202  bool is_gathered() const;
203 
207  virtual bool contains(pod_type xid) const = 0;
208 
213  bool contains(const scoped_index& xid) const;
214 
219  bool contains_hub(pod_type xid) const;
220 
224  virtual bool contains_unglued_hub(pod_type xid) const = 0;
225 
229  virtual bool contains_glued_hub(pod_type xid) const;
230 
236  bool contains(pod_type xid, const scoped_index& xhub_id) const;
237 
242  virtual bool contains(pod_type xid, pod_type xhub_id) const;
243 
247  virtual pod_type pod(pod_type xid) const = 0;
248 
253  pod_type pod(const scoped_index& xid) const;
254 
259  pod_type hub_pod(pod_type xid) const;
260 
264  virtual pod_type unglued_hub_pod(pod_type xid) const = 0;
265 
269  virtual pod_type glued_hub_pod(pod_type xid) const ;
270 
274  bool is_persistent() const;
275 
276 protected:
277 
281  void invalidate_extrema();
282 
287 
291  pod_type _begin;
292 
296  pod_type _end;
297 
302 
303 private:
304 
306 
307 
308  // ===========================================================
310  // ===========================================================
312 
313 public:
314 
319  virtual void new_product_structure(const abstract_product_structure& xproduct);
320 
324  virtual void delete_product_structure();
325 
329  const abstract_product_structure& product_structure() const;
330 
334  abstract_product_structure& product_structure();
335 
339  bool has_product_structure() const;
340 
341 protected:
342 
347 
348 private:
349 
351 
352 
353  // ===========================================================
355  // ===========================================================
357 
358 public:
359 
363  virtual index_space_handle& get_id_space() const = 0;
364 
368  virtual void release_id_space(index_space_handle& xid_space) const = 0;
369 
374  virtual bool allocated_id_space(const index_space_handle& xid_space) const = 0;
375 
376 protected:
377 
381  void attach(explicit_index_space_handle& xid_space) const;
382 
383 private:
384 
386 
387 
388  // ===========================================================
390  // ===========================================================
392 
393 public:
394 
398  virtual index_space_iterator& get_iterator() const = 0;
399 
403  virtual void release_iterator(index_space_iterator& xitr) const = 0;
404 
409  virtual bool allocated_iterator(const index_space_iterator& xitr) const = 0;
410 
411 protected:
412 
416  void attach(explicit_index_space_iterator& xitr) const;
417 
418 private:
419 
421 
422 
423  // ===========================================================
425  // ===========================================================
427 
428 public:
429 
433  virtual const std::string& class_name() const;
434 
438  static factory<explicit_index_space_state>& id_space_factory();
439 
443  virtual explicit_index_space_state* clone() const = 0;
444 
445 protected:
446 
447 private:
448 
450 
451 
452  // ===========================================================
454  // ===========================================================
456 
457 public:
458 
462  virtual bool is_ancestor_of(const any *other) const;
463 
467  virtual bool invariant() const;
468 
469 protected:
470 
471 private:
472 
474 
475 };
476 
477 // ===========================================================
478 // NON-MEMBER FUNCTIONS
479 // ===========================================================
480 
484 SHEAF_DLL_SPEC
485 size_t deep_size(const explicit_index_space_state& xn, bool xinclude_shallow = true);
486 
490 SHEAF_DLL_SPEC
491 std::ostream & operator << (std::ostream &xos, const explicit_index_space_state& xn);
492 
493 } // end namespace sheaf
494 
495 #endif // ifndef EXPLICIT_INDEX_SPACE_STATE_H
abstract_product_structure * _product
The product structure for this id space.
An abstract class that defines the product structure for an id space.
An abstract iterator over the ids of an id space.
explicit_index_space_state(const explicit_index_space_state &xother)
Copy constructor; disabled.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
An implementation of class sum_index_space_handle that has a primary sum id space state...
pod_type _end
Ending id of this space.
Abstract base class with useful features for all objects.
Definition: any.h:39
pod_type _index
The index of this id space.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
A factory for instanting descendants of an abstract type T, given the class name of the descendant...
Definition: eval_family.h:49
An implementation of class index_space_handle for an explicit_index_space_state.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
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
A collection of id space states. This is a virtual class with provides an interface for accessing the...
An implementation of index_space_interval for an interval of explicit id spaces.
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.
size_type _ct
The number of members.
pod_index_type pod_type
The "plain old data" index type for this.
An implementation of class index_space_iterator for an explicit_index_space_state.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
Namespace for the sheaves component of the sheaf system.
An implementation of index_space_collection for a sparse collection of explicit id spaces...
bool _is_persistent
True if this id space should be written to disk.
Factory and container for a family of id spaces.
pod_type _begin
Beginning id of this space.
index_space_collection * _host
The host collection.