SheafSystem  0.0.0.0
e3.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/e3.impl.h"
22 
23 #include "SheafSystem/abstract_poset_member.impl.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/at0.h"
26 #include "SheafSystem/at0_space.h"
27 #include "SheafSystem/at1_space.h"
28 #include "SheafSystem/at2_e3.h"
29 #include "SheafSystem/at3_e3.h"
30 #include "SheafSystem/fiber_bundles_namespace.h"
31 #include "SheafSystem/gl3.h"
32 #include "SheafSystem/schema_poset_member.h"
33 #include "SheafSystem/st2_e3.h"
34 #include "SheafSystem/st3_e3.h"
35 #include "SheafSystem/st4_e3.h"
36 #include "SheafSystem/stp_space.h"
37 #include "SheafSystem/t2_e3.h"
38 #include "SheafSystem/t3_e3.h"
39 #include "SheafSystem/t4_e3.h"
40 #include "SheafSystem/tolerance_comparison.h"
41 #include "SheafSystem/wsv_block.h"
42 
43 using namespace std;
44 using namespace fiber_bundle; // Workaround for MS C++ bug.
45 
46 
47 //==============================================================================
48 // CLASS E3_LITE
49 //==============================================================================
50 
51 //==============================================================================
52 // EUCLIDEAN VECTOR ALGEBRA (E3) FACET OF CLASS E3_LITE
53 //==============================================================================
54 
55 // PUBLIC MEMBER FUNCTIONS
56 
59 {
60 
61  // Preconditions:
62 
63  // Body:
64 
65  // Postconditions:
66 
67  ensure(invariant());
68 
69  // Exit:
70 }
71 
73 e3_lite(const e3_lite& xother)
74 {
75  // Preconditions:
76 
77  // Body:
78 
79  *this = xother;
80 
81  // Postconditions:
82 
83  ensure(invariant());
84 
85  // Exit:
86 }
87 
90 operator=(const e3_lite& xother)
91 {
92 
93  // Preconditions:
94 
95  // Body:
96 
97  if(this == &xother)
98  return *this;
99 
100  _row_dofs = xother._row_dofs;
101 
102  // Postconditions:
103 
104  ensure(invariant());
105  ensure(unexecutable(*this == xother));
106 
107  // Exit:
108 
109  return *this;
110 }
111 
112 
115 {
116  // Preconditions:
117 
118  // Body:
119 
120  // Postconditions:
121 
122  // Exit:
123 }
124 
126 e3_lite(const row_dofs_type& xrow_dofs)
127 {
128  // Preconditions:
129 
130  // Body:
131 
132  *this = xrow_dofs;
133 
134  // Postconditions:
135 
136  // Exit:
137 }
138 
141 operator=(const row_dofs_type& xrow_dofs)
142 {
143  // Preconditions:
144 
145  // Body:
146 
147  _row_dofs = xrow_dofs;
148 
149  // Postconditions:
150 
151  ensure(invariant());
152  ensure(unexecutable(row_dofs() == xrow_dofs));
153  //ensure_for_all(i, 0, d(), component(i) == xrow_dofs[i]);
154 
155  // Exit:
156 
157  return *this;
158 
159 }
160 
162 e3_lite(const value_type& xvalue)
163 {
164  // Preconditions:
165 
166  // Body:
167 
168  _row_dofs.components[0] = xvalue;
169  _row_dofs.components[1] = xvalue;
170  _row_dofs.components[2] = xvalue;
171 
172  // Postconditions:
173 
174  ensure(invariant());
175  ensure(isunordered_or_equals(component(0), xvalue));
176  ensure(isunordered_or_equals(component(1), xvalue));
177  ensure(isunordered_or_equals(component(2), xvalue));
178 
179  // Exit:
180 }
181 
183 e3_lite(const value_type& x0, const value_type& x1, const value_type& x2)
184 {
185  // Preconditions:
186 
187  // Body:
188 
189  _row_dofs.components[0] = x0;
190  _row_dofs.components[1] = x1;
191  _row_dofs.components[2] = x2;
192 
193  // Postconditions:
194 
195  ensure(invariant());
196  ensure(isunordered_or_equals(component(0), x0));
197  ensure(isunordered_or_equals(component(1), x1));
198  ensure(isunordered_or_equals(component(2), x2));
199 
200  // Exit:
201 }
202 
203 fiber_bundle::e3_lite::
205 {
206  // Preconditions:
207 
208  // Body:
209 
210  row_dofs_type& result = _row_dofs;
211 
212  // Postconditions:
213 
214  ensure(invariant());
215 
216  // Exit:
217 
218  return result;
219 }
220 
221 fiber_bundle::e3_lite::
222 operator const e3_lite::row_dofs_type& () const
223 {
224  // Preconditions:
225 
226  // Body:
227 
228  const row_dofs_type& result = _row_dofs;
229 
230  // Postconditions:
231 
232  ensure(invariant());
233 
234  // Exit:
235 
236  return result;
237 }
238 
239 void
242  const value_type& y_comp,
243  const value_type& z_comp)
244 {
245  // Preconditions:
246 
247  // Body:
248 
249  // put_component(0, x_comp);
250  // put_component(1, y_comp);
251  // put_component(2, z_comp);
252 
253  _row_dofs.components[0] = x_comp;
254  _row_dofs.components[1] = y_comp;
255  _row_dofs.components[2] = z_comp;
256 
257  // Postconditions:
258 
259  ensure(invariant());
260  ensure(isunordered_or_equals(component(0), x_comp));
261  ensure(isunordered_or_equals(component(1), y_comp));
262  ensure(isunordered_or_equals(component(2), z_comp));
263 
264  // Exit:
265 }
266 
267 // PROTECTED MEMBER FUNCTIONS
268 
269 // PRIVATE MEMBER FUNCTIONS
270 
271 
272 //==============================================================================
273 // EUCLIDEAN VECTOR ALGEBRA (ED) FACET OF CLASS E3_LITE
274 //==============================================================================
275 
276 // PUBLIC MEMBER FUNCTIONS
277 
278 // PROTECTED MEMBER FUNCTIONS
279 
280 // PRIVATE MEMBER FUNCTIONS
281 
282 
283 //==============================================================================
284 // EXTERIOR ALGEBRA (AT1) FACET OF CLASS E3_LITE
285 //==============================================================================
286 
287 // PUBLIC MEMBER FUNCTIONS
288 
289 // PROTECTED MEMBER FUNCTIONS
290 
291 // PRIVATE MEMBER FUNCTIONS
292 
293 
294 //==============================================================================
295 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS E3_LITE
296 //==============================================================================
297 
298 // PUBLIC MEMBER FUNCTIONS
299 
300 // PROTECTED MEMBER FUNCTIONS
301 
302 // PRIVATE MEMBER FUNCTIONS
303 
304 
305 //==============================================================================
306 // TENSOR ALGEBRA (TP) FACET OF CLASS E3_LITE
307 //==============================================================================
308 
309 // PUBLIC MEMBER FUNCTIONS
310 
311 int
313 dd() const
314 {
315  // Preconditions:
316 
317  // Body:
318 
319  int result = 3;
320 
321  // Postconditions:
322 
323  ensure(invariant());
324  ensure(result == 3);
325 
326  // Exit:
327 
328  return result;
329 }
330 
331 // PROTECTED MEMBER FUNCTIONS
332 
333 // PRIVATE MEMBER FUNCTIONS
334 
335 
336 //==============================================================================
337 // VECTOR ALGEBRA (VD) FACET OF CLASS E3_LITE
338 //==============================================================================
339 
340 // PUBLIC MEMBER FUNCTIONS
341 
342 bool
344 operator==(const e3_lite& xother) const
345 {
346  // cout << endl << "Entering e3_lite::operator==." << endl;
347 
348  // Preconditions:
349 
350  // Body:
351 
352  bool result =
353  (_row_dofs.components[0] == xother._row_dofs.components[0]) &&
354  (_row_dofs.components[1] == xother._row_dofs.components[1]) &&
355  (_row_dofs.components[2] == xother._row_dofs.components[2]);
356 
357  // Postconditions:
358 
359 
360  // Exit:
361 
362  // cout << "Leaving e3_lite::operator==." << endl;
363  return result;
364 }
365 
368 operator=(const value_type& xvalue)
369 {
370  // Preconditions:
371 
372  // Body:
373 
374  _row_dofs.components[0] = xvalue;
375  _row_dofs.components[1] = xvalue;
376  _row_dofs.components[2] = xvalue;
377 
378  // Postconditions:
379 
380  ensure(invariant());
381  ensure_for_all(i, 0, d(), component(i) == xvalue);
382 
383  // Exit:
384 
385  return *this;
386 
387 }
388 
389 bool
391 operator==(const value_type& xvalue) const
392 {
393  // Preconditions:
394 
395  // Body:
396 
397  bool result =
398  (_row_dofs.components[0] == xvalue) &&
399  (_row_dofs.components[1] == xvalue) &&
400  (_row_dofs.components[2] == xvalue);
401 
402  // Postconditions:
403 
404  ensure(invariant());
405  ensure_for_all(i, 0, d(), !result || component(i) == xvalue);
406 
407  // Exit:
408 
409  return result;
410 
411 }
412 
416 {
417  // Preconditions:
418 
419  require((0 <= xp) && (xp <= 4));
420 
421  // Body:
422 
423  switch(xp)
424  {
425  case 0:
426  {
427  static const at0_lite lat0_lite;
428  return lat0_lite;
429  }
430  case 1:
431  {
432  static const e3_lite le3_lite;
433  return le3_lite;
434  }
435  case 2:
436  {
437  static const t2_e3_lite lt2_e3_lite;
438  return lt2_e3_lite;
439  }
440  case 3:
441  {
442  static const t3_e3_lite lt3_e3_lite;
443  return lt3_e3_lite;
444  }
445  case 4:
446  {
447  static const t4_e3_lite lt4_e3_lite;
448  return lt4_e3_lite;
449  }
450  default:
451  {
452  // Can't get here because of the precondition.
453  static const tp_lite ltp_lite;
454  return ltp_lite;
455  }
456  }
457 
458  // Postconditions:
459 
460  ensure(unexecutable("result.p() == xp"));
461 
462  // Exit:
463 }
464 
467 tp_prototype(int xp) const
468 {
469  // Preconditions:
470 
471  require(precondition_of(static_tp_prototype(xp)));
472 
473  // Body:
474 
475  const tp_lite& result = static_tp_prototype(xp);
476 
477  // Postconditions:
478 
479  ensure(postcondition_of(static_tp_prototype(xp)));
480 
481  // Exit:
482 
483  return result;
484 }
485 
489 {
490  // Preconditions:
491 
492  require((0 <= xp) && (xp <= 3));
493 
494  // Body:
495 
496  switch(xp)
497  {
498  case 0:
499  {
500  static const at0_lite lat0_lite;
501  return lat0_lite;
502  }
503  case 1:
504  {
505  static const e3_lite le3_lite;
506  return le3_lite;
507  }
508  case 2:
509  {
510  static const at2_e3_lite lat2_e3_lite;
511  return lat2_e3_lite;
512  }
513  case 3:
514  {
515  static const at3_e3_lite lat3_e3_lite;
516  return lat3_e3_lite;
517  }
518  default:
519  {
520  // Can't get here because of the precondition.
521  static const atp_lite latp_lite;
522  return latp_lite;
523  }
524  }
525 
526  // Postconditions:
527 
528  ensure(unexecutable("result.p() == xp"));
529 
530  // Exit:
531 }
532 
535 atp_prototype(int xp) const
536 {
537  // Preconditions:
538 
539  require(precondition_of(static_atp_prototype(xp)));
540 
541  // Body:
542 
543  const atp_lite& result = static_atp_prototype(xp);
544 
545  // Postconditions:
546 
547  ensure(postcondition_of(static_atp_prototype(xp)));
548 
549  // Exit:
550 
551  return result;
552 }
553 
557 {
558  // Preconditions:
559 
560  require((2 <= xp) && (xp <= 4));
561 
562  // Body:
563 
564  switch(xp)
565  {
566  case 2:
567  {
568  static const st2_e3_lite lst2_e3_lite;
569  return lst2_e3_lite;
570  }
571  case 3:
572  {
573  static const st3_e3_lite lst3_e3_lite;
574  return lst3_e3_lite;
575  }
576  case 4:
577  {
578  static const st4_e3_lite lst4_e3_lite;
579  return lst4_e3_lite;
580  }
581  default:
582  {
583  // Can't get here because of the precondition.
584  static const stp_lite lstp_lite;
585  return lstp_lite;
586  }
587  }
588 
589  // Postconditions:
590 
591  ensure(unexecutable("result.p() == xp"));
592 
593  // Exit:
594 }
595 
598 stp_prototype(int xp) const
599 {
600  // Preconditions:
601 
602  require(precondition_of(static_stp_prototype(xp)));
603 
604  // Body:
605 
606  const stp_lite& result = static_stp_prototype(xp);
607 
608  // Postconditions:
609 
610  ensure(postcondition_of(static_stp_prototype(xp)));
611 
612  // Exit:
613 
614  return result;
615 }
616 
617 
618 // PROTECTED MEMBER FUNCTIONS
619 
620 // PRIVATE MEMBER FUNCTIONS
621 
622 
623 //==============================================================================
624 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS E3_LITE
625 //==============================================================================
626 
627 // PUBLIC MEMBER FUNCTIONS
628 
629 bool
631 c_lt(const e3_lite& xother) const
632 {
633  // cout << endl << "Entering e3::c_lt." << endl;
634 
635  // Preconditions:
636 
637 
638  // Body:
639 
640  bool result =
641  (_row_dofs.components[0] < xother._row_dofs.components[0]) &&
642  (_row_dofs.components[1] < xother._row_dofs.components[1]) &&
643  (_row_dofs.components[2] < xother._row_dofs.components[2]);
644 
645 
646  // Postconditions:
647 
648  ensure(result == (((*this)[0] < xother[0]) && ((*this)[1] < xother[1]) && ((*this)[2] < xother[2])));
649 
650  // Exit:
651 
652  // cout << "Leaving e3::c_lt." << endl;
653  return result;
654 }
655 
656 bool
658 c_le(const e3_lite& xother) const
659 {
660  // cout << endl << "Entering e3::c_le." << endl;
661 
662  // Preconditions:
663 
664 
665  // Body:
666 
667  bool result =
668  (_row_dofs.components[0] <= xother._row_dofs.components[0]) &&
669  (_row_dofs.components[1] <= xother._row_dofs.components[1]) &&
670  (_row_dofs.components[2] <= xother._row_dofs.components[2]);
671 
672 
673  // Postconditions:
674 
675  ensure(result == (((*this)[0] <= xother[0]) && ((*this)[1] <= xother[1]) && ((*this)[2] <= xother[2])));
676 
677  // Exit:
678 
679  // cout << "Leaving e3::c_le." << endl;
680  return result;
681 }
682 
683 bool
685 c_gt(const e3_lite& xother) const
686 {
687  // cout << endl << "Entering e3::c_gt." << endl;
688 
689  // Preconditions:
690 
691 
692  // Body:
693 
694  bool result =
695  (_row_dofs.components[0] > xother._row_dofs.components[0]) &&
696  (_row_dofs.components[1] > xother._row_dofs.components[1]) &&
697  (_row_dofs.components[2] > xother._row_dofs.components[2]);
698 
699 
700  // Postconditions:
701 
702  ensure(result == (((*this)[0] > xother[0]) && ((*this)[1] > xother[1]) && ((*this)[2] > xother[2])));
703 
704  // Exit:
705 
706  // cout << "Leaving e3::c_gt." << endl;
707  return result;
708 }
709 
710 bool
712 c_ge(const e3_lite& xother) const
713 {
714  // cout << endl << "Entering e3::c_ge." << endl;
715 
716  // Preconditions:
717 
718 
719  // Body:
720 
721  bool result =
722  (_row_dofs.components[0] >= xother._row_dofs.components[0]) &&
723  (_row_dofs.components[1] >= xother._row_dofs.components[1]) &&
724  (_row_dofs.components[2] >= xother._row_dofs.components[2]);
725 
726 
727  // Postconditions:
728 
729  ensure(result == (((*this)[0] >= xother[0]) && ((*this)[1] >= xother[1]) && ((*this)[2] >= xother[2])));
730 
731  // Exit:
732 
733  // cout << "Leaving e3::c_ge." << endl;
734  return result;
735 }
736 
737 bool
739 d_lt(const e3_lite& xother) const
740 {
741  // cout << endl << "Entering e3::d_lt." << endl;
742 
743  // Preconditions:
744 
745 
746  // Body:
747 
748  bool result = false;
749 
750  if(_row_dofs.components[0] < xother._row_dofs.components[0])
751  {
752  result = true;
753  }
754  else
755  {
756  if(_row_dofs.components[0] == xother._row_dofs.components[0])
757  {
758  if(_row_dofs.components[1] < xother._row_dofs.components[1])
759  {
760  result = true;
761  }
762  else
763  {
764  if(_row_dofs.components[1] == xother._row_dofs.components[1])
765  {
766  if(_row_dofs.components[2] < xother._row_dofs.components[2])
767  {
768  result = true;
769  }
770  }
771  }
772  }
773  }
774 
775  // Postconditions:
776 
777 
778  // Exit:
779 
780  // cout << "Leaving e3::d_lt." << endl;
781  return result;
782 }
783 
784 bool
786 d_le(const e3_lite& xother) const
787 {
788  // cout << endl << "Entering e3::d_le." << endl;
789 
790  // Preconditions:
791 
792 
793  // Body:
794 
795  bool result = false;
796 
797  if(_row_dofs.components[0] < xother._row_dofs.components[0])
798  {
799  result = true;
800  }
801  else
802  {
803  if(_row_dofs.components[0] == xother._row_dofs.components[0])
804  {
805  if(_row_dofs.components[1] < xother._row_dofs.components[1])
806  {
807  result = true;
808  }
809  else
810  {
811  if(_row_dofs.components[1] == xother._row_dofs.components[1])
812  {
813  if(_row_dofs.components[2] < xother._row_dofs.components[2])
814  {
815  result = true;
816  }
817  else
818  {
819  if(_row_dofs.components[2] == xother._row_dofs.components[2])
820  {
821  result = true;
822  }
823  }
824  }
825  }
826  }
827  }
828 
829  // Postconditions:
830 
831 
832  // Exit:
833 
834  // cout << "Leaving e3::d_le." << endl;
835  return result;
836 }
837 
838 bool
840 d_gt(const e3_lite& xother) const
841 {
842  // cout << endl << "Entering e3::d_lt." << endl;
843 
844  // Preconditions:
845 
846 
847  // Body:
848 
849  bool result = false;
850 
851  if(_row_dofs.components[0] > xother._row_dofs.components[0])
852  {
853  result = true;
854  }
855  else
856  {
857  if(_row_dofs.components[0] == xother._row_dofs.components[0])
858  {
859  if(_row_dofs.components[1] > xother._row_dofs.components[1])
860  {
861  result = true;
862  }
863  else
864  {
865  if(_row_dofs.components[1] == xother._row_dofs.components[1])
866  {
867  if(_row_dofs.components[2] > xother._row_dofs.components[2])
868  {
869  result = true;
870  }
871  }
872  }
873  }
874  }
875 
876  // Postconditions:
877 
878 
879  // Exit:
880 
881  // cout << "Leaving e3::d_gt." << endl;
882  return result;
883 }
884 
885 bool
887 d_ge(const e3_lite& xother) const
888 {
889  // cout << endl << "Entering e3::d_ge." << endl;
890 
891  // Preconditions:
892 
893 
894  // Body:
895 
896  bool result = false;
897 
898  if(_row_dofs.components[0] > xother._row_dofs.components[0])
899  {
900  result = true;
901  }
902  else
903  {
904  if(_row_dofs.components[0] == xother._row_dofs.components[0])
905  {
906  if(_row_dofs.components[1] > xother._row_dofs.components[1])
907  {
908  result = true;
909  }
910  else
911  {
912  if(_row_dofs.components[1] == xother._row_dofs.components[1])
913  {
914  if(_row_dofs.components[2] > xother._row_dofs.components[2])
915  {
916  result = true;
917  }
918  else
919  {
920  if(_row_dofs.components[2] == xother._row_dofs.components[2])
921  {
922  result = true;
923  }
924  }
925  }
926  }
927  }
928  }
929 
930  // Postconditions:
931 
932 
933  // Exit:
934 
935  // cout << "Leaving e3::d_ge." << endl;
936  return result;
937 }
938 
939 
940 // PROTECTED MEMBER FUNCTIONS
941 
942 // PRIVATE MEMBER FUNCTIONS
943 
944 
945 //==============================================================================
946 // ABSTRACT POSET MEMBER FACET OF CLASS E3_LITE
947 //==============================================================================
948 
949 // PUBLIC MEMBER FUNCTIONS
950 
951 const std::string&
953 class_name() const
954 {
955  // Preconditions:
956 
957  // Body:
958 
959  const string& result = static_class_name();
960 
961  // Postconditions:
962 
963  ensure(!result.empty());
964 
965  // Exit:
966 
967  return result;
968 }
969 
970 const std::string&
973 {
974  // Preconditions:
975 
976  // Body:
977 
978  static const string result("e3_lite");
979 
980  // Postconditions:
981 
982  ensure(!result.empty());
983 
984  // Exit:
985 
986  return result;
987 }
988 
991 clone() const
992 {
993  e3_lite* result = 0;
994 
995  // Preconditions:
996 
997  // Body:
998 
999  result = new e3_lite();
1000 
1001  // Postconditions:
1002 
1003  ensure(result != 0);
1004  ensure(is_same_type(*result));
1005 
1006  // Exit:
1007 
1008  return result;
1009 }
1010 
1011 // PROTECTED MEMBER FUNCTIONS
1012 
1013 // PRIVATE MEMBER FUNCTIONS
1014 
1015 
1016 //==============================================================================
1017 // ANY FACET OF CLASS E3_LITE
1018 //==============================================================================
1019 
1020 // PUBLIC MEMBER FUNCTIONS
1021 
1022 bool
1024 is_ancestor_of(const any_lite& xother) const
1025 {
1026  // Preconditions:
1027 
1028  require(&xother != 0);
1029 
1030  // Body:
1031 
1032  // True if other conforms to this.
1033 
1034  bool result = dynamic_cast<const e3_lite*>(&xother) != 0;
1035 
1036  // Postconditions:
1037 
1038  return result;
1039 }
1040 
1041 bool
1043 invariant() const
1044 {
1045  bool result = true;
1046 
1047  if(invariant_check())
1048  {
1049  // Prevent recursive calls to invariant.
1050 
1051  disable_invariant_check();
1052 
1053  // Must satisfy base class invariant.
1054 
1055  invariance(ed_lite::invariant());
1056 
1057  // Invariances for this class:
1058 
1059  // Finished, turn invariant checking back on.
1060 
1061  enable_invariant_check();
1062  }
1063 
1064  // Exit
1065 
1066  return result;
1067 }
1068 
1069 void*
1072 {
1073  return &_row_dofs;
1074 }
1075 
1076 const void*
1078 row_dofs() const
1079 {
1080  return &_row_dofs;
1081 }
1082 
1083 // PROTECTED MEMBER FUNCTIONS
1084 
1085 // PRIVATE MEMBER FUNCTIONS
1086 
1087 
1088 //==============================================================================
1089 // CLASS E3
1090 //==============================================================================
1091 
1092 // ===========================================================
1093 // HOST FACTORY FACET OF CLASS E3
1094 // ===========================================================
1095 
1096 // PUBLIC MEMBER FUNCTIONS
1097 
1098 const sheaf::poset_path&
1101 {
1102  // Preconditions:
1103 
1104 
1105  // Body:
1106 
1107  static const poset_path result(standard_schema_poset_name(), "e3_schema");
1108 
1109  // Postconditions:
1110 
1111  // Exit:
1112 
1113  return result;
1114 }
1115 
1116 void
1119 {
1120  // Preconditions:
1121 
1122  require(xns.state_is_read_write_accessible());
1123  require(xns.contains_poset(standard_schema_poset_name()));
1124  require(!xns.contains_poset_member(standard_schema_path()));
1125 
1126  // Body:
1127 
1128  string lmember_names = "x DOUBLE false ";
1129  lmember_names += "y DOUBLE false ";
1130  lmember_names += "z DOUBLE false";
1131 
1132  schema_poset_member lschema(xns,
1133  standard_schema_path().member_name(),
1134  ed::standard_schema_path(),
1135  lmember_names,
1136  false);
1137 
1138  lschema.detach_from_state();
1139 
1140  // Postconditions:
1141 
1142  ensure(xns.contains_poset_member(standard_schema_path()));
1143 
1144  // Exit:
1145 
1146  return;
1147 }
1148 
1152  const poset_path& xhost_path,
1153  const poset_path& xschema_path,
1154  const poset_path& xscalar_space_path,
1155  bool xauto_access)
1156 {
1157  // cout << endl << "Entering e3::new_host." << endl;
1158 
1159  // Preconditions:
1160 
1161  require(xns.state_is_auto_read_write_accessible(xauto_access));
1162 
1163  require(!xhost_path.empty());
1164  require(!xns.contains_path(xhost_path, xauto_access));
1165 
1166  require(xschema_path.full());
1167  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
1168  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
1169  require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 3);
1170 
1171  require(xns.path_is_auto_read_accessible(xscalar_space_path, xauto_access));
1172  require(xns.contains_poset<scalar_type::host_type>(xscalar_space_path, xauto_access));
1173 
1174  // Body:
1175 
1176  host_type& result =
1177  host_type::new_table(xns, xhost_path, xschema_path, xscalar_space_path, xauto_access);
1178 
1179  // Postconditions:
1180 
1181  ensure(xns.owns(result, xauto_access));
1182  ensure(result.path(true) == xhost_path);
1183  ensure(result.state_is_not_read_accessible());
1184  ensure(result.schema(true).path(xauto_access) == xschema_path);
1185 
1186  ensure(result.factor_ct(true) == 3);
1187  ensure(result.d(true) == 3);
1188  ensure(result.scalar_space_path(true) == xscalar_space_path );
1189  ensure(result.p(true) == 1);
1190  ensure(result.dd(true) == 3);
1191  ensure(result.vector_space_path(true) == xhost_path );
1192 
1193  // Exit:
1194 
1195  // cout << "Leaving e3::new_host." << endl;
1196  return result;
1197 }
1198 
1201 standard_host(namespace_type& xns, const std::string& xsuffix, bool xauto_access)
1202 {
1203  // cout << endl << "Entering e3::new_host." << endl;
1204 
1205  // Preconditions:
1206 
1207  require(xns.state_is_auto_read_write_accessible(xauto_access));
1208 
1209  require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
1210  require(standard_host_is_available<e3>(xns, xsuffix, xauto_access));
1211 
1212  require(xns.path_is_auto_read_accessible(standard_schema_path(), xauto_access));
1213 
1214  require(xns.path_is_auto_read_available(standard_host_path<scalar_type>(xsuffix), xauto_access));
1215 
1216  // Body:
1217 
1218  // Create the scalar space if necessary.
1219 
1220  poset_path lscalar_space_path = scalar_type::standard_host(xns, xsuffix, xauto_access).path(true);
1221 
1222  poset_path lpath(standard_host_path<e3>(xsuffix));
1223 
1224  host_type* result_ptr;
1225  if(xns.contains_path(lpath, xauto_access))
1226  {
1227  result_ptr = &xns.member_poset<host_type>(lpath, xauto_access);
1228  }
1229  else
1230  {
1231  result_ptr = &new_host(xns, lpath, standard_schema_path(), lscalar_space_path, xauto_access);
1232  }
1233 
1234  host_type& result = *result_ptr;
1235 
1236  // Postconditions:
1237 
1238  ensure(xns.owns(result, xauto_access));
1239  ensure(result.path(true) == standard_host_path<e3>(xsuffix));
1240  ensure(result.state_is_not_read_accessible());
1241  ensure(result.schema(true).path(xauto_access) == standard_schema_path());
1242 
1243  ensure(result.factor_ct(true) == 3);
1244  ensure(result.d(true) == 3);
1245  ensure(result.scalar_space_path(true) == standard_host_path<scalar_type>(xsuffix) );
1246  ensure(result.p(true) == 1);
1247  ensure(result.dd(true) == 3);
1248  ensure(result.vector_space_path(true) == result.path(true));
1249 
1250  // Exit:
1251 
1252  // cout << "Leaving e3::new_host." << endl;
1253  return result;
1254 }
1255 
1256 // PROTECTED MEMBER FUNCTIONS
1257 
1258 // PRIVATE MEMBER FUNCTIONS
1259 
1260 
1261 //==============================================================================
1262 // EUCLIDEAN VECTOR ALGEBRA (E3) FACET OF CLASS E3
1263 //==============================================================================
1264 
1265 // PUBLIC MEMBER FUNCTIONS
1266 
1269 {
1270  // Preconditions:
1271 
1272  // Body:
1273 
1274  // Postconditions:
1275 
1276  ensure(invariant());
1277 
1278  // Exit:
1279 }
1280 
1282 e3(const poset_state_handle* xhost, pod_index_type xhub_id)
1283 {
1284  // Preconditions:
1285 
1286  require(xhost != 0);
1287  require(xhost->state_is_read_accessible());
1288  require(xhost->contains_member(xhub_id));
1289 
1290  // Body:
1291 
1292  attach_to_state(xhost, xhub_id);
1293 
1294  // Postconditions:
1295 
1296  ensure(invariant());
1297  // ensure(host() == xhost);
1298  ensure(index() == xhub_id);
1299  ensure(is_attached());
1300 }
1301 
1303 e3(const poset_state_handle* xhost, const scoped_index& xid)
1304 {
1305  // Preconditions:
1306 
1307  require(xhost != 0);
1308  require(xhost->state_is_read_accessible());
1309  require(xhost->contains_member(xid));
1310 
1311  // Body:
1312 
1313  attach_to_state(xhost, xid.hub_pod());
1314 
1315  // Postconditions:
1316 
1317  ensure(invariant());
1318  // ensure(host() == xhost);
1319  ensure(index() ==~ xid);
1320  ensure(is_attached());
1321 }
1322 
1324 e3(const poset_state_handle* xhost, const std::string& xname)
1325 {
1326 
1327  // Preconditions:
1328 
1329  require(xhost != 0);
1330  require(xhost->state_is_read_accessible());
1331  require(!xname.empty());
1332  require(xhost->contains_member(xname));
1333 
1334  // Body:
1335 
1336  attach_to_state(xhost, xname);
1337 
1338  // Postconditions:
1339 
1340  ensure(invariant());
1341  // ensure(host() == xhost);
1342  ensure(name() == xname);
1343  ensure(is_attached());
1344 
1345 }
1346 
1349 {
1350 
1351  // Preconditions:
1352 
1353  require(xother != 0);
1354 
1355  // Body:
1356 
1357  attach_to_state(xother);
1358 
1359  // Postconditions:
1360 
1361  ensure(invariant());
1362  ensure(is_attached());
1363  ensure(is_same_state(xother));
1364 
1365  // Exit:
1366 
1367 }
1368 
1370 e3(poset_state_handle* xhost, bool xauto_access)
1371 {
1372 
1373  // Preconditions:
1374 
1375  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
1376 
1377  // Body:
1378 
1379  new_jim_state(xhost, 0, false, xauto_access);
1380 
1381  // Postconditions:
1382 
1383  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
1384 
1385  // Exit:
1386 
1387  return;
1388 }
1389 
1392  const row_dofs_type& xrdt,
1393  bool xauto_access)
1394 {
1395 
1396  // Preconditions:
1397 
1398  require(precondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
1399 
1400  // Body:
1401 
1402  new_jim_state(&xhost, 0, false, xauto_access);
1403 
1404  if(xauto_access)
1405  {
1406  xhost.get_read_write_access();
1407  }
1408 
1409  *this = xrdt;
1410 
1411  if(xauto_access)
1412  {
1413  xhost.release_access();
1414  }
1415 
1416  // Postconditions:
1417 
1418  ensure(postcondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
1419 
1420  // Exit:
1421 
1422  return;
1423 }
1424 
1428 {
1429  // Preconditions:
1430 
1431  require(state_is_read_write_accessible());
1432 
1433  // Body:
1434 
1435  sheaf::row_dofs(*this) = xrdt;
1436 
1437  // Postconditions:
1438 
1439  ensure_for_all(i, 0, d(), component(i) == xrdt.components[i]);
1440 
1441  // Exit:
1442 
1443  return *this;
1444 
1445 }
1446 
1451 {
1452  // Preconditions:
1453 
1454  require(is_ancestor_of(&xother));
1455  require(precondition_of(attach_to_state(&xother)));
1456 
1457  // Body:
1458 
1459  attach_to_state(&xother);
1460 
1461  // Postconditions:
1462 
1463  ensure(postcondition_of(attach_to_state(&xother)));
1464 
1465  // Exit:
1466 
1467  return *this;
1468 }
1469 
1473 operator=(const e3& xother)
1474 {
1475  // Preconditions:
1476 
1477  require(precondition_of(attach_to_state(&xother)));
1478 
1479  // Body:
1480 
1481  attach_to_state(&xother);
1482 
1483  // Postconditions:
1484 
1485  ensure(postcondition_of(attach_to_state(&xother)));
1486 
1487  // Exit:
1488 
1489  return *this;
1490 }
1491 
1494 {
1495  // Preconditions:
1496 
1497  // Body:
1498 
1499  // Postconditions:
1500 
1501 }
1502 
1506 {
1507  // Preconditions:
1508 
1509  // Body:
1510 
1511  static const volatile_type result;
1512 
1513  // Postconditions:
1514 
1515  // Exit:
1516 
1517  return result;
1518 }
1519 
1523 lite_type() const
1524 {
1525  // Preconditions:
1526 
1527  // Body:
1528 
1529  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
1530 
1531  // Postconditions:
1532 
1533  // Exit:
1534 
1535  return result;
1536 }
1537 
1538 
1539 // PROTECTED MEMBER FUNCTIONS
1540 
1541 // PRIVATE MEMBER FUNCTIONS
1542 
1543 
1544 //==============================================================================
1545 // EUCLIDEAN VECTOR ALGEBRA (ED) FACET OF CLASS E3
1546 //==============================================================================
1547 
1548 // PUBLIC MEMBER FUNCTIONS
1549 
1550 // PROTECTED MEMBER FUNCTIONS
1551 
1552 // PRIVATE MEMBER FUNCTIONS
1553 
1554 
1555 //==============================================================================
1556 // EXTERIOR ALGEBRA (AT1) FACET OF CLASS E3
1557 //==============================================================================
1558 
1559 // PUBLIC MEMBER FUNCTIONS
1560 
1561 // PROTECTED MEMBER FUNCTIONS
1562 
1563 // PRIVATE MEMBER FUNCTIONS
1564 
1565 
1566 //==============================================================================
1567 // EXTERIOR ALGEBRA (ATP) FACET OF CLASS E3
1568 //==============================================================================
1569 
1570 // PUBLIC MEMBER FUNCTIONS
1571 
1572 // PROTECTED MEMBER FUNCTIONS
1573 
1574 // PRIVATE MEMBER FUNCTIONS
1575 
1576 
1577 //==============================================================================
1578 // TENSOR ALGEBRA (TP) FACET OF CLASS E3
1579 //==============================================================================
1580 
1581 // PUBLIC MEMBER FUNCTIONS
1582 
1583 // PROTECTED MEMBER FUNCTIONS
1584 
1585 // PRIVATE MEMBER FUNCTIONS
1586 
1587 
1588 //==============================================================================
1589 // VECTOR ALGEBRA (VD) FACET OF CLASS E3
1590 //==============================================================================
1591 
1592 // PUBLIC MEMBER FUNCTIONS
1593 
1594 void
1597 {
1598  // Preconditions:
1599 
1600  require(state_is_read_write_accessible());
1601 
1602  // Body:
1603 
1604  put_component(0, xcomp);
1605  put_component(1, ycomp);
1606  put_component(2, zcomp);
1607 
1608  // Postconditions:
1609 
1610  ensure(invariant());
1611  ensure(isunordered_or_equals(component(0), xcomp));
1612  ensure(isunordered_or_equals(component(1), ycomp));
1613  ensure(isunordered_or_equals(component(2), zcomp));
1614 
1615  // Exit:
1616 
1617  return;
1618 }
1619 
1620 fiber_bundle::e3::
1621 operator e3::row_dofs_type& ()
1622 {
1623  // Preconditions:
1624 
1625  // Body:
1626 
1627  row_dofs_type& result = sheaf::row_dofs(*this);
1628 
1629  // Postconditions:
1630 
1631  // Exit:
1632 
1633  return result;
1634 }
1635 
1636 fiber_bundle::e3::
1637 operator const e3::row_dofs_type& () const
1638 {
1639  // Preconditions:
1640 
1641  // Body:
1642 
1643  const row_dofs_type& result = sheaf::row_dofs(*this);
1644 
1645  // Postconditions:
1646 
1647  // Exit:
1648 
1649  return result;
1650 }
1651 
1652 // PROTECTED MEMBER FUNCTIONS
1653 
1654 // PRIVATE MEMBER FUNCTIONS
1655 
1656 
1657 //==============================================================================
1658 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS E3
1659 //==============================================================================
1660 
1661 // PUBLIC MEMBER FUNCTIONS
1662 
1665 new_tp(tp_space& xvector_space, int xp)
1666 {
1667  // Preconditions:
1668 
1669  require(xvector_space.state_is_read_accessible());
1670  require((0 <= xp) && (xp <= 4));
1671 
1672  // Body:
1673 
1674  //============================================================================
1675 
1676  namespace_poset* lns = xvector_space.name_space();
1677  const string& lvector_space_name = xvector_space.name();
1678 
1679  switch(xp)
1680  {
1681  case 0:
1682  {
1683  const string lname =
1684  create_tensor_space_name(lvector_space_name, "at0");
1685  at0::host_type& lhost = lns->member_poset<at0::host_type>(lname, false);
1686  at0* result = new at0(&lhost);
1687  return result;
1688  }
1689 
1690  case 1:
1691  {
1692  const string lname =
1693  create_tensor_space_name(lvector_space_name, "e3");
1694  e3::host_type& lhost = lns->member_poset<e3::host_type>(lname, false);
1695  e3* result = new e3(&lhost);
1696  return result;
1697  }
1698 
1699  case 2:
1700  {
1701  const string lname =
1702  create_tensor_space_name(lvector_space_name, "t2_e3");
1703  t2_e3::host_type& lhost = lns->member_poset<t2_e3::host_type>(lname, false);
1704  t2_e3* result = new t2_e3(&lhost);
1705  return result;
1706  }
1707 
1708  case 3:
1709  {
1710  const string lname =
1711  create_tensor_space_name(lvector_space_name, "t3_e3");
1712  t3_e3::host_type& lhost = lns->member_poset<t3_e3::host_type>(lname, false);
1713  t3_e3* result = new t3_e3(&lhost);
1714  return result;
1715  }
1716 
1717  case 4:
1718  {
1719  const string lname =
1720  create_tensor_space_name(lvector_space_name, "t4_e3");
1721  t4_e3::host_type& lhost = lns->member_poset<t4_e3::host_type>(lname, false);
1722  t4_e3* result = new t4_e3(&lhost);
1723  return result;
1724  }
1725 
1726  default:
1727  // Can't get here because of the precondition.
1728  return 0;
1729 
1730  }
1731 
1732  // Postconditions:
1733 
1734  ensure(unexecutable("result.p() == xp"));
1735 
1736  // Exit:
1737 }
1738 
1741 new_atp(tp_space& xvector_space, int xp)
1742 {
1743  // Preconditions:
1744 
1745  require(xvector_space.state_is_read_accessible());
1746  require((0 <= xp) && (xp <= 3));
1747 
1748  // Body:
1749 
1750  namespace_poset* lns = xvector_space.name_space();
1751  const string& lvector_space_name = xvector_space.name();
1752 
1753  switch(xp)
1754  {
1755  case 0:
1756  {
1757  const string lname =
1758  create_tensor_space_name(lvector_space_name, "at0");
1759  at0::host_type& lhost = lns->member_poset<at0::host_type>(lname, false);
1760  at0* result = new at0(&lhost);
1761  return result;
1762  }
1763 
1764  case 1:
1765  {
1766  const string lname =
1767  create_tensor_space_name(lvector_space_name, "e3");
1768  e3::host_type& lhost = lns->member_poset<e3::host_type>(lname, false);
1769  e3* result = new e3(&lhost);
1770  return result;
1771  }
1772 
1773  case 2:
1774  {
1775  const string lname =
1776  create_tensor_space_name(lvector_space_name, "at2_e3");
1777  at2_e3::host_type& lhost = lns->member_poset<at2_e3::host_type>(lname, false);
1778  at2_e3* result = new at2_e3(&lhost);
1779  return result;
1780  }
1781 
1782  case 3:
1783  {
1784  const string lname =
1785  create_tensor_space_name(lvector_space_name, "at3_e3");
1786  at3_e3::host_type& lhost = lns->member_poset<at3_e3::host_type>(lname, false);
1787  at3_e3* result = new at3_e3(&lhost);
1788  return result;
1789  }
1790 
1791  default:
1792  // Can't get here because of the precondition.
1793  return 0;
1794  }
1795 
1796  // Postconditions:
1797 
1798  ensure(unexecutable("result.p() == xp"));
1799 
1800  // Exit:
1801 }
1802 
1803 
1806 new_stp(tp_space& xvector_space, int xp)
1807 {
1808  // Preconditions:
1809 
1810  require(xvector_space.state_is_read_accessible());
1811  require((2 <= xp) && (xp <= 4));
1812 
1813  // Body:
1814 
1815  namespace_poset* lns = xvector_space.name_space();
1816  const string& lvector_space_name = xvector_space.name();
1817 
1818  switch(xp)
1819  {
1820  case 2:
1821  {
1822  const string lname =
1823  create_tensor_space_name(lvector_space_name, "st2_e3");
1824  st2_e3::host_type& lhost = lns->member_poset<st2_e3::host_type>(lname, false);
1825  st2_e3* result = new st2_e3(&lhost);
1826  return result;
1827  }
1828 
1829  case 3:
1830  {
1831  const string lname =
1832  create_tensor_space_name(lvector_space_name, "st3_e3");
1833  st3_e3::host_type& lhost = lns->member_poset<st3_e3::host_type>(lname, false);
1834  st3_e3* result = new st3_e3(&lhost);
1835  return result;
1836  }
1837 
1838  case 4:
1839  {
1840  const string lname =
1841  create_tensor_space_name(lvector_space_name, "st4_e3");
1842  st4_e3::host_type& lhost = lns->member_poset<st4_e3::host_type>(lname, false);
1843  st4_e3* result = new st4_e3(&lhost);
1844  return result;
1845  }
1846 
1847  default:
1848  // Can't get here because of the precondition.
1849  return 0;
1850 
1851  }
1852 
1853  // Postconditions:
1854 
1855  ensure(unexecutable("result.p() == xp"));
1856 
1857  // Exit:
1858 }
1859 
1862 new_tp(int xp, bool xauto_access) const
1863 {
1864  // Preconditions:
1865 
1866  require(precondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1867 
1868  // Body:
1869 
1870  tp* result = e3::new_tp(vector_space(xauto_access), xp);
1871 
1872  // Postconditions:
1873 
1874  ensure(postcondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1875 
1876  // Exit:
1877 
1878  return result;
1879 }
1880 
1883 new_atp(int xp, bool xauto_access) const
1884 {
1885  // Preconditions:
1886 
1887  require(precondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1888 
1889  // Body:
1890 
1891  atp* result = e3::new_atp(vector_space(xauto_access), xp);
1892 
1893  // Postconditions:
1894 
1895  ensure(postcondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1896 
1897  // Exit:
1898 
1899  return result;
1900 }
1901 
1904 new_stp(int xp, bool xauto_access) const
1905 {
1906  // Preconditions:
1907 
1908  require(precondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1909 
1910  // Body:
1911 
1912  stp* result = e3::new_stp(vector_space(xauto_access), xp);
1913 
1914  // Postconditions:
1915 
1916  ensure(postcondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1917 
1918  // Exit:
1919 
1920  return result;
1921 }
1922 
1923 // PROTECTED MEMBER FUNCTIONS
1924 
1925 // PRIVATE MEMBER FUNCTIONS
1926 
1927 
1928 //==============================================================================
1929 // ABSTRACT POSET MEMBER FACET OF CLASS E3
1930 //==============================================================================
1931 
1932 // PUBLIC MEMBER FUNCTIONS
1933 
1934 const std::string&
1936 class_name() const
1937 {
1938  // Preconditions:
1939 
1940  // Body:
1941 
1942  const string& result = static_class_name();
1943 
1944  // Postconditions:
1945 
1946  ensure(!result.empty());
1947 
1948  // Exit:
1949 
1950  return result;
1951 }
1952 
1953 const std::string&
1956 {
1957  // Preconditions:
1958 
1959  // Body:
1960 
1961  static const string result("e3");
1962 
1963  // Postconditions:
1964 
1965  ensure(!result.empty());
1966 
1967  // Exit:
1968 
1969  return result;
1970 }
1971 
1974 clone() const
1975 {
1976 
1977  // Preconditions:
1978 
1979  // Body:
1980 
1981  // Create new handle of the current class.
1982 
1983  e3* result = new e3();
1984 
1985  // Postconditions:
1986 
1987  ensure(result != 0);
1988  ensure(result->invariant());
1989 
1990  // Exit:
1991 
1992  return result;
1993 
1994 }
1995 
1996 // PROTECTED MEMBER FUNCTIONS
1997 
1998 // PRIVATE MEMBER FUNCTIONS
1999 
2000 
2001 //==============================================================================
2002 // ANY FACET OF CLASS E3
2003 //==============================================================================
2004 
2005 // PUBLIC MEMBER FUNCTIONS
2006 
2007 bool
2009 is_ancestor_of(const any* xother) const
2010 {
2011 
2012  // Preconditions:
2013 
2014  require(xother != 0);
2015 
2016  // Body:
2017 
2018  // If other may be dynamically cast to the type of this then this is an
2019  // ancestor of other.
2020 
2021  bool result = dynamic_cast<const e3*>(xother) != 0;
2022 
2023  // Postconditions:
2024 
2025  // ensure(invariant());
2026 
2027  // Exit:
2028 
2029  return result;
2030 
2031 }
2032 
2033 bool
2035 invariant() const
2036 {
2037  bool result = true;
2038 
2039  // Preconditions:
2040 
2041  // Body:
2042 
2043  // Must satisfy base class invariant.
2044 
2045  invariance(ed::invariant());
2046 
2047  if(invariant_check())
2048  {
2049  // Prevent recursive calls to invariant.
2050 
2051  disable_invariant_check();
2052 
2053  invariance((is_attached() ? d() == 3 : true));
2054 
2055  // Finished, turn invariant checking back on.
2056 
2057  enable_invariant_check();
2058  }
2059 
2060  // Postconditions:
2061 
2062  ensure(is_derived_query);
2063 
2064  // Exit:
2065 
2066  return result;
2067 }
2068 
2069 // PROTECTED MEMBER FUNCTIONS
2070 
2071 // PRIVATE MEMBER FUNCTIONS
2072 
2073 
2074 //==============================================================================
2075 // NON-MEMBER FUNCTIONS
2076 //==============================================================================
2077 
2078 size_t
2079 fiber_bundle::
2080 deep_size(const e3_lite& x0, bool xinclude_shallow)
2081 {
2082  size_t result;
2083 
2084  // Preconditions:
2085 
2086  // Body:
2087 
2090 
2091  result = 0;
2092 
2093  // Postconditions:
2094 
2095  ensure(result == 0);
2096  //ensure(result >= 0);
2097 
2098  // Exit
2099 
2100  return result;
2101 }
2102 
2103 //==============================================================================
2104 // E3 FACET:
2105 //==============================================================================
2106 
2107 // PUBLIC MEMBER FUNCTIONS
2108 
2109 void
2110 SHEAF_DLL_SPEC
2112 cross(const e3& x0, const e3& x1, e3& xresult, bool xauto_access)
2113 {
2114  // Preconditions:
2115 
2116  require(x0.state_is_auto_read_accessible(xauto_access));
2117  require(x1.state_is_auto_read_accessible(xauto_access));
2118  require(xresult.state_is_auto_read_write_accessible(xauto_access));
2119  require(x0.d(xauto_access) >= xresult.d(xauto_access));
2120  require(x1.d(xauto_access) >= xresult.d(xauto_access));
2121  require(x0.is_p_form(xauto_access) == x1.is_p_form(xauto_access));
2122 
2123  // Body:
2124 
2125  if(xauto_access)
2126  {
2127  x0.get_read_access();
2128  x1.get_read_access();
2129  xresult.get_read_write_access(true);
2130  }
2131 
2132  // Body:
2133 
2134  vd_value_type a0 = x0.component(0);
2135  vd_value_type a1 = x0.component(1);
2136  vd_value_type a2 = x0.component(2);
2137 
2138  vd_value_type b0 = x1.component(0);
2139  vd_value_type b1 = x1.component(1);
2140  vd_value_type b2 = x1.component(2);
2141 
2142  xresult.put_component(0, a1*b2 - a2*b1);
2143  xresult.put_component(1, a2*b0 - a0*b2);
2144  xresult.put_component(2, a0*b1 - a1*b0);
2145 
2146  // Set the variance of the result.
2147 
2148  x0.is_p_form(false) ? xresult.put_is_p_form(false)
2149  : xresult.put_is_p_vector(false);
2150 
2151  if(xauto_access)
2152  {
2153  x0.release_access();
2154  x1.release_access();
2155  xresult.release_access();
2156  }
2157 
2158  // Postconditions:
2159 
2160  ensure(xresult.is_p_form(xauto_access) == x0.is_p_form(xauto_access));
2161  ensure(unexecutable("result == x0 cross x1"));
2162 
2163  // Exit:
2164 }
2165 
2166 void
2167 SHEAF_DLL_SPEC
2169 cross_equal(e3& xresult, const e3& xother, bool xauto_access)
2170 {
2171  // Preconditions:
2172 
2173  require(precondition_of(cross(xresult, xother, xresult, xauto_access)));
2174 
2175  // Body:
2176 
2177  cross(xresult, xother, xresult, xauto_access);
2178 
2179  // Postconditions:
2180 
2181  ensure(postcondition_of(cross(xresult, xother, xresult, xauto_access)));
2182 
2183  // Exit:
2184 }
2185 
2186 
2189 cross(const e3_lite& x0, const e3_lite& x1)
2190 {
2191  // Preconditions:
2192 
2193  // Body:
2194 
2195  e3_lite* result = x0.clone();
2196  cross(x0, x1, *result);
2197 
2198  // Postconditions:
2199 
2200  // Exit:
2201 
2202  return result;
2203 }
2204 
2205 void
2206 SHEAF_DLL_SPEC
2208 cross(const e3_lite& x0, const e3_lite& x1, e3_lite& xresult)
2209 {
2210  // Preconditions:
2211 
2212  // Body:
2213 
2214  vd_value_type a0 = x0.component(0);
2215  vd_value_type a1 = x0.component(1);
2216  vd_value_type a2 = x0.component(2);
2217 
2218  vd_value_type b0 = x1.component(0);
2219  vd_value_type b1 = x1.component(1);
2220  vd_value_type b2 = x1.component(2);
2221 
2222  xresult.put_component(0, a1*b2 - a2*b1);
2223  xresult.put_component(1, a2*b0 - a0*b2);
2224  xresult.put_component(2, a0*b1 - a1*b0);
2225 
2226  // Postconditions:
2227 
2228  // Exit:
2229 }
2230 
2231 void
2233 cross_equal(e3_lite& xresult, const e3_lite& xother)
2234 {
2235  // Preconditions:
2236 
2237  // Body:
2238 
2239  e3_lite x0 = xresult;
2240  cross(x0, xother, xresult);
2241 
2242  // Postconditions:
2243 
2244  // Exit:
2245 }
2246 
2249 operator^(const e3_lite& x0, const e3_lite& x1)
2250 {
2251  // Preconditions:
2252 
2253  // Body:
2254 
2255  e3_lite* result = cross(x0, x1);
2256 
2257  // Postconditions:
2258 
2259  // Exit:
2260 
2261  return result;
2262 }
2263 
2266 operator^=(e3_lite& xresult, const e3_lite& xother)
2267 {
2268  // Preconditions:
2269 
2270  // Body:
2271 
2272  cross_equal(xresult, xother);
2273 
2274  // Postconditions:
2275 
2276  // Exit:
2277 
2278  return xresult;
2279 }
2280 
2281 void
2283 transform_basis_by(e3_lite& xv, const gl3_lite& xtransform, bool is_contravariant)
2284 {
2285 
2286  // Preconditions:
2287 
2288  require(xtransform.n() == xv.d());
2289 
2290  // Body:
2291 
2293 
2295 
2296  // Notation:
2297  //
2298  // Let the current basis be f-hat, considered as a row of vectors
2299  // with f-hat[i] the i-th basis vector. Similary, let e-hat be the
2300  // new basis. Let B be the matrix of the transform xtransform,
2301  // defined such that the i-th column, B[*][i] contains
2302  // the components of e-hat[i] with respect to f-hat.
2303  //
2304  // Given a covector V, let the components w.r.t. f-hat be represented
2305  // by a column vector, denoted Vf[k], where k is a row index.
2306  // Then the components w.r.t. e-hat are given by:
2307  //
2308  // Ve[m] = sum k{ B[k][m]*Vf[k] }
2309  //
2310  // For a (contravariant) vector, the transform is:
2311  //
2312  // Ve[m] = sum k{ C[m][k]*Vf[k] }
2313  //
2314  // where C is the inverse of B.
2315 
2316  // Get the row dof tuple
2317 
2318  e3_lite::value_type Ve[3];
2319 
2320  // Get the transform matrix
2321 
2327 
2328  //@todo Fix this when we can handle the variance.
2329 
2330  if(!is_contravariant)
2331  {
2332  // Covariant case.
2333 
2334  const gl3_lite::matrix_type& B = xtransform.basis_matrix();
2335 
2336  // Transform the components.
2337 
2338  for(int m=0; m<3; ++m)
2339  {
2340  Ve[m] = 0;
2341  for(int k=0; k<3; ++k)
2342  {
2343  Ve[m] += B[k][m]*xv[k];
2344  }
2345  }
2346  }
2347  else
2348  {
2349  // Contravariant case
2350 
2351  const gl3_lite::matrix_type& C = xtransform.component_matrix();
2352 
2353  // Transform the components.
2354 
2355  for(int m=0; m<3; ++m)
2356  {
2357  Ve[m] = 0;
2358  for(int k=0; k<3; ++k)
2359  {
2360  Ve[m] += C[m][k]*xv[k];
2361  }
2362  }
2363  }
2364 
2365  // Transfer the transformed components back onto the dof tuple.
2366 
2367  for(int i=0; i<3; ++i)
2368  {
2369  xv[i] = Ve[i];
2370  }
2371 
2372  // Postconditions:
2373 
2374  // Exit:
2375 
2376 }
2377 
2378 
2379 void
2381 add(const e3_lite& x0, const e3_lite& x1, vd_value_type xt, e3_lite& xresult)
2382 {
2383  // Preconditions:
2384 
2385  require(x0.d() >= xresult.d());
2386  require(x1.d() >= xresult.d());
2387 
2388  // Body:
2389 
2390  vd_value_type lone_minus_t = 1.0 - xt;
2391 
2392  const e3_lite::row_dofs_type& lx0 = x0;
2393  const e3_lite::row_dofs_type& lx1 = x1;
2394  e3_lite::row_dofs_type& lresult = xresult;
2395 
2396  lresult.components[0] = lx0.components[0]*lone_minus_t + lx1.components[0]*xt;
2397  lresult.components[1] = lx0.components[1]*lone_minus_t + lx1.components[1]*xt;
2398  lresult.components[2] = lx0.components[2]*lone_minus_t + lx1.components[2]*xt;
2399 
2400  // Postconditions:
2401 
2402  ensure(unexecutable("for_all: i, 0, xresult.d(), \
2403  xresult.component(i) == old_x0.component(i)*(1.0 - xt) + old_x1.component(i)*xt"));
2404 
2405  // Exit:
2406 
2407 }
2408 
2409 // ===========================================================
2410 // VECTOR ALGEBRA: TOLERANCE COMPARISON
2411 // ===========================================================
2412 
2413 
2414 
2415 bool
2417 a_eql(const e3_lite& x0, const e3_lite& x1)
2418 {
2419  // Preconditions:
2420 
2421  require(x0.d() == x1.d());
2422 
2423  // Body:
2424 
2425  const e3_lite::row_dofs_type& lx0 = x0;
2426  const e3_lite::row_dofs_type& lx1 = x1;
2427 
2428  bool result =
2429  sheaf::a_eql(lx0.components[0], lx1.components[0], double_tolerance) &&
2430  sheaf::a_eql(lx0.components[1], lx1.components[1], double_tolerance) &&
2431  sheaf::a_eql(lx0.components[2], lx1.components[2], double_tolerance);
2432 
2433  // Postconditions:
2434 
2435  // Exit:
2436 
2437  return result;
2438 };
2439 
2440 bool
2442 a_eql(const e3_lite& x0, const e3_lite& x1, double xtolerance)
2443 {
2444  // Preconditions:
2445 
2446  require(x0.d() == x1.d());
2447 
2448  // Body:
2449 
2450  const e3_lite::row_dofs_type& lx0 = x0;
2451  const e3_lite::row_dofs_type& lx1 = x1;
2452 
2453  bool result =
2454  sheaf::a_eql(lx0.components[0], lx1.components[0], xtolerance) &&
2455  sheaf::a_eql(lx0.components[1], lx1.components[1], xtolerance) &&
2456  sheaf::a_eql(lx0.components[2], lx1.components[2], xtolerance);
2457 
2458  // Postconditions:
2459 
2460  // Exit:
2461 
2462  return result;
2463 };
2464 
2465 bool
2467 a_eql(const e3_lite& x0, const e3_lite& x1, const e3_lite& xtolerance)
2468 {
2469  // Preconditions:
2470 
2471  require(x0.d() == x1.d());
2472 
2473  // Body:
2474 
2475  const e3_lite::row_dofs_type& lx0 = x0;
2476  const e3_lite::row_dofs_type& lx1 = x1;
2477  const e3_lite::row_dofs_type& lt = xtolerance;
2478 
2479  bool result =
2480  sheaf::a_eql(lx0.components[0], lx1.components[0], lt[0]) &&
2481  sheaf::a_eql(lx0.components[1], lx1.components[1], lt[1]) &&
2482  sheaf::a_eql(lx0.components[2], lx1.components[2], lt[2]);
2483 
2484  // Postconditions:
2485 
2486  // Exit:
2487 
2488  return result;
2489 };
2490 
2491 bool
2493 r_eql(const e3_lite& x0, const e3_lite& x1)
2494 {
2495  // Preconditions:
2496 
2497  require(x0.d() == x1.d());
2498 
2499  // Body:
2500 
2501  const e3_lite::row_dofs_type& lx0 = x0;
2502  const e3_lite::row_dofs_type& lx1 = x1;
2503 
2504  bool result =
2505  sheaf::r_eql(lx0.components[0], lx1.components[0], double_tolerance) &&
2506  sheaf::r_eql(lx0.components[1], lx1.components[1], double_tolerance) &&
2507  sheaf::r_eql(lx0.components[2], lx1.components[2], double_tolerance);
2508 
2509  // Postconditions:
2510 
2511  // Exit:
2512 
2513  return result;
2514 };
2515 
2516 bool
2518 r_eql(const e3_lite& x0, const e3_lite& x1, double xtolerance)
2519 {
2520  // Preconditions:
2521 
2522  require(x0.d() == x1.d());
2523 
2524  // Body:
2525 
2526  const e3_lite::row_dofs_type& lx0 = x0;
2527  const e3_lite::row_dofs_type& lx1 = x1;
2528 
2529  bool result =
2530  sheaf::r_eql(lx0.components[0], lx1.components[0], xtolerance) &&
2531  sheaf::r_eql(lx0.components[1], lx1.components[1], xtolerance) &&
2532  sheaf::r_eql(lx0.components[2], lx1.components[2], xtolerance);
2533 
2534  // Postconditions:
2535 
2536  // Exit:
2537 
2538  return result;
2539 };
2540 
2541 bool
2543 r_eql(const e3_lite& x0, const e3_lite& x1, const e3_lite& xtolerance)
2544 {
2545  // Preconditions:
2546 
2547  require(x0.d() == x1.d());
2548 
2549  // Body:
2550 
2551  const e3_lite::row_dofs_type& lx0 = x0;
2552  const e3_lite::row_dofs_type& lx1 = x1;
2553  const e3_lite::row_dofs_type& lt = xtolerance;
2554 
2555  bool result =
2556  sheaf::r_eql(lx0.components[0], lx1.components[0], lt[0]) &&
2557  sheaf::r_eql(lx0.components[1], lx1.components[1], lt[1]) &&
2558  sheaf::r_eql(lx0.components[2], lx1.components[2], lt[2]);
2559 
2560  // Postconditions:
2561 
2562  // Exit:
2563 
2564  return result;
2565 };
2566 
2567 bool
2569 c_eql(const e3_lite& x0, const e3_lite& x1)
2570 {
2571  // Preconditions:
2572 
2573  require(x0.d() == x1.d());
2574 
2575  // Body:
2576 
2577  const e3_lite::row_dofs_type& lx0 = x0;
2578  const e3_lite::row_dofs_type& lx1 = x1;
2579 
2580  bool result =
2581  sheaf::c_eql(lx0.components[0], lx1.components[0], double_tolerance) &&
2582  sheaf::c_eql(lx0.components[1], lx1.components[1], double_tolerance) &&
2583  sheaf::c_eql(lx0.components[2], lx1.components[2], double_tolerance);
2584 
2585  // Postconditions:
2586 
2587  // Exit:
2588 
2589  return result;
2590 };
2591 
2592 bool
2594 c_eql(const e3_lite& x0, const e3_lite& x1, double xtolerance)
2595 {
2596  // Preconditions:
2597 
2598  require(x0.d() == x1.d());
2599 
2600  // Body:
2601 
2602  const e3_lite::row_dofs_type& lx0 = x0;
2603  const e3_lite::row_dofs_type& lx1 = x1;
2604 
2605  bool result =
2606  sheaf::c_eql(lx0.components[0], lx1.components[0], xtolerance) &&
2607  sheaf::c_eql(lx0.components[1], lx1.components[1], xtolerance) &&
2608  sheaf::c_eql(lx0.components[2], lx1.components[2], xtolerance);
2609 
2610  // Postconditions:
2611 
2612  // Exit:
2613 
2614  return result;
2615 };
2616 
2617 bool
2619 c_eql(const e3_lite& x0, const e3_lite& x1, const e3_lite& xtolerance)
2620 {
2621  // Preconditions:
2622 
2623  require(x0.d() == x1.d());
2624 
2625  // Body:
2626 
2627  const e3_lite::row_dofs_type& lx0 = x0;
2628  const e3_lite::row_dofs_type& lx1 = x1;
2629  const e3_lite::row_dofs_type& lt = xtolerance;
2630 
2631  bool result =
2632  sheaf::c_eql(lx0.components[0], lx1.components[0], lt[0]) &&
2633  sheaf::c_eql(lx0.components[1], lx1.components[1], lt[1]) &&
2634  sheaf::c_eql(lx0.components[2], lx1.components[2], lt[2]);
2635 
2636  // Postconditions:
2637 
2638  // Exit:
2639 
2640  return result;
2641 };
2642 
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
virtual int n() const
Dimension of the representation space; n in GL(n, R).
Definition: gl3.cc:671
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 ...
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
Definition: gl3.cc:254
SHEAF_DLL_SPEC void add(const e3_lite &x0, const e3_lite &x1, vd_value_type xt, e3_lite &xresult)
Weighted sum x0*(1-xt) + x1*xt (pre-allocated version for volatile types).
Definition: e3.cc:2381
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: e3.cc:1100
bool d_le(const e3_lite &xother) const
Dictionary (lexicographic) order less than or equal comparison.
Definition: e3.cc:786
A symmetric tensor of degree p over an abstract vector space.
Definition: stp.h:190
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: vd.h:129
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
static stp * new_stp(tp_space &xvector_space, int xp)
Static constructor for symmetric tensors of degree xp over vector space xvector_space.
Definition: e3.cc:1806
row_dofs_type _row_dofs
Row_dofs_type.
Definition: e3.h:201
SHEAF_DLL_SPEC bool r_eql(const e3_lite &x0, const e3_lite &x1)
Relative equality comparison of e3_lite x0 to e3_lite x1 using tolerance double_tolerance.
Definition: e3.cc:2493
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 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 void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: e3.cc:1118
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
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...
static tp * new_tp(tp_space &xvector_space, int xp)
Static constructor for general tensors of degree xp over vector space xvector_space.
Definition: e3.cc:1665
bool c_lt(const e3_lite &xother) const
Cartesian order less than comparison.
Definition: e3.cc:631
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...
virtual void * row_dofs()
The row dofs for this instance (mutable version).
Definition: e3.cc:1071
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.
bool invariant() const
Class invariant.
Definition: e3.cc:2035
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 void components(dof_type xresult[], int comps_dimension) const
The values of all the components (preallocated version).
Definition: vd.cc:252
STL namespace.
value_type component(int xindex) const
The xindex-th component.
Definition: vd.cc:209
A tensor of degree 2 over a Euclidean vector space of dimension 3 (persistent version).
Definition: t2_e3.h:457
virtual ~e3_lite()
Destructor.
Definition: e3.cc:114
virtual void get_read_access() const
Get read access to the state associated with this.
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
static atp * new_atp(tp_space &xvector_space, int xp)
Static constructor for antisymmetric tensors of degree xp over vector space xvector_space.
Definition: e3.cc:1741
A symmetric rank 4 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: st4_e3.h:134
SHEAF_DLL_SPEC void transform_basis_by(e3_lite &xv, const gl3_lite &xtransform, bool is_contravariant=true)
Transform the basis and components of xv by xtransform.
Definition: e3.cc:2283
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: e3.cc:1024
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
Definition: gl3.cc:288
Euclidean vector space of dimension 3 (persistent version).
Definition: e3.h:467
T components[3]
The components (row_dofs).
Definition: e3.h:101
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
e3()
Default constructor.
Definition: e3.cc:1268
void SHEAF_DLL_SPEC cross_equal(e3 &xresult, const e3 &xother, bool xauto_access)
The 3D Euclidean vector "cross" product of xresult with xother (self-allocated version).
Definition: e3.cc:2169
e3_lite()
Default constructor.
Definition: e3.cc:58
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
Definition: atp.h:44
A general tensor of "degree" p and given "variance" over an abstract vector space.
Definition: tp.h:253
bool c_gt(const e3_lite &xother) const
Cartesian order greater than comparison.
Definition: e3.cc:685
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
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
A tensor of degree 3 over a Euclidean vector space of dimension 3 (volatile version).
Definition: t3_e3.h:151
bool operator==(const e3_lite &xother) const
True if this has the same components as xother.
Definition: e3.cc:344
virtual e3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: e3.cc:991
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: e3.cc:1523
SHEAF_DLL_SPEC bool c_eql(float xf0, float xf1)
Combined equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
SHEAF_DLL_SPEC bool c_eql(const e3_lite &x0, const e3_lite &x1)
Combined equality equality comparison of e3_lite x0 to e3_lite x1 using tolerance double_tolerance...
Definition: e3.cc:2569
static const std::string & static_class_name()
The name of this class.
Definition: e3.cc:972
A space of scalars viewed as an antisymmetric tensor space of degree 0.
Definition: at0_space.h:42
static host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path<e3>(xsuffix). Returns the host if it already exists...
Definition: e3.cc:1201
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...
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 3 (volatile version)...
Definition: st2_e3.h:148
virtual const atp_lite & atp_prototype(int xp) const
Prototype for antisymmetric tensors of degree xp over this vector space.
Definition: e3.cc:535
virtual int dd() const
Dimension of the underlying vector space.
Definition: e3.cc:313
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)
~e3()
Destructor.
Definition: e3.cc:1493
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
static const atp_lite & static_atp_prototype(int xp)
Static prototype for antisymmetric tensors of degree xp over this vector space.
Definition: e3.cc:488
bool d_lt(const e3_lite &xother) const
Dictionary (lexicographic) order less than comparison.
Definition: e3.cc:739
A scalar viewed as an antisymmetric tensor of degree 0. As the degree is 0 there is nothing to be sym...
Definition: at0.h:424
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
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 const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: e3.cc:1505
static const std::string & static_class_name()
The name of this class.
Definition: e3.cc:1955
const double double_tolerance
Tolerance for double comparisons.
static const stp_lite & static_stp_prototype(int xp)
Static prototype for symmetric tensors of degree xp over this vector space.
Definition: e3.cc:556
SHEAF_DLL_SPEC bool a_eql(const e3_lite &x0, const e3_lite &x1)
Absolute equality comparison of e3_lite x0 to e3_lite x1 using tolerance double_tolerance.
Definition: e3.cc:2417
virtual value_type component(int xindex) const
The value of the xi-th component.
Definition: vd.cc:1115
gl3_row_dofs_type< double >::matrix_type matrix_type
The type of the associated matrix.
Definition: gl3.h:202
virtual int d() const
Dimension of this as a vector space.
Definition: atp.cc:161
virtual std::string name() const
The name of this poset.
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
virtual const std::string & class_name() const
The name of this class.
Definition: e3.cc:953
A tensor of degree 2 over a Euclidean vector space of dimension 3 (volatile version).
Definition: t2_e3.h:151
virtual const tp_lite & tp_prototype(int xp) const
Prototype for general tensors of degree xp over this vector space.
Definition: e3.cc:467
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
The mathematical group GL(3, R). The group of all invertible, linear transformations on the R3...
Definition: gl3.h:183
bool c_le(const e3_lite &xother) const
Cartesian order less than or equal comparison.
Definition: e3.cc:658
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
bool path_is_auto_read_available(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath does not exist or exists and is auto read accessible.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
Definition: vd_space.cc:250
bool d_gt(const e3_lite &xother) const
Dictionary (lexicographic) order greater than comparison.
Definition: e3.cc:840
e3_lite & operator=(const e3_lite &xother)
Copy assignment operator.
Definition: e3.cc:90
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xscalar_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: e3.cc:1151
namespace_poset * name_space() const
The namespace this poset resides in.
void SHEAF_DLL_SPEC cross(const e3 &x0, const e3 &x1, e3 &xresult, bool xauto_access)
The 3D Euclidean vector "cross" product of x0 with x1 (pre-allocated version).
Definition: e3.cc:2112
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
void put_component(int xindex, value_type xcomp)
Set the xindex-th component to xcomp.
Definition: vd.cc:230
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
virtual e3 * clone() const
Make a new handle, no state instance of current.
Definition: e3.cc:1974
static const tp_lite & static_tp_prototype(int xp)
Static prototype for general tensors of degree xp over this vector space.
Definition: e3.cc:415
SHEAF_DLL_SPEC e3_lite * operator^(const e3_lite &x0, const e3_lite &x1)
The 3D Euclidean vector "cross" product of x0 with x1 (auto-allocated version).
Definition: e3.cc:2249
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
SHEAF_DLL_SPEC bool r_eql(float xf0, float xf1)
Relative equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
Definition: e3.cc:2009
int dd() const
The dimension of the underlying ("domain") vector space.
Definition: tp_space.cc:317
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
virtual void put_components(dof_type x_comp, dof_type y_comp, dof_type z_comp)
Set values of the components to the given arguments.
Definition: e3.cc:1596
virtual int d() const
Dimension of this as a vector space.
Definition: vd.cc:1017
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: at2_e3.h:142
e3 & operator=(const row_dofs_type &xrdt)
Assignment to an instance of the associated row dofs type.
Definition: e3.cc:1427
SHEAF_DLL_SPEC bool a_eql(float xf0, float xf1)
Absolute equality comparison of float xf0 to float xf1 using tolerance float_tolerance.
An abstract client handle for a member of a poset.
virtual const stp_lite & stp_prototype(int xp) const
Prototype for symmetric tensors of degree xp over this vector space.
Definition: e3.cc:598
std::string path() const
The full path as a string.
Definition: poset_path.cc:450
vd_dof_type dof_type
The type of the degrees of freedom. Note that although dof_type == value_type in this implementation...
Definition: vd.h:431
virtual const std::string & class_name() const
The name of this class.
Definition: e3.cc:1936
virtual void put_component(int xindex, value_type xvalue)
Sets the value of the xindex-th component to xvalue.
Definition: vd.cc:1169
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
An abstract tensor space of degree p.
Definition: tp_space.h:47
A symmetric tensor of degree p over an abstract vector space (volatile version).
Definition: stp.h:44
SHEAF_DLL_SPEC e3_lite & operator^=(e3_lite &xresult, const e3_lite &xother)
The 3D Euclidean vector "cross" product of xresult with xother (pre-allocated version).
Definition: e3.cc:2266
bool c_ge(const e3_lite &xother) const
Cartesian order greater than or equal comparison.
Definition: e3.cc:712
An abstract symmetric tensor space of degree p.
Definition: stp_space.h:42
bool invariant() const
Class invariant.
Definition: e3.cc:1043
Namespace for the fiber_bundles component of the sheaf system.
A tensor of degree 3 over a Euclidean vector space of dimension 3 (persistent version).
Definition: t3_e3.h:401
virtual void put_components(const value_type &x_comp, const value_type &y_comp, const value_type &z_comp)
Set values of the components to the given arguments.
Definition: e3.cc:241
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.
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 3 (persistent version)...
Definition: st2_e3.h:435
bool d_ge(const e3_lite &xother) const
Dictionary (lexicographic) order greater than or equal comparison.
Definition: e3.cc:887
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.
Definition: sheaf.cc:102