SheafSystem  0.0.0.0
homogeneous_block.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/homogeneous_block.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/array_index_space_state.h"
25 #include "SheafSystem/arg_list.h"
26 //#include "SheafSystem/base_space_member_prototype.h"
27 #include "SheafSystem/homogeneous_block_crg_interval.h"
28 #include "SheafSystem/index_space_handle.h"
29 #include "SheafSystem/index_space_iterator.h"
30 #include "SheafSystem/fiber_bundles_namespace.h"
31 #include "SheafSystem/poset_path.h"
32 #include "SheafSystem/preorder_iterator.h"
33 #include "SheafSystem/section_space_schema_member.h"
34 #include "SheafSystem/tern.h"
35 #include "SheafSystem/wsv_block.h"
36 
37 using namespace fiber_bundle; // Workaround for MS C++ bug.
38 
39 
40 // ===========================================================
41 // HOST FACTORY FACET
42 // ===========================================================
43 
44 // PUBLIC MEMBER FUNCTIONS
45 
48 new_host(namespace_type& xns, const poset_path& xhost_path, const poset_path& xschema_path, int xmax_db, bool xauto_access)
49 {
50  // cout << endl << "Entering homogeneous_block::new_host." << endl;
51 
52  // Preconditions:
53 
54  require(xns.state_is_auto_read_write_accessible(xauto_access));
55 
56  require(!xhost_path.empty());
57  require(!xns.contains_path(xhost_path, xauto_access));
58 
59  require(xschema_path.full());
60  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
61  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path(), xauto_access));
62 
63  require(xmax_db >= 0);
64 
65  // Body:
66 
67  host_type& result =
68  host_type::new_table(xns, xhost_path, xschema_path, xmax_db, xauto_access);
69 
70  // Postconditions:
71 
72  ensure(xns.owns(result, xauto_access));
73  ensure(result.path(true) == xhost_path);
74  ensure(result.state_is_not_read_accessible());
75  ensure(result.schema(true).path(xauto_access) == xschema_path);
76 
77  ensure(result.max_db() == xmax_db);
78 
79  // Exit:
80 
81  // cout << "Leaving homogeneous_block::new_host." << endl;
82  return result;
83 }
84 
87 new_host(namespace_type& xns, const poset_path& xhost_path, int xmax_db, bool xauto_access)
88 {
89  // cout << endl << "Entering homogeneous_block::new_host." << endl;
90 
91  // Preconditions:
92 
93  require(xns.state_is_auto_read_write_accessible(xauto_access));
94  require(!xhost_path.empty());
95  require(!xns.contains_path(xhost_path, xauto_access));
96  require(xns.path_is_auto_read_accessible(standard_schema_path(), xauto_access));
97 
98  require(xmax_db >= 0);
99 
100  // Body:
101 
102  host_type& result =
103  new_host(xns, xhost_path, standard_schema_path(), xmax_db, xauto_access);
104 
105  // Postconditions:
106 
107  ensure(xns.owns(result, xauto_access));
108  ensure(result.path(true) == xhost_path);
109  ensure(result.state_is_not_read_accessible());
110  ensure(result.schema(true).path(xauto_access) == standard_schema_path());
111 
112  ensure(result.max_db() == xmax_db);
113 
114  // Exit:
115 
116  // cout << "Leaving homogeneous_block::new_host." << endl;
117  return result;
118 }
119 
120 // PROTECTED MEMBER FUNCTIONS
121 
122 // PRIVATE MEMBER FUNCTIONS
123 
124 
125 // ===========================================================
126 // HOMOGENEOUS_BLOCK FACET
127 // ===========================================================
128 
129 // PUBLIC DATA MEMBERS
130 
133 {
134 
135  // Preconditions:
136 
137  // Body:
138 
139  // Exit
140 
141  return;
142 }
143 
147 {
148  // Preconditions:
149 
151 
152  // Body:
153 
154  const hub_index_space_handle& result = _interval->hub_id_space();
155 
156  // Postconditions:
157 
158  ensure(result.is_attached());
159 
160  // Exit:
161 
162  return result;
163 }
164 
168 {
169  // Preconditions:
170 
172 
173  // Body:
174 
175  const index_space_handle& result = _interval->local_id_space();
176 
177  // Postconditions:
178 
179  ensure(result.is_attached());
180 
181  // Exit:
182 
183  return result;
184 }
185 
189 {
190  // Preconditions:
191 
192  require(state_is_read_accessible());
193 
194  // Body:
195 
196  // Type_id is member_id member of prototype_id.
197 
198  homogeneous_block* cthis = const_cast<homogeneous_block*>(this);
199  const pod_index_type& result = cthis->row_dof_tuple()->local_cell_type_id;
200 
201  // Postconditions:
202 
203 
204  // Exit
205 
206  return result;
207 }
208 
209 const char*
212 {
213 
214  // Preconditions:
215 
216  require(state_is_read_accessible());
217  require(is_jim(false));
218 
219  // Body:
220 
221  homogeneous_block* cthis = const_cast<homogeneous_block*>(this);
222  const char* result = cthis->row_dof_tuple()->local_cell_type_name;
223 
224  // Postconditions:
225 
226 
227  // Exit:
228 
229  return result;
230 }
231 
232 const sheaf::size_type&
234 size() const
235 {
236  // Preconditions:
237 
238  require(state_is_read_accessible());
239 
240  // Body:
241 
242  homogeneous_block* cthis = const_cast<homogeneous_block*>(this);
243  const size_type& result = cthis->row_dof_tuple()->size;
244 
245  // Postconditions:
246 
247  // Exit
248 
249  return result;
250 }
251 
254 new_row_dof_map(const poset* xhost,
255  const std::string& xprototype_name,
256  const std::string& xlocal_cell_name,
257  size_type xsize)
258 {
259  // Preconditions:
260 
261  require(xhost->state_is_read_accessible());
262  require(xhost->name_space()->member_poset(prototypes_poset_name(), true).state_is_read_accessible());
263  require(!xprototype_name.empty());
264  require(xhost->name_space()->member_poset(prototypes_poset_name(), true).contains_member(xprototype_name));
265  require(!xlocal_cell_name.empty());
266  require(xhost->name_space()->member_poset(prototypes_poset_name(), true).contains_member(xlocal_cell_name));
267 
268 
269  // Body:
270 
271  // Create the map and initialize type_id and type_name dofs from prototype.
272 
273  array_poset_dof_map* result = new_row_dof_map(xhost, xprototype_name);
274 
275  row_dof_tuple_type& ltuple =
276  *reinterpret_cast<row_dof_tuple_type*>(result->dof_tuple());
277 
278  // Set local cell type id and name.
279 
280  poset_path local_proto_path(prototypes_poset_name(), xlocal_cell_name);
281  base_space_member local_proto(xhost->name_space(), local_proto_path, false);
282 
283  ltuple.local_cell_type_id = local_proto.type_id();
284  ltuple.local_cell_type_name = strdup(local_proto.type_name());
285 
286  // Dimension of block is same as dimension of local cell.
287 
288  ltuple.db = local_proto.db();
289 
290  local_proto.detach_from_state();
291 
292  // Set the size.
293 
294  ltuple.size = xsize;
295 
296  // Postconditions:
297 
298 
299  // Exit:
300 
301  return result;
302 }
303 
304 const sheaf::scoped_index&
307  const std::string& xprototype_name,
308  const std::string& xlocal_cell_name,
309  size_type xsize,
310  bool xauto_access)
311 {
312  // Preconditions:
313 
314  require(xhost.state_is_auto_read_write_accessible(xauto_access));
315  require(xhost.name_space()->member_poset(prototypes_poset_name(), true).state_is_auto_read_accessible(xauto_access));
316  require(!xprototype_name.empty());
317  require(xhost.name_space()->member_poset(prototypes_poset_name(), true).contains_member(xprototype_name));
318  require(!xlocal_cell_name.empty());
319  require(xhost.name_space()->member_poset(prototypes_poset_name(), true).contains_member(xlocal_cell_name));
320 
321 
322  // Body:
323 
324  if(xauto_access)
325  {
326  xhost.get_read_write_access(true);
327  xhost.name_space()->get_read_access();
328  xhost.name_space()->member_poset(prototypes_poset_name(), false).get_read_access();
329  }
330 
331  // Create the dof map and set dofs to defaults.
332 
333  const scoped_index& result = base_space_member::new_row_dof_map(xhost, xprototype_name, false);
334  row_dof_tuple_type* ltuple =
335  reinterpret_cast<row_dof_tuple_type*>(xhost.row_dof_map(result, true).dof_tuple());
336 
337  // Get the local cell prototype
338 
339  poset_path local_proto_path(prototypes_poset_name(), xlocal_cell_name);
340  base_space_member local_proto(xhost.name_space(), local_proto_path, false);
341 
342  // Copy its dofs;
343  // dimension of block same as local cell.
344 
345  ltuple->db = local_proto.db();
346  ltuple->local_cell_type_id = local_proto.type_id();
347  ltuple->local_cell_type_name = strdup(local_proto.type_name());
348  ltuple->size = xsize;
349 
350  // Relase the prototype.
351 
352  local_proto.detach_from_state();
353 
354  if(xauto_access)
355  {
356  xhost.name_space()->member_poset(prototypes_poset_name(), false).release_access();
357  xhost.name_space()->release_access();
358  xhost.release_access();
359  }
360 
361  // Postconditions:
362 
363 
364  // Exit:
365 
366  return result;
367 }
368 
369 // PROTECTED DATA MEMBERS
370 
373 {
374  // Preconditions:
375 
376  // Body:
377 
378  // Postconditions:
379 
380  ensure(invariant());
381  ensure(! is_attached() );
382 }
383 
384 void
387 {
388  // Preconditions:
389 
390  require(state_is_read_accessible());
391  require(unexecutable(data members created));
392 
393  // Body:
394 
395  // Have just attached to a new or different member in the same host.
396  // Attach the handle data members for the different member.
397 
398  _interval =
399  dynamic_cast<homogeneous_block_crg_interval*>(crg()->implicit_member(_index.pod()));
400 
401  // Postconditions:
402 
403  ensure(!is_restricted());
404 
405  // Exit
406 
407  return;
408 }
409 
412 interval() const
413 {
414  return *_interval;
415 }
416 
417 void
419 put_size(const size_type& xsize)
420 {
421  // Preconditions:
422 
423  require(state_is_read_accessible());
424 
425  // Body:
426 
427  row_dof_tuple()->size = xsize;
428 
429  // Postconditions:
430 
431  ensure(size() == xsize);
432 
433  // Exit
434 
435  return;
436 }
437 
438 // PRIVATE DATA MEMBERS
439 
440 
441 // ===========================================================
442 // ZONE ID SPACE FACET
443 // ===========================================================
444 
445 // PUBLIC DATA MEMBERS
446 
447 bool
449 contains_zone_id_space(bool xauto_access) const
450 {
451  // Preconditions:
452 
453  require(state_is_auto_read_accessible(xauto_access));
454 
455  // Body:
456 
459 
460  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
461 
462  bool result = lhost->contains_zone_id_space(_index, xauto_access);
463 
464  // Postconditions:
465 
466  ensure(is_basic_query);
467 
468  // Exit:
469 
470  return result;
471 }
472 
475 get_zone_id_space(bool xauto_access) const
476 {
477  // Preconditions:
478 
479  require(state_is_auto_read_accessible(xauto_access));
480  require(contains_zone_id_space(xauto_access));
481 
482  // Body:
483 
486 
487  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
488 
489  index_space_handle& result = lhost->get_zone_id_space(_index, xauto_access);
490 
491  // Postconditions:
492 
493  ensure(result.is_attached());
494  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
495 
496  // Exit:
497 
498  return result;
499 }
500 
501 void
503 release_zone_id_space(index_space_handle& xid_space, bool xauto_access) const
504 {
505  // Preconditions:
506 
507  require(state_is_auto_read_accessible(xauto_access));
508  require(host()->member_id_spaces(xauto_access).allocated_id_space(xid_space));
509 
510  // Body:
511 
514 
515  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
516 
517  lhost->release_zone_id_space(xid_space, xauto_access);
518 
519  // Postconditions:
520 
521  ensure(!xid_space.is_attached());
522 
523  // Exit:
524 
525  return;
526 }
527 
530 get_zone_id_space_iterator(bool xauto_access) const
531 {
532  // Preconditions:
533 
534  require(state_is_auto_read_accessible(xauto_access));
535  require(contains_zone_id_space(xauto_access));
536 
537  // Body:
538 
541 
542  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
543 
544  index_space_iterator& result = lhost->get_zone_id_space_iterator(_index, xauto_access);
545 
546  // Postconditions:
547 
548  ensure(result.is_attached());
549  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
550 
551  // Exit:
552 
553  return result;
554 }
555 
556 void
559 {
560  // Preconditions:
561 
562  require(state_is_auto_read_accessible(xauto_access));
563  require(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(xitr));
564 
565  // Body:
566 
569 
570  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
571 
572  lhost->release_zone_id_space_iterator(xitr, xauto_access);
573 
574  // Postconditions:
575 
576  ensure(!xitr.is_attached());
577 
578  // Exit:
579 
580  return;
581 }
582 
583 // PROTECTED DATA MEMBERS
584 
585 // PRIVATE DATA MEMBERS
586 
587 
588 // ===========================================================
589 // VERTEX ID SPACE FACET
590 // ===========================================================
591 
592 // PUBLIC DATA MEMBERS
593 
594 bool
596 contains_vertex_id_space(bool xauto_access) const
597 {
598  // Preconditions:
599 
600  require(state_is_auto_read_accessible(xauto_access));
601 
602  // Body:
603 
606 
607  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
608 
609  bool result = lhost->contains_vertex_id_space(_index, xauto_access);
610 
611  // Postconditions:
612 
613  ensure(is_basic_query);
614 
615  // Exit:
616 
617  return result;
618 }
619 
622 get_vertex_id_space(bool xauto_access) const
623 {
624  // Preconditions:
625 
626  require(state_is_auto_read_accessible(xauto_access));
627  require(contains_vertex_id_space(xauto_access));
628 
629  // Body:
630 
633 
634  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
635 
636  index_space_handle& result = lhost->get_vertex_id_space(_index, xauto_access);
637 
638  // Postconditions:
639 
640  ensure(result.is_attached());
641  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
642 
643  // Exit:
644 
645  return result;
646 }
647 
648 void
650 release_vertex_id_space(index_space_handle& xid_space, bool xauto_access) const
651 {
652  // Preconditions:
653 
654  require(state_is_auto_read_accessible(xauto_access));
655  require(host()->member_id_spaces(xauto_access).allocated_id_space(xid_space));
656 
657  // Body:
658 
661 
662  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
663 
664  lhost->release_vertex_id_space(xid_space, xauto_access);
665 
666  // Postconditions:
667 
668  ensure(!xid_space.is_attached());
669 
670  // Exit:
671 
672  return;
673 }
674 
677 get_vertex_id_space_iterator(bool xauto_access) const
678 {
679  // Preconditions:
680 
681  require(state_is_auto_read_accessible(xauto_access));
682  require(contains_vertex_id_space(xauto_access));
683 
684  // Body:
685 
688 
689  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
690 
691  index_space_iterator& result = lhost->get_vertex_id_space_iterator(_index, xauto_access);
692 
693  // Postconditions:
694 
695  ensure(result.is_attached());
696  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
697 
698  // Exit:
699 
700  return result;
701 }
702 
703 void
706 {
707  // Preconditions:
708 
709  require(state_is_auto_read_accessible(xauto_access));
710  require(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(xitr));
711 
712  // Body:
713 
716 
717  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
718 
719  lhost->release_vertex_id_space_iterator(xitr, xauto_access);
720 
721  // Postconditions:
722 
723  ensure(!xitr.is_attached());
724 
725  // Exit:
726 
727  return;
728 }
729 
730 // PROTECTED DATA MEMBERS
731 
732 // PRIVATE DATA MEMBERS
733 
734 
735 // ===========================================================
736 // CONNECTIVITY FACET
737 // ===========================================================
738 
739 // PUBLIC FUNCTIONS
740 
741 bool
743 contains_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
744 {
745  // Preconditions:
746 
747  require(state_is_auto_read_accessible(xauto_access));
748  require(local_id_space().contains_hub(xzone_id));
749 
750  // Body:
751 
754 
755  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
756 
757  bool result = lhost->contains_connectivity_id_space(xzone_id, xauto_access);
758 
759  // Postconditions:
760 
761  ensure(is_basic_query);
762 
763  // Exit:
764 
765  return result;
766 }
767 
768 bool
770 contains_connectivity_id_space(const scoped_index& xzone_id, bool xauto_access) const
771 {
772  // Preconditions:
773 
774  require(state_is_auto_read_accessible(xauto_access));
775  require(local_id_space().contains(xzone_id));
776 
777  // Body:
778 
779  bool result = contains_connectivity_id_space(xzone_id.hub_pod(), xauto_access);
780 
781  // Postconditions:
782 
783  ensure(is_basic_query);
784 
785  // Exit:
786 
787  return result;
788 }
789 
792 get_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
793 {
794  // Preconditions:
795 
796  require(state_is_auto_read_accessible(xauto_access));
797  require(local_id_space().contains_hub(xzone_id));
798  require(contains_connectivity_id_space(xzone_id, xauto_access));
799 
800  // Body:
801 
804 
805  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
806 
807  index_space_handle& result = lhost->get_connectivity_id_space(xzone_id, xauto_access);
808 
809  // Postconditions:
810 
811  ensure(result.is_attached());
812  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
813 
814  // Exit:
815 
816  return result;
817 }
818 
821 get_connectivity_id_space(const scoped_index& xzone_id, bool xauto_access) const
822 {
823  // Preconditions:
824 
825  require(state_is_auto_read_accessible(xauto_access));
826  require(local_id_space().contains(xzone_id));
827  require(contains_connectivity_id_space(xzone_id, xauto_access));
828 
829  // Body:
830 
831  index_space_handle& result = get_connectivity_id_space(xzone_id.hub_pod(), xauto_access);
832 
833  // Postconditions:
834 
835  ensure(result.is_attached());
836  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
837 
838  // Exit:
839 
840  return result;
841 }
842 
843 void
845 release_connectivity_id_space(index_space_handle& xid_space, bool xauto_access) const
846 {
847  // Preconditions:
848 
849  require(state_is_auto_read_accessible(xauto_access));
850  require(host()->member_id_spaces(xauto_access).allocated_id_space(xid_space));
851 
852  // Body:
853 
856 
857  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
858 
859  lhost->release_connectivity_id_space(xid_space, xauto_access);
860 
861  // Postconditions:
862 
863  ensure(!xid_space.is_attached());
864 
865  // Exit:
866 
867  return;
868 }
869 
872 get_connectivity_id_space_iterator(pod_index_type xzone_id, bool xauto_access) const
873 {
874  // Preconditions:
875 
876  require(state_is_auto_read_accessible(xauto_access));
877  require(local_id_space().contains_hub(xzone_id));
878  require(contains_connectivity_id_space(xzone_id, xauto_access));
879 
880  // Body:
881 
884 
885  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
886 
887  index_space_iterator& result = lhost->get_connectivity_id_space_iterator(xzone_id, xauto_access);
888 
889  // Postconditions:
890 
891  ensure(result.is_attached());
892  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
893 
894  // Exit:
895 
896  return result;
897 }
898 
901 get_connectivity_id_space_iterator(const scoped_index& xzone_id, bool xauto_access) const
902 {
903  // Preconditions:
904 
905  require(state_is_auto_read_accessible(xauto_access));
906  require(local_id_space().contains_hub(xzone_id.hub_pod()));
907  require(contains_connectivity_id_space(xzone_id, xauto_access));
908 
909  // Body:
910 
911  index_space_iterator& result = get_connectivity_id_space_iterator(xzone_id.hub_pod(), xauto_access);
912 
913  // Postconditions:
914 
915  ensure(result.is_attached());
916  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
917 
918  // Exit:
919 
920  return result;
921 }
922 
923 void
926 {
927  // Preconditions:
928 
929  require(state_is_auto_read_accessible(xauto_access));
930  require(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(xitr));
931 
932  // Body:
933 
936 
937  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
938 
939  lhost->release_connectivity_id_space_iterator(xitr, xauto_access);
940 
941  // Postconditions:
942 
943  ensure(!xitr.is_attached());
944 
945  // Exit:
946 
947  return;
948 }
949 
950 // PROTECTED FUNCTIONS
951 
952 // PRIVATE FUNCTIONS
953 
954 
955 // ===========================================================
956 // ADJACENCY FACET
957 // ===========================================================
958 
959 // PUBLIC FUNCTIONS
960 
961 bool
963 contains_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
964 {
965  // Preconditions:
966 
967  require(state_is_auto_read_accessible(xauto_access));
968  require(local_id_space().contains_hub(xvertex_id));
969 
970  // Body:
971 
974 
975  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
976 
977  bool result = lhost->contains_adjacency_id_space(xvertex_id, xauto_access);
978 
979  // Postconditions:
980 
981  ensure(is_basic_query);
982 
983  // Exit:
984 
985  return result;
986 }
987 
988 bool
990 contains_adjacency_id_space(const scoped_index& xvertex_id, bool xauto_access) const
991 {
992  // Preconditions:
993 
994  require(state_is_auto_read_accessible(xauto_access));
995  require(local_id_space().contains(xvertex_id));
996 
997  // Body:
998 
999  bool result = contains_adjacency_id_space(xvertex_id.hub_pod(), xauto_access);
1000 
1001  // Postconditions:
1002 
1003  ensure(is_basic_query);
1004 
1005  // Exit:
1006 
1007  return result;
1008 }
1009 
1012 get_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
1013 {
1014  // Preconditions:
1015 
1016  require(state_is_auto_read_accessible(xauto_access));
1017  require(local_id_space().contains_hub(xvertex_id));
1018  require(contains_adjacency_id_space(xvertex_id, xauto_access));
1019 
1020  // Body:
1021 
1024 
1025  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
1026 
1027  index_space_handle& result = lhost->get_adjacency_id_space(xvertex_id, xauto_access);
1028 
1029  // Postconditions:
1030 
1031  ensure(result.is_attached());
1032  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
1033 
1034  // Exit:
1035 
1036  return result;
1037 }
1038 
1041 get_adjacency_id_space(const scoped_index& xvertex_id, bool xauto_access) const
1042 {
1043  // Preconditions:
1044 
1045  require(state_is_auto_read_accessible(xauto_access));
1046  require(local_id_space().contains(xvertex_id));
1047  require(contains_adjacency_id_space(xvertex_id, xauto_access));
1048 
1049  // Body:
1050 
1051  index_space_handle& result = get_adjacency_id_space(xvertex_id.hub_pod(), xauto_access);
1052 
1053  // Postconditions:
1054 
1055  ensure(result.is_attached());
1056  ensure(host()->member_id_spaces(xauto_access).allocated_id_space(result));
1057 
1058  // Exit:
1059 
1060  return result;
1061 }
1062 
1063 void
1065 release_adjacency_id_space(index_space_handle& xid_space, bool xauto_access) const
1066 {
1067  // Preconditions:
1068 
1069  require(state_is_auto_read_accessible(xauto_access));
1070  require(host()->member_id_spaces(xauto_access).allocated_id_space(xid_space));
1071 
1072  // Body:
1073 
1076 
1077  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
1078 
1079  lhost->release_adjacency_id_space(xid_space, xauto_access);
1080 
1081  // Postconditions:
1082 
1083  ensure(!xid_space.is_attached());
1084 
1085  // Exit:
1086 
1087  return;
1088 }
1089 
1092 get_adjacency_id_space_iterator(pod_index_type xvertex_id, bool xauto_access) const
1093 {
1094  // Preconditions:
1095 
1096  require(state_is_auto_read_accessible(xauto_access));
1097  require(local_id_space().contains_hub(xvertex_id));
1098  require(contains_adjacency_id_space(xvertex_id, xauto_access));
1099 
1100  // Body:
1101 
1104 
1105  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
1106 
1107  index_space_iterator& result = lhost->get_adjacency_id_space_iterator(xvertex_id, xauto_access);
1108 
1109  // Postconditions:
1110 
1111  ensure(result.is_attached());
1112  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
1113 
1114  // Exit:
1115 
1116  return result;
1117 }
1118 
1121 get_adjacency_id_space_iterator(const scoped_index& xvertex_id, bool xauto_access) const
1122 {
1123  // Preconditions:
1124 
1125  require(state_is_auto_read_accessible(xauto_access));
1126  require(local_id_space().contains(xvertex_id));
1127  require(contains_adjacency_id_space(xvertex_id, xauto_access));
1128 
1129  // Body:
1130 
1131  index_space_iterator& result = get_adjacency_id_space_iterator(xvertex_id.hub_pod(), xauto_access);
1132 
1133  // Postconditions:
1134 
1135  ensure(result.is_attached());
1136  ensure(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(result));
1137 
1138  // Exit:
1139 
1140  return result;
1141 }
1142 
1143 void
1146 {
1147  // Preconditions:
1148 
1149  require(state_is_auto_read_accessible(xauto_access));
1150  require(host()->member_id_spaces(xauto_access).allocated_id_space_iterator(xitr));
1151 
1152  // Body:
1153 
1156 
1157  base_space_poset* lhost = reinterpret_cast<base_space_poset*>(host());
1158 
1159  lhost->release_adjacency_id_space_iterator(xitr, xauto_access);
1160 
1161  // Postconditions:
1162 
1163  ensure(!xitr.is_attached());
1164 
1165  // Exit:
1166 
1167  return;
1168 }
1169 
1170 // PROTECTED FUNCTIONS
1171 
1172 // PRIVATE FUNCTIONS
1173 
1174 
1175 // ===========================================================
1176 // BASE_SPACE_MEMBER FACET
1177 // ===========================================================
1178 
1179 // PUBLIC DATA MEMBERS
1180 
1181 // PROTECTED DATA MEMBERS
1182 
1183 // PRIVATE DATA MEMBERS
1184 
1185 
1186 // ===========================================================
1187 // TOTAL_POSET_MEMBER FACET
1188 // ===========================================================
1189 
1190 // PUBLIC DATA MEMBERS
1191 
1192 // PROTECTED DATA MEMBERS
1193 
1194 // PRIVATE DATA MEMBERS
1195 
1196 
1197 // ===========================================================
1198 // ABSTRACT_POSET_MEMBER FACET
1199 // ===========================================================
1200 
1201 // PUBLIC DATA MEMBERS
1202 
1203 // PROTECTED DATA MEMBERS
1204 
1205 // PRIVATE DATA MEMBERS
1206 
1207 
1208 // ===========================================================
1209 // ANY FACET
1210 // ===========================================================
1211 
1212 // PUBLIC DATA MEMBERS
1213 
1214 bool
1216 invariant() const
1217 {
1218  // Preconditions:
1219 
1220  // Body:
1221 
1222  // Must satisfy base class invariant
1223 
1224  invariance(total_poset_member::invariant());
1225 
1226  if(invariant_check())
1227  {
1228  // Prevent recursive calls to invariant
1229 
1230  disable_invariant_check();
1231 
1232  // Invariants for this class:
1233 
1234  invariance(state_is_read_accessible() ? is_jim(false) : true);
1235  invariance(unexecutable("db() == local cell db"));
1236 
1237 
1238  // Finished, turn invariant checking back on.
1239 
1240  enable_invariant_check();
1241  }
1242 
1243  // Postconditions:
1244 
1245  // Exit
1246 
1247  return true;
1248 }
1249 
1250 
1251 bool
1253 is_ancestor_of(const any* xother) const
1254 {
1255  bool result;
1256 
1257  // Preconditions:
1258 
1259  // Body:
1260 
1261  result = dynamic_cast<const homogeneous_block*>(xother) != 0;
1262 
1263  // Postconditions:
1264 
1265  // Exit
1266 
1267  return result;
1268 }
1269 
1270 
1274 {
1275  // Preconditions:
1276 
1277  // Body:
1278 
1279  attach_to_state(&xother);
1280 
1281  // Postconditions:
1282 
1283  ensure(is_same_state(&xother));
1284 
1285  // Exit
1286 
1287  return *this;
1288 }
1289 
1293 {
1294 
1295  // Preconditions:
1296 
1297  require(is_ancestor_of(&xother));
1298 
1299  // Body
1300 
1301  not_implemented();
1302 
1303  // Postconditions
1304 
1305  ensure(invariant());
1306 
1307  // Exit
1308 
1309  return *this;
1310 
1311 }
1312 
1313 // PROTECTED DATA MEMBERS
1314 
1315 // PRIVATE DATA MEMBERS
1316 
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
void release_vertex_id_space_iterator(index_space_iterator &xitr, bool xauto_access) const
Returns the iterator to the vertex id space, xitr to the pool of id space iterators.
virtual bool invariant() const
Class invariant.
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
void release_zone_id_space_iterator(index_space_iterator &xitr, bool xauto_access) const
Returns the zone id space iterator xitr to the pool of iterators.
void release_adjacency_id_space_iterator(index_space_iterator &xid_space, bool xauto_access) const
Returns the id space iterator xid_space to the adjacency iterator pool.
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
virtual const size_type & size() const
The number of local cell instances in this block.
An abstract iterator over the ids of an id space.
array_poset_dof_map * new_row_dof_map(const poset *xhost, const std::string &xprototype_name, const std::string &xlocal_cell_name, size_type xsize)
OBSOLETE: use scoped_index new_row_dof_map(poset_state_handle& ...) Creates a new row dof map and ini...
index_space_handle & get_zone_id_space(bool xauto_access) const
Allocates a handle from the pool of handles for the id space of zones in this block.
size_type size
The number of local cells.
virtual ~homogeneous_block()
Destructor; deletes a poset member and its attached state, if any.
poset_path path(bool xauto_access=true) const
A path to this component.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
index_space_iterator & get_vertex_id_space_iterator(pod_index_type xmbr_id, bool xauto_access) const
Allocates an vertex id space iterator for the block containing the member with index xmbr_id for the ...
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
void release_vertex_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the handle to the vertex id space, xid_space to the pool of id space handles.
const char * local_cell_type_name
The local cell type name.
homogeneous_block()
Default constructor; creates a new, unattached homogeneous_block handle.
bool state_is_auto_read_accessible(bool xauto_access) const
True if the state is auto accessible for read, that is, if the state is already accessible for read o...
void release_adjacency_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the id space handle xid_space to the adjacency handle pool.
A client handle for a general, abstract partially order set.
void release_connectivity_id_space_iterator(index_space_iterator &xid_space, bool xauto_access) const
Returns the id space iterator xid_space to the connectivity iterator pool.
virtual void * dof_tuple()=0
The dof tuple (mutable version).
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual void attach_handle_data_members()
Initializes handle data members when attaching to a different member of the same host; intended to be...
void release_zone_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the handle to the zone id space, xid_space to the pool of id space handles.
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
void release_zone_id_space_iterator(index_space_iterator &xitr, bool xauto_access) const
Returns the iterator to the zone id space, xitr to the pool of id space iterators.
bool contains_vertex_id_space(bool xauto_access) const
True if and only if this block contains a vertex id space.
virtual bool is_attached() const =0
True if this handle is attached to a state.
bool contains_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
True if this block contains the connectivity for a zone with id xzone_id.
An implementation of class sum_index_space_handle that has a primary sum id space state...
const hub_index_space_handle & hub_id_space() const
The hub id space.
void release_zone_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the zone id space xid_space to the pool of handles.
index_space_handle & get_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
Allocates an id space handle from the adjacency handle pool attached to the adjacency id space state ...
A client handle for a member of a base space poset.
const pod_index_type & local_cell_type_id() const
The type id of the prototype for the local cell; the id of the local cell prototype in the id space "...
void put_size(const size_type &xsize)
Sets the number of local cell instances in this block.
bool contains_vertex_id_space(pod_index_type xmbr_id, bool xauto_access) const
True, if and only if the block containing the member with index xmbr_id has a vertex id space...
const index_space_handle & local_id_space() const
The id space for the members of this block, including the block itself.
index_space_iterator & get_connectivity_id_space_iterator(pod_index_type xzone_id, bool xauto_access) const
Allocates an id space iterator from the connectivity iterator pool attached to the connectivity id sp...
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...
index_space_iterator & get_zone_id_space_iterator(bool xauto_access) const
Allocates a zone id space iterator from the pool of iterators.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
void release_connectivity_id_space_iterator(index_space_iterator &xid_space, bool xauto_access) const
Returns the id space iterator xid_space to the connectivity iterator pool.
Emulator for a interval of implicit base space members representing a homogeneous collection of cells...
A client handle for a mutable partially ordered set.
Definition: poset.h:40
bool owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual bool is_attached() const
True if this handle is attached to a state.
bool contains_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
True if this block contains the adjacency for a vertex with id xvertex_id.
void release_adjacency_id_space_iterator(index_space_iterator &xid_space, bool xauto_access) const
Returns the id space iterator xid_space to the adjacency iterator pool.
virtual void get_read_access() const
Get read access to the state associated with this.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
index_space_iterator & get_adjacency_id_space_iterator(pod_index_type xvertex_id, bool xauto_access) const
Allocates an id space iterator from the adjacency iterator pool attached to the adjacency id space st...
index_space_handle & get_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
Allocates an id space handle from the connectivity handle pool attached to the connectivity id space ...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
static array_poset_dof_map * new_row_dof_map(const poset *xhost, const std::string &xprototype_name)
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
void release_vertex_id_space_iterator(index_space_iterator &xitr, bool xauto_access) const
Returns the vertex id space iterator xitr to the pool of iterators.
index_space_iterator & get_zone_id_space_iterator(pod_index_type xmbr_id, bool xauto_access) const
Allocates an zone id space iterator for the block containing the member with index xmbr_id for the po...
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
A client handle for a base space member which represents a homgeneous collection of local cells...
void release_connectivity_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the id space handle xid_space to the connectivity handle pool.
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
const hub_index_space_handle & hub_id_space() const
The hub id space of this block.
bool contains_zone_id_space(pod_index_type xmbr_id, bool xauto_access) const
True, if and only if the block containing the member with index xmbr_id has a zone id space...
index_space_handle & get_vertex_id_space(pod_index_type xmbr_id, bool xauto_access) const
Allocates an vertex id space handle for the block containing the member with index xmbr_id for the po...
index_space_handle & get_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
Allocates an id space handle from the connectivity handle pool attached to the connectivity id space ...
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, int xmax_db, bool xauto_access)
Creates a new host poset for members of this type. The poset is created in namespace xns with path xh...
bool contains_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
True if this poset contains the adjacency for a vertex with id xvertex_id.
virtual const homogeneous_block_crg_interval & interval() const
The implicit interval member for this block.
virtual poset_dof_map & row_dof_map(pod_index_type xtuple_hub_id, bool xrequire_write_access=false) const
The map from row dof client_ids to row dof values for dof tuple hub id xtuple_hub_id.
namespace_poset * name_space() const
The namespace this poset resides in.
virtual bool is_attached() const =0
True if this iterator is attached to a state.
void release_vertex_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the vertex id space handle xid_space to the pool of handles.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
const char * local_cell_type_name() const
The type name of the prototype for the local cell.
index_space_iterator & get_connectivity_id_space_iterator(pod_index_type xzone_id, bool xauto_access) const
Allocates an id space iterator from the connectivity iterator pool attached to the connectivity id sp...
virtual bool invariant() const
Class invariant.
void release_adjacency_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the id space handle xid_space to the adjacency handle pool.
void release_connectivity_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the id space handle xid_space to the connectivity handle pool.
index_space_handle & get_vertex_id_space(bool xauto_access) const
Allocates a handle from the pool of handles for the id space of vertices in this block.
bool contains_connectivity_id_space(pod_index_type xzone_id, bool xauto_access) const
True if this poset contains the connectivity for a zone with id xzone_id.
index_space_iterator & get_adjacency_id_space_iterator(pod_index_type xvertex_id, bool xauto_access) const
Allocates an id space iterator from the adjacency iterator pool attached to the adjacency id space st...
virtual void get_read_access() const
Get read access to the state associated with this.
int max_db() const
The maximum dimension of the members of this base space.
An abstract client handle for a member of a poset.
virtual homogeneous_block & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
index_space_iterator & get_vertex_id_space_iterator(bool xauto_access) const
Allocates a vertex id space iterator from the pool of iterators.
The type of row dof tuple for base_space_member.
An array representation of abstract class poset_dof_map.
bool contains_zone_id_space(bool xauto_access) const
True if and only if this block contains a zone id space.
Namespace for the fiber_bundles component of the sheaf system.
bool state_is_not_read_accessible() const
True if this is attached and if the state is accessible for read or if access control is disabled...
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
row_dof_tuple_type * row_dof_tuple(bool xrequire_write_access=false)
The row dof tuple for this.
index_space_handle & get_adjacency_id_space(pod_index_type xvertex_id, bool xauto_access) const
Allocates an id space handle from the adjacency handle pool attached to the adjacency id space state ...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
index_space_handle & get_zone_id_space(pod_index_type xmbr_id, bool xauto_access) const
Allocates an zone id space handle for the block containing the member with index xmbr_id from the poo...