SheafSystem  0.0.0.0
sec_rep_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/sec_rep_space_member.h"
22 
23 #include "SheafSystem/arg_list.h"
24 #include "SheafSystem/array_index_space_handle.h"
25 #include "SheafSystem/array_index_space_state.h"
26 #include "SheafSystem/array_section_dof_map.h"
27 #include "SheafSystem/assert_contract.h"
28 #include "SheafSystem/binary_section_space_schema_member.impl.h"
29 #include "SheafSystem/binary_section_space_schema_poset.h"
30 #include "SheafSystem/index_space_iterator.h"
31 #include "SheafSystem/poset_dof_map.h"
32 #include "SheafSystem/postorder_iterator.h"
33 #include "SheafSystem/preorder_iterator.h"
34 #include "SheafSystem/primitives_poset.h"
35 #include "SheafSystem/sec_rep_space.h"
36 #include "SheafSystem/section_dof_map.h"
37 #include "SheafSystem/sheaves_namespace.h"
38 #include "SheafSystem/subposet_member_iterator.h"
39 #include "SheafSystem/std_typeinfo.h"
40 #include "SheafSystem/tern.h"
41 
42 using namespace std;
43 using namespace fiber_bundle; // Workaround for MS C++ bug.
44 
45 // ===========================================================
46 // SEC_REP_SPACE_MEMBER FACET
47 // ===========================================================
48 
49 // PUBLIC MEMBER FUNCTIONS
50 
51 const std::string&
53 class_name() const
54 {
55  // Preconditions:
56 
57  // Body:
58 
59  const string& result = static_class_name();
60 
61  // Postconditions:
62 
63  ensure(!result.empty());
64 
65  // Exit:
66 
67  return result;
68 }
69 
70 const std::string&
73 {
74  // Preconditions:
75 
76  // Body:
77 
78  static const string result("sec_rep_space_member");
79 
80  // Postconditions:
81 
82  ensure(!result.empty());
83 
84  // Exit:
85 
86  return result;
87 }
88 
89 std::string
91 standard_schema_poset_name(const std::string& xschema_member_name)
92 {
93  // Preconditions:
94 
95 
96  // Body:
97 
98  string result(xschema_member_name + "_host");
99 
100  // Postconditions:
101 
102  ensure(!result.empty());
103 
104  // Exit:
105 
106  return result;
107 }
108 
109 std::string
112 {
113  // Preconditions:
114 
115  // Body:
116 
117  string result;
118 
119  string lschema("_schema");
120 
121  string lschema_member_name(xschema_path.member_name());
122 
123  int lroot_size = lschema_member_name.size() - lschema.size();
124 
125  if(lschema_member_name.substr(lroot_size) == lschema)
126  {
127  // Schema name ends in suffix _schema; strip the suffix
128 
129  result = lschema_member_name.substr(0, lroot_size);
130  }
131  else
132  {
133  // Schema doesn't end with suffix; just append "_fiber".
134 
135  result = lschema_member_name + "_fiber";
136  }
137 
138  // Postconditions:
139 
140  ensure(!result.empty());
141 
142  // Exit:
143 
144  return result;
145 }
146 
147 std::string
149 standard_section_space_name(const std::string& xfiber_space_name,
150  const std::string& xbase_space_name)
151 {
152  string result;
153 
154  // Preconditions:
155 
156  require(poset_path::is_valid_name(xfiber_space_name));
157  require(poset_path::is_valid_name(xbase_space_name));
158 
159  // Body:
160 
161  result = xfiber_space_name + "_on_" + xbase_space_name;
162 
163  // Postconditions:
164 
165  ensure(poset_path::is_valid_name(result));
166 
167  // Exit:
168 
169  return result;
170 }
171 
174 {
175  // Preconditions:
176 
177  // Body:
178 
179  // Postconditions:
180 
181  ensure(!is_attached());
182 
183  // Exit:
184 
185  return;
186 }
187 
189 sec_rep_space_member(const sec_rep_space_member& xother, bool xnew_jem)
190 {
191  // Preconditions:
192 
193  require(xnew_jem ? xother.is_attached() : true);
194 
195  // Body:
196 
197  if(xnew_jem)
198  {
199  new_jem_state(const_cast<sec_rep_space_member*>(&xother), true, true);
200  }
201  else
202  {
203  attach_to_state(&xother);
204  }
205 
206  // Postconditions:
207 
208  ensure(is_same_state(&xother));
209 
210  // Exit:
211 
212  return;
213 }
214 
218 {
219  // Preconditions:
220 
221  require(is_ancestor_of(&xother));
222  require(precondition_of(attach_to_state(&xother)));
223 
224  // Body:
225 
226  attach_to_state(&xother);
227 
228  // Postconditions:
229 
230  ensure(postcondition_of(attach_to_state(&xother)));
231 
232  // Exit:
233 
234  return *this;
235 }
236 
240 {
241  // Preconditions:
242 
243  require(precondition_of(attach_to_state(&xother)));
244 
245  // Body:
246 
247  attach_to_state(&xother);
248 
249  // Postconditions:
250 
251  ensure(is_same_state(&xother));
252 
253  // Exit:
254 
255  return *this;
256 }
257 
260 {
261  // Preconditions:
262 
263  // Body:
264 
265  // Postconditions:
266 
267  // Exit:
268 
269  return;
270 }
271 
274  section_dof_map* xdof_map,
275  bool xauto_access)
276 {
277  // Preconditions:
278 
279  require(precondition_of(new_jim_state(same args)));
280 
281  // Body:
282 
283  new_jim_state(xhost, xdof_map, xauto_access);
284 
285  // Postconditions:
286 
287  ensure(invariant());
288  ensure(postcondition_of(new_jim_state(same args)));
289 
290  // Exit:
291 
292  return;
293 }
294 
297  abstract_poset_member& xbase_mbr,
298  int xbase_version,
299  bool xauto_access)
300 {
301  // Preconditions:
302 
303  require(precondition_of(\
304  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
305 
306  // Body:
307 
308  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
309 
310  // Postconditions:
311 
312  ensure(postcondition_of(\
313  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
314 
315  // Exit:
316 
317  return;
318 }
319 
321 sec_rep_space_member(sec_rep_space* xhost, const subposet& xbase_parts, bool xauto_access)
322 {
323  // Preconditions:
324 
325  require(precondition_of(new_jrm_state(xhost, xbase_parts, xauto_access)));
326 
327  // Body:
328 
329  new_jrm_state(xhost, xbase_parts, xauto_access);
330 
331  // Postconditions:
332 
333  require(postcondition_of(new_jrm_state(xhost, xbase_parts, xauto_access)));
334 
335  // Exit:
336 
337  return;
338 }
339 
342  scoped_index* xexpansion,
343  int xexpansion_ct,
344  const tern& xnew_jem,
345  bool xauto_access)
346 {
347  // Preconditions:
348 
349  require(precondition_of(new_jrm_state(same args)));
350 
351 
352  // Body:
353 
354  new_jrm_state(xhost, xexpansion, xexpansion_ct, xnew_jem, xauto_access);
355 
356 
357  // Postconditions:
358 
359  ensure(invariant());
360  ensure(postcondition_of(new_jrm_state(same args)));
361 
362 }
363 
366 {
367  // Preconditions:
368 
369  require(xhost->state_is_read_accessible());
370  require(xhost->contains_member(xindex));
371 
372  // Body:
373 
374  attach_to_state(xhost, xindex);
375 
376  // Postconditions:
377 
378  ensure(invariant());
379  ensure(host() == xhost);
380  ensure(index() == xindex);
381  ensure(is_attached());
382  ensure(!is_restricted());
383 }
384 
386 sec_rep_space_member(const sec_rep_space* xhost, const scoped_index& xindex)
387 {
388  // Preconditions:
389 
390  require(xhost->state_is_read_accessible());
391  require(xhost->contains_member(xindex));
392 
393  // Body:
394 
395  attach_to_state(xhost, xindex.hub_pod());
396 
397  // Postconditions:
398 
399  ensure(invariant());
400  ensure(host() == xhost);
401  ensure(index() ==~ xindex);
402  ensure(is_attached());
403  ensure(!is_restricted());
404 }
405 
407 sec_rep_space_member(const sec_rep_space* xhost, const std::string& xname)
408 {
409  // Preconditions:
410 
411  require(xhost != 0);
412  require(xhost->state_is_read_accessible());
413  require(!xname.empty());
414  require(xhost->contains_member(xname));
415 
416  // Body:
417 
418  attach_to_state(xhost, xname);
419 
420  // Postconditions:
421 
422  ensure(invariant());
423  ensure(host() == xhost);
424  ensure(name() == xname);
425  ensure(is_attached());
426  ensure(!is_restricted());
427 }
428 
431  const poset_path& xpath,
432  bool xauto_access)
433 {
434  // Preconditions:
435 
436  require(precondition_of(attach_to_state(same args)));
437 
438  // Body:
439 
440  attach_to_state(xnamespace, xpath, xauto_access);
441 
442  // Postconditions:
443 
444  ensure(postcondition_of(attach_to_state(same args)));
445 
446  // Exit:
447 
448  return;
449 }
450 
453  pod_index_type xposet_index,
454  pod_index_type xmember_index)
455 {
456  // Preconditions:
457 
458  require(precondition_of(attach_to_state(same args)));
459 
460  // Body:
461 
462  attach_to_state(xnamespace, xposet_index, xmember_index);
463 
464  // Postconditions:
465 
466  ensure(postcondition_of(attach_to_state(same args)));
467 
468  // Exit:
469 
470  return;
471 }
472 
475  const scoped_index& xposet_index,
476  const scoped_index& xmember_index)
477 {
478  // Preconditions:
479 
480  require(precondition_of(attach_to_state(same args)));
481 
482  // Body:
483 
484  attach_to_state(xnamespace,
485  xposet_index.hub_pod(),
486  xmember_index.hub_pod());
487 
488  // Postconditions:
489 
490  ensure(postcondition_of(attach_to_state(same args)));
491 
492  // Exit:
493 
494  return;
495 }
496 
499 {
500  // Preconditions:
501 
502  require(xother != 0);
503 
504  // Body:
505 
506  attach_to_state(xother);
507 
508  // Postconditions:
509 
510  ensure(invariant());
511  ensure(is_attached());
512  ensure(is_same_state(xother));
513  ensure(is_same_restriction(xother));
514 
515  // Exit:
516 
517  return;
518 }
519 
520 void
522 new_jim_state(abstract_poset_member& xbase_mbr, int xbase_version,
523  bool xauto_access)
524 {
525  // Preconditions:
526 
527  require(is_attached());
528  require(precondition_of(\
529  new_jim_state(host(), xbase_mbr, xbase_version, xauto_access)));
530 
531  // Body:
532 
533  new_jim_state(host(), xbase_mbr, xbase_version, xauto_access);
534 
535  // Postconditions:
536 
537  ensure(postcondition_of\
538  (new_jim_state(host(), xbase_mbr, xbase_version, xauto_access)));
539 
540  // Exit:
541 
542  return;
543 }
544 
545 void
548  const abstract_poset_member& xbase_mbr,
549  int xbase_version,
550  bool xauto_access)
551 {
552  // Preconditions:
553 
554  require(xhost != 0);
555  require(!xauto_access ? xhost->in_jim_edit_mode() : true);
556 
557  if(xauto_access)
558  {
559  xhost->begin_jim_edit_mode();
560  }
561 
562  require(xbase_mbr.leqv(xhost->base().index()));
563  require(xbase_mbr.has_version(xbase_version));
564 
565  // Body:
566 
567  const scoped_index& ltuple_id =
568  xhost->new_row_dof_map(xbase_mbr.index().pod(), xbase_version);
569  new_jim_state(xhost, ltuple_id, false);
570 
571  // Postconditions:
572 
573  ensure(invariant());
574  ensure(host() == xhost);
575  ensure(is_attached());
576  ensure(base().is_same_state(&xbase_mbr));
577  ensure(version() == schema().unaliased_version(xbase_version));
578  ensure(unexecutable(host()->member_ct() == old host->member_ct() + 1));
579  ensure(!is_restricted());
580 
581  if(xauto_access)
582  {
583  xhost->end_jim_edit_mode();
584  }
585 
586  // Exit:
587 
588  return;
589 }
590 
591 void
593 new_jrm_state(sec_rep_space* xhost, const subposet& xbase_parts, bool xauto_access)
594 {
595  // Preconditions:
596 
597  require(xhost != 0);
598  require(xhost->is_attached());
599  require(xauto_access || xhost->state_is_read_write_accessible());
600 
601  if(xauto_access)
602  {
603  xhost->get_read_write_access(true);
604  }
605 
606  require(xhost->schema().host()->base_space().includes_subposet(&xbase_parts));
607  require(!xbase_parts.is_empty());
608 
609  require(unexecutable("for all m in xbase_parts, m.le(xhost->schema().base_space())"));
610 
611  // Body:
612 
613  // Create the branches.
614 
615  block<scoped_index> lbranches(256); // Arbitrary; avoids small reallocs.
616  xhost->begin_jim_edit_mode(false);
617 
618  subposet_member_iterator* litr = xbase_parts.member_iterator();
619  while(!litr->is_done())
620  {
621  new_jim_state(xhost, *litr, CURRENT_HOST_VERSION, false);
622  lbranches.push_back(index());
623  litr->next();
624  }
625  delete litr;
626 
627  xhost->end_jim_edit_mode(true, false);
628 
629  // Create the multi-section itself.
630  // The jrm should always be a distinct member that directly cover the branches,
631  // so set the tern argument to tern::FALSE. Under most conditions the jrm is
632  // unique so tern::NEITHER or TRUE would produce the sme result. But if the
633  // section space is empty before we create the branches then the jrm is equivalent
634  // to top, so we have to force it to be distinct.
635 
636  new_jrm_state(xhost, lbranches.base(), lbranches.ct(), tern::FALSE, false);
637 
638  // Get a sequence id for this multisection.
639 
640  host()->multisection_id_space(false).push_back(index());
641 
642  // Create an id space for the branches.
643 
644  const string& lbranch_space_name =
645  host()->branch_id_space_name(index(), false);
646 
647  array_index_space_handle lbranch_id_space =
648  array_index_space_state::new_space(host()->member_id_spaces(false),
649  lbranch_space_name,
650  true, 0);
651 
652  int lbranch_ct = lbranches.ct();
653  for(int i=0; i<lbranch_ct; ++i)
654  {
655  lbranch_id_space.push_back(lbranches[i]);
656  }
657 
658 
659  if(xauto_access)
660  {
661  xhost->release_access();
662  }
663 
664  // Postconditions:
665 
666  ensure(unexecutable("this has a branch for each member of xbase_parts"));
667  ensure(has_branch_id_space(true));
668 
669 
670  // Exit:
671 
672  return;
673 }
674 
675 // PROTECTED MEMBER FUNCTIONS
676 
677 // PRIVATE MEMBER FUNCTIONS
678 
679 
680 // ===========================================================
681 // MULTISECTION FACET
682 // ===========================================================
683 
684 // PUBLIC MEMBER FUNCTIONS
685 
686 bool
688 is_multisection(bool xauto_access) const
689 {
690  bool result;
691 
692  // Preconditions:
693 
694  require(xauto_access || state_is_read_accessible());
695 
696  // Body:
697 
698  result = host()->is_multisection(index(), xauto_access);
699 
700  // Postconditions:
701 
702 
703  // Exit:
704 
705  return result;
706 }
707 
708 bool
710 has_branch_id_space(bool xauto_access) const
711 {
712  bool result;
713 
714  // Preconditions:
715 
716  require(xauto_access || state_is_read_accessible());
717 
718  // Body:
719 
720  result = host()->member_id_spaces(xauto_access).
721  contains(host()->branch_id_space_name(index(), xauto_access));
722 
723  // Postconditions:
724 
725 
726  // Exit:
727 
728  return result;
729 }
730 
733 get_branch_id_space(bool xauto_access)
734 {
735  // Preconditions:
736 
737  require(xauto_access || state_is_read_accessible());
738  require(has_branch_id_space(xauto_access));
739 
740  // Body:
741 
743  host()->get_branch_id_space(index(), xauto_access);
744 
745  // Postconditions:
746 
747  ensure(result.is_attached());
748 
749  // Exit:
750 
751  return result;
752 }
753 
754 void
756 release_branch_id_space(index_space_handle& xid_space, bool xauto_access) const
757 {
758  // Preconditions:
759 
760  require(xauto_access || state_is_read_accessible());
761  require(allocated_branch_handle(xid_space, xauto_access));
762 
763  // Body:
764 
765  host()->release_branch_id_space(xid_space, xauto_access);
766 
767  // Postconditions:
768 
769  ensure(is_basic_query);
770 
771  // Exit:
772 
773  return;
774 }
775 
776 bool
778 allocated_branch_handle(index_space_handle& xid_space, bool xauto_access) const
779 {
780  // Preconditions:
781 
782  require(xauto_access || state_is_read_accessible());
783 
784  // Body:
785 
786  bool result = host()->allocated_branch_handle(xid_space, xauto_access);
787 
788  // Postconditions:
789 
790  ensure(is_basic_query);
791 
792  // Exit:
793 
794  return result;
795 }
796 
799 get_branch_id_space_iterator(bool xauto_access) const
800 {
801  // Preconditions:
802 
803  require(xauto_access || state_is_read_accessible());
804  require(has_branch_id_space(xauto_access));
805 
806  // Body:
807 
808  index_space_iterator& result =
809  host()->get_branch_id_space_iterator(index(), xauto_access);
810 
811  // Postconditions:
812 
813  ensure(result.is_attached());
814 
815  // Exit:
816 
817  return result;
818 }
819 
820 void
823 {
824  // Preconditions:
825 
826  require(xauto_access || state_is_read_accessible());
827  require(allocated_branch_iterator(xitr, xauto_access));
828 
829  // Body:
830 
831  host()->release_branch_id_space_iterator(xitr, xauto_access);
832 
833  // Postconditions:
834 
835  ensure(is_basic_query);
836 
837  // Exit:
838 
839  return;
840 }
841 
842 bool
844 allocated_branch_iterator(index_space_iterator& xitr, bool xauto_access) const
845 {
846  // Preconditions:
847 
848  require(xauto_access || state_is_read_accessible());
849 
850  // Body:
851 
852  bool result = host()->allocated_branch_iterator(xitr, xauto_access);
853 
854  // Postconditions:
855 
856  ensure(is_basic_query);
857 
858  // Exit:
859 
860  return result;
861 }
862 
863 // PROTECTED MEMBER FUNCTIONS
864 
865 // PRIVATE MEMBER FUNCTIONS
866 
867 
868 // ===========================================================
869 // SCHEMA FACET
870 // ===========================================================
871 
872 // PUBLIC MEMBER FUNCTIONS
873 
877 {
878  // Preconditions:
879 
880  // The implementation of this only requires is_attached(),
881  // but both ancestors and descendants require state_is_read_accessible().
882 
883  require(state_is_read_accessible());
884 
885  // Body:
886 
888  *reinterpret_cast<section_space_schema_member*>(_schema);
889 
890  // Postconditions:
891 
892  ensure(result.is_attached());
893 
894  // Exit
895 
896  return result;
897 }
898 
901 schema() const
902 {
903  // Preconditions:
904 
905  // The implementation of this only requires is_attached(),
906  // but both ancestors and descendants require state_is_read_accessible().
907 
908  require(state_is_read_accessible());
909 
910  // Body:
911 
912  const section_space_schema_member& result =
913  *reinterpret_cast<const section_space_schema_member*>(_schema);
914 
915  // Postconditions:
916 
917  ensure(result.is_attached());
918 
919  // Exit
920 
921  return result;
922 }
923 
926 schema(bool xauto_access)
927 {
928  // Preconditions:
929 
930  require(xauto_access || state_is_read_accessible());
931 
932  // Body:
933 
934  if(xauto_access)
935  {
936  get_read_access();
937  }
938 
939  section_space_schema_member& result = schema();
940 
941  if(xauto_access)
942  {
943  release_access();
944  }
945 
946  // Postconditions:
947 
948  ensure(postcondition_of(schema()));
949 
950  // Exit:
951 
952  return result;
953 }
954 
957 schema(bool xauto_access) const
958 {
959  // Preconditions:
960 
961  require(xauto_access || state_is_read_accessible());
962 
963  // Body:
964 
965  if(xauto_access)
966  {
967  get_read_access();
968  }
969 
970  const section_space_schema_member& result = schema();
971 
972  if(xauto_access)
973  {
974  release_access();
975  }
976 
977  // Postconditions:
978 
979  ensure(postcondition_of(schema()));
980 
981  // Exit:
982 
983  return result;
984 }
985 
989 {
990  // Preconditions:
991 
992  require(state_is_read_accessible());
993 
994  // Body:
995 
997  reinterpret_cast<section_space_schema_member&>
998  (partial_poset_member::unrestricted_schema());
999 
1000  // Postconditions:
1001 
1002  ensure(is_jim(false) ?
1003  result.is_same_state(&(dof_map().schema())) :
1004  result.is_same_state(&(host()->schema())));
1005 
1006  // Exit
1007 
1008  return result;
1009 }
1010 
1014 {
1015  // Preconditions:
1016 
1017  require(state_is_read_accessible());
1018 
1019  // Body:
1020 
1021  const section_space_schema_member& result =
1022  reinterpret_cast<const section_space_schema_member&>
1023  (partial_poset_member::unrestricted_schema());
1024 
1025  // Postconditions:
1026 
1027  ensure(is_jim(false) ?
1028  result.is_same_state(&(dof_map().schema())) :
1029  result.is_same_state(&(host()->schema())));
1030 
1031  // Exit
1032 
1033  return result;
1034 }
1035 
1036 // PROTECTED MEMBER FUNCTIONS
1037 
1038 // PRIVATE MEMBER FUNCTIONS
1039 
1040 
1041 // ===========================================================
1042 // RESTRICTION FACET
1043 // ===========================================================
1044 
1045 // PUBLIC MEMBER FUNCTIONS
1046 
1050 {
1051  // Preconditions:
1052 
1053  require(is_attached());
1054 
1055  // Body:
1056 
1057  abstract_poset_member& result = schema().base_space();
1058 
1059  // Postconditions:
1060 
1061  // Exit
1062 
1063  return result;
1064 }
1065 
1068 base() const
1069 {
1070  // Preconditions:
1071 
1072  require(is_attached());
1073 
1074  // Body:
1075 
1076  const abstract_poset_member& result = schema().base_space();
1077 
1078  // Postconditions:
1079 
1080  // Exit
1081 
1082  return result;
1083 }
1084 
1085 bool
1087 same_base(const sec_rep_space_member* xother) const
1088 {
1089  bool result;
1090 
1091  // Preconditions:
1092 
1093  require(state_is_read_accessible());
1094  require(xother != 0);
1095  require(xother->state_is_read_accessible());
1096 
1097  // Body:
1098 
1099  result = schema().same_base_space(xother->schema());
1100 
1101  // Postconditions:
1102 
1103 
1104  // Exit:
1105 
1106  return result;
1107 }
1108 
1109 int
1111 db() const
1112 {
1113  int result;
1114 
1115  // Preconditions:
1116 
1117  require(is_attached());
1118 
1119  // Body:
1120 
1121  result = schema().db();
1122 
1123  // Postconditions:
1124 
1125  ensure(result >= 0);
1126 
1127  // Exit
1128 
1129  return result;
1130 }
1131 
1132 bool
1134 same_rep(const sec_rep_space_member* xother) const
1135 {
1136  bool result;
1137 
1138  // Preconditions:
1139 
1140  require(state_is_read_accessible());
1141  require(xother != 0);
1142  require(xother->state_is_read_accessible());
1143 
1144  // Body:
1145 
1148 
1150 
1151  result = schema().same_rep(xother->schema()) && same_base(xother);
1152 
1153  // Postconditions:
1154 
1155 
1156  // Exit:
1157 
1158  return result;
1159 }
1160 
1161 int
1164 {
1165  int result;
1166 
1167  // Preconditions:
1168 
1169  require(state_is_read_accessible());
1170 
1171  // Body:
1172 
1173  // Get the disc count from the dof tuple schema because it must have
1174  // already been evaluated while disc ct in schema of handle may need
1175  // updating.
1176 
1177  if(is_jim())
1178  {
1179  // This is an ordinary section,
1180  // discretization count given by schema.
1181 
1182  if(is_restricted())
1183  {
1184  // Have to use handle schema, even if less efficient.
1185 
1186  result = schema().discretization_ct();
1187  }
1188  else
1189  {
1190  result = dof_map().schema().discretization_ct();
1191  }
1192  }
1193  else
1194  {
1195  // This is a multi-section;
1196  // discretization count is sum of counts of branches.
1197 
1198  result = 0;
1199  preorder_iterator litr(*this, "jims", DOWN, NOT_STRICT);
1200  while(!litr.is_done())
1201  {
1202  result +=
1203  host()->member_dof_map(litr.index()).schema().discretization_ct();
1204 
1205  litr.truncate();
1206  }
1207  }
1208 
1209  // Postconditions:
1210 
1211  ensure(result >= 0);
1212 
1213  // Exit
1214 
1215  return result;
1216 }
1217 
1218 int
1220 discretization_ct(bool xauto_access) const
1221 {
1222  int result;
1223 
1224  // Preconditions:
1225 
1226  require(xauto_access || state_is_read_accessible());
1227 
1228  // Body:
1229 
1230  if(xauto_access)
1231  {
1232  get_read_access();
1233  }
1234 
1235  result = discretization_ct();
1236 
1237  if(xauto_access)
1238  {
1239  release_access();
1240  }
1241 
1242  // Postconditions:
1243 
1244  ensure(postcondition_of(discretization_ct()));
1245 
1246  // Exit:
1247 
1248  return result;
1249 }
1250 
1251 int
1254 {
1255  int result;
1256 
1257  // Preconditions:
1258 
1259  require(state_is_read_accessible());
1260 
1261  // Body:
1262 
1263  // Get the disc count from the dof tuple schema because it must have
1264  // already been evaluated while disc ct in schema of handle may need
1265  // updating.
1266 
1267  if(is_jim())
1268  {
1269  // This is an ordinary section,
1270  // evaluation count given by schema.
1271 
1272  if(is_restricted())
1273  {
1274  // Have to use handle schema, even if less efficient.
1275 
1276  result = schema().evaluation_ct();
1277  }
1278  else
1279  {
1280  result = dof_map().schema().evaluation_ct();
1281  }
1282  }
1283  else
1284  {
1285  // This is a multi-section;
1286  // evaluation count is sum of counts of branches.
1287 
1288  result = 0;
1289 
1290  preorder_iterator litr(*this, "jims", DOWN, NOT_STRICT);
1291 
1293 
1294  while(!litr.is_done())
1295  {
1296  result += host()->member_dof_map(litr.index()).schema().evaluation_ct();
1297 
1298  litr.truncate();
1299  }
1300  }
1301 
1302  // Postconditions:
1303 
1304  ensure(result >= 0);
1305 
1306  // Exit
1307 
1308  return result;
1309 }
1310 
1314 {
1315  // Preconditions:
1316 
1317  require(is_attached());
1318 
1319  // Body:
1320 
1321  schema_poset_member& result = schema().fiber_schema();
1322 
1323  // Postconditions:
1324 
1325  // Exit
1326 
1327  return result;
1328 }
1329 
1333 {
1334  // Preconditions:
1335 
1336  require(is_attached());
1337 
1338  // Body:
1339 
1340  const schema_poset_member& result = schema().fiber_schema();
1341 
1342  // Postconditions:
1343 
1344  // Exit
1345 
1346  return result;
1347 }
1348 
1349 sheaf::poset&
1352 {
1353  // Preconditions:
1354 
1355  require(state_is_read_accessible());
1356 
1357  // Body:
1358 
1359  poset& result = schema().fiber_space();
1360 
1361  // Postconditions:
1362 
1363  // Exit
1364 
1365  return result;
1366 }
1367 
1368 const sheaf::poset&
1370 fiber() const
1371 {
1372  // Preconditions:
1373 
1374  require(state_is_read_accessible());
1375 
1376  // Body:
1377 
1378  const poset& result = schema().fiber_space();
1379 
1380  // Postconditions:
1381 
1382  // Exit
1383 
1384  return result;
1385 }
1386 
1387 int
1389 df() const
1390 {
1391  int result;
1392 
1393  // Preconditions:
1394 
1395  require(is_attached());
1396 
1397  // Body:
1398 
1399  result = schema().df();
1400 
1401  // Postconditions:
1402 
1403  ensure(result >= 0);
1404 
1405  // Exit
1406 
1407  return result;
1408 }
1409 
1410 void
1412 restrict_to(pod_index_type xbase_id, pod_index_type xfiber_schema_id)
1413 {
1414  // Preconditions:
1415 
1416  require(state_is_read_accessible());
1417 
1423 
1424  // Body:
1425 
1426  schema().attach_to_state(xbase_id, xfiber_schema_id);
1427 
1428  // Postconditions:
1429 
1433 
1434  // Exit
1435 
1436  return;
1437 }
1438 
1439 void
1441 restrict_to(const scoped_index& xbase_id, const scoped_index& xfiber_schema_id)
1442 {
1443  // Preconditions:
1444 
1445  require(state_is_read_accessible());
1446 
1452 
1453  // Body:
1454 
1455  restrict_to(xbase_id.hub_pod(), xfiber_schema_id.hub_pod());
1456 
1457  // Postconditions:
1458 
1462 
1463  // Exit
1464 
1465  return;
1466 }
1467 
1468 void
1470 restrict_to(const abstract_poset_member* xbase, const abstract_poset_member* xfiber_schema)
1471 {
1472  // Preconditions:
1473 
1474  require(state_is_read_accessible());
1475  require(xbase != 0);
1476  require(xbase->le(&(unrestricted_schema().base_space())));
1477  require(xfiber_schema != 0);
1478  require(xfiber_schema->le(&(unrestricted_schema().fiber_schema())));
1479 
1480  // Body:
1481 
1482  schema().attach_to_state(xbase->index(), xfiber_schema->index());
1483 
1484  // Postconditions:
1485 
1486  ensure(base().is_same_state(xbase));
1487  ensure(fiber_schema().is_same_state(xfiber_schema));
1488 
1489  // Exit
1490 
1491  return;
1492 }
1493 
1494 bool
1497 {
1498  bool result;
1499 
1500  // Preconditions:
1501 
1502  require(is_attached() ? state_is_read_accessible() : true);
1503  require(is_attached() ? base().state_is_read_accessible() : true);
1504 
1505  // Body:
1506 
1507  result = is_attached() &&
1508  !(base().is_same_state(&(unrestricted_schema().base_space())));
1509 
1510  // Postconditions:
1511 
1512  // Exit
1513 
1514  return result;
1515 }
1516 
1517 bool
1520 {
1521  bool result;
1522 
1523  // Preconditions:
1524 
1525  require(is_attached() ? state_is_read_accessible() : true);
1526 
1527  // Body:
1528 
1529  result = is_attached() &&
1530  !(fiber_schema().is_same_state(&(unrestricted_schema().fiber_schema())));
1531 
1532  // Postconditions:
1533 
1534  // Exit
1535 
1536  return result;
1537 }
1538 
1539 int
1541 version() const
1542 {
1543  int result;
1544 
1545  // Preconditions:
1546 
1547  require(state_is_read_accessible());
1548 
1549  // Body:
1550 
1551  if(is_jim())
1552  {
1553  result = dof_map().version();
1554  }
1555  else
1556  {
1557  result = NOT_A_STANDARD_VERSION_INDEX;
1558  }
1559 
1560  // Postconditions:
1561 
1562  ensure(is_jim() ? host()->base().host()->has_version(result) :
1563  result == NOT_A_STANDARD_VERSION_INDEX);
1564 
1565  // Exit
1566 
1567  return result;
1568 }
1569 
1570 // PROTECTED MEMBER FUNCTIONS
1571 
1572 // PRIVATE MEMBER FUNCTIONS
1573 
1574 
1575 // ===========================================================
1576 // NEW DOF ACCESS FACET
1577 // ===========================================================
1578 
1579 // PUBLIC MEMBER FUNCTIONS
1580 
1581 void
1583 get_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, void* xdof, size_type xdof_size) const
1584 {
1585  // Preconditions:
1586 
1587  require(state_is_read_accessible());
1588  require(schema().discretization_id_space().contains(xdisc_id));
1589  require(schema().fiber_schema_id_space(false).contains(xfiber_dof_id));
1590  require(unexecutable("xdof points to buffer of size xdof_size"));
1591  require(xdof_size >= schema().size(xdisc_id, xfiber_dof_id, false));
1592 
1593  // Body:
1594 
1595  dof_map(false).get_dof(xdisc_id, xfiber_dof_id, xdof, xdof_size);
1596 
1597  // Postconditions:
1598 
1599 
1600  // Exit:
1601 
1602  return;
1603 }
1604 
1605 void
1607 get_dof(const scoped_index& xdisc_id,
1608  const scoped_index& xfiber_dof_id,
1609  void* xdof,
1610  size_type xdof_size,
1611  bool xauto_access) const
1612 {
1613  // Preconditions:
1614 
1615  require(state_is_auto_read_accessible(xauto_access));
1616  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1617  require(schema(xauto_access).fiber_schema_id_space(false, xauto_access).contains(xfiber_dof_id));
1618  require(unexecutable("xdof points to buffer of size xdof_size"));
1619  require(xdof_size >= schema(xauto_access).size(xdisc_id, xfiber_dof_id, false, xauto_access));
1620 
1621  // Body:
1622 
1623  if(xauto_access)
1624  {
1625  get_read_access();
1626  }
1627 
1628  dof_map(false).get_dof(xdisc_id, xfiber_dof_id, xdof, xdof_size);
1629 
1630  if(xauto_access)
1631  {
1632  release_access();
1633  }
1634 
1635  // Postconditions:
1636 
1637 
1638  // Exit:
1639 
1640  return;
1641 }
1642 
1643 void
1645 put_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, const void* xdof, size_type xdof_size)
1646 {
1647  // Preconditions:
1648 
1649  require(state_is_read_write_accessible());
1650  require(schema().discretization_id_space().contains(xdisc_id));
1651  require(schema().fiber_schema_id_space(false).contains(xfiber_dof_id));
1652  require(unexecutable("xdof points to buffer of size xdof_size"));
1653  require(xdof_size >= schema().size(xdisc_id, xfiber_dof_id, false));
1654 
1655  // Body:
1656 
1657  dof_map(true).put_dof(xdisc_id, xfiber_dof_id, xdof, xdof_size);
1658 
1659  // Postconditions:
1660 
1661  // Exit:
1662 
1663  return;
1664 }
1665 
1666 void
1668 put_dof(const scoped_index& xdisc_id,
1669  const scoped_index& xfiber_dof_id,
1670  const void* xdof,
1671  size_type xdof_size,
1672  bool xauto_access)
1673 {
1674  // Preconditions:
1675 
1676  require(state_is_auto_read_write_accessible(xauto_access));
1677  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1678  require(schema(xauto_access).fiber_schema_id_space(false, xauto_access).contains(xfiber_dof_id));
1679  require(unexecutable("xdof points to buffer of size xdof_size"));
1680  require(xdof_size >= schema(xauto_access).size(xdisc_id, xfiber_dof_id, false, xauto_access));
1681 
1682  // Body:
1683 
1684  if(xauto_access)
1685  {
1686  get_read_write_access(true);
1687  }
1688 
1689  dof_map(true).put_dof(xdisc_id, xfiber_dof_id, xdof, xdof_size);
1690 
1691  if(xauto_access)
1692  {
1693  release_access();
1694  }
1695 
1696  // Postconditions:
1697 
1698 
1699  // Exit:
1700 
1701  return;
1702 }
1703 
1704 void
1706 get_fiber(pod_index_type xdisc_id, void* xfiber, size_type xfiber_size) const
1707 {
1708  // Preconditions:
1709 
1710  require(state_is_read_accessible());
1711  require(schema().discretization_id_space().contains(xdisc_id));
1712  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1713  require(xfiber_size >= schema().fiber_size());
1714 
1715  // Body:
1716 
1717  dof_map(false).get_fiber(xdisc_id, xfiber, xfiber_size);
1718 
1719  // Postconditions:
1720 
1721 
1722  // Exit:
1723 
1724  return;
1725 }
1726 
1727 void
1729 get_fiber(const scoped_index& xdisc_id, void* xfiber, size_type xfiber_size, bool xauto_access) const
1730 {
1731  // Preconditions:
1732 
1733  require(state_is_auto_read_accessible(xauto_access));
1734  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1735  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1736  require(xfiber_size >= schema(xauto_access).fiber_size(xauto_access));
1737 
1738  // Body:
1739 
1740  if(xauto_access)
1741  {
1742  get_read_access();
1743  }
1744 
1745  dof_map(false).get_fiber(xdisc_id, xfiber, xfiber_size);
1746 
1747  if(xauto_access)
1748  {
1749  release_access();
1750  }
1751 
1752  // Postconditions:
1753 
1754 
1755  // Exit:
1756 
1757  return;
1758 }
1759 
1760 void
1762 put_fiber(pod_index_type xdisc_id, const void* xfiber, size_type xfiber_size)
1763 {
1764  // Preconditions:
1765 
1766  require(state_is_read_write_accessible());
1767  require(schema().discretization_id_space().contains(xdisc_id));
1768  require(unexecutable("dof_map().fiber_in_bounds(xdisc_id, false)"));
1769  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1770  require(xfiber_size >= schema().fiber_size());
1771 
1772  // Body:
1773 
1774  dof_map(true).put_fiber(xdisc_id, xfiber, xfiber_size);
1775 
1776  // Postconditions:
1777 
1778 
1779  // Exit:
1780 
1781  return;
1782 }
1783 
1784 void
1786 put_fiber(const scoped_index& xdisc_id, const void* xfiber, size_type xfiber_size, bool xauto_access)
1787 {
1788  // Preconditions:
1789 
1790  require(state_is_auto_read_write_accessible(xauto_access));
1791  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1792  require(unexecutable("dof_map().fiber_in_bounds(xdisc_id, false)"));
1793  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1794  require(xfiber_size >= schema(xauto_access).fiber_size(xauto_access));
1795 
1796  // Body:
1797 
1798  if(xauto_access)
1799  {
1800  get_read_write_access(true);
1801  }
1802 
1803  dof_map(true).put_fiber(xdisc_id, xfiber, xfiber_size);
1804 
1805  if(xauto_access)
1806  {
1807  release_access();
1808  }
1809 
1810  // Postconditions:
1811 
1812 
1813  // Exit:
1814 
1815  return;
1816 }
1817 
1818 void
1820 force_fiber(pod_index_type xdisc_id, const void* xfiber, size_type xfiber_size)
1821 {
1822  // Preconditions:
1823 
1824  require(state_is_read_write_accessible());
1825  require(schema().discretization_id_space().contains(xdisc_id));
1826  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1827  require(xfiber_size >= schema().fiber_size());
1828 
1829  // Body:
1830 
1831  dof_map(true).force_fiber(xdisc_id, xfiber, xfiber_size);
1832 
1833  // Postconditions:
1834 
1835 
1836  // Exit:
1837 
1838  return;
1839 }
1840 
1841 void
1843 force_fiber(const scoped_index& xdisc_id, const void* xfiber, size_type xfiber_size, bool xauto_access)
1844 {
1845  // Preconditions:
1846 
1847  require(state_is_auto_read_write_accessible(xauto_access));
1848  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1849  require(unexecutable("xfiber points to buffer of size xfiber_size"));
1850  require(xfiber_size >= schema(xauto_access).fiber_size(xauto_access));
1851 
1852  // Body:
1853 
1854  if(xauto_access)
1855  {
1856  get_read_write_access(true);
1857  }
1858 
1859  dof_map(true).force_fiber(xdisc_id, xfiber, xfiber_size);
1860 
1861  if(xauto_access)
1862  {
1863  release_access();
1864  }
1865 
1866  // Postconditions:
1867 
1868 
1869  // Exit:
1870 
1871  return;
1872 }
1873 
1874 void
1876 get_component(pod_index_type xfiber_dof_id, void* xcomponent, size_type xcomponent_size) const
1877 {
1878  // Preconditions:
1879 
1880  require(state_is_read_accessible());
1881  require(schema().fiber_schema_id_space(false).contains(xfiber_dof_id));
1882  require(unexecutable("xcomponent points to buffer of size xcomponent_size"));
1883  require(xcomponent_size >= schema().component_size(xfiber_dof_id));
1884 
1885  // Body:
1886 
1887  dof_map(false).get_component(xfiber_dof_id, xcomponent, xcomponent_size);
1888 
1889  // Postconditions:
1890 
1891 
1892  // Exit:
1893 
1894  return;
1895 }
1896 
1897 void
1899 get_component(const scoped_index& xfiber_dof_id,
1900  void* xcomponent,
1901  size_type xcomponent_size,
1902  bool xauto_access) const
1903 {
1904  // Preconditions:
1905 
1906  require(state_is_auto_read_accessible(xauto_access));
1907  require(schema(xauto_access).fiber_schema_id_space(false, xauto_access).contains(xfiber_dof_id));
1908  require(unexecutable("xcomponent points to buffer of size xcomponent_size"));
1909  require(xcomponent_size >= schema(xauto_access).component_size(xfiber_dof_id, xauto_access));
1910 
1911  // Body:
1912 
1913  if(xauto_access)
1914  {
1915  get_read_access();
1916  }
1917 
1918  dof_map(false).get_component(xfiber_dof_id, xcomponent, xcomponent_size);
1919 
1920  if(xauto_access)
1921  {
1922  release_access();
1923  }
1924 
1925  // Postconditions:
1926 
1927 
1928  // Exit:
1929 
1930  return;
1931 }
1932 
1933 void
1935 put_component(pod_index_type xfiber_dof_id, const void* xcomponent, size_type xcomponent_size)
1936 {
1937  // Preconditions:
1938 
1939  require(state_is_read_write_accessible());
1940  require(schema().fiber_schema_id_space(false).contains(xfiber_dof_id));
1941  require(unexecutable("xcomponent points to buffer of size xcomponent_size"));
1942  require(xcomponent_size >= schema().component_size(xfiber_dof_id));
1943 
1944  // Body:
1945 
1946  dof_map(true).put_component(xfiber_dof_id, xcomponent, xcomponent_size);
1947 
1948  // Postconditions:
1949 
1950 
1951  // Exit:
1952 
1953  return;
1954 }
1955 
1956 void
1958 put_component(const scoped_index& xfiber_dof_id,
1959  const void* xcomponent,
1960  size_type xcomponent_size,
1961  bool xauto_access)
1962 {
1963  // Preconditions:
1964 
1965  require(state_is_auto_read_write_accessible(xauto_access));
1966  require(schema(xauto_access).fiber_schema_id_space(false, xauto_access).contains(xfiber_dof_id));
1967  require(unexecutable("xcomponent points to buffer of size xcomponent_size"));
1968  require(xcomponent_size >= schema(xauto_access).component_size(xfiber_dof_id, xauto_access));
1969 
1970  // Body:
1971 
1972  if(xauto_access)
1973  {
1974  get_read_write_access(true);
1975  }
1976 
1977  dof_map(true).put_component(xfiber_dof_id, xcomponent, xcomponent_size);
1978 
1979  if(xauto_access)
1980  {
1981  release_access();
1982  }
1983 
1984  // Postconditions:
1985 
1986 
1987  // Exit:
1988 
1989  return;
1990 }
1991 
1992 // PROTECTED MEMBER FUNCTIONS
1993 
1994 // PRIVATE MEMBER FUNCTIONS
1995 
1996 
1997 // ===========================================================
1998 // DEGREE OF FREEDOM (DOF) TUPLE FACET
1999 // ===========================================================
2000 
2001 // PUBLIC MEMBER FUNCTIONS
2002 
2003 size_t
2006 {
2007  size_t result = 0;
2008 
2009  // Preconditions:
2010 
2011  // Body:
2012 
2014 
2015  not_implemented();
2016 
2017  // Postconditions:
2018 
2019  // Exit
2020 
2021  return result;
2022 }
2023 
2024 
2025 size_t
2028 {
2029  size_t result;
2030 
2031  // Preconditions:
2032 
2033  require(state_is_read_accessible());
2034  require(fiber_schema().state_is_read_accessible());
2035 
2036  // Body:
2037 
2038  result = schema().fiber_schema().dof_tuple_ub(false);
2039 
2040  // Postconditions:
2041 
2042  // Exit
2043 
2044  return result;
2045 }
2046 
2049 dof_map(bool xrequire_write_access) const
2050 {
2051  // Preconditions:
2052 
2053  require(xrequire_write_access ?
2054  state_is_read_write_accessible() :
2055  state_is_read_accessible());
2056  require(is_jim(false));
2057 
2058  // Body:
2059 
2060  const section_dof_map& result =
2061  reinterpret_cast<const section_dof_map&>(partial_poset_member::dof_map(xrequire_write_access));
2062 
2063  // Postconditions:
2064 
2065  // Exit:
2066 
2067  return result;
2068 }
2069 
2072 dof_map(bool xrequire_write_access)
2073 {
2074  // Preconditions:
2075 
2076  require(xrequire_write_access ?
2077  state_is_read_write_accessible() :
2078  state_is_read_accessible());
2079  require(is_jim(false));
2080 
2081  // Body:
2082 
2083  section_dof_map& result =
2084  reinterpret_cast<section_dof_map&>(partial_poset_member::dof_map(xrequire_write_access));
2085 
2086  // Postconditions:
2087 
2088  // Exit:
2089 
2090  return result;
2091 }
2092 
2093 bool
2096 {
2097  bool result;
2098 
2099  // Preconditions:
2100 
2101  require(xdof_map != 0);
2102 
2103  // Body:
2104 
2105  result = dynamic_cast<const section_dof_map*>(xdof_map) != 0;
2106 
2107  // Postconditions:
2108 
2109  // Exit
2110 
2111  return result;
2112 }
2113 
2114 // PROTECTED MEMBER FUNCTIONS
2115 
2116 // PRIVATE MEMBER FUNCTIONS
2117 
2118 
2119 // ===========================================================
2120 // HOST POSET FACET
2121 // ===========================================================
2122 
2123 // PUBLIC MEMBER FUNCTIONS
2124 
2127 host() const
2128 {
2129  sec_rep_space* result;
2130 
2131  // Preconditions:
2132 
2133  // Body:
2134 
2135  result = dynamic_cast<sec_rep_space*>(_host);
2136 
2137  // Postconditions:
2138 
2139  ensure( (_host != 0) == (result != 0) );
2140 
2141  // Exit
2142 
2143  return result;
2144 }
2145 
2146 bool
2149 {
2150  bool result;
2151 
2152  // Preconditions:
2153 
2154  // Body:
2155 
2156  result = dynamic_cast<const sec_rep_space*>(xother) != 0;
2157 
2158  // Postconditions:
2159 
2160  ensure(result == (dynamic_cast<const sec_rep_space*>(xother) != 0));
2161 
2162  // Exit
2163 
2164  return result;
2165 }
2166 
2167 // PROTECTED MEMBER FUNCTIONS
2168 
2169 // PRIVATE MEMBER FUNCTIONS
2170 
2171 
2172 // ===========================================================
2173 // ANY FACET
2174 // ===========================================================
2175 
2176 // PUBLIC MEMBER FUNCTIONS
2177 
2178 bool
2180 is_ancestor_of(const any* xother) const
2181 {
2182  bool result;
2183 
2184  // Preconditions:
2185 
2186  // Body:
2187 
2188  result = dynamic_cast<const sec_rep_space_member*>(xother) != 0;
2189 
2190  // Postconditions:
2191 
2192  // Exit
2193 
2194  return result;
2195 }
2196 
2199 clone() const
2200 {
2201 
2202  // Preconditions:
2203 
2204  // Body:
2205 
2206  // create new handle of the current class.
2207 
2209 
2210  // Postconditions:
2211 
2212  ensure(result != 0);
2213  ensure(result->invariant());
2214 
2215  // Exit:
2216 
2217  return result;
2218 
2219 }
2220 
2221 bool
2223 invariant() const
2224 {
2225  bool result = true;
2226 
2227  // Preconditions:
2228 
2229  // Body:
2230 
2231  result = result && poset_member::invariant();
2232 
2233  if(invariant_check())
2234  {
2235  disable_invariant_check();
2236 
2237  result = result &&
2238  (is_attached()
2239  ? dynamic_cast<section_space_schema_member*>(_schema) != 0
2240  : true);
2241 
2242  enable_invariant_check();
2243  }
2244 
2245  // Postconditions:
2246 
2247  // Exit
2248 
2249  return result;
2250 }
2251 
2252 // PROTECTED MEMBER FUNCTIONS
2253 
2254 // PRIVATE MEMBER FUNCTIONS
void get_fiber(pod_index_type xdisc_id, void *xfiber, size_type xfiber_size) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
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...
virtual bool host_is_ancestor_of(const poset_state_handle *xother) const
True if other conforms to host.
void put_fiber(pod_index_type xdisc_id, const void *xfiber, size_type xfiber_size)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
virtual void put_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, const void *xdof, size_type xdof_size)
Sets the dof referred to by xdof_id to the value at xdof.
void put_component(pod_index_type xfiber_dof_id, const void *xcomponent, size_type xcomponent_size)
Sets the xcomponent referred to by fiber id xfiber_dof_id to xcomponent.
schema_poset_member & fiber_schema()
The schema of the restricted fiber of this section space member (mutable version) ...
A client handle for a subposet.
Definition: subposet.h:86
void truncate()
Makes this the next member of the subset which is not less than old this, i.e. the depth-first descen...
static std::string standard_section_space_name(const std::string &xfiber_space_name, const std::string &xbase_space_name)
The standard name for the section space with fiber space poset name xfiber_space_name and base space ...
int df() const
The dimension of the restricted fiber.
virtual int db() const
The dimension of the restricted base.
sec_rep_space * host() const
The section representation space this is a member of.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
The abstract map from section dof ids to section dof values of heterogeneous type.
An abstract iterator over the ids of an id space.
subposet_member_iterator * member_iterator() const
An iterator for members of this poset; handle version.
Definition: subposet.cc:912
bool allocated_branch_iterator(index_space_iterator &xitr, bool xauto_access) const
True if the id space iterator xitr was allocated by the iterator pool.
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
A client handle for a general, abstract partially order set.
A three state "bool". Does not provide the operations of ternary logic and is intended for use mostly...
Definition: tern.h:45
virtual bool includes_subposet(pod_index_type xsubposet_hub_id, bool xauto_access=true) const
True if this poset includes subposet with hub id xsubposet_hub_id.
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
A member of a sec_rep_space; a section.
bool is_done() const
True if iteration finished.
abstract_poset_member & base()
The restricted base of this section space member (mutable version)
STL namespace.
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual const std::string & class_name() const
The name of this class.
bool has_branch_id_space(bool xauto_access) const
True if this is a multisection and it has a branch sequence id space.
static std::string standard_fiber_space_name(const poset_path &xschema_path)
The standard name for the fiber space constructed for the schema member with path xschema_path...
const scoped_index & index() const
The index of the component state this handle is attached to.
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
abstract_poset_member & base()
The base space for this section space (mutable version)
bool invariant() const
Class invariant.
void next()
Makes this the next member of the subset.
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual sec_rep_space_member * clone() const
Make a new handle, no state instance of current.
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
const bool NOT_STRICT
Iteration strictness control.
Definition: sheaf.h:102
size_t dof_tuple_size()
Get the size in bytes of the restricted dof tuple for this member.
const bool DOWN
Iteration directions.
Definition: sheaf.h:77
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
A client handle for a mutable partially ordered set.
Definition: poset.h:40
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
bool leqv(pod_index_type xother_index) const
True if this is less than or equivalent to the member with index xother_index.
bool same_base(const sec_rep_space_member *xother) const
True if this has the same base as xother.
bool allocated_branch_handle(index_space_handle &xid_space, bool xauto_access) const
True if the handle pool allocated xid_space.
pointer_type base() const
The underlying storage array.
virtual const scoped_index & new_row_dof_map()
Creates a new row dof map for total sections of this.
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.
virtual void restrict_to(pod_index_type xbase_id, pod_index_type xfiber_schema_id)
Restricts this section to base with index xbase_id and fiber schema with index xfiber_schema_id.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
An array implementation of class scattered_insertion_index_space_handle. This representation is inten...
int version() const
The base space version this section is defined on.
bool same_rep(const sec_rep_space_member *xother) const
True if this has the same rep and same base as xother. /.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
scattered_insertion_index_space_handle & get_branch_id_space(bool xauto_access)
Allocate an id space handle from the handle pool attached to the branch id space for this member...
virtual void get_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, void *xdof, size_type xdof_size) const
Copies the dof referred to by xdisc_id, xfiber_dof_id into xdof.
bool is_empty() const
True if this poset is empty.
Definition: subposet.cc:1340
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. ...
virtual void begin_jim_edit_mode(bool xauto_access=true)
allow editing of jims and jim order relation
bool le(pod_index_type xother_index) const
True if this is less than or equal to the member with index xother_index.
index_space_iterator & get_branch_id_space_iterator(bool xauto_access) const
Allocates an iterator from the iterator pool attached to the branch id space for this member...
bool fiber_schema_is_restricted() const
True if fiber_schema() is not the same as host()->fiber_schema().
virtual bool dof_map_is_ancestor_of(const poset_dof_map *xdof_map) const
True if xdof_map conforms to (is derived from) the type of dof map required by this handle...
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...
static std::string standard_schema_poset_name(const std::string &xschema_member_name)
The standard name for the section_space_schema_poset constructed for the schema member with name xsch...
virtual sec_rep_space_member & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(xother).
void force_fiber(pod_index_type xdisc_id, const void *xfiber, size_type xfiber_size)
Sets the fiber referred to by discretization id xdisc_id to xfiber; reallocates dof map memory if nec...
bool is_done() const
True if iteration finished.
virtual bool is_attached() const
True if this is attached to a state.
void get_component(pod_index_type xfiber_dof_id, void *xcomponent, size_type xcomponent_size) const
Sets xcomponent to the component referred to by fiber id xfiber_dof_id.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to current.
void release_branch_id_space_iterator(index_space_iterator &xitr, bool xauto_access) const
Returns the iterator xitr to the iterator pool.
virtual bool is_attached() const =0
True if this iterator is attached to a state.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
virtual section_space_schema_member & unrestricted_schema()
The unrestricted schema for this poset membe (mutable version).
std::string member_name() const
The member name part of the path.
Definition: poset_path.cc:511
int evaluation_ct() const
The number of members of the evaluation subposet contained in the down set of the restricted base...
A handle for a scattered_insertion_index_space_state.
A client handle for a poset member which has been prepared for use as a schema for a section space...
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
prevent editing of jims and jim order relation
void new_jrm_state(sec_rep_space *xhost, const subposet &xbase_parts, bool xauto_access)
Multisection constructor; creates a new jrm state which is a multi-section with a branch for each mem...
static const std::string & static_class_name()
The name of this class.
void push_back(const scoped_index &xhub_id)
Make the next id in this space equivalent to xhub_id in the hub id space. synonym for push_back(xhub_...
size_t fiber_size()
Get the size in bytes of the restricted fiber for this member.
void new_jim_state(abstract_poset_member &xbase_mbr, int xbase_version=CURRENT_HOST_VERSION, bool xauto_access=true)
Creates a new jim state in host() and attaches this handle to the state. The state is a partial secti...
An abstract client handle for a member of a poset.
bool base_is_restricted() const
True if base() is not the same as host()->base();.
void release_branch_id_space(index_space_handle &xid_space, bool xauto_access) const
Returns the id space handle xid_space to the handle pool.
sec_rep_space_member()
Default constructor; creates an unattached handle.
bool in_jim_edit_mode() const
True if editing jims and jim order relation is allowed.
bool is_multisection(bool xauto_access) const
True if this is a multisection.
Namespace for the fiber_bundles component of the sheaf system.
int discretization_ct() const
The number of members of the discretization subposet contained in the down set of the restricted base...
poset & fiber()
The unrestricted fiber of host() (mutable version).
virtual section_dof_map & dof_map(bool xrequire_write_access=false)
The map from client_ids to dof values for this poset member (mutable version)
A client handle for a poset member which has been prepared for use as a schema.
bool has_version(int xversion) const
True if xversion is a valid version for this.
base_space_poset & base_space()
The base space for section spaces on this schema.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
const scoped_index & index() const
The index of the current member of the iteration.
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61