SheafSystem  0.0.0.0
at0.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/at0.impl.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/at0_space.h"
25 #include "SheafSystem/at1_space.h"
26 #include "SheafSystem/fiber_bundles_namespace.h"
27 #include "SheafSystem/schema_poset_member.h"
28 #include "SheafSystem/stp.h"
29 #include "SheafSystem/wsv_block.h"
30 
31 using namespace std;
32 using namespace fiber_bundle; // Workaround for MS C++ bug.
33 
34 
35 //==============================================================================
36 // CLASS AT0_LITE
37 //==============================================================================
38 
39 
40 //==============================================================================
41 // AT0 FACET OF CLASS AT0_LITE
42 //==============================================================================
43 
44 // PUBLIC MEMBER FUNCTIONS
45 
48 {
49 
50  // Preconditions:
51 
52  // Body:
53 
54  // Postconditions:
55 
56  ensure(invariant());
57 
58  // Exit:
59 }
60 
62 at0_lite(const at0_lite& xother)
63 {
64  // Preconditions:
65 
66  // Body:
67 
68  *this = xother;
69 
70  // Postconditions:
71 
72  ensure(invariant());
73 
74  // Exit:
75 }
76 
79 operator=(const at0_lite& xother)
80 {
81 
82  // Preconditions:
83 
84  // Body:
85 
86  if(this != &xother)
87  {
88  put_component(0, xother[0]);
89  }
90 
91  // Postconditions:
92 
93  ensure(invariant());
94 
95  // Exit:
96 
97  return *this;
98 }
99 
102 {
103  // Preconditions:
104 
105  // Body:
106 
107  // Postconditions:
108 
109  // Exit:
110 
111 }
112 
114 at0_lite(const row_dofs_type& xrow_dofs)
115 {
116  // Preconditions:
117 
118  // Body:
119 
120  *this = xrow_dofs;
121 
122  // Postconditions:
123 
124  ensure(invariant());
125 
126  // Exit:
127 }
128 
131 operator=(const row_dofs_type& xrow_dofs)
132 {
133  // Preconditions:
134 
135  // Body:
136 
137  put_component(xrow_dofs.components[0]);
138 
139  // Postconditions:
140 
141  ensure(invariant());
142 
143  // Exit:
144 
145  return *this;
146 
147 }
148 
151 {
152  // Preconditions:
153 
154  // Body:
155 
156  put_component(x0);
157 
158  // Postconditions:
159 
160  ensure(invariant());
161 
162  // Exit:
163 }
164 
165 
168 operator=(const value_type& xcomp)
169 {
170  // Preconditions:
171 
172  // Body:
173 
174  put_component(xcomp);
175 
176  // Postconditions:
177 
178  ensure(invariant());
179 
180  // Exit:
181 
182  return *this;
183 }
184 
185 bool
187 operator==(const vd_value_type& xother) const
188 {
189  // Preconditions:
190 
191  // Body:
192 
193  bool result = (component() == xother);
194 
195  // Postconditions:
196 
197  ensure(invariant());
198 
199  // Exit:
200 
201  return result;
202 }
203 
204 fiber_bundle::at0_lite::
206 {
207  // Preconditions:
208 
209  // Body:
210 
211  value_type result = component();
212 
213  // Postconditions:
214 
215  // Exit:
216 
217  return result;
218 }
219 
220 fiber_bundle::at0_lite::
221 operator at0_lite::value_type () const
222 {
223  // Preconditions:
224 
225  // Body:
226 
227  const value_type result = component();
228 
229  // Postconditions:
230 
231  // Exit:
232 
233  return result;
234 }
235 
236 fiber_bundle::at0_lite::
238 {
239  // Preconditions:
240 
241  // Body:
242 
243  row_dofs_type& result = _row_dofs;
244 
245  // Postconditions:
246 
247  // Exit:
248 
249  return result;
250 }
251 
252 fiber_bundle::at0_lite::
253 operator const at0_lite::row_dofs_type& () const
254 {
255  // Preconditions:
256 
257  // Body:
258 
259  const row_dofs_type& result = _row_dofs;
260 
261  // Postconditions:
262 
263  // Exit:
264 
265  return result;
266 }
267 
268 void
271 {
272  // Preconditions:
273 
274  // Body:
275 
276  put_component(0, xcomp);
277 
278  // Postconditions:
279 
280  ensure(invariant());
281  ensure(isunordered_or_equals(component(0), xcomp));
282 
283  // Exit:
284 }
285 
288 component() const
289 {
290  // Preconditions:
291 
292  // Body:
293 
294  value_type result = sheaf::row_dofs(*this)[0];
295 
296  // Postconditions:
297 
298  ensure(invariant());
299 
300  // Exit:
301 
302  return result;
303 }
304 
309 {
310  // Preconditions:
311 
312  require(0 <= xp);
313 
314  // Body:
315 
316  static const tp_lite ltp_lite;
317  return ltp_lite;
318 
319  // Postconditions:
320 
321  ensure(unexecutable("result.p() == xp"));
322 
323  // Exit:
324 }
325 
327 const fiber_bundle::tp_lite&
329 tp_prototype(int xp) const
330 {
331  // Preconditions:
332 
333  // Body:
334  // Preconditions:
335 
336  require(precondition_of(static_tp_prototype(xp)));
337 
338  // Body:
339 
340  const tp_lite& result = static_tp_prototype(xp);
341 
342  // Postconditions:
343 
344  ensure(postcondition_of(static_tp_prototype(xp)));
345 
346  // Exit:
347 
348  return result;
349 }
350 
355 {
356  // Preconditions:
357 
358  require(0 <= xp);
359 
360  // Body:
361 
362  static const atp_lite latp_lite;
363  return latp_lite;
364 
365  // Postconditions:
366 
367  ensure(unexecutable("result.p() == xp"));
368 
369  // Exit:
370 }
371 
375 atp_prototype(int xp) const
376 {
377  // Preconditions:
378 
379  require(precondition_of(static_atp_prototype(xp)));
380 
381  // Body:
382 
383  const atp_lite& result = static_atp_prototype(xp);
384 
385  // Postconditions:
386 
387  ensure(postcondition_of(static_atp_prototype(xp)));
388 
389  // Exit:
390 
391  return result;
392 }
393 
398 {
399  // Preconditions:
400 
401  require(0 <= xp);
402 
403  // Body:
404 
405  static const stp_lite lstp_lite;
406  return lstp_lite;
407 
408  // Postconditions:
409 
410  ensure(unexecutable("result.p() == xp"));
411 
412  // Exit:
413 }
414 
417 stp_prototype(int xp) const
418 {
419  // Preconditions:
420 
421  require(precondition_of(static_stp_prototype(xp)));
422 
423  // Body:
424 
425  const stp_lite& result = static_stp_prototype(xp);
426 
427  // Postconditions:
428 
429  ensure(postcondition_of(static_stp_prototype(xp)));
430 
431  // Exit:
432 
433  return result;
434 }
435 
436 // PROTECTED MEMBER FUNCTIONS
437 
438 // PRIVATE MEMBER FUNCTIONS
439 
440 
441 //==============================================================================
442 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS AT0_LITE
443 //==============================================================================
444 
445 // PUBLIC MEMBER FUNCTIONS
446 
447 int
449 p() const
450 {
451  // Preconditions:
452 
453  // Body:
454 
455  int result = 0;
456 
457  // Postconditions:
458 
459  ensure(invariant());
460  ensure(result == 0);
461 
462  // Exit:
463 
464  return result;
465 }
466 
467 // PROTECTED MEMBER FUNCTIONS
468 
469 // PRIVATE MEMBER FUNCTIONS
470 
471 
472 //==============================================================================
473 // TENSOR ALGEBRA (TP) FACET OF CLASS AT0_LITE
474 //==============================================================================
475 
476 // PUBLIC MEMBER FUNCTIONS
477 
478 int
480 dd() const
481 {
482  // Preconditions:
483 
484  // Body:
485 
486  int result = 1;
487 
488  // Postconditions:
489 
490  ensure(invariant());
491  ensure(result == 1);
492 
493  // Exit:
494 
495  return result;
496 }
497 
498 // PROTECTED MEMBER FUNCTIONS
499 
500 // PRIVATE MEMBER FUNCTIONS
501 
502 
503 //===========================================================================
504 // VECTOR ALGEBRA (VD) FACET OF CLASS AT0_LITE
505 //===========================================================================
506 
507 // PUBLIC MEMBER FUNCTIONS
508 
509 // PROTECTED MEMBER FUNCTIONS
510 
511 // PRIVATE MEMBER FUNCTIONS
512 
513 
514 //===========================================================================
515 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS AT0_LITE
516 //===========================================================================
517 
518 // PUBLIC MEMBER FUNCTIONS
519 
520 // PROTECTED MEMBER FUNCTIONS
521 
522 // PRIVATE MEMBER FUNCTIONS
523 
524 
525 //============================================================================
526 // ABSTRACT POSET MEMBER FACET OF CLASS AT0_LITE
527 //============================================================================
528 
529 // PUBLIC MEMBER FUNCTIONS
530 
531 const std::string&
533 class_name() const
534 {
535  // Preconditions:
536 
537  // Body:
538 
539  const string& result = static_class_name();
540 
541  // Postconditions:
542 
543  ensure(!result.empty());
544 
545  // Exit:
546 
547  return result;
548 }
549 
550 const std::string&
553 {
554  // Preconditions:
555 
556  // Body:
557 
558  static const string result("at0_lite");
559 
560  // Postconditions:
561 
562  ensure(!result.empty());
563 
564  // Exit:
565 
566  return result;
567 }
568 
571 clone() const
572 {
573  at0_lite* result = 0;
574 
575  // Preconditions:
576 
577  // Body:
578 
579  result = new at0_lite();
580 
581  // Postconditions:
582 
583  ensure(result != 0);
584  ensure(is_same_type(*result));
585 
586  // Exit:
587 
588  return result;
589 }
590 
591 // PROTECTED MEMBER FUNCTIONS
592 
593 // PRIVATE MEMBER FUNCTIONS
594 
595 
596 //==============================================================================
597 // ANY FACET OF CLASS AT0_LITE
598 //==============================================================================
599 
600 // PUBLIC MEMBER FUNCTIONS
601 
602 bool
604 is_ancestor_of(const any_lite& xother) const
605 {
606  // Preconditions:
607 
608  require(&xother != 0);
609 
610  // Body:
611 
612  // True if other conforms to this.
613 
614  bool result = dynamic_cast<const at0_lite*>(&xother) != 0;
615 
616  // Postconditions:
617 
618  return result;
619 }
620 
621 bool
623 invariant() const
624 {
625  bool result = true;
626 
627  if(invariant_check())
628  {
629  // Prevent recursive calls to invariant.
630 
631  disable_invariant_check();
632 
633  // Must satisfy base class invariant.
634 
635  invariance(atp_lite::invariant());
636 
637  // Invariances for this class:
638 
639  // Finished, turn invariant checking back on.
640 
641  enable_invariant_check();
642  }
643 
644  // Exit
645 
646  return result;
647 }
648 
649 void*
652 {
653  return &_row_dofs;
654 }
655 
656 const void*
658 row_dofs() const
659 {
660  return &_row_dofs;
661 }
662 
663 // PROTECTED MEMBER FUNCTIONS
664 
665 // PRIVATE MEMBER FUNCTIONS
666 
667 
668 //==============================================================================
669 // CLASS AT0
670 //==============================================================================
671 
672 // ===========================================================
673 // HOST FACTORY FACET OF CLASS AT0
674 // ===========================================================
675 
676 // PUBLIC MEMBER FUNCTIONS
677 
678 
679 const sheaf::poset_path&
682 {
683  // Preconditions:
684 
685 
686  // Body:
687 
688  static const poset_path result(standard_schema_poset_name(), "at0_schema");
689 
690  // Postconditions:
691 
692  // Exit:
693 
694  return result;
695 }
696 
697 void
700 {
701  // Preconditions:
702 
703  require(xns.state_is_read_write_accessible());
704  require(xns.contains_poset(standard_schema_poset_name()));
705  require(!xns.contains_poset_member(standard_schema_path()));
706 
707 
708  // Body:
709 
710  string lmember_names = "value DOUBLE false";
711 
712  schema_poset_member lschema(xns,
713  standard_schema_path().member_name(),
714  atp::standard_schema_path(),
715  lmember_names,
716  false);
717 
718  lschema.detach_from_state();
719 
720  // Postconditions:
721 
722  ensure(xns.contains_poset_member(standard_schema_path()));
723 
724  // Exit:
725 
726  return;
727 }
728 
731 new_host(namespace_type& xns, const poset_path& xhost_path, const poset_path& xschema_path, bool xauto_access)
732 {
733  // cout << endl << "Entering at0::new_host." << endl;
734 
735  // Preconditions:
736 
737  require(xns.state_is_auto_read_write_accessible(xauto_access));
738 
739  require(!xhost_path.empty());
740  require(!xns.contains_path(xhost_path, xauto_access));
741 
742  require(xschema_path.full());
743  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
744  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
745  require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 1);
746 
747  // Body:
748 
749  host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xauto_access);
750 
751  // Postconditions:
752 
753  ensure(xns.owns(result, xauto_access));
754  ensure(result.path(true) == xhost_path);
755  ensure(result.state_is_not_read_accessible());
756  ensure(result.schema(true).path(xauto_access) == xschema_path);
757 
758  ensure(result.factor_ct(true) == 1);
759  ensure(result.d(true) == 1);
760  ensure(result.scalar_space_path(true) == xhost_path);
761  ensure(result.p(true) == 0);
762  ensure(result.dd(true) == 1);
763  ensure(result.vector_space_path(true) == xhost_path );
764 
765  // Exit:
766 
767  // cout << "Leaving at0::new_host." << endl;
768  return result;
769 }
770 
773 standard_host(namespace_type& xns, const std::string& xsuffix, bool xauto_access)
774 {
775  // cout << endl << "Entering at0::new_host." << endl;
776 
777  // Preconditions:
778 
779  require(xns.state_is_auto_read_write_accessible(xauto_access));
780 
781  require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
782  require(standard_host_is_available<at0>(xns, xsuffix, xauto_access));
783 
784  require(xns.path_is_auto_read_accessible(standard_schema_path(), xauto_access));
785 
786  // Body:
787 
788  poset_path lpath(standard_host_path<at0>(xsuffix));
789 
790  host_type* result_ptr;
791  if(xns.contains_path(lpath, xauto_access))
792  {
793  result_ptr = &xns.member_poset<host_type>(lpath, xauto_access);
794  }
795  else
796  {
797  result_ptr = &new_host(xns, lpath, standard_schema_path(), xauto_access);
798  }
799 
800  host_type& result = *result_ptr;
801 
802  // Postconditions:
803 
804  ensure(xns.owns(result, xauto_access));
805  ensure(result.path(true) == standard_host_path<at0>(xsuffix));
806  ensure(result.state_is_not_read_accessible());
807  ensure(result.schema(true).path(xauto_access) == standard_schema_path());
808 
809  ensure(result.factor_ct(true) == 1);
810  ensure(result.d(true) == 1);
811  ensure(result.scalar_space_path(true) == result.path(true));
812  ensure(result.p(true) == 0);
813  ensure(result.dd(true) == 1);
814  ensure(result.vector_space_path(true) == result.path(true));
815 
816  // Exit:
817 
818  // cout << "Leaving at0::new_host." << endl;
819  return result;
820 }
821 
822 
823 // PROTECTED MEMBER FUNCTIONS
824 
825 // PRIVATE MEMBER FUNCTIONS
826 
827 
828 //==============================================================================
829 // AT0 FACET OF CLASS AT0
830 //==============================================================================
831 
832 // PUBLIC MEMBER FUNCTIONS
833 
836 {
837 
838  // Preconditions:
839 
840  // Body:
841 
842  // Postconditions:
843 
844  ensure(invariant());
845 }
846 
848 at0(const poset_state_handle* xhost, pod_index_type xhub_id)
849 {
850 
851  // Preconditions:
852 
853  require(xhost != 0);
854  require(xhost->state_is_read_accessible());
855  require(xhost->contains_member(xhub_id));
856 
857  // Body:
858 
859  attach_to_state(xhost, xhub_id);
860 
861  // Postconditions:
862 
863  ensure(invariant());
864  // ensure(host() == xhost);
865  ensure(index() == xhub_id);
866  ensure(is_attached());
867 
868 }
869 
871 at0(const poset_state_handle* xhost, const scoped_index& xid)
872 {
873 
874  // Preconditions:
875 
876  require(xhost != 0);
877  require(xhost->state_is_read_accessible());
878  require(xhost->contains_member(xid));
879 
880  // Body:
881 
882  attach_to_state(xhost, xid.hub_pod());
883 
884  // Postconditions:
885 
886  ensure(invariant());
887  // ensure(host() == xhost);
888  ensure(index() ==~ xid);
889  ensure(is_attached());
890 
891 }
892 
894 at0(const poset_state_handle* xhost, const std::string& xname)
895 {
896 
897  // Preconditions:
898 
899  require(xhost != 0);
900  require(xhost->state_is_read_accessible());
901  require(!xname.empty());
902  require(xhost->contains_member(xname));
903 
904  // Body:
905 
906  attach_to_state(xhost, xname);
907 
908  // Postconditions:
909 
910  ensure(invariant());
911  // ensure(host() == xhost);
912  ensure(name() == xname);
913  ensure(is_attached());
914 
915 }
916 
919 {
920 
921  // Preconditions:
922 
923  require(xother != 0);
924 
925  // Body:
926 
927  attach_to_state(xother);
928 
929  // Postconditions:
930 
931  ensure(invariant());
932  ensure(is_attached());
933  ensure(is_same_state(xother));
934 
935 }
936 
938 at0(poset_state_handle* xhost, bool xauto_access)
939 {
940 
941  // Preconditions:
942 
943  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
944 
945  // Body:
946 
947  new_jim_state(xhost, 0, false, xauto_access);
948 
949  // Postconditions:
950 
951  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
952 
953  // Exit:
954 
955  return;
956 }
957 
960  const row_dofs_type& xrdt,
961  bool xauto_access)
962 {
963 
964  // Preconditions:
965 
966  require(precondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
967 
968  // Body:
969 
970  new_jim_state(&xhost, 0, false, xauto_access);
971 
972  if(xauto_access)
973  {
974  xhost.get_read_write_access();
975  }
976 
977  *this = xrdt;
978 
979  if(xauto_access)
980  {
981  xhost.release_access();
982  }
983 
984  // Postconditions:
985 
986  ensure(postcondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
987 
988  // Exit:
989 
990  return;
991 }
992 
996 {
997  // Preconditions:
998 
999  require(state_is_read_write_accessible());
1000 
1001  // Body:
1002 
1003  put_component(0, xrdt.components[0]);
1004 
1005  // Postconditions:
1006 
1007  ensure(isunordered_or_equals(component(0), xrdt.components[0]));
1008 
1009  // Exit:
1010 
1011  return *this;
1012 
1013 }
1014 
1019 {
1020  // Preconditions:
1021 
1022  require(is_ancestor_of(&xother));
1023  require(precondition_of(attach_to_state(&xother)));
1024 
1025  // Body:
1026 
1027  attach_to_state(&xother);
1028 
1029  // Postconditions:
1030 
1031  ensure(postcondition_of(attach_to_state(&xother)));
1032 
1033  // Exit:
1034 
1035  return *this;
1036 }
1037 
1041 operator=(const at0& xother)
1042 {
1043  // Preconditions:
1044 
1045  require(precondition_of(attach_to_state(&xother)));
1046 
1047  // Body:
1048 
1049  attach_to_state(&xother);
1050 
1051  // Postconditions:
1052 
1053  ensure(postcondition_of(attach_to_state(&xother)));
1054 
1055  // Exit:
1056 
1057  return *this;
1058 }
1059 
1062 {
1063 
1064  // Preconditions:
1065 
1066  // Body:
1067 
1068  // Postconditions:
1069 }
1070 
1074 {
1075  // Preconditions:
1076 
1077  // Body:
1078 
1079  static const volatile_type result;
1080 
1081  // Postconditions:
1082 
1083  // Exit:
1084 
1085  return result;
1086 }
1087 
1091 lite_type() const
1092 {
1093  // Preconditions:
1094 
1095  // Body:
1096 
1097  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
1098 
1099  // Postconditions:
1100 
1101  // Exit:
1102 
1103  return result;
1104 }
1105 
1106 
1109 value() const
1110 {
1111  // Preconditions:
1112 
1113  require(state_is_read_accessible());
1114 
1115  // Body:
1116 
1117  value_type result = component(0);
1118 
1119  // Postconditions:
1120 
1121  ensure(invariant());
1122 
1123  // Exit:
1124 
1125  return result;
1126 }
1127 
1128 void
1131 {
1132  // Preconditions:
1133 
1134  require(state_is_read_write_accessible());
1135 
1136  // Body:
1137 
1138  put_component(0, xvalue);
1139 
1140  // Postconditions:
1141 
1142  ensure(value() == xvalue);
1143  ensure(invariant());
1144 }
1145 
1146 fiber_bundle::at0::
1148 {
1149  // Preconditions:
1150 
1151  // Body:
1152 
1153  row_dofs_type& result = sheaf::row_dofs(*this);
1154 
1155  // Postconditions:
1156 
1157  // Exit:
1158 
1159  return result;
1160 }
1161 
1162 fiber_bundle::at0::
1163 operator const at0::row_dofs_type& () const
1164 {
1165  // Preconditions:
1166 
1167  // Body:
1168 
1169  const row_dofs_type& result = sheaf::row_dofs(*this);
1170 
1171  // Postconditions:
1172 
1173  // Exit:
1174 
1175  return result;
1176 }
1177 
1178 // PROTECTED MEMBER FUNCTIONS
1179 
1180 // PRIVATE MEMBER FUNCTIONS
1181 
1182 
1183 //==============================================================================
1184 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS AT0
1185 //==============================================================================
1186 
1187 // PUBLIC MEMBER FUNCTIONS
1188 
1189 // PROTECTED MEMBER FUNCTIONS
1190 
1191 // PRIVATE MEMBER FUNCTIONS
1192 
1193 
1194 //==============================================================================
1195 // TENSOR ALGEBRA (TP) FACET OF CLASS AT0
1196 //==============================================================================
1197 
1198 // PUBLIC MEMBER FUNCTIONS
1199 
1200 // PROTECTED MEMBER FUNCTIONS
1201 
1202 // PRIVATE MEMBER FUNCTIONS
1203 
1204 
1205 //==============================================================================
1206 // VECTOR ALGEBRA (VD) FACET OF CLASS AT0
1207 //==============================================================================
1208 
1209 // PUBLIC MEMBER FUNCTIONS
1210 
1211 // PROTECTED MEMBER FUNCTIONS
1212 
1213 // PRIVATE MEMBER FUNCTIONS
1214 
1215 
1216 //==============================================================================
1217 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS AT0
1218 //==============================================================================
1219 
1220 // PUBLIC MEMBER FUNCTIONS
1221 
1222 int
1224 factor_ct() const
1225 {
1226  // Preconditions:
1227 
1228  // Body:
1229 
1230  int result = 1;
1231 
1232  // Postconditions:
1233 
1234  ensure(invariant());
1235  ensure(result == 1);
1236 
1237  // Exit:
1238 
1239  return result;
1240 }
1241 
1242 // PROTECTED MEMBER FUNCTIONS
1243 
1244 // PRIVATE MEMBER FUNCTIONS
1245 
1246 
1247 //==============================================================================
1248 // ABSTRACT POSET MEMBER FACET OF CLASS AT0
1249 //==============================================================================
1250 
1251 // PUBLIC MEMBER FUNCTIONS
1252 
1253 const std::string&
1255 class_name() const
1256 {
1257  // Preconditions:
1258 
1259  // Body:
1260 
1261  const string& result = static_class_name();
1262 
1263  // Postconditions:
1264 
1265  ensure(!result.empty());
1266 
1267  // Exit:
1268 
1269  return result;
1270 }
1271 
1272 const std::string&
1275 {
1276  // Preconditions:
1277 
1278  // Body:
1279 
1280  static const string result("at0");
1281 
1282  // Postconditions:
1283 
1284  ensure(!result.empty());
1285 
1286  // Exit:
1287 
1288  return result;
1289 }
1290 
1291 // PROTECTED MEMBER FUNCTIONS
1292 
1293 // PRIVATE MEMBER FUNCTIONS
1294 
1295 
1296 
1297 // ===========================================================
1298 // POSET_COMPONENT FACET
1299 // ===========================================================
1300 
1301 // PUBLIC MEMBER FUNCTIONS
1302 
1305 host() const
1306 {
1307  return reinterpret_cast<host_type*>(_host);
1308 }
1309 
1310 bool
1313 {
1314  return dynamic_cast<const host_type*>(xother) != 0;
1315 }
1316 
1317 // PROTECTED MEMBER FUNCTIONS
1318 
1319 // PRIVATE MEMBER FUNCTIONS
1320 
1321 
1322 //==============================================================================
1323 // ANY FACET OF CLASS AT0
1324 //==============================================================================
1325 
1326 // PUBLIC MEMBER FUNCTIONS
1327 
1328 bool
1330 is_ancestor_of(const any* xother) const
1331 {
1332 
1333  // Preconditions:
1334 
1335  require(xother != 0);
1336 
1337  // Body:
1338 
1339  // If other may be dynamically cast to the type of this then this is an
1340  // ancestor of other.
1341 
1342  bool result = dynamic_cast<const at0*>(xother) != 0;
1343 
1344  // Postconditions:
1345 
1346  //ensure(invariant());
1347  //ensure(xother->invariant());
1348 
1349  // Exit:
1350 
1351  return result;
1352 
1353 }
1354 
1357 clone() const
1358 {
1359 
1360  // Preconditions:
1361 
1362  // Body:
1363 
1364  // Create new handle of the current class.
1365 
1366  at0* result = new at0();
1367 
1368  // Postconditions:
1369 
1370  ensure(result != 0);
1371  ensure(result->invariant());
1372 
1373  // Exit:
1374 
1375  return result;
1376 
1377 }
1378 
1379 bool
1381 invariant() const
1382 {
1383  bool result = true;
1384 
1385  // Body:
1386 
1387  // Must satisfy base class invariant.
1388 
1389  invariance(atp::invariant());
1390 
1393 
1394  if (invariant_check())
1395  {
1396  // Prevent recursive calls to invariant.
1397 
1398  disable_invariant_check();
1399 
1400  invariance((is_attached() ? p() == 0 : true));
1401  invariance((is_attached() ? d() == 1 : true));
1402  invariance((is_attached() ? dof_ct() == 1 : true));
1403 
1404  // Finished, turn invariant checking back on.
1405 
1406  enable_invariant_check();
1407  }
1408 
1409  // Exit:
1410 
1411  return result;
1412 }
1413 
1414 // PROTECTED MEMBER FUNCTIONS
1415 
1416 // PRIVATE MEMBER FUNCTIONS
1417 
static const std::string & static_class_name()
The name of this class.
Definition: at0.cc:1274
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...
at0_lite & operator=(const at0_lite &xother)
Assignment operator.
Definition: at0.cc:79
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
bool invariant() const
Class invariant.
Definition: at0.cc:623
virtual int factor_ct() const
Number of factors (components) in tuple.
Definition: at0.cc:1224
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: vd.h:129
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
virtual const tp_lite & tp_prototype(int xp) const
Virtual constructor for general tensors of degree xp over this vector space.
Definition: at0.cc:329
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: at0.cc:681
static int d(const namespace_poset &xns, int xp, const poset_path &xvector_space_path, bool xauto_access)
The tensor dimension implied by tensor degree xp and the dimension of the domain vector space specifi...
Definition: atp_space.cc:86
value_type component() const
Value of (the only) component.
Definition: at0.cc:288
virtual value_type value() const
The value of this as a POD ("plain old data") type.
Definition: at0.cc:1109
poset_path path(bool xauto_access=true) const
A path to this component.
bool invariant() const
Class invariant.
Definition: at0.cc:1381
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...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
poset_path vector_space_path() const
The path of the underlying vector space.
Definition: tp_space.cc:365
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
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
STL namespace.
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.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
T components[1]
The components (row_dofs), only one in this case.
Definition: at0.h:111
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
Definition: atp.h:44
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: at0.cc:604
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual ~at0_lite()
Destructor.
Definition: at0.cc:101
virtual const std::string & class_name() const
The name of this class.
Definition: at0.cc:1255
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
at0_lite()
Default constructor.
Definition: at0.cc:47
A space of scalars viewed as an antisymmetric tensor space of degree 0.
Definition: at0_space.h:42
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 owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
virtual void detach_from_state()
Detach this handle from its state, if any.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
A scalar viewed as an antisymmetric tensor of degree 0. As the degree is 0 there is nothing to be sym...
Definition: at0.h:424
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
static const std::string & static_class_name()
The name of this class.
Definition: at0.cc:552
at0 & operator=(const row_dofs_type &xrdt)
Assignment to an instance of the associated row dofs type.
Definition: at0.cc:995
Antisymetric tensor of degree 0 (volatile version).
Definition: at0.h:127
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: at0.cc:699
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. ...
int p(int xd, int xdd) const
Tensor degree as a function of tensor dimension xd and domain dimension xdd.
Definition: tp_space.cc:235
at0()
Default constructor.
Definition: at0.cc:835
virtual const stp_lite & stp_prototype(int xp) const
Prototype for symmetric tensors of degree xp over this vector space.
Definition: at0.cc:417
virtual void * row_dofs()
The row dofs for this instance (mutable version).
Definition: at0.cc:651
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: at0.cc:1091
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
virtual const std::string & class_name() const
The name of this class.
Definition: at0.cc:533
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
static const stp_lite & static_stp_prototype(int xp)
Static prototype for symmetric tensors of degree xp over this vector space.
Definition: at0.cc:397
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
poset_path scalar_space_path() const
The path of the underlying space of scalars.
Definition: vd_space.cc:250
static host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path(xsuffix). Returns the host if it already exists, otherwise, creates it in namespace xns with schema specified by standard_schema_path() and standard paths for prerequisites, which are also created if needed.
Definition: at0.cc:773
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: at0.cc:1073
host_type * host() const
The poset this is a member of.
Definition: at0.cc:1305
virtual int p() const
Degree of this as an antisymmetric tensor space.
Definition: at0.cc:449
bool operator==(const vd_value_type &xother) const
Equality operator.
Definition: at0.cc:187
virtual void put_component(value_type xcomp)
Set value of (the only) component to xcomp.
Definition: at0.cc:270
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
Definition: vd_space.cc:167
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
Definition: at0.cc:731
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
static const tp_lite & static_tp_prototype(int xp)
Static prototype for general tensors of degree xp over this vector space.
Definition: at0.cc:308
vd_value_type value_type
The POD ("plain old data") type of scalar in the vector space of this.
Definition: vd.h:423
int dd() const
The dimension of the underlying ("domain") vector space.
Definition: tp_space.cc:317
virtual const atp_lite & atp_prototype(int xp) const
Prototype for antisymmetric tensors of degree xp over this vector space.
Definition: at0.cc:375
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
Definition: at0.cc:1312
An abstract client handle for a member of a poset.
virtual at0 * clone() const
Make a new handle, no state instance of current.
Definition: at0.cc:1357
~at0()
Destructor.
Definition: at0.cc:1061
virtual at0_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: at0.cc:571
A symmetric tensor of degree p over an abstract vector space (volatile version).
Definition: stp.h:44
Namespace for the fiber_bundles component of the sheaf system.
static const atp_lite & static_atp_prototype(int xp)
Static prototype for antisymmetric tensors of degree xp over this vector space.
Definition: at0.cc:354
void put_value(value_type xvalue)
Sets value to xvalue.
Definition: at0.cc:1130
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...
A client handle for a poset member which has been prepared for use as a schema.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
Definition: at0.cc:1330
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63
virtual int dd() const
Degree of this as an antisymmetric tensor space.
Definition: at0.cc:480
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.
Definition: sheaf.cc:102