SheafSystem  0.0.0.0
tp.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/tp.h"
22 
23 #include "SheafSystem/abstract_poset_member.impl.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/at1.h"
26 #include "SheafSystem/at1_space.h"
27 #include "SheafSystem/fiber_bundles_namespace.h"
28 #include "SheafSystem/schema_poset_member.h"
29 #include "SheafSystem/tp_space.h"
30 #include "SheafSystem/wsv_block.h"
31 
32 using namespace std;
33 using namespace fiber_bundle; // Workaround for MS C++ bug.
34 
35 //==============================================================================
36 // CLASS TP_LITE
37 //==============================================================================
38 
39 //==============================================================================
40 // TENSOR ALGEBRA (TP) FACET OF CLASS TP_LITE
41 //==============================================================================
42 
45 {
46 
47  // Preconditions:
48 
49  // Body:
50 
51  // Postconditions:
52 
53  ensure(invariant());
54 
55  // Exit:
56 }
57 
59 tp_lite(const tp_lite& xother)
60 {
61  // Preconditions:
62 
63  // Body:
64 
65  *this = xother;
66 
67  // Postconditions:
68 
69  ensure(invariant());
70 
71  // Exit:
72 }
73 
76 operator=(const tp_lite& xother)
77 {
78 
79  // Preconditions:
80 
81 
82  // Body:
83 
84 
85  // Postconditions:
86 
87  ensure(invariant());
88 
89  // Exit:
90 
91  return *this;
92 }
93 
96 {
97  // Preconditions:
98 
99  // Body:
100 
101 
102  // Postconditions:
103 
104  // Exit:
105 
106 }
107 
109 tp_lite(const row_dofs_type& xrow_dofs)
110 {
111  // Preconditions:
112 
113  // Body:
114 
115  *this = xrow_dofs;
116 
117  // Postconditions:
118 
119  ensure(invariant());
120 
121  // Exit:
122 }
123 
126 operator=(const row_dofs_type& xrow_dofs)
127 {
128  // Preconditions:
129 
130  // Body:
131 
132  vd_lite::operator=(xrow_dofs);
133 
134  // Postconditions:
135 
136  postcondition_of(vd_lite::operator=(xrow_dofs));
137 
138  // Exit:
139 
140  return *this;
141 
142 }
143 
144 int
146 p() const
147 {
148  // Preconditions:
149 
150  // Body:
151 
152  int result = 0; // Just to silence compiler.
153 
154  // Postconditions:
155 
156  ensure(invariant());
157  ensure(result == 0);
158 
159  // Exit:
160 
161  return result;
162 }
163 
164 int
166 dd() const
167 {
168  // Preconditions:
169 
170  // Body:
171 
172  int result = 0; // Just to silence compiler.
173 
174  // Postconditions:
175 
176  ensure(invariant());
177  ensure(result == 0);
178 
179  // Exit:
180 
181  return result;
182 }
183 
187 {
188  // Preconditions:
189 
190  // Body:
191 
192  pod_index_type result = 0; // Just to silence compiler.
193 
194  // Postconditions:
195 
196  ensure(invariant());
197  ensure(result == 0);
198 
199  // Exit:
200 
201  return result;
202 }
203 
206 table_dofs() const
207 {
208  // Preconditions:
209 
210  // Body:
211 
213 
214  int lfactor_ct = factor_ct();
215  int ld = d();
216 
217  char* lscalar_space_path = new char[1];
218  lscalar_space_path[0] = 0;
219 
220  int lp = p();
221  int ldd = dd();
222 
223  char* lvector_space_path = new char[1];
224  lvector_space_path[0] = 0;
225 
226  table_dofs_type result =
227  {
228  lfactor_ct,
229  ld,
230  lscalar_space_path,
231  lp,
232  ldd,
233  lvector_space_path
234  };
235 
236  // Postconditions:
237 
238  // Exit:
239 
240  return result;
241 }
242 
243 // PROTECTED MEMBER FUNCTIONS
244 
245 // PRIVATE MEMBER FUNCTIONS
246 
247 
248 //==============================================================================
249 // VECTOR ALGEBRA (VD) FACET OF CLASS TP_LITE
250 //==============================================================================
251 
252 // PUBLIC MEMBER FUNCTIONS
253 
254 int
256 d() const
257 {
258  // Preconditions:
259 
260  // Body:
261 
262  int result = 0;
263  if(!(dd() == 0 && p() == 0))
264  {
265  result = static_cast<int>(pow(static_cast<double>( dd() ),
266  static_cast<int>( p() )));
267  }
268 
269 
270  // Postconditions:
271 
272  ensure(invariant());
273  // $$SCRIBBLE kabuch: Next line causes doxygen to emit a warning:
274  // <unknown>:1: Warning: Unsupported xml/html tag <int> found
275  //ensure(result == static_cast< int >(pow(static_cast<double>(dd()),
276  // static_cast<int>(p()))));
277 
278  // Exit:
279 
280  return result;
281 }
282 
283 //==============================================================================
284 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS TP_LITE
285 //==============================================================================
286 
287 // PUBLIC MEMBER FUNCTIONS
288 
289 // PROTECTED MEMBER FUNCTIONS
290 
291 // PRIVATE MEMBER FUNCTIONS
292 
293 
294 //==============================================================================
295 // ABSTRACT POSET MEMBER FACET OF CLASS TP_LITE
296 //==============================================================================
297 
298 // PUBLIC MEMBER FUNCTIONS
299 
300 const std::string&
302 class_name() const
303 {
304  // Preconditions:
305 
306  // Body:
307 
308  const string& result = static_class_name();
309 
310  // Postconditions:
311 
312  ensure(!result.empty());
313 
314  // Exit:
315 
316  return result;
317 }
318 
319 const std::string&
322 {
323  // Preconditions:
324 
325  // Body:
326 
327  static const string result("tp_lite");
328 
329  // Postconditions:
330 
331  ensure(!result.empty());
332 
333  // Exit:
334 
335  return result;
336 }
337 
340 clone() const
341 {
342  tp_lite* result = 0;
343 
344  // Preconditions:
345 
346  // Body:
347 
348  result = new tp_lite();
349 
350  // Postconditions:
351 
352  ensure(result != 0);
353  ensure(is_same_type(*result));
354 
355  // Exit:
356 
357  return result;
358 }
359 
360 // PROTECTED MEMBER FUNCTIONS
361 
362 // PRIVATE MEMBER FUNCTIONS
363 
364 
365 //==============================================================================
366 // ANY FACET OF CLASS TP_LITE
367 //==============================================================================
368 
369 // PUBLIC MEMBER FUNCTIONS
370 
371 bool
373 is_ancestor_of(const any_lite& xother) const
374 {
375  // Preconditions:
376 
377  require(&xother != 0);
378 
379  // Body:
380 
381  // True if other conforms to this.
382 
383  bool result = dynamic_cast<const tp_lite*>(&xother) != 0;
384 
385  // Postconditions:
386 
387  return result;
388 }
389 
390 bool
392 invariant() const
393 {
394  bool result = true;
395 
396  if(invariant_check())
397  {
398  // Prevent recursive calls to invariant.
399 
400  disable_invariant_check();
401 
402  // Must satisfy base class invariant.
403 
404  invariance(vd_lite::invariant());
405 
406  // Invariances for this class:
407 
408  // Finished, turn invariant checking back on.
409 
410  enable_invariant_check();
411  }
412 
413  // Exit
414 
415  return result;
416 }
417 
418 // PROTECTED MEMBER FUNCTIONS
419 
420 // PRIVATE MEMBER FUNCTIONS
421 
422 
423 //==============================================================================
424 // CLASS TP
425 //==============================================================================
426 
427 // ===========================================================
428 // HOST FACTORY FACET
429 // ===========================================================
430 
431 // PUBLIC MEMBER FUNCTIONS
432 
433 const sheaf::poset_path&
436 {
437  // Preconditions:
438 
439 
440  // Body:
441 
442  static const poset_path result(standard_schema_poset_name(), "tp_schema");
443 
444  // Postconditions:
445 
446  ensure(result.full());
447  ensure(result.poset_name() == standard_schema_poset_name());
448 
449  // Exit:
450 
451  return result;
452 }
453 
454 void
457 {
458  // Preconditions:
459 
460  require(xns.state_is_read_write_accessible());
461  require(xns.contains_poset(standard_schema_poset_name()));
462  require(!xns.contains_poset_member(standard_schema_path()));
463 
464  // Body:
465 
466  string lmember_names = "p INT true";
467  lmember_names += " dd INT true";
468  lmember_names += " vector_space_path C_STRING true";
469 
470  schema_poset_member lschema(xns,
471  standard_schema_path().member_name(),
472  vd::standard_schema_path(),
473  lmember_names,
474  false);
475 
476  lschema.detach_from_state();
477 
478  // Postconditions:
479 
480  ensure(xns.contains_poset_member(standard_schema_path()));
481 
482  // Exit:
483 
484  return;
485 }
486 
490  const poset_path& xhost_path,
491  const poset_path& xschema_path,
492  int xp,
493  const poset_path& xvector_space_path,
494  bool xauto_access)
495 {
496  // cout << endl << "Entering tp::new_host." << endl;
497 
498  // Preconditions:
499 
500  require(xns.state_is_auto_read_write_accessible(xauto_access));
501 
502  require(!xhost_path.empty());
503  require(!xns.contains_path(xhost_path, xauto_access));
504 
505  require(xschema_path.full());
506  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
507  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
508 
509  require(xns.path_is_auto_read_accessible(xvector_space_path, xauto_access));
510  require(xns.contains_poset<vector_space_type::host_type>(xvector_space_path, xauto_access));
511 
512  require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, xp, xvector_space_path, xauto_access));
513 
514 
515  // Body:
516 
517  host_type& result =
518  host_type::new_table(xns, xhost_path, xschema_path, xp, xvector_space_path, xauto_access);
519 
520  // Postconditions:
521 
522  ensure(xns.owns(result, xauto_access));
523  ensure(result.path(true) == xhost_path);
524  ensure(result.state_is_not_read_accessible());
525  ensure(result.schema(true).path(xauto_access) == xschema_path);
526 
527  ensure(result.factor_ct(true) == result.d(true));
528  ensure(result.d(true) == host_type::d(xns, xschema_path, xauto_access));
529  ensure(result.scalar_space_path(true) == xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).scalar_space_path());
530  ensure(result.p(true) == xp);
531  ensure(result.dd(true) == xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).d());
532  ensure(result.vector_space_path(true) == xvector_space_path );
533 
534  // Exit:
535 
536  // cout << "Leaving tp::new_host." << endl;
537  return result;
538 }
539 
540 
541 // PROTECTED MEMBER FUNCTIONS
542 
543 // PRIVATE MEMBER FUNCTIONS
544 
545 
546 
547 //==============================================================================
548 // TENSOR ALGEBRA (TP) FACET OF CLASS TP
549 //==============================================================================
550 
551 // PUBLIC MEMBER FUNCTIONS
552 
554 tp()
555 {
556  // Preconditions:
557 
558  // Body:
559 
560  // Postconditions:
561 
562  ensure(invariant());
563 
564  // Exit:
565 }
566 
568 tp(const poset_state_handle* xhost, pod_index_type xhub_id)
569 {
570  // Preconditions:
571 
572  require(xhost != 0);
573  require(xhost->state_is_read_accessible());
574  require(xhost->contains_member(xhub_id));
575 
576  // Body:
577 
578  attach_to_state(xhost, xhub_id);
579 
580  // Postconditions:
581 
582  ensure(invariant());
583  // ensure(host() == xhost);
584  ensure(index() == xhub_id);
585  ensure(is_attached());
586 }
587 
589 tp(const poset_state_handle* xhost, const scoped_index& xid)
590 {
591  // Preconditions:
592 
593  require(xhost != 0);
594  require(xhost->state_is_read_accessible());
595  require(xhost->contains_member(xid));
596 
597  // Body:
598 
599  attach_to_state(xhost, xid.hub_pod());
600 
601  // Postconditions:
602 
603  ensure(invariant());
604  // ensure(host() == xhost);
605  ensure(index() ==~ xid);
606  ensure(is_attached());
607 }
608 
610 tp(const poset_state_handle* xhost, const std::string& xname)
611 {
612 
613  // Preconditions:
614 
615  require(xhost != 0);
616  require(xhost->state_is_read_accessible());
617  require(!xname.empty());
618  require(xhost->contains_member(xname));
619 
620  // Body:
621 
622  attach_to_state(xhost, xname);
623 
624  // Postconditions:
625 
626  ensure(invariant());
627  // ensure(host() == xhost);
628  ensure(name() == xname);
629  ensure(is_attached());
630 
631  // Exit:
632 
633 }
634 
637 {
638 
639  // Preconditions:
640 
641  require(xother != 0);
642 
643  // Body:
644 
645  attach_to_state(xother);
646 
647  // Postconditions:
648 
649  ensure(invariant());
650  ensure(is_attached());
651  ensure(is_same_state(xother));
652 
653  // Exit:
654 
655 }
656 
658 tp(poset_state_handle* xhost, bool xauto_access)
659 {
660 
661  // Preconditions:
662 
663  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
664 
665  // Body:
666 
667  new_jim_state(xhost, 0, false, xauto_access);
668 
669  // Postconditions:
670 
671  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
672 
673  // Exit:
674 
675  return;
676 }
677 
681 {
682  // Preconditions:
683 
684  require(is_ancestor_of(&xother));
685  require(precondition_of(attach_to_state(&xother)));
686 
687  // Body:
688 
689  attach_to_state(&xother);
690 
691  // Postconditions:
692 
693  ensure(postcondition_of(attach_to_state(&xother)));
694 
695  // Exit:
696 
697  return *this;
698 }
699 
702 operator=(const tp& xother)
703 {
704  // Preconditions:
705 
706  require(precondition_of(attach_to_state(&xother)));
707 
708  // Body:
709 
710  attach_to_state(&xother);
711 
712  // Postconditions:
713 
714  ensure(postcondition_of(attach_to_state(&xother)));
715 
716  // Exit:
717 
718  return *this;
719 }
720 
723 {
724  // Preconditions:
725 
726  // Body:
727 
728  // Postconditions:
729 
730  // Exit:
731 }
732 
733 int
735 p() const
736 {
737  // Preconditions:
738 
739  require(state_is_read_accessible());
740 
741  // Body:
742 
743  int result = sheaf::table_dofs(*this).p;
744 
745  // Postconditions:
746 
747  ensure(result >= 0);
748 
749  // Exit:
750 
751  return result;
752 }
753 
754 int
756 p(bool xauto_access) const
757 {
758  // Preconditions:
759 
760  require(state_is_auto_read_accessible(xauto_access));
761 
762  // Body:
763 
764  if(xauto_access)
765  {
766  get_read_access();
767  }
768 
769  int result = p();
770 
771  if(xauto_access)
772  {
773  release_access();
774  }
775 
776  // Postconditions:
777 
778  ensure(result >= 0);
779 
780  // Exit:
781 
782  return result;
783 }
784 
785 
786 int
788 dd() const
789 {
790  // Preconditions:
791 
792  require(state_is_read_accessible());
793 
794  // Body:
795 
796  int result = sheaf::table_dofs(*this).dd;
797 
798  // Postconditions:
799 
800  // ensure(invariant());
801  ensure(result >= 0);
802 
803  // Exit:
804 
805  return result;
806 }
807 
808 int
810 dd(bool xauto_access) const
811 {
812  // Preconditions:
813 
814  require(state_is_auto_read_accessible(xauto_access));
815 
816  // Body:
817 
818  if(xauto_access)
819  {
820  get_read_access();
821  }
822 
823  int result = dd();
824 
825  if(xauto_access)
826  {
827  release_access();
828  }
829 
830  // Postconditions:
831 
833  // ensure(invariant());
834  ensure(result >= 0);
835 
836  // Exit:
837 
838  return result;
839 }
840 
844 {
845  // Preconditions:
846 
847  require(state_is_read_accessible());
848 
849  // Body:
850 
851  poset_path result(sheaf::table_dofs(*this).vector_space_path);
852 
853  // Postconditions:
854 
855  ensure(!result.empty());
856 
857  // Exit:
858 
859  return result;
860 }
861 
864 vector_space_path(bool xauto_access) const
865 {
866  // Preconditions:
867 
868  require(state_is_auto_read_accessible(xauto_access));
869 
870  // Body:
871 
872  if(xauto_access)
873  {
874  get_read_access();
875  }
876 
877  poset_path result(sheaf::table_dofs(*this).vector_space_path);
878 
879  if(xauto_access)
880  {
881  release_access();
882  }
883 
884  // Postconditions:
885 
886  ensure(!result.empty());
887 
888  // Exit:
889 
890  return result;
891 }
892 
896 {
897  // Preconditions:
898 
899  require(state_is_read_accessible());
900  require(name_space()->state_is_read_accessible());
901 
902  // Body:
903 
904  poset_state_handle& lpsh = name_space()->member_poset(vector_space_path(), false);
905 
906  tp_space& result = reinterpret_cast<host_type&>(lpsh);
907 
908  // Postconditions:
909 
910  // Exit:
911 
912  return result;
913 
914 }
915 
918 vector_space(bool xauto_access) const
919 {
920  // Preconditions:
921 
922  require(state_is_auto_read_accessible(xauto_access));
923  require(name_space()->state_is_auto_read_accessible(xauto_access));
924 
925  // Body:
926 
927  if(xauto_access)
928  {
929  name_space()->get_read_access();
930  get_read_access();
931  }
932 
933  tp_space& result = vector_space();
934 
935  if(xauto_access)
936  {
937  release_access();
938  name_space()->release_access();
939  }
940 
941  // Postconditions:
942 
943  // Exit:
944 
945  return result;
946 }
947 
948 const std::string
950 create_tensor_space_name(const std::string& xvector_space_name, const std::string& xname)
951 {
952  // Preconditions:
953 
954  // Body:
955 
956  const string result = xvector_space_name + "_" + xname;
957 
958  // Postconditions:
959 
960  // Exit:
961 
962  return result;
963 }
964 
968 {
969  // Preconditions:
970 
971  // Body:
972 
973  static const volatile_type result;
974 
975  // Postconditions:
976 
977  // Exit:
978 
979  return result;
980 }
981 
984 lite_type() const
985 {
986  // Preconditions:
987 
988  // Body:
989 
990  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
991 
992  // Postconditions:
993 
994  // Exit:
995 
996  return result;
997 }
998 
1001 variance(bool xauto_access) const
1002 {
1003  // Preconditions:
1004 
1005  require(state_is_auto_read_accessible(xauto_access));
1006 
1007  // Body:
1008 
1009  tensor_variance result = host()->variance(_index, xauto_access);
1010 
1011  // Postconditions:
1012 
1013  // Exit:
1014 
1015  return result;
1016 }
1017 
1018 bool
1020 variance(int xi, bool xauto_access) const
1021 {
1022  // Preconditions:
1023 
1024  require(state_is_auto_read_accessible(xauto_access));
1025 
1026  // Body:
1027 
1028  bool result = host()->variance(_index, xi, xauto_access);
1029 
1030  // Postconditions:
1031 
1032  // Exit:
1033 
1034  return result;
1035 }
1036 
1037 void
1039 put_variance(const tensor_variance& xvariance, bool xauto_access)
1040 {
1041  // Preconditions:
1042 
1043  require(state_is_auto_read_write_accessible(xauto_access));
1044 
1045  // Body:
1046 
1047  host()->put_variance(_index, xvariance, xauto_access);
1048 
1049  // Postconditions:
1050 
1051  // Exit:
1052 
1053  return;
1054 }
1055 
1056 void
1058 put_variance(int xi, bool xvariance, bool xauto_access)
1059 {
1060  // Preconditions:
1061 
1062  require(state_is_auto_read_write_accessible(xauto_access));
1063  require((0 <= xi) && (xi < p(xauto_access)));
1064 
1065  // Body:
1066 
1067  host()->put_variance(_index, xi, xvariance, xauto_access);
1068 
1069  // Postconditions:
1070 
1071  // Exit:
1072 
1073  return;
1074 }
1075 
1076 bool
1078 is_covariant(bool xauto_access) const
1079 {
1080  // Preconditions:
1081 
1082  require(state_is_auto_read_accessible(xauto_access));
1083 
1084  // Body:
1085 
1086  bool result = host()->is_covariant(_index, xauto_access);
1087 
1088  // Postconditions:
1089 
1090  // Exit:
1091 
1092  return result;
1093 }
1094 
1095 bool
1097 is_covariant(int xi, bool xauto_access) const
1098 {
1099  // Preconditions:
1100 
1101  require(state_is_auto_read_accessible(xauto_access));
1102  require((0 <= xi) && (xi < p(xauto_access)));
1103 
1104  // Body:
1105 
1106  bool result = host()->is_covariant(_index, xi, xauto_access);
1107 
1108  // Postconditions:
1109 
1110  // Exit:
1111 
1112  return result;
1113 }
1114 
1115 void
1117 put_is_covariant(bool xauto_access)
1118 {
1119  // Preconditions:
1120 
1121  require(state_is_auto_read_accessible(xauto_access));
1122 
1123  // Body:
1124 
1125  host()->put_is_covariant(_index, xauto_access);
1126 
1127  // Postconditions:
1128 
1129  ensure(is_covariant(xauto_access));
1130 
1131  // Exit:
1132 
1133  return;
1134 }
1135 
1136 void
1138 put_is_covariant(int xi, bool xauto_access)
1139 {
1140  // Preconditions:
1141 
1142  require(state_is_auto_read_write_accessible(xauto_access));
1143  require((0 <= xi) && (xi < p(xauto_access)));
1144 
1145  // Body:
1146 
1147  host()->put_is_covariant(_index, xi, xauto_access);
1148 
1149  // Postconditions:
1150 
1151  ensure(is_covariant(xi, xauto_access));
1152 
1153  // Exit:
1154 
1155  return;
1156 }
1157 
1158 bool
1160 is_contravariant(bool xauto_access) const
1161 {
1162  // Preconditions:
1163 
1164  require(state_is_auto_read_accessible(xauto_access));
1165 
1166  // Body:
1167 
1168  bool result = host()->is_contravariant(_index, xauto_access);
1169 
1170  // Postconditions:
1171 
1172  // Can not ensure result == !is_covariant because at0 is both co- and contra-vairant.
1173 
1174  // Exit:
1175 
1176  return result;
1177 }
1178 
1179 bool
1181 is_contravariant(int xi, bool xauto_access) const
1182 {
1183  // Preconditions:
1184 
1185  require(state_is_auto_read_accessible(xauto_access));
1186  require((0 <= xi) && (xi < p(xauto_access)));
1187 
1188  // Body:
1189 
1190  bool result = host()->is_contravariant(_index, xi, xauto_access);
1191 
1192  // Postconditions:
1193 
1194  // Exit:
1195 
1196  return result;
1197 }
1198 
1199 void
1201 put_is_contravariant(bool xauto_access)
1202 {
1203  // Preconditions:
1204 
1205  require(state_is_auto_read_accessible(xauto_access));
1206 
1207  // Body:
1208 
1209  host()->put_is_contravariant(_index, xauto_access);
1210 
1211  // Postconditions:
1212 
1213  ensure(is_contravariant(xauto_access));
1214 
1215  // Exit:
1216 
1217  return;
1218 }
1219 
1220 void
1222 put_is_contravariant(int xi, bool xauto_access)
1223 {
1224  // Preconditions:
1225 
1226  require(state_is_auto_read_write_accessible(xauto_access));
1227  require((0 <= xi) && (xi < p(xauto_access)));
1228 
1229  // Body:
1230 
1231  host()->put_is_contravariant(_index, xi, xauto_access);
1232 
1233  // Postconditions:
1234 
1235  ensure(is_contravariant(xi, xauto_access));
1236 
1237  // Exit:
1238 
1239  return;
1240 }
1241 
1242 // PROTECTED MEMBER FUNCTIONS
1243 
1244 // PRIVATE MEMBER FUNCTIONS
1245 
1246 
1247 //==============================================================================
1248 // VECTOR ALGEBRA (VD) FACET OF CLASS TP
1249 //==============================================================================
1250 
1251 // PUBLIC MEMBER FUNCTIONS
1252 
1253 // PROTECTED MEMBER FUNCTIONS
1254 
1255 // PRIVATE MEMBER FUNCTIONS
1256 
1257 //==============================================================================
1258 // ABSTRACT POSET MEMBER FACET OF CLASS TP
1259 //==============================================================================
1260 
1261 // PUBLIC MEMBER FUNCTIONS
1262 
1263 const std::string&
1265 class_name() const
1266 {
1267  // Preconditions:
1268 
1269  // Body:
1270 
1271  const string& result = static_class_name();
1272 
1273  // Postconditions:
1274 
1275  ensure(!result.empty());
1276 
1277  // Exit:
1278 
1279  return result;
1280 }
1281 
1282 const std::string&
1285 {
1286  // Preconditions:
1287 
1288  // Body:
1289 
1290  static const string result("tp");
1291 
1292  // Postconditions:
1293 
1294  ensure(!result.empty());
1295 
1296  // Exit:
1297 
1298  return result;
1299 }
1300 
1301 // PROTECTED MEMBER FUNCTIONS
1302 
1303 // PRIVATE MEMBER FUNCTIONS
1304 
1305 // ===========================================================
1306 // POSET_COMPONENT FACET
1307 // ===========================================================
1308 
1309 // PUBLIC MEMBER FUNCTIONS
1310 
1313 host() const
1314 {
1315  return reinterpret_cast<host_type*>(_host);
1316 }
1317 
1318 bool
1321 {
1322  return dynamic_cast<const host_type*>(xother) != 0;
1323 }
1324 
1325 // PROTECTED MEMBER FUNCTIONS
1326 
1327 // PRIVATE MEMBER FUNCTIONS
1328 
1329 
1330 //==============================================================================
1331 // ANY FACET OF CLASS TP
1332 //==============================================================================
1333 
1334 // PUBLIC MEMBER FUNCTIONS
1335 
1336 bool
1338 is_ancestor_of(const any* xother) const
1339 {
1340  // Preconditions:
1341 
1342  require(xother != 0);
1343 
1344  // Body:
1345 
1346  // If other may be dynamically cast to the type of this then this is an
1347  // ancestor of xother.
1348 
1349  bool result = dynamic_cast<const tp*>(xother) != 0;
1350 
1351  // Postconditions:
1352 
1353  ensure(invariant());
1354 
1355  // Exit:
1356 
1357  return result;
1358 
1359 }
1360 
1363 clone() const
1364 {
1365 
1366  // Preconditions:
1367 
1368  // Body:
1369 
1370  tp* result = 0;
1371 
1372  // Create new handle of the current class.
1373 
1374  result = new tp();
1375 
1376  // Postconditions:
1377 
1378  ensure(result != 0);
1379  ensure(result->invariant());
1380 
1381  // Exit:
1382 
1383  return result;
1384 
1385 }
1386 
1387 bool
1389 invariant() const
1390 {
1391  bool result = true;
1392 
1393  // Preconditions:
1394 
1395  // Body:
1396 
1397  // Must satisfy base class invariant.
1398 
1399  invariance(vd::invariant());
1400 
1401  if(invariant_check())
1402  {
1403  // Prevent recursive calls to invariant.
1404 
1405  disable_invariant_check();
1406 
1407  // Invariants for this class:
1408 
1409  invariance(state_is_read_accessible() ? p() >= 0 : true);
1410 
1411  // Finished, turn invariant checking back on.
1412 
1413  enable_invariant_check();
1414  }
1415 
1416  // Postconditions:
1417 
1418  ensure(is_derived_query);
1419 
1420  // Exit:
1421 
1422  return result;
1423 }
1424 
1425 // PROTECTED MEMBER FUNCTIONS
1426 
1427 // PRIVATE MEMBER FUNCTIONS
1428 
1429 
1430 //==============================================================================
1431 // NON-MEMBER FUNCTIONS
1432 //==============================================================================
1433 
1434 std::ostream&
1436 operator<<(std::ostream& xos, tp_lite::table_dofs_type& xt)
1437 {
1438  xos << " " << xt.factor_ct
1439  << " " << xt.d
1440  << " " << xt.scalar_space_path
1441  << " " << xt.p
1442  << " " << xt.dd
1443  << " " << xt.vector_space_path;
1444 
1445  return xos;
1446 }
1447 
1448 //==============================================================================
1449 // TP FACET
1450 //==============================================================================
1451 
1452 #include "SheafSystem/error_message.h"
1453 #include "SheafSystem/at0.h"
1454 #include "SheafSystem/at1.h"
1455 #include "SheafSystem/at2.h"
1456 #include "SheafSystem/at3_e3.h"
1457 #include "SheafSystem/st2.h"
1458 #include "SheafSystem/st3.h"
1459 #include "SheafSystem/st3_e3.h"
1460 #include "SheafSystem/st4_e2.h"
1461 #include "SheafSystem/st4_e3.h"
1462 #include "SheafSystem/t2.h"
1463 #include "SheafSystem/t3.h"
1464 #include "SheafSystem/t3_e3.h"
1465 #include "SheafSystem/t4_e2.h"
1466 #include "SheafSystem/t4_e3.h"
1467 
1468 void
1470 contract(const tp_lite& x0, int xp, int xq, tp_lite& xresult)
1471 {
1472  // Preconditions:
1473 
1474  require(xp >= 0 && xp <= x0.p());
1475  require(xq >= 0 && xq <= x0.p());
1476  require(xresult.p() == x0.p() - 2);
1477 
1478  // Body:
1479 
1480  const t2_lite* t2_x0 = dynamic_cast<const t2_lite*>(&x0);
1481  const t3_lite* t3_x0 = dynamic_cast<const t3_lite*>(&x0);
1482 
1483  at0_lite* at0_xresult = dynamic_cast<at0_lite*>(&xresult);
1484  at1_lite* at1_xresult = dynamic_cast<at1_lite*>(&xresult);
1485 
1486  if(t2_x0 && at0_xresult)
1487  {
1488  contract(*t2_x0, xp, xq, *at0_xresult);
1489  }
1490  else if(t3_x0 && at1_xresult)
1491  {
1492  contract(*t3_x0, xp, xq, *at1_xresult);
1493  }
1494  else
1495  {
1496  post_fatal_error_message(\
1497  "Unsupported argument types in call to contract(...)");
1498  }
1499 
1500  // Postconditions:
1501 
1502  //ensure();
1503 
1504  // Exit:
1505 
1506  return;
1507 }
1508 
1509 void
1511 contract(const tp& x0, int xp, int xq, tp& xresult, bool xauto_access)
1512 {
1513  // Preconditions:
1514 
1515  require(x0.state_is_auto_read_accessible(xauto_access));
1516  require(xresult.state_is_auto_read_accessible(xauto_access));
1517  require(xp >= 0 && xp <= x0.p(xauto_access));
1518  require(xq >= 0 && xq <= x0.p(xauto_access));
1519  require(xresult.p(xauto_access) == x0.p(xauto_access) - 2);
1520 
1521  // Body:
1522 
1523  const t2* t2_x0 = dynamic_cast<const t2*>(&x0);
1524  const t3* t3_x0 = dynamic_cast<const t3*>(&x0);
1525 
1526  at0* at0_xresult = dynamic_cast<at0*>(&xresult);
1527  at1* at1_xresult = dynamic_cast<at1*>(&xresult);
1528 
1529  if(t2_x0 && at0_xresult)
1530  {
1531  contract(*t2_x0, xp, xq, *at0_xresult, xauto_access);
1532  }
1533  else if(t3_x0 && at1_xresult)
1534  {
1535  contract(*t3_x0, xp, xq, *at1_xresult, xauto_access);
1536  }
1537  else
1538  {
1539  post_fatal_error_message(\
1540  "Unsupported argument types in call to contract(...)");
1541  }
1542 
1543  // Postconditions:
1544 
1545  //ensure();
1546 
1547  // Exit:
1548 
1549  return;
1550 }
1551 
1552 void
1554 alt(const tp_lite& x0, tp_lite& xresult)
1555 {
1556  // Preconditions:
1557 
1558  require(x0.dd() == xresult.dd());
1559 
1560  // Body:
1561 
1562  const t2_lite* t2_x0 = dynamic_cast<const t2_lite*>(&x0);
1563  const t3_lite* t3_x0 = dynamic_cast<const t3_lite*>(&x0);
1564  const t3_e3_lite* t3_e3_x0 = dynamic_cast<const t3_e3_lite*>(&x0);
1565 
1566  at2_lite* at2_xresult = dynamic_cast<at2_lite*>(&xresult);
1567  t2_lite* t2_xresult = dynamic_cast<t2_lite*>(&xresult);
1568  at3_e3_lite* at3_e3_xresult = dynamic_cast<at3_e3_lite*>(&xresult);
1569  at3_lite* at3_xresult = dynamic_cast<at3_lite*>(&xresult);
1570  t3_lite* t3_xresult = dynamic_cast<t3_lite*>(&xresult);
1571 
1572  if(t2_x0 && at2_xresult)
1573  {
1574  alt(*t2_x0, *at2_xresult);
1575  }
1576  else if(t2_x0 && t2_xresult)
1577  {
1578  alt(*t2_x0, *t2_xresult);
1579  }
1580  else if(t3_e3_x0 && at3_e3_xresult)
1581  {
1582  alt(*t3_e3_x0, *at3_e3_xresult);
1583  }
1584  else if(t3_x0 && t3_xresult)
1585  {
1586  alt(*t3_x0, *t3_xresult);
1587  }
1588  else if(t3_x0 && at3_xresult)
1589  {
1590  alt(*t3_x0, *at3_xresult);
1591  }
1592  else
1593  {
1594  post_fatal_error_message(\
1595  "Unsupported argument types in call to alt(...)");
1596  }
1597 
1598  // Postconditions:
1599 
1600  //ensure();
1601 
1602  // Exit:
1603 
1604  return;
1605 }
1606 
1607 void
1609 alt(const tp& x0, tp& xresult, bool xauto_access)
1610 {
1611  // Preconditions:
1612 
1613  require(x0.state_is_auto_read_accessible(xauto_access));
1614  require(xresult.state_is_auto_read_accessible(xauto_access));
1615  require(x0.dd() == xresult.dd());
1616 
1617  // Body:
1618 
1619  const t2* t2_x0 = dynamic_cast<const t2*>(&x0);
1620  const t3* t3_x0 = dynamic_cast<const t3*>(&x0);
1621  const t3_e3* t3_e3_x0 = dynamic_cast<const t3_e3*>(&x0);
1622 
1623  at2* at2_xresult = dynamic_cast<at2*>(&xresult);
1624  t2* t2_xresult = dynamic_cast<t2*>(&xresult);
1625  at3_e3* at3_e3_xresult = dynamic_cast<at3_e3*>(&xresult);
1626  at3* at3_xresult = dynamic_cast<at3*>(&xresult);
1627  t3* t3_xresult = dynamic_cast<t3*>(&xresult);
1628 
1629  if(t2_x0 && at2_xresult)
1630  {
1631  alt(*t2_x0, *at2_xresult, xauto_access);
1632  }
1633  else if(t2_x0 && t2_xresult)
1634  {
1635  alt(*t2_x0, *t2_xresult, xauto_access);
1636  }
1637  else if(t3_e3_x0 && at3_e3_xresult)
1638  {
1639  alt(*t3_e3_x0, *at3_e3_xresult, xauto_access);
1640  }
1641  else if(t3_x0 && t3_xresult)
1642  {
1643  alt(*t3_x0, *t3_xresult, xauto_access);
1644  }
1645  else if(t3_x0 && at3_xresult)
1646  {
1647  alt(*t3_x0, *at3_xresult, xauto_access);
1648  }
1649  else
1650  {
1651  post_fatal_error_message(\
1652  "Unsupported argument types in call to alt(...)");
1653  }
1654 
1655  // Postconditions:
1656 
1657  //ensure();
1658 
1659  // Exit:
1660 
1661  return;
1662 }
1663 
1664 void
1666 sym(const tp_lite& x0, tp_lite& xresult)
1667 {
1668  // Preconditions:
1669 
1670  require(x0.dd() == xresult.dd());
1671 
1672  // Body:
1673 
1674  const t2_lite* t2_x0 = dynamic_cast<const t2_lite*>(&x0);
1675  const t3_lite* t3_x0 = dynamic_cast<const t3_lite*>(&x0);
1676  const t3_e3_lite* t3_e3_x0 = dynamic_cast<const t3_e3_lite*>(&x0);
1677  const t4_e2_lite* t4_e2_x0 = dynamic_cast<const t4_e2_lite*>(&x0);
1678  const t4_e3_lite* t4_e3_x0 = dynamic_cast<const t4_e3_lite*>(&x0);
1679 
1680  st2_lite* st2_xresult = dynamic_cast<st2_lite*>(&xresult);
1681  st3_lite* st3_xresult = dynamic_cast<st3_lite*>(&xresult);
1682  st3_e3_lite* st3_e3_xresult = dynamic_cast<st3_e3_lite*>(&xresult);
1683  t2_lite* t2_xresult = dynamic_cast<t2_lite*>(&xresult);
1684  t3_lite* t3_xresult = dynamic_cast<t3_lite*>(&xresult);
1685  st4_e2_lite* st4_e2_xresult = dynamic_cast<st4_e2_lite*>(&xresult);
1686  st4_e3_lite* st4_e3_xresult = dynamic_cast<st4_e3_lite*>(&xresult);
1687 
1688  if(t2_x0 && st2_xresult)
1689  {
1690  sym(*t2_x0, *st2_xresult);
1691  }
1692  else if(t2_x0 && t2_xresult)
1693  {
1694  sym(*t2_x0, *t2_xresult);
1695  }
1696  else if(t3_e3_x0 && st3_e3_xresult)
1697  {
1698  sym(*t3_e3_x0, *st3_e3_xresult);
1699  }
1700  else if(t3_x0 && t3_xresult)
1701  {
1702  sym(*t3_x0, *t3_xresult);
1703  }
1704  else if(t3_x0 && st3_xresult)
1705  {
1706  sym(*t3_x0, *st3_xresult);
1707  }
1708  else if(t4_e2_x0 && st4_e2_xresult)
1709  {
1710  sym(*t4_e2_x0, *st4_e2_xresult);
1711  }
1712  else if(t4_e3_x0 && st4_e3_xresult)
1713  {
1714  sym(*t4_e3_x0, *st4_e3_xresult);
1715  }
1716  else
1717  {
1718  post_fatal_error_message(\
1719  "Unsupported argument types in call to sym(...)");
1720  }
1721 
1722  // Postconditions:
1723 
1724  //ensure();
1725 
1726  // Exit:
1727 
1728  return;
1729 }
1730 
1731 void
1733 sym(const tp& x0, tp& xresult, bool xauto_access)
1734 {
1735  // Preconditions:
1736 
1737  require(x0.state_is_auto_read_accessible(xauto_access));
1738  require(xresult.state_is_auto_read_accessible(xauto_access));
1739  require(x0.dd() == xresult.dd());
1740 
1741  // Body:
1742 
1743  const t2* t2_x0 = dynamic_cast<const t2*>(&x0);
1744  const t3* t3_x0 = dynamic_cast<const t3*>(&x0);
1745  const t3_e3* t3_e3_x0 = dynamic_cast<const t3_e3*>(&x0);
1746  const t4_e2* t4_e2_x0 = dynamic_cast<const t4_e2*>(&x0);
1747  const t4_e3* t4_e3_x0 = dynamic_cast<const t4_e3*>(&x0);
1748 
1749  st2* st2_xresult = dynamic_cast<st2*>(&xresult);
1750  st3* st3_xresult = dynamic_cast<st3*>(&xresult);
1751  st3_e3* st3_e3_xresult = dynamic_cast<st3_e3*>(&xresult);
1752  t2* t2_xresult = dynamic_cast<t2*>(&xresult);
1753  t3* t3_xresult = dynamic_cast<t3*>(&xresult);
1754  st4_e2* st4_e2_xresult = dynamic_cast<st4_e2*>(&xresult);
1755  st4_e3* st4_e3_xresult = dynamic_cast<st4_e3*>(&xresult);
1756 
1757  if(t2_x0 && st2_xresult)
1758  {
1759  sym(*t2_x0, *st2_xresult, xauto_access);
1760  }
1761  else if(t2_x0 && t2_xresult)
1762  {
1763  sym(*t2_x0, *t2_xresult, xauto_access);
1764  }
1765  else if(t3_e3_x0 && st3_e3_xresult)
1766  {
1767  sym(*t3_e3_x0, *st3_e3_xresult, xauto_access);
1768  }
1769  else if(t3_x0 && t3_xresult)
1770  {
1771  sym(*t3_x0, *t3_xresult, xauto_access);
1772  }
1773  else if(t3_x0 && st3_xresult)
1774  {
1775  sym(*t3_x0, *st3_xresult, xauto_access);
1776  }
1777  else if(t4_e2_x0 && st4_e2_xresult)
1778  {
1779  sym(*t4_e2_x0, *st4_e2_xresult, xauto_access);
1780  }
1781  else if(t4_e3_x0 && st4_e3_xresult)
1782  {
1783  sym(*t4_e3_x0, *st4_e3_xresult, xauto_access);
1784  }
1785  else
1786  {
1787  post_fatal_error_message(\
1788  "Unsupported argument types in call to sym(...)");
1789  }
1790 
1791  // Postconditions:
1792 
1793  //ensure();
1794 
1795  // Exit:
1796 
1797  return;
1798 }
1799 
1800 void
1802 tensor(const tp_lite& x0, const tp_lite& x1, tp_lite& xresult)
1803 {
1804  // Preconditions:
1805 
1806  require(x1.dd() == x0.dd());
1807  require(xresult.dd() == x0.dd());
1808  require(xresult.p() == x0.p() + x1.p());
1809 
1810  // Body:
1811 
1812  const at1_lite* at1_x0 = dynamic_cast<const at1_lite*>(&x0);
1813  const at2_lite* at2_x0 = dynamic_cast<const at2_lite*>(&x0);
1814  const st2_lite* st2_x0 = dynamic_cast<const st2_lite*>(&x0);
1815  const t2_lite* t2_x0 = dynamic_cast<const t2_lite*>(&x0);
1816 
1817  const at1_lite* at1_x1 = dynamic_cast<const at1_lite*>(&x1);
1818  const at2_lite* at2_x1 = dynamic_cast<const at2_lite*>(&x1);
1819  const st2_lite* st2_x1 = dynamic_cast<const st2_lite*>(&x1);
1820  const t2_lite* t2_x1 = dynamic_cast<const t2_lite*>(&x1);
1821 
1822  t2_lite* t2_xresult = dynamic_cast<t2_lite*>(&xresult);
1823  t3_lite* t3_xresult = dynamic_cast<t3_lite*>(&xresult);
1824 
1825  if(at1_x0 && at1_x1 && t2_xresult)
1826  {
1827  tensor(*at1_x0, *at1_x1, *t2_xresult);
1828  }
1829  else if(t2_x0 && at1_x1 && t3_xresult)
1830  {
1831  tensor(*t2_x0, *at1_x1, *t3_xresult);
1832  }
1833  else if(at1_x0 && t2_x1 && t3_xresult)
1834  {
1835  tensor(*at1_x0, *t2_x1, *t3_xresult);
1836  }
1837  else if(at2_x0 && at1_x1 && t3_xresult)
1838  {
1839  tensor(*at2_x0, *at1_x1, *t3_xresult);
1840  }
1841  else if(at1_x0 && at2_x1 && t3_xresult)
1842  {
1843  tensor(*at1_x0, *at2_x1, *t3_xresult);
1844  }
1845  else if(st2_x0 && at1_x1 && t3_xresult)
1846  {
1847  tensor(*st2_x0, *at1_x1, *t3_xresult);
1848  }
1849  else if(at1_x0 && st2_x1 && t3_xresult)
1850  {
1851  tensor(*at1_x0, *st2_x1, *t3_xresult);
1852  }
1853  else
1854  {
1855  post_fatal_error_message(\
1856  "Unsupported argument types in call to tensor(...)");
1857  }
1858 
1859  // Postconditions:
1860 
1861  //ensure();
1862 
1863  // Exit:
1864 
1865  return;
1866 }
1867 
1868 void
1870 tensor(const tp& x0, const tp& x1, tp& xresult, bool xauto_access)
1871 {
1872  // Preconditions:
1873 
1874  require(x0.state_is_auto_read_accessible(xauto_access));
1875  require(x1.state_is_auto_read_accessible(xauto_access));
1876  require(xresult.state_is_auto_read_accessible(xauto_access));
1877  require(xresult.p(xauto_access) == x0.p(xauto_access) + x1.p(xauto_access));
1878 
1879  // Body:
1880 
1881  const at1* at1_x0 = dynamic_cast<const at1*>(&x0);
1882  const at2* at2_x0 = dynamic_cast<const at2*>(&x0);
1883  const st2* st2_x0 = dynamic_cast<const st2*>(&x0);
1884  const t2* t2_x0 = dynamic_cast<const t2*>(&x0);
1885 
1886  const at1* at1_x1 = dynamic_cast<const at1*>(&x1);
1887  const at2* at2_x1 = dynamic_cast<const at2*>(&x1);
1888  const st2* st2_x1 = dynamic_cast<const st2*>(&x1);
1889  const t2* t2_x1 = dynamic_cast<const t2*>(&x1);
1890 
1891  t2* t2_xresult = dynamic_cast<t2*>(&xresult);
1892  t3* t3_xresult = dynamic_cast<t3*>(&xresult);
1893 
1894  if(at1_x0 && at1_x1 && t2_xresult)
1895  {
1896  tensor(*at1_x0, *at1_x1, *t2_xresult, xauto_access);
1897  }
1898  else if(t2_x0 && at1_x1 && t3_xresult)
1899  {
1900  tensor(*t2_x0, *at1_x1, *t3_xresult, xauto_access);
1901  }
1902  else if(at1_x0 && t2_x1 && t3_xresult)
1903  {
1904  tensor(*at1_x0, *t2_x1, *t3_xresult, xauto_access);
1905  }
1906  else if(at2_x0 && at1_x1 && t3_xresult)
1907  {
1908  tensor(*at2_x0, *at1_x1, *t3_xresult, xauto_access);
1909  }
1910  else if(at1_x0 && at2_x1 && t3_xresult)
1911  {
1912  tensor(*at1_x0, *at2_x1, *t3_xresult, xauto_access);
1913  }
1914  else if(st2_x0 && at1_x1 && t3_xresult)
1915  {
1916  tensor(*st2_x0, *at1_x1, *t3_xresult, xauto_access);
1917  }
1918  else if(at1_x0 && st2_x1 && t3_xresult)
1919  {
1920  tensor(*at1_x0, *st2_x1, *t3_xresult, xauto_access);
1921  }
1922  else
1923  {
1924  post_fatal_error_message(\
1925  "Unsupported argument types in call to tensor(...)");
1926  }
1927 
1928  // Postconditions:
1929 
1930  //@todo Fix this.
1931  //ensure(xresult.variance(xauto_access) == \
1932  // (x0.variance(xauto_access) | x1.variance(xauto_access)));
1933 
1934  // Exit:
1935 
1936  return;
1937 }
1938 
A tensor of degree 3 over an abstract vector space (volatile version).
Definition: t3.h:43
virtual int dd() const
Dimension of the underlying vector space.
Definition: tp.cc:166
virtual bool is_contravariant(bool xauto_access) const
True if and only if all tensor index positions are contravariant.
Definition: tp.cc:1160
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 ...
An antisymmetric rank 3 tensor over an abstract vector space (volatile version).
Definition: at3.h:43
int factor_ct
Number of factors (components) in tuple.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: tp.cc:984
SHEAF_DLL_SPEC void alt(const t2_lite &x0, at2_lite &xresult)
The alternating (antisymmetric) part of tensor x0 (pre-allocated version for volatile types)...
Definition: t2.cc:1176
virtual int dd() const
Dimension of the underlying vector space.
Definition: tp.cc:788
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
void put_variance(const tensor_variance &xvariance, bool xauto_access)
Sets the variance to xvariance.
Definition: tp.cc:1039
virtual int p() const
The degree of the tensors in host(); the sum of the contravariant and covariant degrees.
Definition: tp.cc:735
The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tenso...
An antisymmetric rank 3 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: at3_e3.h:120
poset_path path(bool xauto_access=true) const
A path to this component.
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...
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: tp.cc:967
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.
A general antisymmetric tensor of degree 1 over an abstract vector space (persistent version)...
Definition: at1.h:211
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
A tensor of degree 3 over an abstract vector space (persistent version).
Definition: t3.h:222
poset_path vector_space_path() const
The path of the underlying vector space.
Definition: tp_space.cc:365
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
Definition: at1.h:44
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...
bool state_is_auto_read_accessible(bool xauto_access) const
True if the state is auto accessible for read, that is, if the state is already accessible for read o...
A client handle for a general, abstract partially order set.
SHEAF_DLL_SPEC void sym(const t2_lite &x0, st2_lite &xresult)
The symmetric part of tensor x0 (pre-allocated version for volatile types).
Definition: t2.cc:1301
A symmetric rank 3 tensor over a 3D Euclidean vector space (persistent version).
Definition: st3_e3.h:370
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
virtual int d() const
Dimension of this as a vector space.
Definition: tp.cc:256
A tensor of degree 4 over a Euclidean vector space of dimension 2 (persistent version).
Definition: t4_e2.h:378
STL namespace.
virtual void put_is_contravariant(bool xauto_access)
Sets all tensor index positions to contravariant.
Definition: tp.cc:1201
virtual const std::string & class_name() const
The name of this class.
Definition: tp.cc:1265
host_type * host() const
The poset this is a member of.
Definition: tp.cc:1313
bool invariant() const
Class invariant.
Definition: tp.cc:392
static const std::string create_tensor_space_name(const std::string &xvector_space_name, const std::string &xname)
Create a standard tensor space name.
Definition: tp.cc:950
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.
bool is_ancestor_of(const any *other) const
True if other conforms to current.
Definition: tp.cc:1338
A symmetric rank 4 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: st4_e3.h:134
int dd
Dimension of the underlying vector space.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
A tensor of degree 4 over a Euclidean vector space of dimension 3 (persistent version).
Definition: t4_e3.h:438
virtual bool is_covariant(bool xauto_access) const
True if and only if all tensor index positions are covariant.
Definition: tp.cc:1078
virtual int p() const
The degree of the tensor; the sum of the contravariant and covariant degrees.
Definition: tp.cc:146
A tensor of degree 2 over an abstract vector space (volatile version).
Definition: t2.h:43
A general tensor of "degree" p and given "variance" over an abstract vector space.
Definition: tp.h:253
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
An antisymmetric rank 3 tensor over a 3D Euclidean vector space.
Definition: at3_e3.h:372
Abstract base class with useful features for all objects.
Definition: any.h:39
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: tp.cc:435
A tensor of degree 3 over a Euclidean vector space of dimension 3 (volatile version).
Definition: t3_e3.h:151
A general symmetric tensor of degree 2 over an abstract vector space (volatile version).
Definition: st2.h:43
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: tp.cc:456
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 tensor of degree 4 over a Euclidean vector space of dimension 3 (volatile version).
Definition: t4_e3.h:210
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
std::string poset_name() const
The poset name part of the path.
Definition: poset_path.cc:473
virtual pod_index_type vector_space_index() const
Index of the underlying vector space.
Definition: tp.cc:186
virtual ~tp()
Destructor.
Definition: tp.cc:722
virtual ~tp_lite()
Destructor.
Definition: tp.cc:95
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
Definition: tp.cc:1320
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
tp_lite()
Default constructor.
Definition: tp.cc:44
Antisymetric tensor of degree 0 (volatile version).
Definition: at0.h:127
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
int d
Dimension of this as a vector space.
A symmetric rank 3 tensor over an abstract vector space (persistent version).
Definition: st3.h:230
A symmetric rank 3 tensor over an abstract vector space. (volatile version).
Definition: st3.h:43
An antisymmetric rank 3 tensor over an abstract vector space (volatile version).
Definition: at3.h:230
A symmetric rank 3 tensor over a 3D Euclidean vector space (persistent version).
Definition: st4_e2.h:376
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
bool invariant() const
Class invariant.
Definition: tp.cc:1389
c_string vector_space_path
The path of the underlying vector space.
virtual tp & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: tp.cc:680
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
A symmetric rank 4 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: st4_e2.h:124
static const std::string & static_class_name()
The name of this class.
Definition: tp.cc:1284
poset_path scalar_space_path() const
The path of the underlying space of scalars.
Definition: vd_space.cc:250
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
poset_path vector_space_path() const
The path of the underlying vector space.
Definition: tp.cc:843
virtual const std::string & class_name() const
The name of this class.
Definition: tp.cc:302
static int d(const namespace_poset &xns, const poset_path &xschema_path, bool xauto_access)
The tensor dimension implied by the schema specified by xschema_path.
Definition: tp_space.cc:83
virtual tp_space & vector_space() const
The underlying vector space.
Definition: tp.cc:895
Table dofs type for class tp.
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
Definition: vd_space.cc:167
virtual tp * clone() const
Make a new handle, no state instance of current.
Definition: tp.cc:1363
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
tp()
Default constructor.
Definition: tp.cc:554
int dd() const
The dimension of the underlying ("domain") vector space.
Definition: tp_space.cc:317
bool variance(int xi) const
The variance of the xi-th index; covariant if true, contravariant if false.
A symmetric rank 3 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: st3_e3.h:118
A symmetric rank 3 tensor over a 3D Euclidean vector space (persistent version).
Definition: st4_e3.h:386
int p
The degree of the tensor; the sum of the contravariant and covariant degrees.
tp_lite & operator=(const tp_lite &xother)
Assignment operator.
Definition: tp.cc:76
virtual tensor_variance variance(bool xauto_access) const
The variance.
Definition: tp.cc:1001
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: tp.cc:373
A general antisymmetric tensor of degree 2 over an abstract vector space (volatile version)...
Definition: at2.h:43
An abstract client handle for a member of a poset.
A tensor of degree 4 over a Euclidean vector space of dimension 2 (volatile version).
Definition: t4_e2.h:140
virtual void put_is_covariant(bool xauto_access)
Sets all tensor index positions to covariant.
Definition: tp.cc:1117
c_string scalar_space_path
The path of the underlying scalar space.
table_dofs_type table_dofs() const
The table dofs.
Definition: tp.cc:206
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, int xp, const poset_path &xvector_space_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: tp.cc:489
static const std::string & static_class_name()
The name of this class.
Definition: tp.cc:321
An abstract tensor space of degree p.
Definition: tp_space.h:47
SHEAF_DLL_SPEC void tensor(const at1_lite &x0, const at1_lite &x1, t2_lite &xresult)
Tensor product (pre-allocated version for volatile types).
Definition: t2.cc:1488
Namespace for the fiber_bundles component of the sheaf system.
A general symmetric tensor of degree 2 over an abstract vector space (persistent version).
Definition: st2.h:234
SHEAF_DLL_SPEC void pow(const sec_at0 &x0, const vd_value_type &xexponent, sec_at0 &xresult, bool xauto_access)
Compute x0 to power xexponent (pow(x0, xexponent)) (pre-allocated version).
Definition: sec_at0.cc:1495
A tensor of degree 3 over a Euclidean vector space of dimension 3 (persistent version).
Definition: t3_e3.h:401
Row dofs type for class vd.
Definition: vd.h:61
A general antisymmetric tensor of degree 2 over an abstract vector space.
Definition: at2.h:233
virtual tp_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: tp.cc:340
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.
SHEAF_DLL_SPEC void contract(const t2_lite &x0, int xp, int xq, at0_lite &xresult)
Contraction on contravariant index xp and covariant index xq (pre-allocated version for volatime type...
Definition: t2.cc:1091
A tensor of degree 2 over an abstract vector space (persistent version).
Definition: t2.h:226
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
Definition: binary_index.cc:35
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710