SheafSystem  0.0.0.0
index_space_handle.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 INDEX_SPACE_HANDLE_H
22 #define INDEX_SPACE_HANDLE_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 POD_TYPES_H
33 #include "SheafSystem/pod_types.h"
34 #endif
35 
36 namespace sheaf
37 {
38 
39 class abstract_product_structure;
40 class hub_index_space_handle;
41 class index_space_collection;
42 class index_space_family;
43 class index_space_iterator;
44 class scoped_index;
45 
50 class SHEAF_DLL_SPEC index_space_handle : public any
51 {
52 
53  // ===========================================================
55  // ===========================================================
57 
58 public:
59 
64 
68  virtual ~index_space_handle();
69 
74  virtual index_space_handle& operator=(const index_space_handle& xother);
75 
79  bool operator==(const index_space_handle& xother) const;
80 
85  virtual index_space_handle* clone() const = 0;
86 
87 protected:
88 
93 
98 
99 private:
100 
102 
103 
104  // ===========================================================
106  // ===========================================================
108 
109 public:
110 
114  virtual const index_space_family& id_spaces() const = 0;
115 
119  virtual index_space_family& id_spaces() = 0;
120 
124  const hub_index_space_handle& hub_id_space() const;
125 
129  virtual size_type ct() const = 0;
130 
134  bool is_empty() const;
135 
139  virtual pod_type begin() const = 0;
140 
144  virtual pod_type end() const = 0;
145 
149  bool is_gathered() const;
150 
154  virtual bool contains(pod_type xid) const = 0;
155 
160  bool contains(const scoped_index& xid) const;
161 
166  bool contains_hub(pod_type xid) const;
167 
171  virtual bool contains_unglued_hub(pod_type xid) const = 0;
172 
176  virtual bool contains_glued_hub(pod_type xid) const = 0;
177 
183  bool contains(pod_type xid, const scoped_index& xhub_id) const;
184 
189  virtual bool contains(pod_type xid, pod_type xhub_id) const = 0;
190 
194  virtual pod_type pod(pod_type xid) const = 0;
195 
200  pod_type pod(const scoped_index& xid) const;
201 
206  pod_type hub_pod(pod_type xid) const;
207 
211  virtual pod_type unglued_hub_pod(pod_type xid) const = 0;
212 
217  virtual pod_type glued_hub_pod(pod_type xid) const = 0;
218 
222  virtual bool is_persistent() const = 0;
223 
224 protected:
225 
226 private:
227 
229 
230 
231  // ===========================================================
233  // ===========================================================
235 
236 public:
237 
242  virtual void new_product_structure(const abstract_product_structure& xproduct) = 0;
243 
247  virtual void delete_product_structure() = 0;
248 
252  virtual const abstract_product_structure& product_structure() const = 0;
253 
257  virtual abstract_product_structure& product_structure() = 0;
258 
262  template<typename T>
263  const T& product_structure() const;
264 
268  template<typename T>
269  T& product_structure();
270 
274  virtual bool has_product_structure() const = 0;
275 
279  template<typename T>
280  bool product_structure_conforms_to() const;
281 
282 protected:
283 
284 private:
285 
287 
288 
289  // ===========================================================
291  // ===========================================================
293 
294 public:
295 
299  virtual const index_space_collection& host() const = 0;
300 
304  virtual pod_type index() const = 0;
305 
309  std::string name() const;
310 
314  void put_name(const std::string& xname);
315 
319  virtual bool is_attached() const = 0;
320 
324  void attach_to(const index_space_family& xid_spaces, pod_type xindex);
325 
329  void attach_to(const index_space_family& xid_spaces, const std::string& xname);
330 
334  virtual void attach_to(pod_type xindex) = 0;
335 
339  void attach_to(const std::string& xname);
340 
344  void attach_to(const index_space_handle& xother);
345 
350  bool conforms_to_state(const index_space_family& xid_spaces,
351  pod_type xindex) const;
352 
357  bool conforms_to_state(const index_space_family& xid_spaces,
358  const std::string& xname) const;
359 
364  bool conforms_to_state(pod_type xid) const;
365 
370  bool conforms_to_state(const std::string& xname) const;
371 
376  bool conforms_to_state(const index_space_handle& xother) const;
377 
382  virtual void attach_to(const index_space_collection& xhost,
383  pod_type xlocal_id) = 0;
384 
388  virtual void detach() = 0;
389 
394  virtual bool conforms_to_state(const index_space_collection& xhost,
395  pod_type xlocal_id) const = 0;
396 
397 protected:
398 
399 private:
400 
402 
403 
404  // ===========================================================
406  // ===========================================================
408 
409 public:
410 
415  virtual index_space_handle& get_id_space() const = 0;
416 
420  virtual void release_id_space() const = 0;
421 
426  virtual bool allocated_id_space() const = 0;
427 
428 protected:
429 
430 private:
431 
433 
434 
435  // ===========================================================
437  // ===========================================================
439 
440 public:
441 
445  virtual index_space_iterator& get_iterator() const = 0;
446 
450  virtual void release_iterator(index_space_iterator& xitr) const = 0;
451 
456  virtual bool allocated_iterator(const index_space_iterator& xitr) const = 0;
457 
458 protected:
459 
460 private:
461 
463 
464 
465  // ===========================================================
467  // ===========================================================
469 
470 public:
471 
475  virtual bool is_ancestor_of(const any *other) const;
476 
480  virtual bool invariant() const;
481 
482 protected:
483 
484 private:
485 
487 
488 };
489 
490 // ===========================================================
491 // NON-MEMBER FUNCTIONS
492 // ===========================================================
493 
497 SHEAF_DLL_SPEC
498 std::ostream & operator << (std::ostream &xos, const index_space_handle& xi);
499 
503 SHEAF_DLL_SPEC
504 size_t deep_size(const index_space_handle& xn, bool xinclude_shallow = true);
505 
506 } // end namespace sheaf
507 
508 #endif // ifndef INDEX_SPACE_HANDLE_H
An abstract class that defines the product structure for an id space.
An abstract iterator over the ids of an id space.
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...
Abstract base class with useful features for all objects.
Definition: any.h:39
pod_index_type pod_type
The "plain old data" index type for this.
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...
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.
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.
Factory and container for a family of id spaces.
index_space_handle(const index_space_handle &xother)
Copy constructor; disabled.