SheafSystem  0.0.0.0
met.cc
Go to the documentation of this file.
1 
2 
3 //
4 // Copyright (c) 2014 Limit Point Systems, Inc.
5 
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 
10 // http://www.apache.org/licenses/LICENSE-2.0
11 
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 
18 //
19 
22 
23 #include "SheafSystem/met.h"
24 
25 #include "SheafSystem/abstract_poset_member.impl.h"
26 #include "SheafSystem/assert_contract.h"
27 #include "SheafSystem/at0.h"
28 #include "SheafSystem/stp_space.h"
29 #include "SheafSystem/fiber_bundles_namespace.h"
30 #include "SheafSystem/schema_poset_member.h"
31 #include "SheafSystem/wsv_block.h"
32 
33 
34 using namespace std;
35 using namespace fiber_bundle; // Workaround for MS C++ bug.
36 
37 
38 //==============================================================================
39 // CLASS MET_LITE
40 //==============================================================================
41 
42 //==============================================================================
43 // METRIC TENSOR (MET) FACET
44 //==============================================================================
45 
46 // PUBLIC MEMBER FUNCTIONS
47 
50 {
51 
52  // Preconditions:
53 
54  // Body:
55 
56  // Postconditions:
57 
58  ensure(invariant());
59 
60  // Exit:
61 }
62 
64 met_lite(const met_lite& xother)
65 {
66  // Preconditions:
67 
68  // Body:
69 
70  // Postconditions:
71 
72  ensure(invariant());
73 
74  // Exit:
75 }
76 
79 operator=(const met_lite& xother)
80 {
81  // Preconditions:
82 
83  // Body:
84 
85  // Postconditions:
86 
87  ensure(invariant());
88 
89  // Exit:
90 
91  return *this;
92 }
93 
96 {
97  // Preconditions:
98 
99  // Body:
100 
101  // Postconditions:
102 
103  // Exit:
104 
105 }
106 
108 met_lite(const row_dofs_type& xrow_dofs)
109 {
110  // Preconditions:
111 
112  // Body:
113 
114  *this = xrow_dofs;
115 
116  // Postconditions:
117 
118  ensure(invariant());
119 
120  // Exit:
121 }
122 
125 operator=(const row_dofs_type& xrow_dofs)
126 {
127  // Preconditions:
128 
129  // Body:
130 
131  vd_lite::operator=(xrow_dofs);
132 
133  // Postconditions:
134 
135  postcondition_of(vd_lite::operator=(xrow_dofs));
136 
137  // Exit:
138 
139  return *this;
140 
141 }
142 
143 // PROTECTED MEMBER FUNCTIONS
144 
145 // PRIVATE MEMBER FUNCTIONS
146 
147 
148 //==============================================================================
149 // ST2 FACET
150 //==============================================================================
151 
152 // PUBLIC MEMBER FUNCTIONS
153 
154 // PROTECTED MEMBER FUNCTIONS
155 
156 // PRIVATE MEMBER FUNCTIONS
157 
158 
159 //==============================================================================
160 // INTERIOR ALGEBRA (STP) FACET
161 //==============================================================================
162 
163 // PUBLIC MEMBER FUNCTIONS
164 
165 // PROTECTED MEMBER FUNCTIONS
166 
167 // PRIVATE MEMBER FUNCTIONS
168 
169 
170 //==============================================================================
171 // TENSOR ALGEBRA (TP) FACET
172 //==============================================================================
173 
174 // PUBLIC MEMBER FUNCTIONS
175 
176 // PROTECTED MEMBER FUNCTIONS
177 
178 // PRIVATE MEMBER FUNCTIONS
179 
180 
181 //==============================================================================
182 // VECTOR ALGEBRA (VD) FACET
183 //==============================================================================
184 
185 // PUBLIC MEMBER FUNCTIONS
186 
187 // PROTECTED MEMBER FUNCTIONS
188 
189 // PRIVATE MEMBER FUNCTIONS
190 
191 
192 //==============================================================================
193 // CARTESIAN ALGEBRA (TUPLE) FACET
194 //==============================================================================
195 
196 // PUBLIC MEMBER FUNCTIONS
197 
198 // PROTECTED MEMBER FUNCTIONS
199 
200 // PRIVATE MEMBER FUNCTIONS
201 
202 
203 //==============================================================================
204 // ABSTRACT POSET MEMBER FACET
205 //==============================================================================
206 
207 // PUBLIC MEMBER FUNCTIONS
208 
209 const std::string&
211 class_name() const
212 {
213  // Preconditions:
214 
215  // Body:
216 
217  const string& result = static_class_name();
218 
219  // Postconditions:
220 
221  ensure(!result.empty());
222 
223  // Exit:
224 
225  return result;
226 }
227 
228 const std::string&
231 {
232  // Preconditions:
233 
234  // Body:
235 
236  static const string result("met_lite");
237 
238  // Postconditions:
239 
240  ensure(!result.empty());
241 
242  // Exit:
243 
244  return result;
245 }
246 
249 clone() const
250 {
251  met_lite* result = 0;
252 
253  // Preconditions:
254 
255  // Body:
256 
257  result = new met_lite();
258 
259  // Postconditions:
260 
261  ensure(result != 0);
262  ensure(is_same_type(*result));
263 
264  // Exit:
265 
266  return result;
267 }
268 
269 // PROTECTED MEMBER FUNCTIONS
270 
271 // PRIVATE MEMBER FUNCTIONS
272 
273 
274 //==============================================================================
275 // ANY FACET
276 //==============================================================================
277 
278 // PUBLIC MEMBER FUNCTIONS
279 
280 bool
282 is_ancestor_of(const any_lite& xother) const
283 {
284  // Preconditions:
285 
286  require(&xother != 0);
287 
288  // Body:
289 
290  // True if other conforms to this.
291 
292  bool result = dynamic_cast<const met_lite*>(&xother) != 0;
293 
294  // Postconditions:
295 
296  return result;
297 }
298 
299 bool
301 invariant() const
302 {
303  bool result = true;
304 
305  if(invariant_check())
306  {
307  // Prevent recursive calls to invariant.
308 
309  disable_invariant_check();
310 
311  // Must satisfy base class invariant.
312 
313  invariance(st2_lite::invariant());
314 
315  // Invariances for this class:
316 
317  // Finished, turn invariant checking back on.
318 
319  enable_invariant_check();
320  }
321 
322  // Exit
323 
324  return result;
325 }
326 
327 // PROTECTED MEMBER FUNCTIONS
328 
329 // PRIVATE MEMBER FUNCTIONS
330 
331 
332 //==============================================================================
333 // CLASS MET
334 //==============================================================================
335 
336 // ===========================================================
337 // HOST FACTORY FACET OF CLASS MET
338 // ===========================================================
339 
340 // PUBLIC MEMBER FUNCTIONS
341 
342 const sheaf::poset_path&
345 {
346  // Preconditions:
347 
348 
349  // Body:
350 
351  static const poset_path result(standard_schema_poset_name(), "met_schema");
352 
353  // Postconditions:
354 
355  // Exit:
356 
357  return result;
358 }
359 
360 void
363 {
364  // Preconditions:
365 
366  require(xns.state_is_read_write_accessible());
367  require(xns.contains_poset(standard_schema_poset_name()));
368  require(!xns.contains_poset_member(standard_schema_path()));
369 
370  // Body:
371 
372  schema_poset_member lschema(xns,
373  standard_schema_path().member_name(),
374  st2::standard_schema_path(),
375  "",
376  false);
377 
378  lschema.detach_from_state();
379 
380  // Postconditions:
381 
382  ensure(xns.contains_poset_member(standard_schema_path()));
383 
384  // Exit:
385 
386  return;
387 }
388 
392  const poset_path& xhost_path,
393  const poset_path& xschema_path,
394  const poset_path& xvector_space_path,
395  bool xauto_access)
396 {
397  // cout << endl << "Entering met::new_host." << endl;
398 
399  // Preconditions:
400 
401  require(xns.state_is_auto_read_write_accessible(xauto_access));
402 
403  require(!xhost_path.empty());
404  require(!xns.contains_path(xhost_path, xauto_access));
405 
406  require(xschema_path.full());
407  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
408  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
409 
410  require(xns.path_is_auto_read_accessible(xvector_space_path, xauto_access));
411  require(xns.contains_poset<scalar_type::host_type>(xvector_space_path, xauto_access));
412 
413  // Body:
414 
415  host_type& result =
416  host_type::new_table(xns, xhost_path, xschema_path, 2, xvector_space_path, xauto_access);
417 
418  // Postconditions:
419 
420  ensure(xns.owns(result, xauto_access));
421  ensure(result.path(true) == xhost_path);
422  ensure(result.state_is_not_read_accessible());
423  ensure(result.schema(true).path(xauto_access) == xschema_path);
424 
425  ensure(result.factor_ct(true) == result.d(true));
426  ensure(result.d(true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
427  ensure(result.vector_space_path(true) == xvector_space_path );
428  ensure(result.p(true) == 2);
429  ensure(result.dd(true) == result.d(true));
430  ensure(result.vector_space_path(true) == xhost_path );
431 
432  // Exit:
433 
434  // cout << "Leaving met::new_host." << endl;
435  return result;
436 }
437 
438 // PROTECTED MEMBER FUNCTIONS
439 
440 // PRIVATE MEMBER FUNCTIONS
441 
442 
443 //==============================================================================
444 // MET FACET
445 //==============================================================================
446 
447 // PUBLIC MEMBER FUNCTIONS
448 
451 {
452 
453  // Preconditions:
454 
455  // Body:
456 
457  // Postconditions:
458 
459  ensure(invariant());
460 }
461 
463 met(const poset_state_handle* xhost, pod_index_type xhub_id)
464 {
465  // Preconditions:
466 
467  require(xhost != 0);
468  require(xhost->state_is_read_accessible());
469  require(xhost->contains_member(xhub_id));
470 
471  // Body:
472 
473  attach_to_state(xhost, xhub_id);
474 
475  // Postconditions:
476 
477  ensure(invariant());
478  // ensure(host() == xhost);
479  ensure(index() == xhub_id);
480  ensure(is_attached());
481 }
482 
484 met(const poset_state_handle* xhost, const scoped_index& xid)
485 {
486  // Preconditions:
487 
488  require(xhost != 0);
489  require(xhost->state_is_read_accessible());
490  require(xhost->contains_member(xid));
491 
492  // Body:
493 
494  attach_to_state(xhost, xid.hub_pod());
495 
496  // Postconditions:
497 
498  ensure(invariant());
499  // ensure(host() == xhost);
500  ensure(index() ==~ xid);
501  ensure(is_attached());
502 }
503 
505 met(const poset_state_handle* xhost, const std::string& xname)
506 {
507 
508  // Preconditions:
509 
510  require(xhost != 0);
511  require(xhost->state_is_read_accessible());
512  require(!xname.empty());
513  require(xhost->contains_member(xname));
514 
515  // Body:
516 
517  attach_to_state(xhost, xname);
518 
519  // Postconditions:
520 
521  ensure(invariant());
522  // ensure(host() == xhost);
523  ensure(name() == xname);
524  ensure(is_attached());
525 
526 }
527 
530 {
531 
532  // Preconditions:
533 
534  require(xother != 0);
535 
536  // Body:
537 
538  attach_to_state(xother);
539 
540  // Postconditions:
541 
542  ensure(invariant());
543  ensure(is_attached());
544  ensure(is_same_state(xother));
545 
546 }
547 
549 met(poset_state_handle* xhost, bool xauto_access)
550 {
551 
552  // Preconditions:
553 
554  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
555 
556  // Body:
557 
558  new_jim_state(xhost, 0, false, xauto_access);
559 
560  // Postconditions:
561 
562  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
563 
564  // Exit:
565 
566  return;
567 }
568 
573 {
574  // Preconditions:
575 
576  require(is_ancestor_of(&xother));
577  require(precondition_of(attach_to_state(&xother)));
578 
579  // Body:
580 
581  attach_to_state(&xother);
582 
583  // Postconditions:
584 
585  ensure(postcondition_of(attach_to_state(&xother)));
586 
587  // Exit:
588 
589  return *this;
590 }
591 
595 operator=(const met& xother)
596 {
597  // Preconditions:
598 
599  require(precondition_of(attach_to_state(&xother)));
600 
601  // Body:
602 
603  attach_to_state(&xother);
604 
605  // Postconditions:
606 
607  ensure(postcondition_of(attach_to_state(&xother)));
608 
609  // Exit:
610 
611  return *this;
612 }
613 
616 {
617 
618  // Preconditions:
619 
620  // Body:
621 
622  // Postconditions:
623 
624 }
625 
629 {
630  // Preconditions:
631 
632  // Body:
633 
634  static const volatile_type result;
635 
636  // Postconditions:
637 
638  // Exit:
639 
640  return result;
641 }
642 
646 lite_type() const
647 {
648  // Preconditions:
649 
650  // Body:
651 
652  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
653 
654  // Postconditions:
655 
656  // Exit:
657 
658  return result;
659 }
660 
661 
662 // PROTECTED MEMBER FUNCTIONS
663 
664 // PRIVATE MEMBER FUNCTIONS
665 
666 
667 //==============================================================================
668 // ST2 FACET
669 //==============================================================================
670 
671 // PUBLIC MEMBER FUNCTIONS
672 
673 // PROTECTED MEMBER FUNCTIONS
674 
675 // PRIVATE MEMBER FUNCTIONS
676 
677 
678 //==============================================================================
679 // STP FACET
680 //==============================================================================
681 
682 // PUBLIC MEMBER FUNCTIONS
683 
684 // PROTECTED MEMBER FUNCTIONS
685 
686 // PRIVATE MEMBER FUNCTIONS
687 
688 
689 //==============================================================================
690 // TP FACET
691 //==============================================================================
692 
693 // PUBLIC MEMBER FUNCTIONS
694 
695 // PROTECTED MEMBER FUNCTIONS
696 
697 // PRIVATE MEMBER FUNCTIONS
698 
699 
700 //==============================================================================
701 // VD FACET
702 //==============================================================================
703 
704 // PUBLIC MEMBER FUNCTIONS
705 
706 // PROTECTED MEMBER FUNCTIONS
707 
708 // PRIVATE MEMBER FUNCTIONS
709 
710 
711 //==============================================================================
712 // TUPLE FACET
713 //==============================================================================
714 
715 // PUBLIC MEMBER FUNCTIONS
716 
717 // PROTECTED MEMBER FUNCTIONS
718 
719 // PRIVATE MEMBER FUNCTIONS
720 
721 
722 //==============================================================================
723 // ABSTRACT POSET MEMBER FACET
724 //==============================================================================
725 
726 // PUBLIC MEMBER FUNCTIONS
727 
728 const std::string&
730 class_name() const
731 {
732  // Preconditions:
733 
734  // Body:
735 
736  const string& result = static_class_name();
737 
738  // Postconditions:
739 
740  ensure(!result.empty());
741 
742  // Exit:
743 
744  return result;
745 }
746 
747 const std::string&
750 {
751  // Preconditions:
752 
753  // Body:
754 
755  static const string result("met");
756 
757  // Postconditions:
758 
759  ensure(!result.empty());
760 
761  // Exit:
762 
763  return result;
764 }
765 
768 clone() const
769 {
770 
771  // Preconditions:
772 
773  // Body:
774 
775  // Create new handle of the current class.
776 
777  met* result = new met();
778 
779  // Postconditions:
780 
781  ensure(result != 0);
782  ensure(result->invariant());
783 
784  // Exit:
785 
786  return result;
787 
788 }
789 
790 // PROTECTED MEMBER FUNCTIONS
791 
792 // PRIVATE MEMBER FUNCTIONS
793 
794 
795 //==============================================================================
796 // ANY FACET
797 //==============================================================================
798 
799 // PUBLIC MEMBER FUNCTIONS
800 
801 bool
803 is_ancestor_of(const any* xother) const
804 {
805 
806  // Preconditions:
807 
808  require(xother != 0);
809 
810  // Body:
811 
812  // If xother may be dynamically cast to the type of this then this is an
813  // ancestor of other.
814 
815  bool result = dynamic_cast<const met*>(xother) != 0;
816 
817  // Postconditions:
818 
819  // ensure(invariant());
820 
821  // Exit:
822 
823  return result;
824 
825 }
826 
827 bool
829 invariant() const
830 {
831  bool result = true;
832 
833  // Preconditions:
834 
835  // Body:
836 
837  // Must satisfy base class invariant.
838 
839  invariance(st2::invariant());
840 
841  if (invariant_check())
842  {
843  // Prevent recursive calls to invariant.
844 
845  disable_invariant_check();
846 
847  // Finished, turn invariant checking back on.
848 
849  enable_invariant_check();
850  }
851 
852  // Postconditions:
853 
854  ensure(is_derived_query);
855 
856  // Exit:
857 
858  return result;
859 }
860 
861 // PROTECTED MEMBER FUNCTIONS
862 
863 // PRIVATE MEMBER FUNCTIONS
864 
865 
866 //==============================================================================
867 // NON-MEMBER FUNCTIONS
868 //==============================================================================
869 
870 
871 //==============================================================================
872 // MET FACET
873 //==============================================================================
874 
875 #include "SheafSystem/error_message.h"
876 #include "SheafSystem/e1.h"
877 #include "SheafSystem/e2.h"
878 #include "SheafSystem/e3.h"
879 #include "SheafSystem/met_e1.h"
880 #include "SheafSystem/met_e2.h"
881 #include "SheafSystem/met_e3.h"
882 
884 void
886 raise(const met& xmetric, const ed& xcovector, ed& xresult,
887  bool xauto_access)
888 {
889  // Preconditions:
890 
891  require(xmetric.state_is_auto_read_accessible(xauto_access));
892  require(xcovector.state_is_auto_read_accessible(xauto_access));
893  require(xresult.state_is_auto_read_write_accessible(xauto_access));
894  require(xcovector.d(xauto_access) == xmetric.dd(xauto_access));
895  require(xresult.d(xauto_access) == xmetric.dd(xauto_access));
896  require(xmetric.is_contravariant(0, xauto_access));
897  require(xcovector.is_covariant(0, xauto_access)); // is_dual;
898 
899  // Body:
900 
901  const met_e1* met_e1_xmetric = dynamic_cast<const met_e1*>(&xmetric);
902  const met_e2* met_e2_xmetric = dynamic_cast<const met_e2*>(&xmetric);
903  const met_e3* met_e3_xmetric = dynamic_cast<const met_e3*>(&xmetric);
904 
905  const e1* e1_xcovector = dynamic_cast<const e1*>(&xcovector);
906  const e2* e2_xcovector = dynamic_cast<const e2*>(&xcovector);
907  const e3* e3_xcovector = dynamic_cast<const e3*>(&xcovector);
908 
909  e1* e1_xresult = dynamic_cast<e1*>(&xresult);
910  e2* e2_xresult = dynamic_cast<e2*>(&xresult);
911  e3* e3_xresult = dynamic_cast<e3*>(&xresult);
912 
913  if(met_e1_xmetric && e1_xcovector && e1_xresult)
914  {
915  raise(*met_e1_xmetric, *e1_xcovector, *e1_xresult, xauto_access);
916  }
917  else if(met_e2_xmetric && e2_xcovector && e2_xresult, xauto_access)
918  {
919  raise(*met_e2_xmetric, *e2_xcovector, *e2_xresult, xauto_access);
920  }
921  else if(met_e3_xmetric && e3_xcovector && e3_xresult, xauto_access)
922  {
923  raise(*met_e3_xmetric, *e3_xcovector, *e3_xresult, xauto_access);
924  }
925  else
926  {
927  post_fatal_error_message(\
928  "Unsupported argument types in call to raise(...)");
929  }
930 
931  // Postconditions:
932 
933  ensure(xresult.is_contravariant(0, xauto_access)); // !is_dual
934 
935  // Exit:
936 
937  return;
938 }
939 
941 void
943 lower(const met& xmetric, const ed& xvector, ed& xresult, bool xauto_access)
944 {
945  // Preconditions:
946 
947  require(xmetric.state_is_auto_read_accessible(xauto_access));
948  require(xvector.state_is_auto_read_accessible(xauto_access));
949  require(xresult.state_is_auto_read_write_accessible(xauto_access));
950  require(xvector.d(xauto_access) == xmetric.dd(xauto_access));
951  require(xresult.d(xauto_access) == xmetric.dd(xauto_access));
952  require(xmetric.is_covariant(0, xauto_access));
953  require(xvector.is_contravariant(0, xauto_access)); // !is_dual;
954 
955  // Body:
956 
957  const met_e1* met_e1_xmetric = dynamic_cast<const met_e1*>(&xmetric);
958  const met_e2* met_e2_xmetric = dynamic_cast<const met_e2*>(&xmetric);
959  const met_e3* met_e3_xmetric = dynamic_cast<const met_e3*>(&xmetric);
960 
961  const e1* e1_xvector = dynamic_cast<const e1*>(&xvector);
962  const e2* e2_xvector = dynamic_cast<const e2*>(&xvector);
963  const e3* e3_xvector = dynamic_cast<const e3*>(&xvector);
964 
965  e1* e1_xresult = dynamic_cast<e1*>(&xresult);
966  e2* e2_xresult = dynamic_cast<e2*>(&xresult);
967  e3* e3_xresult = dynamic_cast<e3*>(&xresult);
968 
969  if(met_e1_xmetric && e1_xvector && e1_xresult)
970  {
971  lower(*met_e1_xmetric, *e1_xvector, *e1_xresult, xauto_access);
972  }
973  else if(met_e2_xmetric && e2_xvector && e2_xresult, xauto_access)
974  {
975  lower(*met_e2_xmetric, *e2_xvector, *e2_xresult, xauto_access);
976  }
977  else if(met_e3_xmetric && e3_xvector && e3_xresult, xauto_access)
978  {
979  lower(*met_e3_xmetric, *e3_xvector, *e3_xresult, xauto_access);
980  }
981  else
982  {
983  post_fatal_error_message(\
984  "Unsupported argument types in call to lower(...)");
985  }
986 
987  // Postconditions:
988 
989  ensure(xresult.is_covariant(0, xauto_access)); // is_dual
990 
991  // Exit:
992 
993  return;
994 }
995 
997 void
999 raise(const met_lite& xmetric, const ed_lite& xcovector, ed_lite& xresult)
1000 {
1001  // Preconditions:
1002 
1003  require(xcovector.d() == xmetric.dd());
1004  require(xresult.d() == xmetric.dd());
1005  require(unexecutable("xmetric.is_contravariant())"));
1006  require(unexecutable("xcovector.is_covariant())")); // is_dual;
1007 
1008  // Body:
1009 
1010 // met_e1.h: raise(const met_e1_lite& xmetric, const e1_lite& xcovector,
1011 // met_e2.h: raise(const met_e2_lite& xmetric, const e2_lite& xcovector,
1012 // met_e3.h: raise(const met_e3_lite& xmetric, const e3_lite& xcovector,
1013 
1014  const met_e1_lite* met_e1_xmetric = dynamic_cast<const met_e1_lite*>(&xmetric);
1015  const met_e2_lite* met_e2_xmetric = dynamic_cast<const met_e2_lite*>(&xmetric);
1016  const met_e3_lite* met_e3_xmetric = dynamic_cast<const met_e3_lite*>(&xmetric);
1017 
1018  const e1_lite* e1_xcovector = dynamic_cast<const e1_lite*>(&xcovector);
1019  const e2_lite* e2_xcovector = dynamic_cast<const e2_lite*>(&xcovector);
1020  const e3_lite* e3_xcovector = dynamic_cast<const e3_lite*>(&xcovector);
1021 
1022  e1_lite* e1_xresult = dynamic_cast<e1_lite*>(&xresult);
1023  e2_lite* e2_xresult = dynamic_cast<e2_lite*>(&xresult);
1024  e3_lite* e3_xresult = dynamic_cast<e3_lite*>(&xresult);
1025 
1026  if(met_e1_xmetric && e1_xcovector && e1_xresult)
1027  {
1028  raise(*met_e1_xmetric, *e1_xcovector, *e1_xresult);
1029  }
1030  else if(met_e2_xmetric && e2_xcovector && e2_xresult)
1031  {
1032  raise(*met_e2_xmetric, *e2_xcovector, *e2_xresult);
1033  }
1034  else if(met_e3_xmetric && e3_xcovector && e3_xresult)
1035  {
1036  raise(*met_e3_xmetric, *e3_xcovector, *e3_xresult);
1037  }
1038  else
1039  {
1040  post_fatal_error_message(\
1041  "Unsupported argument types in call to raise(...)");
1042  }
1043 
1044  // Postconditions:
1045 
1046  ensure(unexecutable("xresult.is_contravariant())")); // !is_dual
1047 
1048  // Exit:
1049 
1050  return;
1051 }
1052 
1056 raise(const met_lite& xmetric, const ed_lite& xcovector)
1057 {
1058  // Preconditions:
1059 
1060  require(precondition_of(raise(xmetric, xcovector, *result)));
1061 
1062  // Body:
1063 
1064  ed_lite* result = new ed_lite();
1065  raise(xmetric, xcovector, *result);
1066 
1067  // Postconditions:
1068 
1069  ensure(postcondition_of(raise(xmetric, xcovector, *result)));
1070 
1071  // Exit:
1072 
1073  return result;
1074 }
1075 
1077 void
1079 lower(const met_lite& xmetric, const ed_lite& xvector, ed_lite& xresult)
1080 {
1081  // Preconditions:
1082 
1083  require(xvector.d() == xmetric.dd());
1084  require(xresult.d() == xmetric.dd());
1085  require(unexecutable("xmetric.is_covariant())"));
1086  require(unexecutable("xcovector.is_contravariant())")); // !is_dual
1087 
1088  // Body:
1089 
1090  const met_e1_lite* met_e1_xmetric = dynamic_cast<const met_e1_lite*>(&xmetric);
1091  const met_e2_lite* met_e2_xmetric = dynamic_cast<const met_e2_lite*>(&xmetric);
1092  const met_e3_lite* met_e3_xmetric = dynamic_cast<const met_e3_lite*>(&xmetric);
1093 
1094  const e1_lite* e1_xvector = dynamic_cast<const e1_lite*>(&xvector);
1095  const e2_lite* e2_xvector = dynamic_cast<const e2_lite*>(&xvector);
1096  const e3_lite* e3_xvector = dynamic_cast<const e3_lite*>(&xvector);
1097 
1098  e1_lite* e1_xresult = dynamic_cast<e1_lite*>(&xresult);
1099  e2_lite* e2_xresult = dynamic_cast<e2_lite*>(&xresult);
1100  e3_lite* e3_xresult = dynamic_cast<e3_lite*>(&xresult);
1101 
1102  if(met_e1_xmetric && e1_xvector && e1_xresult)
1103  {
1104  lower(*met_e1_xmetric, *e1_xvector, *e1_xresult);
1105  }
1106  else if(met_e2_xmetric && e2_xvector && e2_xresult)
1107  {
1108  lower(*met_e2_xmetric, *e2_xvector, *e2_xresult);
1109  }
1110  else if(met_e3_xmetric && e3_xvector && e3_xresult)
1111  {
1112  lower(*met_e3_xmetric, *e3_xvector, *e3_xresult);
1113  }
1114  else
1115  {
1116  post_fatal_error_message(\
1117  "Unsupported argument types in call to lower(...)");
1118  }
1119 
1120  // Postconditions:
1121 
1122  ensure(unexecutable("xresult.is_covariant())")); // is_dual
1123 
1124  // Exit:
1125 
1126  return;
1127 }
1128 
1132 lower(const met_lite& xmetric, const ed_lite& xvector)
1133 {
1134  // Preconditions:
1135 
1136  require(precondition_of(lower(xmetric, xvector, *result)));
1137 
1138  // Body:
1139 
1140  ed_lite* result = new ed_lite();
1141  lower(xmetric, xvector, *result);
1142 
1143  // Postconditions:
1144 
1145  ensure(postcondition_of(lower(xmetric, xvector, *result)));
1146 
1147  // Exit:
1148 
1149  return result;
1150 }
1151 
1152 
SHEAF_DLL_SPEC void lower(const met &xmetric, const ed &xvector, ed &xresult, bool xauto_access)
Lower vector (pre-allocated version for persistent type).
Definition: met.cc:943
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 ...
met()
Default constructor.
Definition: met.cc:450
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
Euclidean vector space of dimension 3 (volatile version).
Definition: e3.h:116
A metric tensor over a 1 dimensional Euclidean vector space (volatile version).
Definition: met_e3.h:145
Euclidean vector space of dimension 2 (persistent version).
Definition: e2.h:405
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...
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 met * clone() const
Make a new handle, no state instance of current.
Definition: met.cc:768
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 metric tensor over a 1 dimensional Euclidean vector space.
Definition: met_e1.h:396
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.
virtual ~met_lite()
Destructor.
Definition: met.cc:95
bool invariant() const
Class invariant.
Definition: met.cc:829
~met()
Destructor.
Definition: met.cc:615
A metric tensor over an abstract vector space (volatile version).
Definition: met.h:43
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 bool is_covariant(bool xauto_access) const
True if and only if all tensor index positions are covariant.
Definition: tp.cc:1078
Euclidean vector space of dimension 1 (persistent version).
Definition: e1.h:400
A metric tensor over an abstract vector space (persistent version).
Definition: met.h:208
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: stp_space.cc:86
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
A metric tensor over a 2 dimensional Euclidean vector space (persistent version). ...
Definition: met_e2.h:448
Euclidean vector space of dimension d (volatile version).
Definition: ed.h:44
A space of scalars viewed as an antisymmetric tensor space of degree 0.
Definition: at0_space.h:42
Euclidean vector space of dimension 2 (volatile version).
Definition: e2.h:112
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)
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: met.cc:344
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
static const std::string & static_class_name()
The name of this class.
Definition: met.cc:230
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
met_lite & operator=(const met_lite &xother)
Assignment operator.
Definition: met.cc:79
A metric tensor over a 1 dimensional Euclidean vector space (volatile version).
Definition: met_e1.h:116
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. ...
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
Definition: met.cc:803
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
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: met.cc:362
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 met_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: met.cc:249
A metric tensor over a 3 dimensional Euclidean vector space (persistent version). ...
Definition: met_e3.h:461
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, 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: met.cc:391
bool invariant() const
Class invariant.
Definition: met.cc:301
virtual const std::string & class_name() const
The name of this class.
Definition: met.cc:211
Euclidean vector space of dimension d (peresistent version).
Definition: ed.h:210
met_lite()
Default constructor.
Definition: met.cc:49
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 met & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: met.cc:572
Euclidean vector space of dimension 1 (volatile version).
Definition: e1.h:113
virtual int d() const
Dimension of this as a vector space.
Definition: vd.cc:1017
virtual const std::string & class_name() const
The name of this class.
Definition: met.cc:730
An abstract client handle for a member of a poset.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: met.cc:628
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: met.cc:282
A metric tensor over a 2 dimensional Euclidean vector space (volatile version).
Definition: met_e2.h:142
An abstract symmetric tensor space of degree p.
Definition: stp_space.h:42
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: met.cc:646
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC void raise(const met &xmetric, const ed &xcovector, ed &xresult, bool xauto_access)
Raise covector (pre-allocated version for persistent type).
Definition: met.cc:886
Row dofs type for class vd.
Definition: vd.h:61
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 std::string & static_class_name()
The name of this class.
Definition: met.cc:749
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710