SheafSystem  0.0.0.0
atp.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/atp.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/atp_space.h"
28 #include "SheafSystem/fiber_bundles_namespace.h"
29 #include "SheafSystem/schema_poset_member.h"
30 #include "SheafSystem/wsv_block.h"
31 
32 using namespace std;
33 using namespace fiber_bundle; // Workaround for MS C++ bug.
34 using namespace fiber_bundle::vd_algebra;
35 
36 //==============================================================================
37 // CLASS ATP_LITE
38 //==============================================================================
39 
40 //==============================================================================
41 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS ATP_LITE
42 //==============================================================================
43 
44 // PUBLIC MEMBER FUNCTIONS
45 
48 {
49  // Preconditions:
50 
51  // Body:
52 
53  // Postconditions:
54 
55  ensure(invariant());
56 
57  // Exit:
58 }
59 
61 atp_lite(const atp_lite& xother)
62 {
63  // Preconditions:
64 
65  // Body:
66 
67  *this = xother;
68 
69  // Postconditions:
70 
71  ensure(invariant());
72 
73  // Exit:
74 }
75 
78 operator=(const atp_lite& xother)
79 {
80  // Preconditions:
81 
82  // Body:
83 
84  // Postconditions:
85 
86  ensure(invariant());
87 
88  // Exit:
89 
90  return *this;
91 }
92 
95 {
96  // Preconditions:
97 
98  // Body:
99 
100  // Postconditions:
101 
102  // Exit:
103 
104 }
105 
107 atp_lite(const row_dofs_type& xrow_dofs)
108 {
109  // Preconditions:
110 
111  // Body:
112 
113  *this = xrow_dofs;
114 
115  // Postconditions:
116 
117  ensure(invariant());
118 
119  // Exit:
120 }
121 
124 operator=(const row_dofs_type& xrow_dofs)
125 {
126  // Preconditions:
127 
128  // Body:
129 
130  vd_lite::operator=(xrow_dofs);
131 
132  // Postconditions:
133 
134  postcondition_of(vd_lite::operator=(xrow_dofs));
135 
136  // Exit:
137 
138  return *this;
139 
140 }
141 
142 //==============================================================================
143 // TENSOR ALGEBRA (TP) FACET OF CLASS ATP_LITE
144 //==============================================================================
145 
146 // PUBLIC MEMBER FUNCTIONS
147 
148 // PROTECTED MEMBER FUNCTIONS
149 
150 // PRIVATE MEMBER FUNCTIONS
151 
152 
153 //==============================================================================
154 // VECTOR ALGEBRA (VD) FACET OF CLASS ATP_LITE
155 //==============================================================================
156 
157 // PUBLIC MEMBER FUNCTIONS
158 
159 int
161 d() const
162 {
163  // Preconditions:
164 
165  //require(dd() >= p() && p() >= 0);
166 
167  // Body:
168 
169  //$$SCRIBBLE: Don't know what the correct value is here when
170  // dd() == 0 and p() == 1 (or 0). For now just return 0.
171 
172  int result = 0;
173 
174  if(!(dd() == 0 && p() == 0))
175  {
176  if(dd() >= p() && p() >= 0)
177  {
178  result = static_cast<int>(binomial_coefficient(dd(), p()));
179  }
180  }
181 
182  // Postconditions:
183 
184  ensure(invariant());
185  //ensure(result == static_cast<int>(binomial_coefficient(dd(), p())));
186 
187  // Exit:
188 
189  return result;
190 
191 }
192 
193 // PROTECTED MEMBER FUNCTIONS
194 
195 // PRIVATE MEMBER FUNCTIONS
196 
197 
198 //==============================================================================
199 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS ATP_LITE
200 //==============================================================================
201 
202 // PUBLIC MEMBER FUNCTIONS
203 
204 const sheaf::poset_path&
207 {
208  // Preconditions:
209 
210 
211  // Body:
212 
213  static const poset_path result(standard_schema_poset_name(), "atp_schema");
214 
215  // Postconditions:
216 
217  ensure(result.full());
218  ensure(result.poset_name() == standard_schema_poset_name());
219 
220  // Exit:
221 
222  return result;
223 }
224 
225 void
228 {
229  // Preconditions:
230 
231  require(xns.state_is_read_write_accessible());
232  require(xns.contains_poset(standard_schema_poset_name()));
233  require(!xns.contains_poset_member(standard_schema_path()));
234 
235  // Body:
236 
237  schema_poset_member lschema(xns,
238  standard_schema_path().member_name(),
239  tp::standard_schema_path(),
240  "",
241  false);
242 
243  lschema.detach_from_state();
244 
245  // Postconditions:
246 
247  ensure(xns.contains_poset_member(standard_schema_path()));
248 
249  // Exit:
250 
251  return;
252 }
253 
257  const poset_path& xhost_path,
258  const poset_path& xschema_path,
259  int xp,
260  const poset_path& xvector_space_path,
261  bool xauto_access)
262 {
263  // cout << endl << "Entering atp::new_host." << endl;
264 
265  // Preconditions:
266 
267  require(xns.state_is_auto_read_write_accessible(xauto_access));
268 
269  require(!xhost_path.empty());
270  require(!xns.contains_path(xhost_path, xauto_access));
271 
272  require(xschema_path.full());
273  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
274  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
275 
276  require(xp >= 0);
277 
278  require(xns.path_is_auto_read_accessible(xvector_space_path, xauto_access));
279  require(xns.contains_poset<vector_space_type::host_type>(xvector_space_path, xauto_access));
280 
281  require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, xp, xvector_space_path, xauto_access)); // dmb new
282 
283  // Body:
284 
285  host_type& result =
286  host_type::new_table(xns, xhost_path, xschema_path, xp, xvector_space_path, xauto_access);
287 
288  // Postconditions:
289 
290  ensure(xns.owns(result, xauto_access));
291  ensure(result.path(true) == xhost_path);
292  ensure(result.state_is_not_read_accessible());
293  ensure(result.schema(true).path(xauto_access) == xschema_path);
294 
295  ensure(result.factor_ct(true) == result.d(true));
296  ensure(result.d(true) == host_type::d(xns, xschema_path, xauto_access));
297  ensure(result.scalar_space_path(true) == xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).scalar_space_path(xauto_access) );
298  ensure(result.p(true) == xp);
299  ensure(result.dd(true) == xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).d());
300  ensure(result.vector_space_path(true) == xvector_space_path );
301 
302  // Exit:
303 
304  // cout << "Leaving atp::new_host." << endl;
305  return result;
306 }
307 
308 // PROTECTED MEMBER FUNCTIONS
309 
310 // PRIVATE MEMBER FUNCTIONS
311 
312 
313 //==============================================================================
314 // ABSTRACT POSET MEMBER FACET OF CLASS ATP_LITE
315 //==============================================================================
316 
317 // PUBLIC MEMBER FUNCTIONS
318 
319 const std::string&
321 class_name() const
322 {
323  // Preconditions:
324 
325  // Body:
326 
327  const string& result = static_class_name();
328 
329  // Postconditions:
330 
331  ensure(!result.empty());
332 
333  // Exit:
334 
335  return result;
336 }
337 
338 const std::string&
341 {
342  // Preconditions:
343 
344  // Body:
345 
346  static const string result("atp_lite");
347 
348  // Postconditions:
349 
350  ensure(!result.empty());
351 
352  // Exit:
353 
354  return result;
355 }
356 
359 clone() const
360 {
361  atp_lite* result = 0;
362 
363  // Preconditions:
364 
365  // Body:
366 
367  result = new atp_lite();
368 
369  // Postconditions:
370 
371  ensure(result != 0);
372  ensure(is_same_type(*result));
373 
374  // Exit:
375 
376  return result;
377 }
378 
379 // PROTECTED MEMBER FUNCTIONS
380 
381 // PRIVATE MEMBER FUNCTIONS
382 
383 
384 //==============================================================================
385 // ANY FACET OF CLASS ATP_LITE
386 //==============================================================================
387 
388 // PUBLIC MEMBER FUNCTIONS
389 
390 bool
392 is_ancestor_of(const any_lite& xother) const
393 {
394  // Preconditions:
395 
396  require(&xother != 0);
397 
398  // Body:
399 
400  // True if other conforms to this.
401 
402  bool result = dynamic_cast<const atp_lite*>(&xother) != 0;
403 
404  // Postconditions:
405 
406  return result;
407 }
408 
409 bool
411 invariant() const
412 {
413  bool result = true;
414 
415  if(invariant_check())
416  {
417  // Prevent recursive calls to invariant.
418 
419  disable_invariant_check();
420 
421  // Must satisfy base class invariant.
422 
423  invariance(tp_lite::invariant());
424 
425  // Invariances for this class:
426 
427  // Finished, turn invariant checking back on.
428 
429  enable_invariant_check();
430  }
431 
432  // Exit
433 
434  return result;
435 }
436 
437 // PROTECTED MEMBER FUNCTIONS
438 
439 // PRIVATE MEMBER FUNCTIONS
440 
441 
442 //==============================================================================
443 // CLASS ATP
444 //==============================================================================
445 
446 // ===========================================================
447 // HOST FACTORY FACET
448 // ===========================================================
449 
450 // PUBLIC MEMBER FUNCTIONS
451 
452 // PROTECTED MEMBER FUNCTIONS
453 
454 // PRIVATE MEMBER FUNCTIONS
455 
456 
457 //==============================================================================
458 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS ATP
459 //==============================================================================
460 
461 // PUBLIC MEMBER FUNCTIONS
462 
465 {
466 
467  // Preconditions:
468 
469  // Body:
470 
471  // Postconditions:
472 
473  ensure(invariant());
474 }
475 
477 atp(const poset_state_handle* xhost, pod_index_type xhub_id)
478 {
479  // Preconditions:
480 
481  require(xhost != 0);
482  require(xhost->state_is_read_accessible());
483  require(xhost->contains_member(xhub_id));
484 
485  // Body:
486 
487  attach_to_state(xhost, xhub_id);
488 
489  // Postconditions:
490 
491  ensure(invariant());
492  // ensure(host() == xhost);
493  ensure(index() == xhub_id);
494  ensure(is_attached());
495 }
496 
498 atp(const poset_state_handle* xhost, const scoped_index& xid)
499 {
500  // Preconditions:
501 
502  require(xhost != 0);
503  require(xhost->state_is_read_accessible());
504  require(xhost->contains_member(xid));
505 
506  // Body:
507 
508  attach_to_state(xhost, xid.hub_pod());
509 
510  // Postconditions:
511 
512  ensure(invariant());
513  // ensure(host() == xhost);
514  ensure(index() ==~ xid);
515  ensure(is_attached());
516 }
517 
519 atp(const poset_state_handle* xhost, const std::string& xname)
520 {
521 
522  // Preconditions:
523 
524  require(xhost != 0);
525  require(xhost->state_is_read_accessible());
526  require(!xname.empty());
527  require(xhost->contains_member(xname));
528 
529  // Body:
530 
531  attach_to_state(xhost, xname);
532 
533  // Postconditions:
534 
535  ensure(invariant());
536  // ensure(host() == xhost);
537  ensure(name() == xname);
538  ensure(is_attached());
539 
540 }
541 
544 {
545 
546  // Preconditions:
547 
548  require(xother != 0);
549 
550  // Body:
551 
552  attach_to_state(xother);
553 
554  // Postconditions:
555 
556  ensure(invariant());
557  ensure(is_attached());
558  ensure(is_same_state(xother));
559 
560 }
561 
563 atp(poset_state_handle* xhost, bool xauto_access)
564 {
565 
566  // Preconditions:
567 
568  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
569 
570  // Body:
571 
572  new_jim_state(xhost, 0, false, xauto_access);
573 
574  // Postconditions:
575 
576  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
577 
578  // Exit:
579 
580  return;
581 }
582 
587 {
588  // Preconditions:
589 
590  require(is_ancestor_of(&xother));
591  require(precondition_of(attach_to_state(&xother)));
592 
593  // Body:
594 
595  attach_to_state(&xother);
596 
597  // Postconditions:
598 
599  ensure(postcondition_of(attach_to_state(&xother)));
600 
601  // Exit:
602 
603  return *this;
604 }
605 
609 operator=(const atp& xother)
610 {
611  // Preconditions:
612 
613  require(precondition_of(attach_to_state(&xother)));
614 
615  // Body:
616 
617  attach_to_state(&xother);
618 
619  // Postconditions:
620 
621  ensure(postcondition_of(attach_to_state(&xother)));
622 
623  // Exit:
624 
625  return *this;
626 }
627 
630 {
631 
632  // Preconditions:
633 
634  // Body:
635 
636  // Postconditions:
637 
638 }
639 
643 {
644  // Preconditions:
645 
646  // Body:
647 
648  static const volatile_type result;
649 
650  // Postconditions:
651 
652  // Exit:
653 
654  return result;
655 }
656 
660 lite_type() const
661 {
662  // Preconditions:
663 
664  // Body:
665 
666  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
667 
668  // Postconditions:
669 
670  // Exit:
671 
672  return result;
673 }
674 
675 bool
677 is_p_form(bool xauto_access) const
678 {
679 
680  // Preconditions:
681 
682  require(state_is_auto_read_accessible(xauto_access));
683  require(host()->contains_variance_subposets(xauto_access));
684 
685  // Body:
686 
687  bool result = host()->is_p_form(_index, xauto_access);
688 
689  // Postconditions:
690 
691  // Exit:
692 
693  return result;
694 
695 }
696 
697 void
699 put_is_p_form(bool xauto_access)
700 {
701  // Preconditions:
702 
703  require(state_is_auto_read_write_accessible(xauto_access));
704  require(host()->contains_variance_subposets(xauto_access));
705 
706  // Body:
707 
708  host()->put_is_p_form(_index, xauto_access);
709 
710  // Postconditions:
711 
712  ensure(is_p_form(xauto_access));
713 
714  // Exit:
715 
716  return;
717 }
718 
719 
720 bool
722 is_p_vector(bool xauto_access) const
723 {
724 
725  // Preconditions:
726 
727  require(state_is_auto_read_accessible(xauto_access));
728  require(host()->contains_variance_subposets(xauto_access));
729 
730  // Body:
731 
732  bool result = host()->is_p_vector(_index, xauto_access);
733 
734  // Postconditions:
735 
736  // Exit:
737 
738  return result;
739 }
740 
741 void
743 put_is_p_vector(bool xauto_access)
744 {
745  // Preconditions:
746 
747  require(state_is_auto_read_write_accessible(xauto_access));
748  require(host()->contains_variance_subposets(xauto_access));
749 
750  // Body:
751 
752  host()->put_is_p_vector(_index, xauto_access);
753 
754  // Postconditions:
755 
756  ensure(is_p_vector(xauto_access));
757 
758  // Exit:
759 
760  return;
761 }
762 
763 // PROTECTED MEMBER FUNCTIONS
764 
765 // PRIVATE MEMBER FUNCTIONS
766 
767 
768 //==============================================================================
769 // TP FACET OF CLASS ATP
770 //==============================================================================
771 
772 // PUBLIC MEMBER FUNCTIONS
773 
774 // PROTECTED MEMBER FUNCTIONS
775 
776 // PRIVATE MEMBER FUNCTIONS
777 
778 
779 //==============================================================================
780 // VD FACET OF CLASS ATP
781 //==============================================================================
782 
783 // PUBLIC MEMBER FUNCTIONS
784 
785 // PROTECTED MEMBER FUNCTIONS
786 
787 // PRIVATE MEMBER FUNCTIONS
788 
789 
790 //==============================================================================
791 // ABSTRACT POSET MEMBER FACET OF CLASS ATP
792 //==============================================================================
793 
794 // PUBLIC MEMBER FUNCTIONS
795 
796 const std::string&
798 class_name() const
799 {
800  // Preconditions:
801 
802  // Body:
803 
804  const string& result = static_class_name();
805 
806  // Postconditions:
807 
808  ensure(!result.empty());
809 
810  // Exit:
811 
812  return result;
813 }
814 
815 const std::string&
818 {
819  // Preconditions:
820 
821  // Body:
822 
823  static const string result("atp");
824 
825  // Postconditions:
826 
827  ensure(!result.empty());
828 
829  // Exit:
830 
831  return result;
832 }
833 
834 // PROTECTED MEMBER FUNCTIONS
835 
836 // PRIVATE MEMBER FUNCTIONS
837 
838 
839 // ===========================================================
840 // POSET_COMPONENT FACET
841 // ===========================================================
842 
843 // PUBLIC MEMBER FUNCTIONS
844 
847 host() const
848 {
849  return reinterpret_cast<host_type*>(_host);
850 }
851 
852 bool
855 {
856  return dynamic_cast<const host_type*>(xother) != 0;
857 }
858 
859 // PROTECTED MEMBER FUNCTIONS
860 
861 // PRIVATE MEMBER FUNCTIONS
862 
863 
864 //==============================================================================
865 // ANY FACET OF CLASS ATP
866 //==============================================================================
867 
868 // PUBLIC MEMBER FUNCTIONS
869 
870 bool
872 is_ancestor_of(const any* xother) const
873 {
874 
875  // Preconditions:
876 
877  require(xother != 0);
878 
879  // Body:
880 
881  // If other may be dynamically cast to the type of this then this is an
882  // ancestor of other.
883 
884  bool result = dynamic_cast<const atp*>(xother) != 0;
885 
886  // Postconditions:
887 
888  //ensure(invariant());
889  //ensure(other->invariant());
890 
891  // Exit:
892 
893  return result;
894 
895 }
896 
899 clone() const
900 {
901 
902  // Preconditions:
903 
904  // Body:
905 
906  // Create new handle of the current class.
907 
908  atp* result = new atp();
909 
910  // Postconditions:
911 
912  ensure(result != 0);
913  ensure(result->invariant());
914 
915  // Exit:
916 
917  return result;
918 
919 }
920 
921 bool
923 invariant() const
924 {
925  bool result = true;
926 
927  // Preconditions:
928 
929  // Body:
930 
931  // Must satisfy base class invariant.
932 
933  invariance(tp::invariant());
934 
935  if(invariant_check())
936  {
937  // Prevent recursive calls to invariant.
938 
939  disable_invariant_check();
940 
941  invariance(state_is_read_accessible() ? is_covariant(false) || is_contravariant(false) : true);
942 
943  // Finished, turn invariant checking back on.
944 
945  enable_invariant_check();
946  }
947 
948  // Postconditions:
949 
950  ensure(is_derived_query);
951 
952  // Exit:
953 
954  return result;
955 }
956 
957 //==============================================================================
958 // NON-MEMBER FUNCTIONS
959 //==============================================================================
960 
961 #include "SheafSystem/error_message.h"
962 #include "SheafSystem/at0.h"
963 #include "SheafSystem/e2.h"
964 #include "SheafSystem/e3.h"
965 #include "SheafSystem/at2_e2.h"
966 #include "SheafSystem/at2_e3.h"
967 #include "SheafSystem/at3_e3.h"
968 
970 void
972 hook(const atp& x0, const atp& x1, atp& xresult, bool xauto_access)
973 {
974  // Preconditions:
975 
976  require(x0.state_is_auto_read_accessible(xauto_access));
977  require(x1.state_is_auto_read_accessible(xauto_access));
978  require(xresult.state_is_auto_read_write_accessible(xauto_access));
979  require(x0.is_p_form(xauto_access) == x1.is_p_form(xauto_access));
980  require(x0.is_p_form(xauto_access) == xresult.is_p_form(xauto_access));
981 
982  // Body:
983 
984  const e2* e2_x0 = dynamic_cast<const e2*>(&x0);
985  const e3* e3_x0 = dynamic_cast<const e3*>(&x0);
986  const at2_e2* at2_e2_x0 = dynamic_cast<const at2_e2*>(&x0);
987  const at2_e3* at2_e3_x0 = dynamic_cast<const at2_e3*>(&x0);
988  const at3_e3* at3_e3_x0 = dynamic_cast<const at3_e3*>(&x0);
989 
990  const e2* e2_x1 = dynamic_cast<const e2*>(&x1);
991  const e3* e3_x1 = dynamic_cast<const e3*>(&x1);
992 
993  at0* at0_xresult = dynamic_cast<at0*>(&xresult);
994  e2* e2_xresult = dynamic_cast<e2*>(&xresult);
995  e3* e3_xresult = dynamic_cast<e3*>(&xresult);
996  at2_e3* at2_e3_xresult = dynamic_cast<at2_e3*>(&xresult);
997 
998  if(e2_x0 && e2_x1 && at0_xresult)
999  {
1000  hook(*e2_x0, *e2_x1, *at0_xresult, xauto_access);
1001  }
1002  else if(at2_e2_x0 && e2_x1 && e2_xresult)
1003  {
1004  hook(*at2_e2_x0, *e2_x1, *e2_xresult, xauto_access);
1005  }
1006  else if(e3_x0 && e3_x1 && at0_xresult)
1007  {
1008  hook(*e3_x0, *e3_x1, *at0_xresult, xauto_access);
1009  }
1010  else if(at2_e3_x0 && e3_x1 && e3_xresult)
1011  {
1012  hook(*at2_e3_x0, *e3_x1, *e3_xresult, xauto_access);
1013  }
1014  else if(at3_e3_x0 && e3_x1 && at2_e3_xresult)
1015  {
1016  hook(*at3_e3_x0, *e3_x1, *at2_e3_xresult, xauto_access);
1017  }
1018  else
1019  {
1020  post_fatal_error_message(\
1021  "Unsupported argument types in call to hook(...)");
1022  }
1023 
1024  // Postconditions:
1025 
1027 
1028  //ensure();
1029 
1030  // Exit:
1031 
1032  return;
1033 
1034 }
1035 
1037 void
1039 hook(const atp_lite& x0, const atp_lite& x1, atp_lite& xresult)
1040 {
1041  // Preconditions:
1042 
1043  // Body:
1044 
1045 // hook(const e2_lite& x0, const e2_lite& x1, at0_lite& xresult);
1046 // hook(const at2_e2_lite& x0, const e2_lite& x1, e2_lite& xresult);
1047 // hook(const e3_lite& x0, const e3_lite& x1, at0_lite& xresult);
1048 // hook(const at2_e3_lite& x0, const e3_lite& x1, e3_lite& xresult);
1049 // hook(const at3_e3_lite& x0, const e3_lite& x1, at2_e3_lite& xresult);
1050 
1051  const e2_lite* e2_x0 = dynamic_cast<const e2_lite*>(&x0);
1052  const e3_lite* e3_x0 = dynamic_cast<const e3_lite*>(&x0);
1053  const at2_e2_lite* at2_e2_x0 = dynamic_cast<const at2_e2_lite*>(&x0);
1054  const at2_e3_lite* at2_e3_x0 = dynamic_cast<const at2_e3_lite*>(&x0);
1055  const at3_e3_lite* at3_e3_x0 = dynamic_cast<const at3_e3_lite*>(&x0);
1056 
1057  const e2_lite* e2_x1 = dynamic_cast<const e2_lite*>(&x1);
1058  const e3_lite* e3_x1 = dynamic_cast<const e3_lite*>(&x1);
1059 
1060  at0_lite* at0_xresult = dynamic_cast<at0_lite*>(&xresult);
1061  e2_lite* e2_xresult = dynamic_cast<e2_lite*>(&xresult);
1062  e3_lite* e3_xresult = dynamic_cast<e3_lite*>(&xresult);
1063  at2_e3_lite* at2_e3_xresult = dynamic_cast<at2_e3_lite*>(&xresult);
1064 
1065  if(e2_x0 && e2_x1 && at0_xresult)
1066  {
1067  hook(*e2_x0, *e2_x1, *at0_xresult);
1068  }
1069  else if(at2_e2_x0 && e2_x1 && e2_xresult)
1070  {
1071  hook(*at2_e2_x0, *e2_x1, *e2_xresult);
1072  }
1073  else if(e3_x0 && e3_x1 && at0_xresult)
1074  {
1075  hook(*e3_x0, *e3_x1, *at0_xresult);
1076  }
1077  else if(at2_e3_x0 && e3_x1 && e3_xresult)
1078  {
1079  hook(*at2_e3_x0, *e3_x1, *e3_xresult);
1080  }
1081  else if(at3_e3_x0 && e3_x1 && at2_e3_xresult)
1082  {
1083  hook(*at3_e3_x0, *e3_x1, *at2_e3_xresult);
1084  }
1085  else
1086  {
1087  post_fatal_error_message(\
1088  "Unsupported argument types in call to hook(...)");
1089  }
1090 
1091  // Postconditions:
1092 
1094 
1095  //ensure();
1096 
1097  // Exit:
1098 
1099  return;
1100 
1101 }
1102 
1104 void
1106 star(const atp& x0, atp& xresult, bool xauto_access)
1107 {
1108  // Preconditions:
1109 
1110  require(x0.state_is_auto_read_accessible(xauto_access));
1111  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1112  require(x0.dd(xauto_access) == xresult.dd(xauto_access));
1113 
1114  // Body:
1115 
1116  const at2_e2* at2_e2_x0 = dynamic_cast<const at2_e2*>(&x0);
1117  const at0* at0_x0 = dynamic_cast<const at0*>(&x0);
1118  const e2* e2_x0 = dynamic_cast<const e2*>(&x0);
1119  const at2_e3* at2_e3_x0 = dynamic_cast<const at2_e3*>(&x0);
1120  const e3* e3_x0 = dynamic_cast<const e3*>(&x0);
1121  const at3_e3* at3_e3_x0 = dynamic_cast<const at3_e3*>(&x0);
1122 
1123  at0* at0_xresult = dynamic_cast<at0*>(&xresult);
1124  at2_e2* at2_e2_xresult = dynamic_cast<at2_e2*>(&xresult);
1125  e2* e2_xresult = dynamic_cast<e2*>(&xresult);
1126  e3* e3_xresult = dynamic_cast<e3*>(&xresult);
1127  at2_e3* at2_e3_xresult = dynamic_cast<at2_e3*>(&xresult);
1128  at3_e3* at3_e3_xresult = dynamic_cast<at3_e3*>(&xresult);
1129 
1130  if(at2_e2_x0 && at0_xresult)
1131  {
1132  star(*at2_e2_x0, *at0_xresult, xauto_access);
1133  }
1134  else if(at0_x0 && at2_e2_xresult)
1135  {
1136  star(*at0_x0, *at2_e2_xresult, xauto_access);
1137  }
1138  else if(e2_x0 && e2_xresult)
1139  {
1140  star(*e2_x0, *e2_xresult, xauto_access);
1141  }
1142  else if(at2_e3_x0 && e3_xresult)
1143  {
1144  star(*at2_e3_x0, *e3_xresult, xauto_access);
1145  }
1146  else if(e3_x0 && at2_e3_xresult)
1147  {
1148  star(*e3_x0, *at2_e3_xresult, xauto_access);
1149  }
1150  else if(at3_e3_x0 && at0_xresult)
1151  {
1152  star(*at3_e3_x0, *at0_xresult, xauto_access);
1153  }
1154  else if(at0_x0 && at3_e3_xresult)
1155  {
1156  star(*at0_x0, *at3_e3_xresult, xauto_access);
1157  }
1158  else
1159  {
1160  post_fatal_error_message(\
1161  "Unsupported argument types in call to star(...)");
1162  }
1163 
1164  // Postconditions:
1165 
1167 
1168  //ensure();
1169 
1170  // Exit:
1171 
1172  return;
1173 }
1174 
1176 void
1178 star(const atp_lite& x0, atp_lite& xresult)
1179 {
1180  // Preconditions:
1181 
1182 // require(x0.dd() == xresult.dd());
1183 
1184  // Body:
1185 
1186  const at2_e2_lite* at2_e2_x0 = dynamic_cast<const at2_e2_lite*>(&x0);
1187  const at0_lite* at0_x0 = dynamic_cast<const at0_lite*>(&x0);
1188  const e2_lite* e2_x0 = dynamic_cast<const e2_lite*>(&x0);
1189  const at2_e3_lite* at2_e3_x0 = dynamic_cast<const at2_e3_lite*>(&x0);
1190  const e3_lite* e3_x0 = dynamic_cast<const e3_lite*>(&x0);
1191  const at3_e3_lite* at3_e3_x0 = dynamic_cast<const at3_e3_lite*>(&x0);
1192 
1193  at0_lite* at0_xresult = dynamic_cast<at0_lite*>(&xresult);
1194  at2_e2_lite* at2_e2_xresult = dynamic_cast<at2_e2_lite*>(&xresult);
1195  e2_lite* e2_xresult = dynamic_cast<e2_lite*>(&xresult);
1196  e3_lite* e3_xresult = dynamic_cast<e3_lite*>(&xresult);
1197  at2_e3_lite* at2_e3_xresult = dynamic_cast<at2_e3_lite*>(&xresult);
1198  at3_e3_lite* at3_e3_xresult = dynamic_cast<at3_e3_lite*>(&xresult);
1199 
1200  if(at2_e2_x0 && at0_xresult)
1201  {
1202  star(*at2_e2_x0, *at0_xresult);
1203  }
1204  else if(at0_x0 && at2_e2_xresult)
1205  {
1206  star(*at0_x0, *at2_e2_xresult);
1207  }
1208  else if(e2_x0 && e2_xresult)
1209  {
1210  star(*e2_x0, *e2_xresult);
1211  }
1212  else if(at2_e3_x0 && e3_xresult)
1213  {
1214  star(*at2_e3_x0, *e3_xresult);
1215  }
1216  else if(e3_x0 && at2_e3_xresult)
1217  {
1218  star(*e3_x0, *at2_e3_xresult);
1219  }
1220  else if(at3_e3_x0 && at0_xresult)
1221  {
1222  star(*at3_e3_x0, *at0_xresult);
1223  }
1224  else if(at0_x0 && at3_e3_xresult)
1225  {
1226  star(*at0_x0, *at3_e3_xresult);
1227  }
1228  else
1229  {
1230  post_fatal_error_message(\
1231  "Unsupported argument types in call to star(...)");
1232  }
1233 
1234  // Postconditions:
1235 
1237 
1238  //ensure();
1239 
1240  // Exit:
1241 
1242  return;
1243 }
1244 
1248 star(const atp_lite& x0)
1249 {
1250  // Preconditions:
1251 
1252  require(precondition_of(star(x0, *result)));
1253 
1254  // Body:
1255 
1256  atp_lite* result = new atp_lite();;
1257 
1258  star(x0, *result);
1259 
1260  // Postconditions:
1261 
1262  ensure(postcondition_of(star(x0, *result)));
1263 
1264  // Exit:
1265 
1266  return result;
1267 }
1268 
1270 void
1272 wedge(const atp& x0, const atp& x1, atp& xresult, bool xauto_access)
1273 {
1274  // Preconditions:
1275 
1276  require(x0.state_is_auto_read_accessible(xauto_access));
1277  require(x1.state_is_auto_read_accessible(xauto_access));
1278  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1279  require(x0.dd(xauto_access) >= xresult.dd(xauto_access));
1280  require(x1.dd(xauto_access) >= xresult.dd(xauto_access));
1281  require(xresult.p(xauto_access) == x0.p(xauto_access) + x1.p(xauto_access));
1282 
1283  // Body:
1284 
1285  const e2* e2_x0 = dynamic_cast<const e2*>(&x0);
1286  const e3* e3_x0 = dynamic_cast<const e3*>(&x0);
1287  const at2_e3* at2_e3_x0 = dynamic_cast<const at2_e3*>(&x0);
1288 
1289  const e2* e2_x1 = dynamic_cast<const e2*>(&x1);
1290  const e3* e3_x1 = dynamic_cast<const e3*>(&x1);
1291 
1292  at2_e2* at2_e2_xresult = dynamic_cast<at2_e2*>(&xresult);
1293  at2_e3* at2_e3_xresult = dynamic_cast<at2_e3*>(&xresult);
1294  at3_e3* at3_e3_xresult = dynamic_cast<at3_e3*>(&xresult);
1295 
1296  if(e2_x0 && e2_x1 && at2_e2_xresult)
1297  {
1298  wedge(*e2_x0, *e2_x1, *at2_e2_xresult, xauto_access);
1299  }
1300  else if(e3_x0 && e3_x1 && at2_e3_xresult)
1301  {
1302  wedge(*e3_x0, *e3_x1, *at2_e3_xresult, xauto_access);
1303  }
1304  else if(at2_e3_x0 && e3_x1 && at3_e3_xresult)
1305  {
1306  wedge(*at2_e3_x0, *e3_x1, *at3_e3_xresult, xauto_access);
1307  }
1308  else
1309  {
1310  post_fatal_error_message(\
1311  "Unsupported argument types in call to wedge(...)");
1312  }
1313 
1314  // Postconditions:
1315 
1317 
1318  //ensure();
1319 
1320  // Exit:
1321 
1322  return;
1323 }
1324 
1326 void
1328 wedge(const atp_lite& x0, const atp_lite& x1, atp_lite& xresult)
1329 {
1330  // Preconditions:
1331 
1332  require(x0.dd() == x1.dd());
1333  require(x0.dd() == xresult.dd());
1334  require(xresult.p() == x0.p() + x1.p());
1335 
1336  // Body:
1337 
1338  //wedge(const e2_lite& x0, const e2_lite& x1, at2_e2_lite& xresult);
1339  //wedge(const e3_lite& x0, const e3_lite& x1, at2_e3_lite& xresult);
1340  //wedge(const at2_e3_lite& x0, const e3_lite& x1, at3_e3_lite& xresult);
1341 
1342  const e2_lite* e2_x0 = dynamic_cast<const e2_lite*>(&x0);
1343  const e3_lite* e3_x0 = dynamic_cast<const e3_lite*>(&x0);
1344  const at2_e3_lite* at2_e3_x0 = dynamic_cast<const at2_e3_lite*>(&x0);
1345 
1346  const e2_lite* e2_x1 = dynamic_cast<const e2_lite*>(&x1);
1347  const e3_lite* e3_x1 = dynamic_cast<const e3_lite*>(&x1);
1348 
1349  at2_e2_lite* at2_e2_xresult = dynamic_cast<at2_e2_lite*>(&xresult);
1350  at2_e3_lite* at2_e3_xresult = dynamic_cast<at2_e3_lite*>(&xresult);
1351  at3_e3_lite* at3_e3_xresult = dynamic_cast<at3_e3_lite*>(&xresult);
1352 
1353  if(e2_x0 && e2_x1 && at2_e2_xresult)
1354  {
1355  wedge(*e2_x0, *e2_x1, *at2_e2_xresult);
1356  }
1357  else if(e3_x0 && e3_x1 && at2_e3_xresult)
1358  {
1359  wedge(*e3_x0, *e3_x1, *at2_e3_xresult);
1360  }
1361  else if(at2_e3_x0 && e3_x1 && at3_e3_xresult)
1362  {
1363  wedge(*at2_e3_x0, *e3_x1, *at3_e3_xresult);
1364  }
1365  else
1366  {
1367  post_fatal_error_message(\
1368  "Unsupported argument types in call to hook(...)");
1369  }
1370 
1371  // Postconditions:
1372 
1374 
1375  //ensure();
1376 
1377  // Exit:
1378 
1379  return;
1380 }
virtual int dd() const
Dimension of the underlying vector space.
Definition: tp.cc:166
atp_lite & operator=(const atp_lite &xother)
Assignment operator.
Definition: atp.cc:78
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 ...
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
virtual int p() const
The degree of the tensors in host(); the sum of the contravariant and covariant degrees.
Definition: tp.cc:735
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (persistent version)...
Definition: at2_e2.h:412
An antisymmetric tensor of degree p.
Definition: atp.h:190
void put_is_p_vector(bool xauto_access)
Sets is_p_vector to true; synonym for put_is_contravariant(xauto_access).
Definition: atp.cc:743
Euclidean vector space of dimension 3 (volatile version).
Definition: e3.h:116
static const std::string & static_class_name()
The name of this class.
Definition: atp.cc:817
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
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: atp.cc:256
virtual ~atp()
Destructor.
Definition: atp.cc:629
Euclidean vector space of dimension 2 (persistent version).
Definition: e2.h:405
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.
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 3. (persistent version)...
Definition: at2_e3.h:424
virtual ~atp_lite()
Destructor.
Definition: atp.cc:94
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
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
Definition: atp.cc:854
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.
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.
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
Definition: atp.cc:872
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.
SHEAF_DLL_SPEC unsigned int binomial_coefficient(unsigned int xi, unsigned int xj)
Binomial coefficient (xi, xj).
Definition: vd.cc:2673
host_type * host() const
The poset this is a member of.
Definition: atp.cc:847
bool invariant() const
Class invariant.
Definition: atp.cc:411
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (volatile version)...
Definition: at2_e2.h:146
Euclidean vector space of dimension 3 (persistent version).
Definition: e3.h:467
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual int p() const
The degree of the tensor; the sum of the contravariant and covariant degrees.
Definition: tp.cc:146
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
Definition: atp.h:44
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
SHEAF_DLL_SPEC void wedge(const e2 &x0, const e2 &x1, at2_e2 &xresult, bool xauto_access)
The exterior (wedge) product of two antisymmetric tensors (pre-allocated version for persistent types...
Definition: at2_e2.cc:1779
SHEAF_DLL_SPEC void hook(const e2 &x0, const e2 &x1, at0 &xresult, bool xauto_access)
The interior (hook) product of two antisymmetric tensors (pre-allocated version for persistent types)...
Definition: at2_e2.cc:1328
static const std::string & static_class_name()
The name of this class.
Definition: atp.cc:340
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
virtual atp & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: atp.cc:586
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: atp.cc:392
Euclidean vector space of dimension 2 (volatile version).
Definition: e2.h:112
An abstract antisymmetric tensor space of degree p.
Definition: atp_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...
atp_lite()
Default constructor.
Definition: atp.cc:47
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)
atp()
Default constructor.
Definition: atp.cc:464
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
bool invariant() const
Class invariant.
Definition: atp.cc:923
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 const std::string & class_name() const
The name of this class.
Definition: atp.cc:321
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
bool is_p_form(bool xauto_access) const
True if this is a p-form; synonym for is_covariant(xauto_access).
Definition: atp.cc:677
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
virtual int d() const
Dimension of this as a vector space.
Definition: atp.cc:161
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
virtual const std::string & class_name() const
The name of this class.
Definition: atp.cc:798
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
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
virtual atp_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: atp.cc:359
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
Definition: vd_space.cc:167
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
int dd() const
The dimension of the underlying ("domain") vector space.
Definition: tp_space.cc:317
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: atp.cc:660
bool is_p_vector(bool xauto_access) const
True if this is a p-vector; synonym for is_contravariant(xauto_access).
Definition: atp.cc:722
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: at2_e3.h:142
virtual atp * clone() const
Make a new handle, no state instance of current.
Definition: atp.cc:899
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: atp.cc:227
An abstract client handle for a member of a poset.
void put_is_p_form(bool xauto_access)
Sets is_p_form to true; synonym for put_is_covariant(xauto_access).
Definition: atp.cc:699
Namespace containing the vector algrebra functions for the fiber_bundles component of the sheaf syste...
Definition: e3.h:1135
Namespace for the fiber_bundles component of the sheaf system.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: atp.cc:642
Row dofs type for class vd.
Definition: vd.h:61
SHEAF_DLL_SPEC void star(const at2_e2 &x0, at0 &xresult, bool xauto_access)
The Hodge star operator for antisymmetric tensors (pre-allocated version persistent types)...
Definition: at2_e2.cc:1518
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.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: atp.cc:206
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710