SheafSystem  0.0.0.0
section_space_schema_poset.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 
18 // Licensed under the Apache License, Version 2.0 (the "License");
19 // you may not use this file except in compliance with the License.
20 // You may obtain a copy of the License at
21 
22 // http://www.apache.org/licenses/LICENSE-2.0
23 
24 // Unless required by applicable law or agreed to in writing, software
25 // distributed under the License is distributed on an "AS IS" BASIS,
26 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 // See the License for the specific language governing permissions and
28 // limitations under the License.
29 
30 //
31 
34 
35 #include "SheafSystem/section_space_schema_poset.h"
36 
37 #include "SheafSystem/abstract_poset_member.impl.h"
38 #include "SheafSystem/array_poset_dof_map.h"
39 #include "SheafSystem/ij_product_structure.h"
40 #include "SheafSystem/index_iterator.h"
41 #include "SheafSystem/index_space_iterator.h"
42 #include "SheafSystem/error_message.h"
43 #include "SheafSystem/namespace_poset.impl.h"
44 #include "SheafSystem/namespace_poset_member.h"
45 #include "SheafSystem/pod_types.h"
46 #include "SheafSystem/poset_member_iterator.h"
47 #include "SheafSystem/poset_state.h"
48 #include "SheafSystem/primary_index_space_handle.h"
49 #include "SheafSystem/schema_descriptor.h"
50 #include "SheafSystem/schema_poset_member.h"
51 #include "SheafSystem/section_space_schema_member.impl.h"
52 #include "SheafSystem/section_space_schema_table_dofs_type.h"
53 #include "SheafSystem/std_limits.h"
54 #include "SheafSystem/std_sstream.h"
55 
56 using namespace std;
57 using namespace fiber_bundle; // Workaround for MS C++ bug.
58 
59 namespace
60 {
62 
63  //
64  // Fiber schema radix for ad-hoc factoring of section_space_schema ids.
65  //
66  const pod_index_type FIBER_SCHEMA_MEMBER_ID_UB = 256;
67 
68  //
69  // Base space radix for ad-hoc factoring of section_space_schema ids.
70  //
71  const pod_index_type BASE_SPACE_MEMBER_ID_UB =
72  numeric_limits<pod_index_type>::max()/FIBER_SCHEMA_MEMBER_ID_UB;
73 
74  //
75  // The increment in the member id when the id of the
76  // fiber schema component is increased by one.
77  //
78  const pod_index_type FIBER_SCHEMA_STRIDE = 1;
79 
80  //
81  // The increment in the member id when the id of the
82  // base space component is increased by one.
83  //
84  const pod_index_type BASE_SPACE_STRIDE = FIBER_SCHEMA_MEMBER_ID_UB*FIBER_SCHEMA_STRIDE;
85 
86 }
87 
88 // ===========================================================
89 // SECTION_SPACE_SCHEMA_POSET FACET
90 // ===========================================================
91 
92 // PUBLIC FUNCTIONS
93 
94 const sheaf::poset_path&
97 {
98  // Preconditions:
99 
100 
101  // Body:
102 
103  const poset_path& result = section_space_schema_member::standard_schema_path();
104 
105  // Postconditions:
106 
107  ensure(result.full());
108 
109  // Exit:
110 
111  return result;
112 }
113 
116 rep_path(bool xauto_access) const
117 {
118  // cout << endl << "Entering section_space_schema_poset::rep_path." << endl;
119 
120  // Preconditions:
121 
122  require(state_is_auto_read_accessible(xauto_access));
123 
124  // Body:
125 
126  if(xauto_access)
127  {
128  get_read_access();
129  }
130 
131  poset_path result(sheaf::table_dofs(*this).rep_path);
132 
133 
134  if(xauto_access)
135  {
136  release_access();
137  }
138 
139  // Postconditions:
140 
141 
142  // Exit:
143 
144  // cout << "Leaving section_space_schema_poset::rep_path." << endl;
145  return result;
146 }
147 
148 
152 {
153  return _rep;
154 }
155 
158 rep() const
159 {
160  return _rep;
161 }
162 
163 bool
166 {
167  // Preconditions:
168 
169  require(rep().state_is_read_accessible());
170  require(base_space().state_is_read_accessible());
171 
172  // Body:
173 
174  bool result = !rep().multivalued_subposet_name().empty() &&
175  base_space().includes_subposet(rep().multivalued_subposet_name());
176 
177  // Postconditions:
178 
179  // Exit:
180 
181  return result;
182 }
183 
184 bool
186 rep_is_valid(const sec_rep_descriptor& xrep, const poset_state_handle& xbase_space)
187 {
188  bool result;
189 
190  // Preconditions:
191 
192  require(xrep.state_is_read_accessible());
193  require(xbase_space.state_is_read_accessible());
194 
195  // Body:
196 
197  // Discretization subposet must exist.
198 
199  result = xbase_space.includes_subposet(xrep.discretization_subposet_name());
200 
201  // Discretization must have a non-empty id space;
202  // see section_space_schems_index_map - doesn't support empty factors.
203 
204  subposet ldisc_sp(&xbase_space, xrep.discretization_subposet_name());
205  result = result && ldisc_sp.has_id_space() && !ldisc_sp.id_space().is_empty();
206  ldisc_sp.detach_from_state();
207 
208  // Evaluation subposets must exist.
209 
210  result = result && xbase_space.includes_subposet(xrep.evaluation_subposet_name());
211 
215 
216  // Postconditions:
217 
218  // Exit
219 
220  return result;
221 }
222 
226 {
227  // Preconditions:
228 
229  require(state_is_read_accessible());
230 
231  // Body:
232 
233  return BASE_SPACE_MEMBER_ID_UB;
234 }
235 
239 {
240  // Preconditions:
241 
242  require(state_is_read_accessible());
243  require(base_space_stride() > 0);
244 
245  // Body:
246 
247  pod_index_type result = xmbr_hub_id/base_space_stride();
248 
249  // Postconditions:
250 
251  ensure(result < base_space_member_id_ub());
252 
253  // Exit
254 
255  return result;
256 }
257 
258 void
261  scoped_index& result) const
262 {
263  // Preconditions:
264 
265  require(state_is_read_accessible());
266  require(base_space_stride() > 0);
267  require(xmbr_id.in_scope());
268 
269  // Body:
270 
271  result.put(_base_space->member_hub_id_space(false),
272  get_base_space_id_from_index(xmbr_id.hub_pod()));
273 
274  // Postconditions:
275 
276  ensure(result.same_scope(_base_space->member_hub_id_space(false)));
277  ensure(result.pod() < base_space_member_id_ub());
278 
279  // Exit
280 
281  return;
282 }
283 
284 int
287 {
288  // Preconditions:
289 
290  // Body:
291 
292  static const int result = BASE_SPACE_STRIDE;
293 
294  // Postconditions:
295 
296  ensure(result > 0);
297 
298  // Exit
299 
300  return result;
301 }
302 
303 int
305 db() const
306 {
307  int result;
308 
309  // Preconditions:
310 
311  require(state_is_read_accessible());
312 
313  // Body:
314 
315  result = _base_space->max_db();
316 
317  // Postconditions:
318 
319  ensure(result >= 0);
320 
321  // Exit
322 
323  return result;
324 }
325 
328 base_space_path(bool xauto_access) const
329 {
330  // cout << endl << "Entering section_space_schema_poset::base_space_path." << endl;
331 
332  // Preconditions:
333 
334  require(state_is_auto_read_accessible(xauto_access));
335 
336  // Body:
337 
338  if(xauto_access)
339  {
340  get_read_access();
341  }
342 
343  poset_path result(sheaf::table_dofs(*this).base_space_path);
344 
345 
346  if(xauto_access)
347  {
348  release_access();
349  }
350 
351  // Postconditions:
352 
353 
354  // Exit:
355 
356  // cout << "Leaving section_space_schema_poset::base_space_path." << endl;
357  return result;
358 }
359 
363 {
364  return *_base_space;
365 }
366 
369 base_space() const
370 {
371  return *_base_space;
372 }
373 
377 {
378  // Preconditions:
379 
380  require(state_is_read_accessible());
381 
382  // Body:
383 
384  return FIBER_SCHEMA_MEMBER_ID_UB;
385 }
386 
390 {
391  // Preconditions:
392 
393  require(state_is_read_accessible());
394  require(fiber_schema_stride() > 0);
395  require(fiber_schema_member_id_ub() > 0);
396 
397 
398  // Body:
399 
400  pod_index_type lfiber_schema_member_id_ub = fiber_schema_member_id_ub();
401  pod_index_type lfiber_schema_stride = fiber_schema_stride();
402 
404  // Assume base space id is first index, fiber schema id is second.
405 
406  pod_index_type result = (xmbr_hub_id/lfiber_schema_stride) % lfiber_schema_member_id_ub;
407 
408  // Postconditions:
409 
410  ensure(result < fiber_schema_member_id_ub());
411 
412  // Exit
413 
414  return result;
415 }
416 
417 void
420  scoped_index& result) const
421 {
422  // Preconditions:
423 
424  require(state_is_read_accessible());
425  require(fiber_schema_stride() > 0);
426  require(fiber_schema_member_id_ub() > 0);
427  require(xmbr_id.in_scope());
428 
429  // Body:
430 
431  result.put(fiber_schema().member_hub_id_space(false),
432  get_fiber_schema_id_from_index(xmbr_id.hub_pod()));
433 
434  // Postconditions:
435 
436  ensure(result.same_scope(fiber_schema().member_hub_id_space(false)));
437  ensure(result.pod() < fiber_schema_member_id_ub());
438 
439  // Exit
440 
441  return;
442 }
443 
444 int
447 {
448  // Preconditions:
449 
450  // Body:
451 
452  static const int result = FIBER_SCHEMA_STRIDE;
453 
454  // Postconditions:
455 
456  ensure(result > 0);
457 
458  // Exit
459 
460  return result;
461 }
462 
463 int
465 df() const
466 {
467  int result;
468 
469  // Preconditions:
470 
471  require(state_is_read_accessible());
472 
473  // Body:
474 
478 
479  result = _fiber_space->schema().row_dof_ct();
480 
481  // Postconditions:
482 
483  ensure(result >= 0);
484 
485  // Exit
486 
487  return result;
488 }
489 
493 {
494  require(state_is_read_accessible());
495 
496  return *_fiber_space->schema().host();
497 }
498 
502 {
503  require(state_is_read_accessible());
504 
505  return *_fiber_space->schema().host();
506 }
507 
510 fiber_space_path(bool xauto_access) const
511 {
512  // cout << endl << "Entering section_space_schema_poset::fiber_space_path." << endl;
513 
514  // Preconditions:
515 
516  require(state_is_auto_read_accessible(xauto_access));
517 
518  // Body:
519 
520  if(xauto_access)
521  {
522  get_read_access();
523  }
524 
525  poset_path result(sheaf::table_dofs(*this).fiber_space_path);
526 
527 
528  if(xauto_access)
529  {
530  release_access();
531  }
532 
533  // Postconditions:
534 
535 
536  // Exit:
537 
538  // cout << "Leaving section_space_schema_poset::fiber_space_path." << endl;
539  return result;
540 }
541 
545 {
546  return *_fiber_space;
547 }
548 
549 const sheaf::poset&
551 fiber_space() const
552 {
553  return *_fiber_space;
554 }
555 
559 {
560  return _discretization;
561 }
562 
563 const sheaf::subposet&
566 {
567  return _discretization;
568 }
569 
573 {
574  return _multivalued;
575 }
576 
577 const sheaf::subposet&
579 multivalued() const
580 {
581  return _multivalued;
582 }
583 
587 {
588  return _evaluation;
589 }
590 
591 const sheaf::subposet&
593 evaluation() const
594 {
595  return _evaluation;
596 }
597 
598 std::string
601 {
602  // Preconditions:
603 
604  require(rep().state_is_read_accessible());
605 
606  // Body:
607 
608  string result = _rep.evaluator_family_name();
609 
610  // Postconditions:
611 
612  // Exit:
613 
614  return result;
615 }
616 
620 {
621  // Precondtions:
622 
623  require(state_is_read_accessible());
624 
625  // Body:
626 
627  const ij_product_structure& result = *_product;
628 
629  // Postconditions:
630 
631  // Exit:
632 
633  return result;
634 }
635 
639  pod_index_type xfiber_schema_id) const
640 {
641  // Preconditions:
642 
643  require(state_is_read_accessible());
644  require(base_space().contains_member(xbase_space_id));
645  require(fiber_schema().contains_member(xfiber_schema_id));
646 
647  // Body:
648 
649  pod_index_type result = 0; // Just to silence compiler warnings.
650 
651  is_abstract();
652 
653  // Postconditions:
654 
655  // Exit:
656 
657  return result;
658 }
659 
660 void
663  const scoped_index& xfiber_schema_id,
664  scoped_index& result) const
665 {
666  // Preconditions:
667 
668  require(state_is_read_accessible());
669  require(base_space().contains_member(xbase_space_id));
670  require(fiber_schema().contains_member(xfiber_schema_id));
671 
672  // Body:
673 
674  result.put(member_hub_id_space(false),
675  get_index_from_components(xbase_space_id.hub_pod(),
676  xfiber_schema_id.hub_pod()));
677 
678  // Postconditions:
679 
680  ensure(result.same_scope(member_hub_id_space(false)));
681 
682  // Exit:
683 
684  return;
685 }
686 
687 void
689 update_hub_id_space(bool xauto_access)
690 {
691  // Preconditions:
692 
693  require(state_is_auto_read_write_accessible(xauto_access));
694 
695  // Body:
696 
697  if(xauto_access)
698  {
699  get_read_write_access(true);
700  }
701 
702  pod_index_type lmember_id_ub =
703  base_space().member_index_ub().pod()*base_space_stride();
704 
705  extend_last_member_term(lmember_id_ub, false);
706 
707  _product->put_ubs(base_space().member_index_ub().pod(), base_space_stride());
708 
709  if(xauto_access)
710  {
711  release_access();
712  }
713 
714  // Postconditions:
715 
716 
717  // Exit:
718 
719  return;
720 }
721 
722 // PROTECTED FUNCTIONS
723 
726 {
727  // Preconditions:
728 
729  // Body:
730 
731  // Postconditions:
732 
733  // Exit
734 
735  return;
736 }
737 
740  : poset_state_handle(xtop, xbottom)
741 {
742  // Preconditions:
743 
744  // Body:
745 
746  _base_space = 0;
747  _fiber_space = 0;
748 
749  // Postconditions:
750 
751  // Exit
752 
753  return;
754 }
755 
756 // PRIVATE FUNCTIONS
757 
758 
759 // ===========================================================
760 // STATE FACET
761 // ===========================================================
762 
763 // PUBLIC FUNCTIONS
764 
767 type_id() const
768 {
769  return SECTION_SPACE_SCHEMA_POSET_ID;
770 }
771 
772 const char*
774 class_name() const
775 {
776  // Preconditions:
777 
778  // Body:
779 
780  static const char* result = "section_space_schema_poset";
781 
782  // Postconditions:
783 
784  // Exit:
785 
786  return result;
787 }
788 
789 void
792 {
793  // Preconditions:
794 
795  require(is_attached());
796 
797  // Body:
798 
799  int old_access_request_depth = access_request_depth();
800 
801  rep().get_read_access();
805 
806  // Postconditions:
807 
808  ensure(state_is_read_accessible());
809  ensure(access_request_depth() == old_access_request_depth + 1);
810  ensure(rep().state_is_read_accessible());
813 
814  // Exit
815 
816  return;
817 }
818 
819 void
821 get_read_write_access(bool xrelease_read_only_access)
822 {
823  // Preconditions:
824 
825  require(is_attached());
826  require(!xrelease_read_only_access ? state_is_not_read_only_accessible() : true);
827 
828 
829  // Body:
830 
831  int old_access_request_depth = access_request_depth();
832 
833  rep().get_read_access();
836  poset_state_handle::get_read_write_access(xrelease_read_only_access);
837 
838  // Postconditions:
839 
841  ensure(access_request_depth() == old_access_request_depth + 1);
842  ensure(rep().state_is_read_accessible());
845 
846  // Exit
847 
848  return;
849 }
850 
851 void
853 release_access(bool xall) const
854 {
855  // Preconditions:
856 
857  require(state_is_read_accessible());
858 
859  // Body:
860 
861  int old_access_request_depth = access_request_depth();
862 
863  // Release at least one level of access for this. If xall, release all levels
864  // of access for this. Since each level of access to this also
865  // acquired a level of access to the rep, the base space, and the fiber space,
866  // release the same number of levels of access to each of these.
867  // Note that this may not be all the levels of access of these.
868 
869  do
870  {
871  // Release one level of access.
872 
873  rep().release_access(false);
874  base_space().release_access(false);
875  fiber_space().release_access(false);
877  }
878  while(xall && state_is_read_accessible());
879 
880  // Postconditions:
881 
882  ensure(!xall ? access_request_depth() == old_access_request_depth - 1 :
883  access_request_depth() == 0);
884  ensure(access_request_depth() == 0 ? state_is_not_read_accessible() : true);
885  ensure(unexecutable("schema, rep, base, base schema, fiber, and fiber schema access released"));
886 
887  // Exit
888 
889  return;
890 }
891 
892 // PROTECTED FUNCTIONS
893 
894 void
897 {
898  // Preconditions:
899 
900  require(state_is_read_accessible());
901 
902  // Body:
903 
904  // Attach the handle data members that depend on the table dofs
905  // and are required to get access.
906 
907  table_dofs_type& ldofs = sheaf::table_dofs(*this);
908 
909  // Attach the rep handle to the current state.
910 
914 
915  poset_path lrep_path(ldofs.rep_path);
916  rep().attach_to_state(&xns, lrep_path, true);
917 
918  // Attach the component handles to the current state.
919 
920  poset_path lbase_space_path(ldofs.base_space_path);
921  _base_space = &xns.member_poset<base_space_poset>(lbase_space_path, true);
922 
923  poset_path lfiber_space_path(ldofs.fiber_space_path);
924  _fiber_space = &xns.member_poset<poset>(lfiber_space_path, true);
925 
926 
927 
928  // Attach the subposet handles to the current state.
929 
931  rep().get_read_access();
932  discretization().attach_to_state(&(base_space()), rep().discretization_subposet_name());
933 
934  if(is_multivalued())
935  {
936  multivalued().attach_to_state(&(base_space()), rep().multivalued_subposet_name());
937  }
938 
939  evaluation().attach_to_state(&(base_space()), rep().evaluation_subposet_name());
940 
941  // Postconditions:
942 
943  ensure(rep().is_attached());
944  ensure(base_space().is_attached());
945  ensure(fiber_space().is_attached());
946  ensure(discretization().is_attached());
947  ensure(is_multivalued() ? multivalued().is_attached() : true);
948  ensure(evaluation().is_attached());
949 
950  rep().release_access();
952 
953  // Postconditions:
954 
955 
956  // Exit
957 
958  return;
959 }
960 
961 void
964 {
965  // Preconditions:
966 
967  require(state_is_read_accessible());
968 
969  // Body:
970 
972 
973  table_dofs_type& ldofs = sheaf::table_dofs(*this);
974  namespace_poset* lns = name_space();
975 
976  // Attach the rep handle to the current state.
977 
981 
982  rep().attach_to_state(lns, ldofs.rep_path, true);
983 
984  // Attach the component handles to the current state.
985 
986  poset_path lbase_space_path(ldofs.base_space_path);
987  _base_space = &lns->member_poset<base_space_poset>(lbase_space_path, true);
988 
989  poset_path lfiber_space_path(ldofs.fiber_space_path);
990  _fiber_space = &lns->member_poset<poset>(lfiber_space_path, true);
991 
992  // Attach the subposet handles to the current state.
993 
994  discretization().attach_to_state(&(base_space()), rep().discretization_subposet_name());
995 
996  if(is_multivalued())
997  {
998  multivalued().attach_to_state(&(base_space()), rep().multivalued_subposet_name());
999  }
1000 
1001  evaluation().attach_to_state(&(base_space()), rep().evaluation_subposet_name());
1002 
1003  // Postconditions:
1004 
1005  ensure(rep().is_attached());
1006  ensure(base_space().is_attached());
1007  // ensure(fiber_schema().is_attached());
1008  ensure(fiber_space().is_attached());
1009  ensure(discretization().is_attached());
1010  ensure(is_multivalued() ? multivalued().is_attached() : true);
1011  ensure(evaluation().is_attached());
1012 
1013 
1014  // Exit
1015 
1016  return;
1017 }
1018 
1019 void
1022 {
1023  // Preconditions:
1024 
1025  require(state_is_read_write_accessible());
1026 
1027  // Body:
1028 
1029  define_old_variable(int old_rep_access_request_depth = rep().access_request_depth());
1030  define_old_variable(int old_base_space_access_request_depth = base_space().access_request_depth());
1031  define_old_variable(int old_fiber_space_access_request_depth = fiber_space().access_request_depth());
1032 
1033  // Release all levels of access this poset has to its various parts,
1034  // but do not release access to the state of this because
1035  // we are going to delete the state and don't want another
1036  // client able to sneak in and get access before we do.
1037 
1041 
1042  string rep_name(rep().name());
1043  string base_space_name(base_space().name());
1044  string fiber_space_name(fiber_space().name());
1045 
1046 #ifdef DIAGNOSTIC_OUTPUT
1047  cout << "poset: " << name() << endl
1048  << "\trep: " << rep_name
1049  << " old lvl:" << old_rep_access_request_depth << endl
1050  << "\tbase_space: " << base_space_name
1051  << " old lvl:" << old_base_space_access_request_depth << endl
1052  << "\tfiber_space: " << fiber_space_name
1053  << " old lvl:" << old_fiber_space_access_request_depth << endl;
1054 #endif
1055 
1056  int old_access_request_depth = access_request_depth();
1057  for(size_type i=0; i<old_access_request_depth; ++i)
1058  {
1059  rep().release_access(false);
1060  base_space().release_access(false);
1061  fiber_space().release_access(false);
1062  }
1063 
1064  define_old_variable(int rep_access_request_depth = rep().access_request_depth());
1065  define_old_variable(int base_space_access_request_depth = base_space().access_request_depth());
1066  define_old_variable(int fiber_space_access_request_depth = fiber_space().access_request_depth());
1067 
1068 #ifdef DIAGNOSTIC_OUTPUT
1069  cout << " \trep lvl:" << rep_access_request_depth
1070  << " base_space lvl:" << base_space_access_request_depth
1071  << " fiber_space lvl:" << fiber_space_access_request_depth
1072  << endl;
1073 #endif
1074 
1075  // Detach and delete the state.
1076 
1078 
1079  // Postconditions:
1080 
1081  ensure(!is_attached());
1082  ensure(unexecutable("state has been deleted"));
1083  ensure(rep_access_request_depth == (old_rep_access_request_depth - old_access_request_depth));
1084  ensure(base_space_access_request_depth == (old_base_space_access_request_depth - old_access_request_depth));
1085  ensure(fiber_space_access_request_depth == (old_fiber_space_access_request_depth - old_access_request_depth));
1086 
1087  // Exit
1088 
1089  return;
1090 }
1091 
1092 // PRIVATE FUNCTIONS
1093 
1094 
1095 // ===========================================================
1096 // SCHEMA FACET
1097 // ===========================================================
1098 
1099 // PUBLIC FUNCTIONS
1100 
1101 // PROTECTED FUNCTIONS
1102 
1103 // PRIVATE FUNCTIONS
1104 
1105 // ===========================================================
1106 // SCHEMATIZATION FACET
1107 // ===========================================================
1108 
1109 // PUBLIC FUNCTIONS
1110 
1111 bool
1113 is_schematized(bool xauto_access) const
1114 {
1115  bool result;
1116 
1117  // Preconditions:
1118 
1119  require(xauto_access || state_is_read_accessible());
1120 
1121  // Body:
1122 
1123  if(xauto_access)
1124  {
1125  get_read_access();
1126  }
1127 
1128  result = fiber_schema().is_schematized(false);
1129 
1130  if(xauto_access)
1131  {
1132  release_access();
1133  }
1134 
1135  // Postconditions:
1136 
1138 
1139  ensure(unexecutable(result == top member has been schematized));
1140 
1141  // Exit
1142 
1143  return result;
1144 }
1145 
1146 void
1148 schematize(subposet* xtable_dof_subposet,
1149  subposet* xrow_dof_subposet,
1150  bool xall_members)
1151 {
1152  // Preconditions:
1153 
1154  require(state_is_read_write_accessible());
1155  require(dynamic_cast<primitives_poset_schema*>(schema().host()) != 0);
1156  // can only schematize posets which have same schema as primitives_poset
1157  require(xtable_dof_subposet != 0);
1158  require(includes_subposet(xtable_dof_subposet));
1159  require(xrow_dof_subposet != 0);
1160  require(includes_subposet(xrow_dof_subposet));
1161 
1162  // Body:
1163 
1164  not_implemented();
1165 
1167 
1168  // Postconditions:
1169 
1170  ensure(is_schematized(false));
1171 
1172  // Exit
1173 
1174  return;
1175 }
1176 
1177 // PROTECTED FUNCTIONS
1178 
1179 // PRIVATE FUNCTIONS
1180 
1181 
1182 // ===========================================================
1183 // MEMBERSHIP FACET
1184 // ===========================================================
1185 
1186 // PUBLIC FUNCTIONS
1187 
1188 int
1190 member_ct() const
1191 {
1192 
1193  // Preconditions:
1194 
1195  require(state_is_read_accessible());
1196 
1197  // Body:
1198 
1199  int result = base_space().member_ct()*fiber_schema().member_ct();
1200 
1201  // Postconditions:
1202 
1203  ensure(result >= 0);
1204 
1205  return result;
1206 }
1207 
1208 int
1211 {
1212  int result;
1213 
1214  // Preconditions:
1215 
1216  require(state_is_read_accessible());
1217 
1218  // Body:
1219 
1221 
1222  // Postconditions:
1223 
1224  ensure(result >= 0);
1225 
1226  return result;
1227 }
1228 
1232 {
1233 
1234  // Preconditions:
1235 
1236  require(state_is_read_accessible());
1237 
1238  // Body:
1239 
1240  scoped_index result(member_hub_id_space(false));
1241 
1242  result =
1245 
1246  // Postconditions:
1247 
1248  ensure(result >= 0);
1249 
1250  return result;
1251 }
1252 
1256 {
1257  // Preconditions:
1258 
1259  require(state_is_read_accessible());
1260 
1261  // Body:
1262 
1263  not_implemented();
1264 
1266 
1267  index_iterator result;
1268 
1269  // Postconditions:
1270 
1271  // Exit
1272 
1273  return result;
1274 }
1275 
1276 bool
1278 contains_member(pod_index_type xhub_id, bool xauto_access) const
1279 {
1280  bool result;
1281 
1282  // Preconditions:
1283 
1284  require(!xauto_access ? state_is_read_accessible() : true);
1285 
1286  // Body:
1287 
1288  result =
1289  base_space().contains_member(get_base_space_id_from_index(xhub_id), xauto_access) &&
1291 
1292  return result;
1293 }
1294 
1295 bool
1297 contains_member(pod_index_type xhub_id, int xversion, bool xauto_access) const
1298 {
1299  bool result;
1300 
1301  // Preconditions:
1302 
1303  require(!xauto_access ? state_is_read_accessible() : true);
1304 
1305  // Body:
1306 
1307  result =
1308  base_space().contains_member(get_base_space_id_from_index(xhub_id), xversion, xauto_access) &&
1310 
1311  return result;
1312 }
1313 
1314 bool
1316 is_jim(pod_index_type xhub_id, bool xin_current_version) const
1317 {
1318  bool result;
1319 
1320  // Preconditions:
1321 
1322  require(state_is_read_accessible());
1323 
1324  // Body:
1325 
1326  result =
1327  base_space().is_jim(get_base_space_id_from_index(xhub_id), xin_current_version) &&
1328  fiber_schema().is_jim(get_fiber_schema_id_from_index(xhub_id), xin_current_version);
1329 
1330  // Postconditions:
1331 
1332  // Exit
1333 
1334  return result;
1335 }
1336 
1337 bool
1339 is_atom(pod_index_type xhub_id) const
1340 {
1341  bool result;
1342 
1343  // Preconditions:
1344 
1345  require(state_is_read_accessible());
1346 
1347  // Body:
1348 
1349  result =
1352 
1353  // Postconditions:
1354 
1355  // Exit
1356 
1357  return result;
1358 }
1359 
1360 // string
1361 // fiber_bundle::section_space_schema_poset::
1362 // member_name(pod_index_type xhub_id, bool xauto_access) const
1363 // {
1364 // string result;
1365 
1366 // // Preconditions:
1367 
1368 // require(state_is_auto_read_accessible(xauto_access));
1369 
1370 // // Body:
1371 
1372 // if(xauto_access)
1373 // {
1374 // get_read_access();
1375 // }
1376 
1377 // result = poset_state_handle::member_name(xhub_id, false);
1378 // if(result.empty())
1379 // {
1380 // // Member does not have a client assigned name;
1381 // // try to construct a default name from factor names.
1382 
1383 // pod_index_type lbase_id = get_base_space_id_from_index(xhub_id);
1384 
1385 // pod_index_type lfiber_schema_id = get_fiber_schema_id_from_index(xhub_id);
1386 // string lfiber_name = fiber_schema().member_name(lfiber_schema_id);
1387 
1388 // if( (lbase_id == BOTTOM_INDEX) &&
1389 // (fiber_schema().table_dof_subposet().contains_member(lfiber_schema_id)) )
1390 // {
1391 // // This is a table dof member;
1392 // // name is name of fiber factor.
1393 
1394 // result = lfiber_name;
1395 // }
1396 // else
1397 // {
1398 // // This is not a table dof member;
1399 // // construct name from both base and fiber factor.
1400 
1401 // string lbase_name = base_space().member_name(lbase_id);
1402 
1403 // if(lbase_name.empty())
1404 // {
1405 // // Construct a name from the base space id.
1406 
1407 // stringstream lstr;
1408 // lstr << lbase_id;
1409 // lbase_name = lstr.str();
1410 // }
1411 
1412 // if(lfiber_name.empty())
1413 // {
1414 // // Construct a name from the fiber schema id.
1415 
1416 // stringstream lstr;
1417 // lstr << lfiber_schema_id;
1418 // lfiber_name = lstr.str();
1419 // }
1420 
1421 // result = lbase_name + "_" + lfiber_name;
1422 
1423 // // ERROR: the following produces the same name for different members.
1424 // // if(!lbase_name.empty() || !lfiber_name.empty())
1425 // // {
1426 // // result = lbase_name + '_' + lfiber_name;
1427 // // }
1428 // // else
1429 // // {
1430 // // // Both base and fiber names are empty; do nothing.
1431 // // }
1432 // }
1433 
1434 // }
1435 
1436 // if(xauto_access)
1437 // {
1438 // release_access();
1439 // }
1440 
1441 // // Postconditions:
1442 
1443 
1444 // // Exit:
1445 
1446 // return result;
1447 // }
1448 
1452 {
1453  // Preconditions:
1454 
1455  // Body:
1456 
1457  // Postconditions:
1458 
1459  // Exit
1460 
1461  return *(static_cast<section_space_schema_member*>(_top));
1462 }
1463 
1466 top() const
1467 {
1468  // Preconditions:
1469 
1470  // Body:
1471 
1472  // Postconditions:
1473 
1474  // Exit
1475 
1476  return *(static_cast<const section_space_schema_member*>(_top));
1477 }
1478 
1482 {
1483  // Preconditions:
1484 
1485  // Body:
1486 
1487  // Postconditions:
1488 
1489  // Exit
1490 
1491  return *(static_cast<section_space_schema_member*>(_bottom));
1492 }
1493 
1496 bottom() const
1497 {
1498  // Preconditions:
1499 
1500  // Body:
1501 
1502  // Postconditions:
1503 
1504  // Exit
1505 
1506  return *(static_cast<const section_space_schema_member*>(_bottom));
1507 }
1508 
1509 // PROTECTED FUNCTIONS
1510 
1511 void
1514 {
1515  // Preconditions:
1516 
1517  require(state_is_read_write_accessible());
1518 
1519  // Body:
1520 
1521 
1538 
1539  pod_index_type lbase_space_stride = base_space_stride();
1540  pod_index_type lmember_id_ub =
1541  base_space().member_index_ub().pod()*lbase_space_stride;
1542 
1543  pod_index_type lspace_id = new_term(lmember_id_ub, false);
1544  primary_index_space_handle lproduct_id_space(member_id_spaces(false), lspace_id);
1545 
1546  ij_product_structure lproduct(base_space().member_index_ub().pod(), lbase_space_stride);
1547  lproduct_id_space.new_product_structure(lproduct);
1548 
1549  _product = &lproduct_id_space.product_structure<ij_product_structure>();
1550 
1551  // Bottom member already allocated at index 0;
1552  // just have to make explicit cover sets.
1553 
1554  new_standard_member_hack(BOTTOM_INDEX);
1555  put_member_name(BOTTOM_INDEX, "bottom", true, false);
1556  bottom().attach_to_state(this, BOTTOM_INDEX);
1557 
1558  // Top member already allocated at index 1;
1559  // just have to make explicit cover sets.
1560 
1561  new_standard_member_hack(TOP_INDEX);
1562  put_member_name(TOP_INDEX, "top", true, false);
1563  top().attach_to_state(this, TOP_INDEX);
1564 
1565  // All the members exist implicitly, but they
1566  // don't have names unless we explicitly give them names.
1567  // Make the names for the table schema members
1568  // the same as the corresponding members of the fiber schema
1569 
1570  schema_poset_member lfiber_schema = fiber_space().schema();
1571  index_space_iterator& litr = lfiber_schema.table_dof_id_space().get_iterator();
1572  while(!litr.is_done())
1573  {
1574  // Get the name for the table dof in the fiber schema.
1575 
1576  string ltable_dof_name = lfiber_schema.host()->member_name(litr.hub_pod(), false);
1577 
1578  // Get the index for the corresponding member of this poset.
1579 
1580  pod_index_type ltable_dof_id = get_index_from_components(BOTTOM_INDEX, litr.hub_pod());
1581 
1582  // Set the name in this poset the same as in the fiber schema.
1583 
1584  put_member_name(ltable_dof_id, ltable_dof_name, true, false);
1585 
1586  litr.next();
1587  }
1588  lfiber_schema.table_dof_id_space().release_iterator(litr);
1589 
1590  // Only two standard members and no dof tuples so far.
1591  // (More may be added in descendants.)
1592 
1593  // All the members and row dof tuples are standard.
1594 
1595  put_standard_member_ct(2); // != member_ct(), which is always the product of component cts
1597 
1598  // Now the cover relation graph invariant is satisfied
1599 
1601 
1602  // Postconditions:
1603 
1604  ensure(state_obj()->crg()->invariant());
1605  ensure(bottom().is_attached() && (bottom().index() == BOTTOM_INDEX));
1606  ensure(top().is_attached() && (top().index() == TOP_INDEX));
1608 
1609  // Exit
1610 
1611  return;
1612 }
1613 
1614 void
1617 {
1618  // Preconditions:
1619 
1620  require((xindex == BOTTOM_INDEX) || (xindex == TOP_INDEX));
1621 
1622  // Body:
1623 
1624  define_old_variable(const scoped_index old_member_index_ub = member_index_ub());
1625  define_old_variable(int old_member_ct = member_ct());
1626 
1627  // Create new node in crg; ensures lower and upper covers empty.
1628 
1629  // $$SCRIBBLE start here - retrofitting new_std_mbr_hack
1630 
1631  crg().new_standard_member_hack(xindex);
1632 
1633  // If node allocation has extended the member pool,
1634  // extend the subposet characteristic functions to match.
1635 
1636  if(crg().end() > powerset().subposet_member_index_ub())
1637  {
1639  }
1640 
1641  // Put new node in subposet of all members.
1642 
1643  powerset().whole().insert_member(xindex);
1644 
1645  // Postconditions:
1646 
1647  ensure(invariant());
1648  ensure(contains_member(xindex));
1649  ensure(cover_is_empty(LOWER, xindex));
1650  ensure(cover_is_empty(UPPER, xindex));
1651 
1652  // Exit
1653 
1654  return;
1655 }
1656 
1659 new_member(bool xis_jim, pod_index_type xdof_tuple_id)
1660 {
1661  // Preconditions:
1662 
1663  // Body:
1664 
1666 
1667  pod_index_type result = poset_state_handle::new_member(xis_jim, xdof_tuple_id);
1668 
1669 #ifdef DIAGNOSTIC_OUTPUT
1670  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::new_member(), result = " << result << endl;
1671 #endif
1672 
1673  // Postconditions:
1674 
1675  // Exit
1676 
1677  return result;
1678 }
1679 
1682 new_member(bool xis_jim, poset_dof_map* xdof_map, bool xcopy_dof_map)
1683 {
1684  // Preconditions:
1685 
1686  // Body:
1687 
1689 
1690  pod_index_type result = poset_state_handle::new_member(xis_jim, xdof_map, xcopy_dof_map);
1691 
1692 #ifdef DIAGNOSTIC_OUTPUT
1693  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::new_member(), result = " << result << endl;
1694 #endif
1695 
1696  // Postconditions:
1697 
1698  // Exit
1699 
1700  return result;
1701 }
1702 
1703 void
1706 {
1707  // Preconditions:
1708 
1709  // Body:
1710 
1712 
1713 #ifdef DIAGNOSTIC_OUTPUT
1714  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::delete_member(), index = " << xhub_id << endl;
1715 #endif
1716 
1718 
1719  // Postconditions:
1720 
1721  // Exit
1722 
1723  return;
1724 }
1725 
1726 // PRIVATE FUNCTIONS
1727 
1728 
1729 // ===========================================================
1730 // COVER RELATION FACET
1731 // ===========================================================
1732 
1733 // PUBLIC FUNCTIONS
1734 
1735 // PROTECTED FUNCTIONS
1736 
1737 void
1740 {
1741  // Preconditions:
1742 
1743  // Body:
1744 
1746 
1747 #ifdef DIAGNOSTIC_OUTPUT
1748  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::new_link(), gtr, lsr = " << xgreater << ", " << xlesser << endl;
1749 #endif
1750 
1751  poset_state_handle::new_link(xgreater, xlesser);
1752 
1753  // Postconditions:
1754 
1755  // Exit
1756 
1757  return;
1758 }
1759 
1760 void
1763 {
1764  // Preconditions:
1765 
1766  // Body:
1767 
1769 
1770 #ifdef DIAGNOSTIC_OUTPUT
1771  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::delete_link(), gtr, lsr = " << xgreater << ", " << xlesser << endl;
1772 #endif
1773 
1774  poset_state_handle::delete_link(xgreater, xlesser);
1775 
1776  // Postconditions:
1777 
1778  // Exit
1779 
1780  return;
1781 }
1782 
1783 // PRIVATE FUNCTIONS
1784 
1785 
1786 // ===========================================================
1787 // POWERSET FACET
1788 // ===========================================================
1789 
1790 // PUBLIC FUNCTIONS
1791 
1795 {
1796  // Preconditions:
1797 
1798  // Body:
1799 
1801 
1803 
1804 #ifdef DIAGNOSTIC_OUTPUT
1805 
1806  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::new_subposet(), result = " << result << endl;
1807 #endif
1808 
1809  // Postconditions:
1810 
1811  // Exit
1812 
1813  return result;
1814 }
1815 
1816 void
1819 {
1820  // Preconditions:
1821 
1822  // Body:
1823 
1825 
1826 #ifdef DIAGNOSTIC_OUTPUT
1827  cout << "DIAGNOSTIC_OUTPUT: call to section_space_schema_poset::delete_subposet(), index = " << xsubposet_hub_id << endl;
1828 #endif
1829 
1830  poset_state_handle::delete_subposet(xsubposet_hub_id);
1831 
1832  // Postconditions:
1833 
1834  // Exit
1835 
1836  return;
1837 }
1838 
1839 int
1841 version_ct() const
1842 {
1843  int result = 0;
1844 
1845  // Preconditions:
1846 
1847  require(state_is_read_accessible());
1848  require(base_space().state_is_read_accessible());
1849 
1850  // Body:
1851 
1852  result = base_space().version_ct();
1853 
1854  ensure(result >= 0);
1855 
1856  // Exit
1857 
1858  return result;
1859 }
1860 
1861 int
1863 version() const
1864 {
1865  int result = 0;
1866 
1867  // Preconditions:
1868 
1869  require(state_is_read_accessible());
1870  require(base_space().state_is_read_accessible());
1871 
1872  // Body:
1873 
1876 
1877  result = base_space().version();
1878 
1879  // Postconditions:
1880 
1881  ensure( has_version(result) );
1882 
1883  // Exit
1884 
1885  return result;
1886 }
1887 
1890 version_index(int xversion) const
1891 {
1892  // Preconditions:
1893 
1894  require(state_is_read_accessible());
1895  require(base_space().state_is_read_accessible());
1896  require(has_version(xversion));
1897 
1898  // Body:
1899 
1900  pod_index_type result = base_space().version_index(xversion);
1901 
1902  // Postconditions:
1903 
1904  ensure(base_space().includes_subposet(result));
1905 
1906  // Exit
1907 
1908  return result;
1909 }
1910 
1913 version_jims_index(int xversion) const
1914 {
1915  // Preconditions:
1916 
1917  require(state_is_read_accessible());
1918  require(base_space().state_is_read_accessible());
1919  require(has_version(xversion));
1920 
1921  // Body:
1922 
1923  pod_index_type result = base_space().version_jims_index(xversion);
1924 
1925  // Postconditions:
1926 
1927  ensure(base_space().includes_subposet(result));
1928 
1929  // Exit
1930 
1931  return result;
1932 }
1933 
1934 // PROTECTED FUNCTIONS
1935 
1936 // PRIVATE FUNCTIONS
1937 
1938 
1939 // ===========================================================
1940 // I/O SUPPORT FACET
1941 // ===========================================================
1942 
1943 // PUBLIC FUNCTIONS
1944 
1948 {
1951 
1952  // Preconditions:
1953 
1954  require(state_is_read_accessible());
1955 
1956  // It is precisely because we can't support product subposets
1957  // that we can't require the following here.
1958 
1959  // require(includes_subposet(xindex));
1960 
1961  // Body:
1962 
1963  // This routine should only be called for writing or reading row decompositions,
1964  // which is not supported for section_space_schema_posets.
1965 
1966  post_fatal_error_message("Product subposet hack, ver 2. Row decomposition i/o not supported for section space schema.");
1967 
1968  // Postconditions:
1969 
1970  // Exit:
1971 
1972  return 0;
1973 }
1974 
1975 bool
1978  const std::string& xid_space_name,
1979  bool xauto_access) const
1980 {
1981  // Preconditions:
1982 
1983  require(xauto_access || state_is_read_accessible());
1984 
1985  if(xauto_access)
1986  {
1987  get_read_access();
1988  }
1989 
1990  // Body:
1991 
1992  bool result = true;
1993 
1994  if(xint_id >= standard_member_ct())
1995  {
1996  result = base_space().member_id_spaces(false).contains(xid_space_name);
1997  if(result)
1998  {
1999  result = base_space().member_id_spaces(false).contains_hub(xid_space_name,
2000  get_base_space_id_from_index(xint_id));
2001  }
2002  }
2003 
2004  if(xauto_access)
2005  {
2006  release_access();
2007  }
2008 
2009  // Postconditions:
2010 
2011  // Exit:
2012 
2013  return result;
2014 }
2015 
2019  const std::string& xid_space_name,
2020  bool xauto_access) const
2021 {
2022  // Preconditions:
2023 
2024  require(xauto_access || state_is_read_accessible());
2025  require(is_valid_int_id(xint_id, xid_space_name, xauto_access));
2026 
2027 
2028  // Body:
2029 
2031  xid_space_name,
2032  xauto_access);
2033 
2034  // Postconditions:
2035 
2036  ensure(result >= 0);
2037 
2038  // Exit:
2039 
2040  return result;
2041 }
2042 
2045 prereq_id(int xi) const
2046 {
2047  pod_index_type result;
2048 
2049  // Preconditions:
2050 
2051  // Body:
2052 
2053  switch(xi)
2054  {
2055  case 0: // schema
2056  result = schema().host()->index().pod();
2057  break;
2058  case 1: // rep
2059  result = _rep.host()->index().pod();
2060  break;
2061  case 2: // fiber space
2062  result = _fiber_space->index().pod();
2063  break;
2064  case 3: // base
2065  result = _base_space->index().pod();
2066  break;
2067  default:
2068  result = invalid_pod_index();
2069  break;
2070  }
2071 
2072  // Postconditions:
2073 
2074  // Exit:
2075 
2076  return result;
2077 }
2078 
2079 // PROTECTED FUNCTIONS
2080 
2081 // PRIVATE FUNCTIONS
2082 
2083 
2084 // ===========================================================
2085 // ANY FACET
2086 // ===========================================================
2087 
2088 // PUBLIC FUNCTIONS
2089 
2090 bool
2092 is_ancestor_of(const any* xother) const
2093 {
2094  bool result;
2095 
2096  // Preconditions:
2097 
2098  // Body:
2099 
2100  result = dynamic_cast<const section_space_schema_poset*>(xother) != 0;
2101 
2102  // Postconditions:
2103 
2104  // Exit
2105 
2106  return result;
2107 }
2108 
2109 bool
2111 invariant() const
2112 {
2113  bool result = true;
2114 
2115  invariance(poset_state_handle::invariant());
2116 
2117  if(invariant_check())
2118  {
2120 
2121  invariance(state_is_read_accessible() ? rep().state_is_read_accessible() : true);
2122 
2124 
2126 
2128 
2129  invariance(state_is_read_accessible() ?
2130  fiber_space().schema().host()->member_index_ub().pod() <= FIBER_SCHEMA_MEMBER_ID_UB :
2131  true);
2132 
2134 
2135  invariance(unexecutable("rep.evaluator_family_name is compatible with base_space"));
2136 
2139 
2141  }
2142 
2143  return result;
2144 }
2145 
2146 // PROTECTED FUNCTIONS
2147 
2148 // PRIVATE FUNCTIONS
2149 
2150 
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...
poset_state_handle * host() const
The poset which this is a handle to a component of.
pod_index_type fiber_schema_member_id_ub() const
The upper bound on the member id of the fiber schema for section spaces on this schema.
virtual void delete_member(pod_index_type xmbr_hub_id)
Delete the member with hub id xmbr_hub_id. Redefined here only to trap attempts to make a new member...
virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser)
Delete the cover link between hub id xgreater and hub id xlesser.
virtual int version() const
The current version.
A client handle for a subposet.
Definition: subposet.h:86
int fiber_schema_stride() const
The increment in the member id when the id of the fiber schema component is increased by one...
virtual void terminate_access()
Release all access to posets this depends on, then detach and delete the state.
virtual void attach_handle_data_members()
Initializes the handle data members when this handle is attached to a state.
static bool rep_is_valid(const sec_rep_descriptor &xrep, const poset_state_handle &xbase_space)
True if the discretization and evaluation subposets named in xrep are included in xbase_space and the...
int df() const
The dimension of the fiber space.
bool state_is_not_read_only_accessible() const
True if this is attached and the state is not accessible for read only access.
virtual void new_link(pod_index_type xgreater, pod_index_type xlesser)
Insert a cover link from greater to lesser (that is, hub id xgreater covers hub id xlesser)...
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
virtual int member_ct() const
The number of members of this poset.
virtual pod_index_type new_member(bool xis_jim, pod_index_type xdof_tuple_id)
Create a disconnected member with is_jim == xis_jim. Redefined here only to trap attempts to make a n...
bool in_scope() const
True if and only if scope() contains an entry for pod().
Definition: scoped_index.h:584
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
virtual index_iterator * get_decomposition(pod_index_type xindex) const
An iterator over the members of the decomposition identified by xindex.
An abstract iterator over the ids of an id space.
virtual void new_link(pod_index_type xgreater, pod_index_type xlesser)
Insert a link from lesser to greater (i.e. lesser <= greater). Redefined here only to trap attempts t...
poset_crg_state * crg()
/// The name of the type of poset.
Definition: poset_state.cc:218
virtual poset_state * state_obj() const
State object for this poset.
const scoped_index & index() const
The member index of this poset within the namespace host()
virtual pod_index_type version_jims_index(int xversion) const
The subposet index of the jims() subposet for version xversion.
virtual const char * class_name() const
The name of this class.
virtual bool has_id_space() const
True if this already has an id space.
Definition: subposet.cc:622
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
subposet & whole()
The members of the current version of this poset.
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...
standard_member_index
Ids for standard poset members.
std::string discretization_subposet_name() const
The name of the discretization subposet.
ij_product_structure * _product
The Cartisian product subspace structure.
poset_type
Identifiers for poset types.
Definition: poset_type.h:41
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 is_schematized(bool xauto_access) const
True if this poset has been prepared for use as a schema, that is, if the top member has been schemat...
A client handle for a general, abstract partially order set.
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.
virtual pod_index_type get_base_space_id_from_index(pod_index_type xmbr_hub_id) const
Computes the base space member id associated with hub id xmbr_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
section_space_schema_member & top()
The top of member of the lattice (mutable version)
const index_space_family & member_id_spaces(bool xauto_access) const
Collection of member id spaces for this (const version).
virtual bool is_atom(pod_index_type xmbr_hub_id) const
True if the member with hub id xmbr_hub_id covers the bottom.
subposet & discretization()
The discretization subposet for section spaces on this schema.
virtual void get_read_access() const
Get read access to the state associated with this.
void put_standard_row_dof_tuple_ct(int xct)
Sets the number of standard row dof tuples automatically allocated by the constructor.
STL namespace.
abstract_poset_member * _top
Top member of poset.
int db() const
The dimension of the base space.
virtual int version() const
The current version.
virtual void attach_handle_data_members()
Initializes the handle data members when this handle is attached to a state. Intended to be redefined...
virtual void get_read_access() const
Get read access to the state associated with this.
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.
virtual void next()=0
Makes id() the next id in the iteration.
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
namespace_poset * host() const
The namespace this poset resides in. Obsolete; use name_space() instead.
virtual void put_member_name(pod_index_type xmbr_hub_id, const std::string &xname, bool xunique, bool xauto_access=false)
Make xname a name for the member with hub id xmbr_hub_id. if xunique, make xname the only name...
poset_path rep_path(bool xauto_access) const
The path to the representation for section spaces on this schema..
const index_space_handle & table_dof_id_space() const
The table dof id space for the schema defined by this.
bool has_version(int xversion) const
True if xversion is a valid version.
abstract_poset_member * _bottom
Bottom members of poset.
virtual bool is_valid_int_id(pod_index_type xint_id, const std::string &xid_space_name, bool xauto_access) const
True if xint_id can be translated to an external id using the equivalence map with name xid_space_nam...
virtual pod_index_type new_member(bool xis_jim, pod_index_type xtuple_hub_id)
Create a disconnected member with is_jim == xis_jim and the dof tuple identified by hub id xtuple_hub...
virtual pod_index_type version_index(int xversion) const
The subposet index of the whole() subposet for version xversion.
virtual pod_index_type get_index_from_components(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id) const =0
Computes the index associated with component ids xbase_space_id and xfiber_schema_id.
An implementation of class explicit_index_space_handle that has a primary id space state...
bool same_scope(const scoped_index &xother) const
True if and only if this is in the same id space as xother.
Definition: scoped_index.h:464
void attach_to_state(const poset_state_handle *xhost, pod_index_type xhub_id)
Attach this handle to the state with hub id xhub_id in the current version of host xhost...
void new_standard_member_hack(standard_member_index xid)
Create a new bottom or top member.
virtual pod_index_type version_jims_index(int xversion) const
The subposet hub id of the jims() subposet for version xversion.
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...
subposet & evaluation()
The evaluation subposet for section spaces on this schema.
virtual bool invariant() const
Class invariant.
Table dofs type for class section_space_schema_poset.
Abstract base class with useful features for all objects.
Definition: any.h:39
section_space_schema_poset()
Default constructor; disabled.
poset & fiber_space()
The fiber space for section spaces on this schema.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
pod_index_type new_term(size_type xct, bool xauto_access)
Creates a new term in the member hub id space with xct number of ids. Returns the index of the id spa...
virtual int standard_member_ct() const
The number of standard members automatically allocated by the constructor.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
bool is_done() const
True if iteration is finished.
virtual pod_index_type new_subposet(const block< pod_index_type > &xmembers)
Creates a new subposet. If xinitialize, set the membership to include the members with indices in xma...
virtual pod_index_type version_index(int xversion) const
The subposet hub id of the whole() subposet for version xversion.
virtual pod_index_type get_ext_id(pod_index_type xint_id, const std::string &xid_space_name, bool xauto_access) const
Translates xint_id to an external id using the equivalence map with name xid_space_name.
virtual void delete_subposet(pod_index_type xsubposet_hub_id)
Deletes the subposet with hub id xsubposet_hub_id.
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...
A client handle for a mutable partially ordered set.
Definition: poset.h:40
virtual pod_index_type new_subposet(bool xinitialize=true)
Creates a new subposet. If xinitialize, make the subposet empty,.
bool has_standard_row_dof_tuple_ct() const
True if poset is in its initial state, that is, it contains just the standard row_dof_tuples.
virtual void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
virtual int standard_member_ct() const
The number of standard members automatically allocated by the constructor.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual pod_index_type prereq_id(int xi) const
The id of the xi-th prerequisite poset for this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
Definition: subposet.cc:1091
bool cover_is_empty(bool xlower, pod_index_type xmbr_hub_id) const
True if and only if the lower (xlower true) or upper (xlower false) cover set of the member with hub ...
virtual bool is_jim(pod_index_type xmbr_hub_id, bool xin_current_version=true) const
True if the member with hub id xmbr_hub_id is a jim.
size_type row_dof_tuple_ct() const
The number of row_dof_tuples of this poset.
virtual void terminate_access()
Release all access to posets this depends on, then detach and delete the state.
virtual void delete_subposet(pod_index_type xsubposet_hub_id)
Deletes the subposet with hub id xsubposet_hub_id.
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. ...
const bool UPPER
Selector for upper cover.
Definition: sheaf.h:72
bool is_multivalued() const
Switch that tells the user if the multivalued subposet exists.
sec_rep_descriptor & rep()
The representation for section spaces on this schema.
virtual std::string member_name(pod_index_type xmbr_hub_id, bool xauto_access=false) const
A name for the member with hub id xmbr_hub_id.
virtual void initialize_handle_data_members(const namespace_poset &xns)
Initializes the handle data members that depend on the table dofs and are required to get access when...
std::string evaluator_family_name() const
The name of the evaluator family for section spaces on this schema.
void put_standard_member_ct(int xct)
Sets the number of standard members automatically allocated by the constructor.
void put(const index_space_handle &xid_space, pod_type xpod)
Set the scope to id space, xid_space and pod() to xpod.
Definition: scoped_index.h:332
virtual std::string name() const
The name of this poset.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
Definition: any.h:97
poset_path base_space_path(bool xauto_access) const
The path to the base space for section spaces on this schema.
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...
void new_standard_member_hack(standard_member_index xindex)
Create a new bottom or top member.
const ij_product_structure & product_structure() const
The product structure of this schema.
SHEAF_DLL_SPEC void max(const vd &x0, vd_value_type &xresult, bool xauto_access)
Maximum component of x0, pre-allocated version.
Definition: vd.cc:2097
virtual pod_index_type get_fiber_schema_id_from_index(pod_index_type xmbr_hub_id) const
Computes the fiber schema member id associated with hub id xmbr_hub_id.
int base_space_stride() const
The increment in the member id when the id of the base space component is increased by one...
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
virtual int version_ct() const
The number of versions.
const hub_index_space_handle & member_hub_id_space(bool xauto_access) const
The member hub id space.
void put_subposet_member_index_ub(const scoped_index &xub)
Sets the upper bound of member index in each subposet to xub.
Iterates over the subset of Zn defined by the characteristic function host().
pod_index_type base_space_member_id_ub() const
The upper bound of the member id of the base space for section spaces on this schema.
const bool LOWER
Selector for lower cover.
Definition: sheaf.h:67
virtual int member_ct() const
The number of members of this poset.
namespace_poset * name_space() const
The namespace this poset resides in.
virtual bool is_attached() const
True if this is attached to a state.
virtual const abstract_product_structure & product_structure() const
The product structure for this id space (const version).
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. ...
index_iterator member_iterator() const
An iterator for members of this poset.
virtual void schematize(subposet *xtable_dof_subposet, subposet *xrow_dof_subposet, bool xall_members=false)
Prepare this poset and its top member for use as a schema. If xall_members = true, schematize all other members as well.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
int access_request_depth() const
The number of times access has been requested and granted without being released. ...
section_space_schema_member & bottom()
The bottom of member of the lattice (mutable version)
An abstract schema poset for a section space. A Cartesian product subspace of the tensor product of a...
virtual void new_product_structure(const abstract_product_structure &xproduct)
Creates a new product structure for this id space by cloning the product structure, xproduct.
virtual poset_type type_id() const
Identifier for the type of this poset.
poset_crg_state & crg() const
The cover relation graph.
virtual bool is_schematized(bool xauto_access) const
True if this poset has been prepared for use as a schema, that is, if the top member has been schemat...
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
poset_path fiber_space_path(bool xauto_access) const
The path to the fiber space for section spaces on this schema.
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...
poset_state_handle & fiber_schema()
The fiber schema for section spaces on this schema (mutable version).
virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser)
Delete the link with between xgreater and xlesser Redefined here only to trap attempts to delete a li...
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
A 2D implementation of abstract_product_structure.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
sec_rep_descriptor _rep
The representation for section spaces on this schema.
std::string evaluation_subposet_name() const
The name of the evaluation subposet.
A client handle for a poset member which has been prepared for use as a schema for a section space...
subposet & multivalued()
The multivalued subposet for section spaces on this schema.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual bool is_jim(pod_index_type xmbr_hub_id, bool xin_current_version=true) const
True if the member with hub id xmbr_hub_id is a jim in the current version (xin_current_version == tr...
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
virtual void delete_member(pod_index_type xmbr_hub_id)
Delete the member with hub id xmbr_hub_id. Warning: this routine does not delete links; it will leave...
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
virtual pod_index_type get_ext_id(pod_index_type xint_id, const std::string &xid_space_name, bool xauto_access) const
Translates xint_id to an external id using the equivalence map with name xid_space_name.
virtual void get_read_access() const
Get read access to the state associated with this.
poset * _fiber_space
The fiber space for section spaces on this schema.
virtual bool is_atom(pod_index_type xmbr_hub_id) const
True if the member with hub id xmbr_hub_id covers the bottom.
virtual void initialize_standard_members()
Creates the members common to every poset (i.e. _top and _bottom).
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
Definition: pod_types.cc:31
virtual void attach_to_state(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id)=0
Attach to the state in host() with component ids xbase_id and xfiber_schema_id.
void update_hub_id_space(bool xauto_access)
Extends the hub id space to match extension of the base space.
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
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 bool invariant() const
Class invariant.
A client handle for a poset member which has been prepared for use as a schema.
bool contains_hub(const std::string &xname, pod_type xid) const
True if the space with name xname contains an id equivalent to xid in the unglued hub id space...
virtual int version_ct() const
The number of versions currently defined.
poset_powerset_state & powerset() const
The set of subposets of this poset.
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
base_space_poset & base_space()
The base space for section spaces on this schema.
A description for a section representation scheme.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
base_space_poset * _base_space
The base space for section spaces on this schema.