SheafSystem  0.0.0.0
t2_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/t2_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/at1_space.h"
27 #include "SheafSystem/at2_e3.h"
28 #include "SheafSystem/fiber_bundles_namespace.h"
29 #include "SheafSystem/schema_poset_member.h"
30 #include "SheafSystem/st2_e3.h"
31 #include "SheafSystem/tp_space.h"
32 #include "SheafSystem/wsv_block.h"
33 
34 
35 using namespace std;
36 using namespace fiber_bundle; // Workaround for MS C++ bug.
37 
38 //==============================================================================
39 // CLASS T2_E3_LITE
40 //==============================================================================
41 
42 //==============================================================================
43 // T2_E3 FACET OF CLASS T2_E3_LITE
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 t2_e3_lite(const t2_e3_lite& xother)
65 {
66  // Preconditions:
67 
68  // Body:
69 
70  *this = xother;
71 
72  // Postconditions:
73 
74  ensure(invariant());
75 
76  // Exit:
77 }
78 
81 operator=(const t2_e3_lite& xother)
82 {
83 
84  // Preconditions:
85 
86  // Body:
87 
88  if(this == &xother)
89  return *this;
90 
91  _row_dofs = xother._row_dofs;
92 
93  // Postconditions:
94 
95  ensure(invariant());
96 
97  // Exit:
98 
99  return *this;
100 }
101 
104 {
105  // Preconditions:
106 
107  // Body:
108 
109  // Postconditions:
110 
111  // Exit:
112 
113 }
114 
116 t2_e3_lite(const at2_e3_lite& xother)
117 {
118  // Preconditions:
119 
120  // Body:
121 
122  *this = xother;
123 
124  // Postconditions:
125 
126  ensure(invariant());
127 
128  // Exit:
129 }
130 
133 operator=(const at2_e3_lite& xother)
134 {
135 
136  // Preconditions:
137 
138  // Body:
139 
140  for(int i=0; i<3; i++)
141  {
142  for(int j=0; j<3; j++)
143  {
144  value_type lcomp = xother.component(i, j);
145  put_component(i, j, lcomp);
146  }
147  }
148 
149  // Postconditions:
150 
151  ensure(invariant());
152 
153  // Exit:
154 
155  return *this;
156 }
157 
159 t2_e3_lite(const st2_e3_lite& xother)
160 {
161  // Preconditions:
162 
163  // Body:
164 
165  *this = xother;
166 
167  // Postconditions:
168 
169  ensure(invariant());
170 
171  // Exit:
172 }
173 
176 operator=(const st2_e3_lite& xother)
177 {
178 
179  // Preconditions:
180 
181  // Body:
182 
183  for(int i=0; i<3; i++)
184  {
185  for(int j=0; j<3; j++)
186  {
187  value_type lcomp = xother.component(i, j);
188  put_component(i, j, lcomp);
189  }
190  }
191 
192  // Postconditions:
193 
194  ensure(invariant());
195 
196  // Exit:
197 
198  return *this;
199 }
200 
202 t2_e3_lite(const row_dofs_type& xrow_dofs)
203 {
204  // Preconditions:
205 
206  // Body:
207 
208  *this = xrow_dofs;
209 
210  // Postconditions:
211 
212  ensure(invariant());
213 
214  // Exit:
215 }
216 
219 operator=(const row_dofs_type& xrow_dofs)
220 {
221  // Preconditions:
222 
223  // Body:
224 
225  _row_dofs = xrow_dofs;
226 
227  // Postconditions:
228 
229  ensure(invariant());
230 
231  // Exit:
232 
233  return *this;
234 
235 }
236 
238 t2_e3_lite(const matrix_type& xmatrix)
239 {
240  // Preconditions:
241 
242  // Body:
243 
244  *this = xmatrix;
245 
246  // Postconditions:
247 
248  ensure(invariant());
249 
250  // Exit:
251 }
252 
255 operator=(const matrix_type& xmatrix)
256 {
257  // Preconditions:
258 
259  // Body:
260 
261  //_row_dofs = xmatrix;
262  _row_dofs = reinterpret_cast<const row_dofs_type&>(xmatrix);
263 
264  // Postconditions:
265 
266  ensure(invariant());
267 
268  // Exit:
269 
270  return *this;
271 
272 }
273 
274 fiber_bundle::t2_e3_lite::
276 {
277  // Preconditions:
278 
279  // Body:
280 
281  matrix_type& result = _row_dofs;
282 
283  // Postconditions:
284 
285  // Exit:
286 
287  return result;
288 }
289 
290 fiber_bundle::t2_e3_lite::
291 operator const t2_e3_lite::matrix_type& () const
292 {
293  // Preconditions:
294 
295  // Body:
296 
297  const matrix_type& result = _row_dofs;
298 
299  // Postconditions:
300 
301  // Exit:
302 
303  return result;
304 }
305 
306 fiber_bundle::t2_e3_lite::
308 {
309  // Preconditions:
310 
311  // Body:
312 
313  row_dofs_type& result = _row_dofs;
314 
315  // Postconditions:
316 
317  // Exit:
318 
319  return result;
320 }
321 
322 fiber_bundle::t2_e3_lite::
323 operator const t2_e3_lite::row_dofs_type& () const
324 {
325  // Preconditions:
326 
327  // Body:
328 
329  const row_dofs_type& result = _row_dofs;
330 
331  // Postconditions:
332 
333  // Exit:
334 
335  return result;
336 }
337 
339 t2_e3_lite(const value_type& xx_comp,
340  const value_type& xy_comp,
341  const value_type& xz_comp,
342  const value_type& yx_comp,
343  const value_type& yy_comp,
344  const value_type& yz_comp,
345  const value_type& zx_comp,
346  const value_type& zy_comp,
347  const value_type& zz_comp)
348 {
349  // Preconditions:
350 
351  // Body:
352 
353  put_components(xx_comp, xy_comp, xz_comp,
354  yx_comp, yy_comp, yz_comp,
355  zx_comp, zy_comp, zz_comp);
356 
357  // Postconditions:
358 
359  // Exit:
360 }
361 
362 void
364 put_components(const value_type& xx_comp,
365  const value_type& xy_comp,
366  const value_type& xz_comp,
367  const value_type& yx_comp,
368  const value_type& yy_comp,
369  const value_type& yz_comp,
370  const value_type& zx_comp,
371  const value_type& zy_comp,
372  const value_type& zz_comp)
373 {
374  // Preconditions:
375 
376  // Body:
377 
378  put_component(0, xx_comp);
379  put_component(1, xy_comp);
380  put_component(2, xz_comp);
381  put_component(3, yx_comp);
382  put_component(4, yy_comp);
383  put_component(5, yz_comp);
384  put_component(6, zx_comp);
385  put_component(7, zy_comp);
386  put_component(8, zz_comp);
387 
388 
389  // Postconditions:
390 
391  ensure(invariant());
392 
393  ensure(isunordered_or_equals(component(0), xx_comp));
394  ensure(isunordered_or_equals(component(1), xy_comp));
395  ensure(isunordered_or_equals(component(2), xz_comp));
396  ensure(isunordered_or_equals(component(3), yx_comp));
397  ensure(isunordered_or_equals(component(4), yy_comp));
398  ensure(isunordered_or_equals(component(5), yz_comp));
399  ensure(isunordered_or_equals(component(6), zx_comp));
400  ensure(isunordered_or_equals(component(7), zy_comp));
401  ensure(isunordered_or_equals(component(8), zz_comp));
402 
403  // Exit:
404 }
405 
406 // PROTECTED MEMBER FUNCTIONS
407 
408 // PRIVATE MEMBER FUNCTIONS
409 
410 
411 //==============================================================================
412 // T2 FACET OF CLASS T2_E3_LITE
413 //==============================================================================
414 
415 // PUBLIC MEMBER FUNCTIONS
416 
417 // PROTECTED MEMBER FUNCTIONS
418 
419 // PRIVATE MEMBER FUNCTIONS
420 
421 
422 //==============================================================================
423 // TENSOR ALGEBRA (TP) FACET OF CLASS T2_E3_LITE
424 //==============================================================================
425 
426 // PUBLIC MEMBER FUNCTIONS
427 
428 int
430 dd() const
431 {
432  // Preconditions:
433 
434  // Body:
435 
436  int result = 3;
437 
438  // Postconditions:
439 
440  ensure(invariant());
441  ensure(result == 3);
442 
443  // Exit:
444 
445  return result;
446 }
447 
448 // PROTECTED MEMBER FUNCTIONS
449 
450 // PRIVATE MEMBER FUNCTIONS
451 
452 
453 //==============================================================================
454 // VECTOR ALGEBRA (VD) FACET OF CLASS T2_E3_LITE
455 //==============================================================================
456 
457 // PUBLIC MEMBER FUNCTIONS
458 
461 tp_prototype(int xp) const
462 {
463  // Preconditions:
464 
465  require(precondition_of(e3_lite::static_tp_prototype(xp)));
466 
467  // Body:
468 
469  const tp_lite& result = e3_lite::static_tp_prototype(xp);
470 
471  // Postconditions:
472 
473  ensure(postcondition_of(e3_lite::static_tp_prototype(xp)));
474 
475  // Exit:
476 
477  return result;
478 }
479 
482 atp_prototype(int xp) const
483 {
484  // Preconditions:
485 
486  require(precondition_of(e3_lite::static_atp_prototype(xp)));
487 
488  // Body:
489 
490  const atp_lite& result = e3_lite::static_atp_prototype(xp);
491 
492  // Postconditions:
493 
494  ensure(postcondition_of(e3_lite::static_atp_prototype(xp)));
495 
496  // Exit:
497 
498  return result;
499 }
500 
503 stp_prototype(int xp) const
504 {
505  // Preconditions:
506 
507  require(precondition_of(e3_lite::static_stp_prototype(xp)));
508 
509  // Body:
510 
511  const stp_lite& result = e3_lite::static_stp_prototype(xp);
512 
513  // Postconditions:
514 
515  ensure(postcondition_of(e3_lite::static_stp_prototype(xp)));
516 
517  // Exit:
518 
519  return result;
520 }
521 
522 // PROTECTED MEMBER FUNCTIONS
523 
524 // PRIVATE MEMBER FUNCTIONS
525 
526 
527 //==============================================================================
528 // CARTESIAN ALGEBRA (TUPLE) FACET OF CLASS T2_E3_LITE
529 //==============================================================================
530 
531 // PUBLIC MEMBER FUNCTIONS
532 
533 // PROTECTED MEMBER FUNCTIONS
534 
535 // PRIVATE MEMBER FUNCTIONS
536 
537 
538 //==============================================================================
539 // ABSTRACT POSET MEMBER FACET OF CLASS T2_E3_LITE
540 //==============================================================================
541 
542 // PUBLIC MEMBER FUNCTIONS
543 
544 const std::string&
546 class_name() const
547 {
548  // Preconditions:
549 
550  // Body:
551 
552  const string& result = static_class_name();
553 
554  // Postconditions:
555 
556  ensure(!result.empty());
557 
558  // Exit:
559 
560  return result;
561 }
562 
563 const std::string&
566 {
567  // Preconditions:
568 
569  // Body:
570 
571  static const string result("t2_e3_lite");
572 
573  // Postconditions:
574 
575  ensure(!result.empty());
576 
577  // Exit:
578 
579  return result;
580 }
581 
584 clone() const
585 {
586  t2_e3_lite* result = 0;
587 
588  // Preconditions:
589 
590  // Body:
591 
592  result = new t2_e3_lite();
593 
594  // Postconditions:
595 
596  ensure(result != 0);
597  ensure(is_same_type(*result));
598 
599  // Exit:
600 
601  return result;
602 }
603 
604 // PROTECTED MEMBER FUNCTIONS
605 
606 // PRIVATE MEMBER FUNCTIONS
607 
608 
609 //==============================================================================
610 // ANY FACET OF CLASS T2_E3_LITE
611 //==============================================================================
612 
613 // PUBLIC MEMBER FUNCTIONS
614 
615 bool
617 is_ancestor_of(const any_lite& xother) const
618 {
619  // Preconditions:
620 
621  require(&xother != 0);
622 
623  // Body:
624 
625  // True if other conforms to this.
626 
627  bool result = dynamic_cast<const t2_e3_lite*>(&xother) != 0;
628 
629  // Postconditions:
630 
631  return result;
632 }
633 
634 bool
636 invariant() const
637 {
638  bool result = true;
639 
640  if(invariant_check())
641  {
642  // Prevent recursive calls to invariant.
643 
644  disable_invariant_check();
645 
646  // Must satisfy base class invariant.
647 
648  invariance(t2_lite::invariant());
649 
650  // Invariances for this class:
651 
652  // Finished, turn invariant checking back on.
653 
654  enable_invariant_check();
655  }
656 
657  // Exit
658 
659  return result;
660 }
661 
662 void*
665 {
666  return &_row_dofs;
667 }
668 
669 const void*
671 row_dofs() const
672 {
673  return &_row_dofs;
674 }
675 
676 // PROTECTED MEMBER FUNCTIONS
677 
678 // PRIVATE MEMBER FUNCTIONS
679 
680 
681 //==============================================================================
682 // CLASS T2_E3
683 //==============================================================================
684 
685 // ===========================================================
686 // HOST FACTORY FACET OF CLASS T2_E3
687 // ===========================================================
688 
689 // PUBLIC MEMBER FUNCTIONS
690 
691 const sheaf::poset_path&
694 {
695  // Preconditions:
696 
697 
698  // Body:
699 
700  static const poset_path result(standard_schema_poset_name(), "t2_e3_schema");
701 
702  // Postconditions:
703 
704  // Exit:
705 
706  return result;
707 }
708 
709 void
712 {
713  // Preconditions:
714 
715  require(xns.state_is_read_write_accessible());
716  require(xns.contains_poset(standard_schema_poset_name()));
717  require(!xns.contains_poset_member(standard_schema_path()));
718 
719  // Body:
720 
721  string lmember_names = "xx DOUBLE false ";
722  lmember_names += "xy DOUBLE false ";
723  lmember_names += "xz DOUBLE false ";
724  lmember_names += "yx DOUBLE false ";
725  lmember_names += "yy DOUBLE false ";
726  lmember_names += "yz DOUBLE false ";
727  lmember_names += "zx DOUBLE false ";
728  lmember_names += "zy DOUBLE false ";
729  lmember_names += "zz DOUBLE false";
730 
731  schema_poset_member lschema(xns,
732  standard_schema_path().member_name(),
733  t2::standard_schema_path(),
734  lmember_names,
735  false);
736 
737  lschema.detach_from_state();
738 
739  // Postconditions:
740 
741  ensure(xns.contains_poset_member(standard_schema_path()));
742 
743  // Exit:
744 
745  return;
746 }
747 
751  const poset_path& xhost_path,
752  const poset_path& xschema_path,
753  const poset_path& xvector_space_path,
754  bool xauto_access)
755 {
756  // cout << endl << "Entering t2_e3::new_host." << endl;
757 
758  // Preconditions:
759 
760  require(xns.state_is_auto_read_write_accessible(xauto_access));
761 
762  require(!xhost_path.empty());
763  require(!xns.contains_path(xhost_path, xauto_access));
764 
765  require(xschema_path.full());
766  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
767  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
768  require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 9);
769 
770  require(xns.path_is_auto_read_accessible(xvector_space_path, xauto_access));
771  require(xns.contains_poset<vector_space_type::host_type>(xvector_space_path, xauto_access));
772  require(xns.member_poset(xvector_space_path, xauto_access).schema(xauto_access).conforms_to(vector_space_type::standard_schema_path()));
773  require(xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).d(xauto_access) == 3);
774 
775  require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, 2, xvector_space_path, xauto_access));
776 
777  // Body:
778 
779  host_type& result =
780  host_type::new_table(xns, xhost_path, xschema_path, 2, xvector_space_path, xauto_access);
781 
782  // Postconditions:
783 
784  ensure(xns.owns(result, xauto_access));
785  ensure(result.path(true) == xhost_path);
786  ensure(result.state_is_not_read_accessible());
787  ensure(result.schema(true).path(xauto_access) == xschema_path);
788 
789  ensure(result.factor_ct(true) == 9);
790  ensure(result.d(true) == 9);
791  ensure(result.scalar_space_path(true) == xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).scalar_space_path());
792  ensure(result.p(true) == 2);
793  ensure(result.dd(true) == 3);
794  ensure(result.vector_space_path(true) == xvector_space_path);
795 
796  // Exit:
797 
798  // cout << "Leaving t2_e3::new_host." << endl;
799  return result;
800 }
801 
804 standard_host(namespace_type& xns, const std::string& xsuffix, bool xauto_access)
805 {
806  // cout << endl << "Entering t2_e3::new_host." << endl;
807 
808  // Preconditions:
809 
810  require(xns.state_is_auto_read_write_accessible(xauto_access));
811 
812  require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
813  require(standard_host_is_available<t2_e3>(xns, xsuffix, xauto_access));
814 
815  require(xns.path_is_auto_read_accessible(standard_schema_path(), xauto_access));
816 
817  require(xns.path_is_auto_read_available(standard_host_path<vector_space_type>(xsuffix), xauto_access));
818 
819  // Body:
820 
821  // Create the vector space if necessary.
822 
823  poset_path lvector_space_path = vector_space_type::standard_host(xns, xsuffix, xauto_access).path(true);
824 
825  poset_path lpath(standard_host_path<t2_e3>(xsuffix));
826 
827  host_type* result_ptr;
828  if(xns.contains_path(lpath, xauto_access))
829  {
830  result_ptr = &xns.member_poset<host_type>(lpath, xauto_access);
831  }
832  else
833  {
834  result_ptr = &new_host(xns, lpath, standard_schema_path(), lvector_space_path, xauto_access);
835  }
836 
837  host_type& result = *result_ptr;
838 
839  // Postconditions:
840 
841  ensure(xns.owns(result, xauto_access));
842  ensure(result.path(true) == standard_host_path<t2_e3>(xsuffix));
843  ensure(result.state_is_not_read_accessible());
844  ensure(result.schema(true).path(xauto_access) == standard_schema_path());
845 
846  ensure(result.factor_ct(true) == 9);
847  ensure(result.d(true) == 9);
848  ensure(result.scalar_space_path(true) == standard_host_path<vector_space_type::scalar_type>(xsuffix) );
849  ensure(result.p(true) == 2);
850  ensure(result.dd(true) == 3);
851  ensure(result.vector_space_path(true) == standard_host_path<vector_space_type>(xsuffix) );
852 
853  // Exit:
854 
855  // cout << "Leaving t2_e3::new_host." << endl;
856  return result;
857 }
858 
859 // PROTECTED MEMBER FUNCTIONS
860 
861 // PRIVATE MEMBER FUNCTIONS
862 
863 
864 //==============================================================================
865 // T2_E3 FACET OF CLASS T2_E3
866 //==============================================================================
867 
868 // PUBLIC MEMBER FUNCTIONS
869 
872 {
873 
874  // Preconditions:
875 
876  // Body:
877 
878  // Postconditions:
879 
880  ensure(invariant());
881 
882  // Exit:
883 
884  return;
885 }
886 
888 t2_e3(const t2_e3& xother)
889 {
890 
891  // Preconditions:
892 
893 
894  // Body:
895 
896  attach_to_state(&xother);
897 
898  // Postconditions:
899 
900  ensure(invariant());
901 
902  // Exit:
903 
904  return;
905 }
906 
911 {
912  // Preconditions:
913 
914  require(is_ancestor_of(&xother));
915  require(precondition_of(attach_to_state(&xother)));
916 
917  // Body:
918 
919  attach_to_state(&xother);
920 
921  // Postconditions:
922 
923  ensure(postcondition_of(attach_to_state(&xother)));
924 
925  // Exit:
926 
927  return *this;
928 }
929 
933 operator=(const t2_e3& xother)
934 {
935  // Preconditions:
936 
937  require(precondition_of(attach_to_state(&xother)));
938 
939  // Body:
940 
941  attach_to_state(&xother);
942 
943  // Postconditions:
944 
945  ensure(postcondition_of(attach_to_state(&xother)));
946 
947  // Exit:
948 
949  return *this;
950 }
951 
954 {
955 
956  // Preconditions:
957 
958  // Body:
959 
960  // Postconditions:
961 
962  // Exit:
963 
964  return;
965 }
966 
970 {
971  // Preconditions:
972 
973  // Body:
974 
975  static const volatile_type result;
976 
977  // Postconditions:
978 
979  // Exit:
980 
981  return result;
982 }
983 
987 lite_type() const
988 {
989  // Preconditions:
990 
991  // Body:
992 
993  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
994 
995  // Postconditions:
996 
997  // Exit:
998 
999  return result;
1000 }
1001 
1002 // NEW HANDLE, NEW STATE CONSTRUCTORS
1003 
1005 t2_e3(poset* xhost, bool xauto_access)
1006 {
1007 
1008  // Preconditions:
1009 
1010  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
1011 
1012  // Body:
1013 
1014  new_jim_state(xhost, 0, false, xauto_access);
1015 
1016  // Postconditions:
1017 
1018  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
1019 
1020  // Exit:
1021 
1022  return;
1023 }
1024 
1027  const row_dofs_type& xrdt,
1028  bool xauto_access)
1029 {
1030 
1031  // Preconditions:
1032 
1033  require(precondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
1034 
1035  // Body:
1036 
1037  new_jim_state(&xhost, 0, false, xauto_access);
1038 
1039  if(xauto_access)
1040  {
1041  xhost.get_read_write_access();
1042  }
1043 
1044  *this = xrdt;
1045 
1046  if(xauto_access)
1047  {
1048  xhost.release_access();
1049  }
1050 
1051  // Postconditions:
1052 
1053  ensure(postcondition_of(new_jim_state(&xhost, 0, false, xauto_access)));
1054 
1055  // Exit:
1056 
1057  return;
1058 }
1059 
1063 {
1064  // Preconditions:
1065 
1066  require(state_is_read_write_accessible());
1067 
1068  // Body:
1069 
1070  sheaf::row_dofs(*this) = xrdt;
1071 
1072  // Postconditions:
1073 
1074  ensure_for_all(i, 0, d(), component(i) == xrdt.components[i]);
1075 
1076  // Exit:
1077 
1078  return *this;
1079 
1080 }
1081 
1082 
1083 // NEW HANDLE, EXISTING STATE CONSTRUCTORS
1084 
1086 t2_e3(const poset* xhost, pod_index_type xhub_id)
1087 {
1088  // Preconditions:
1089 
1090  require(xhost != 0);
1091  require(xhost->state_is_read_accessible());
1092  require(xhost->contains_member(xhub_id));
1093 
1094  // Body:
1095 
1096  attach_to_state(xhost, xhub_id);
1097 
1098  // Postconditions:
1099 
1100  ensure(invariant());
1101  ensure(is_attached());
1102  // ensure(host() == xhost);
1103  ensure(index() == xhub_id);
1104 }
1105 
1107 t2_e3(const poset* xhost, const scoped_index& xid)
1108 {
1109  // Preconditions:
1110 
1111  require(xhost != 0);
1112  require(xhost->state_is_read_accessible());
1113  require(xhost->contains_member(xid));
1114 
1115  // Body:
1116 
1117  attach_to_state(xhost, xid.hub_pod());
1118 
1119  // Postconditions:
1120 
1121  ensure(invariant());
1122  ensure(is_attached());
1123  // ensure(host() == xhost);
1124  ensure(index() ==~ xid);
1125 }
1126 
1128 t2_e3(const poset* xhost, const std::string& xname)
1129 {
1130 
1131  // Preconditions:
1132 
1133  require(xhost != 0);
1134  require(xhost->state_is_read_accessible());
1135  require(!xname.empty());
1136  require(xhost->contains_member(xname));
1137 
1138  // Body:
1139 
1140  attach_to_state(xhost, xname);
1141 
1142  // Postconditions:
1143 
1144  ensure(invariant());
1145  ensure(is_attached());
1146  // ensure(host() == xhost);
1147  ensure(name() == xname);
1148 
1149 }
1150 
1151 fiber_bundle::t2_e3::
1153 {
1154  // Preconditions:
1155 
1156  require(state_is_read_write_accessible());
1157 
1158  // Body:
1159 
1160  row_dofs_type& result = sheaf::row_dofs(*this);
1161 
1162  // Postconditions:
1163 
1164  // Exit:
1165 
1166  return result;
1167 }
1168 
1169 fiber_bundle::t2_e3::
1170 operator const t2_e3::row_dofs_type& () const
1171 {
1172  // Preconditions:
1173 
1174  require(state_is_read_accessible());
1175 
1176  // Body:
1177 
1178  const row_dofs_type& result = sheaf::row_dofs(*this);
1179 
1180  // Postconditions:
1181 
1182  // Exit:
1183 
1184  return result;
1185 }
1186 
1187 // PROTECTED MEMBER FUNCTIONS
1188 
1189 // PRIVATE MEMBER FUNCTIONS
1190 
1191 
1192 //==============================================================================
1193 // T2 FACET OF CLASS T2_E3
1194 //==============================================================================
1195 
1196 // PUBLIC MEMBER FUNCTIONS
1197 
1198 // PROTECTED MEMBER FUNCTIONS
1199 
1200 // PRIVATE MEMBER FUNCTIONS
1201 
1202 
1203 //==============================================================================
1204 // TP FACET OF CLASS T2_E3
1205 //==============================================================================
1206 
1207 // PUBLIC MEMBER FUNCTIONS
1208 
1209 // PROTECTED MEMBER FUNCTIONS
1210 
1211 // PRIVATE MEMBER FUNCTIONS
1212 
1213 
1214 //==============================================================================
1215 // VD FACET OF CLASS T2_E3
1216 //==============================================================================
1217 
1218 // PUBLIC MEMBER FUNCTIONS
1219 
1220 // PROTECTED MEMBER FUNCTIONS
1221 
1222 // PRIVATE MEMBER FUNCTIONS
1223 
1224 
1225 //==============================================================================
1226 // TUPLE FACET OF CLASS T2_E3
1227 //==============================================================================
1228 
1229 // PUBLIC MEMBER FUNCTIONS
1230 
1233 new_tp(int xp, bool xauto_access) const
1234 {
1235  // Preconditions:
1236 
1237  require(precondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1238 
1239  // Body:
1240 
1241  tp* result = e3::new_tp(vector_space(xauto_access), xp);
1242 
1243  // Postconditions:
1244 
1245  ensure(postcondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1246 
1247  // Exit:
1248 
1249  return result;
1250 }
1251 
1254 new_atp(int xp, bool xauto_access) const
1255 {
1256  // Preconditions:
1257 
1258  require(precondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1259 
1260  // Body:
1261 
1262  atp* result = e3::new_atp(vector_space(xauto_access), xp);
1263 
1264  // Postconditions:
1265 
1266  ensure(postcondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1267 
1268  // Exit:
1269 
1270  return result;
1271 }
1272 
1275 new_stp(int xp, bool xauto_access) const
1276 {
1277  // Preconditions:
1278 
1279  require(precondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1280 
1281  // Body:
1282 
1283  stp* result = e3::new_stp(vector_space(xauto_access), xp);
1284 
1285  // Postconditions:
1286 
1287  ensure(postcondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1288 
1289  // Exit:
1290 
1291  return result;
1292 }
1293 
1294 // PROTECTED MEMBER FUNCTIONS
1295 
1296 // PRIVATE MEMBER FUNCTIONS
1297 
1298 
1299 //==============================================================================
1300 // ABSTRACT POSET MEMBER FACET OF CLASS T2_E3
1301 //==============================================================================
1302 
1303 // PUBLIC MEMBER FUNCTIONS
1304 
1305 const std::string&
1307 class_name() const
1308 {
1309  // Preconditions:
1310 
1311  // Body:
1312 
1313  const string& result = static_class_name();
1314 
1315  // Postconditions:
1316 
1317  ensure(!result.empty());
1318 
1319  // Exit:
1320 
1321  return result;
1322 }
1323 
1324 const std::string&
1327 {
1328  // Preconditions:
1329 
1330  // Body:
1331 
1332  static const string result("t2_e3");
1333 
1334  // Postconditions:
1335 
1336  ensure(!result.empty());
1337 
1338  // Exit:
1339 
1340  return result;
1341 }
1342 
1345 clone() const
1346 {
1347 
1348  // Preconditions:
1349 
1350  // Body:
1351 
1352  // Create new handle of the current class.
1353 
1354  t2_e3 *result = new t2_e3();
1355 
1356  // Postconditions:
1357 
1358  ensure(result != 0);
1359  ensure(result->invariant());
1360 
1361  // Exit:
1362 
1363  return result;
1364 
1365 }
1366 
1367 // PROTECTED MEMBER FUNCTIONS
1368 
1369 // PRIVATE MEMBER FUNCTIONS
1370 
1371 
1372 //==============================================================================
1373 // ANY FACET OF CLASS T2_E3
1374 //==============================================================================
1375 
1376 bool
1378 invariant() const
1379 {
1380  bool result = true;
1381 
1382  // Body:
1383 
1384  if(invariant_check())
1385  {
1386  // Prevent recursive calls to invariant
1387 
1388  disable_invariant_check();
1389 
1390  // Must satisfy base class invariant
1391 
1392  invariance(t2::invariant());
1393 
1394  // Invariances for this class:
1395 
1396  invariance(state_is_read_accessible() ? dd() == 3 : true);
1397 
1398  // Finished, turn invariant checking back on.
1399 
1400  enable_invariant_check();
1401  }
1402 
1403  // Exit:
1404 
1405  return result;
1406 }
1407 
1408 bool
1410 is_ancestor_of(const any* xother) const
1411 {
1412  // Preconditions:
1413 
1414  require(xother != 0);
1415 
1416  // Body:
1417 
1418  // True if xother conforms to this.
1419 
1420  bool result = dynamic_cast<const t2_e3*>(xother) != 0;
1421 
1422  // Postconditions:
1423 
1424  ensure(invariant());
1425 
1426  // Exit:
1427 
1428  return result;
1429 
1430 }
1431 
1432 // PROTECTED MEMBER FUNCTIONS
1433 
1434 // PRIVATE MEMBER FUNCTIONS
1435 
1436 
1437 //==============================================================================
1438 // NON-MEMBER FUNCTIONS
1439 //==============================================================================
1440 
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 poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
bool invariant() const
Class invariant.
Definition: t2_e3.cc:636
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
Definition: t2_e3.cc:1410
t2_e3_lite & operator=(const t2_e3_lite &xother)
Assignment operator.
Definition: t2_e3.cc:81
static const std::string & static_class_name()
The name of this class.
Definition: t2_e3.cc:1326
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 void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: t2_e3.cc:711
An antisymmetric tensor of degree p.
Definition: atp.h:190
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
virtual t2_e3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: t2_e3.cc:584
T components[9]
The dofs in the following order: components[0] => xx components[1] => xy components[2] => xz componen...
Definition: t2_e3.h:132
poset_path path(bool xauto_access=true) const
A path to this component.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
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...
virtual atp * new_atp(int xp, bool xauto_access) const
Virtual constructor for antisymmetric tensors of degree xp over vector space xvector_space.
Definition: t2_e3.cc:1254
poset_path vector_space_path() const
The path of the underlying vector space.
Definition: tp_space.cc:365
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
virtual const std::string & class_name() const
The name of this class.
Definition: t2_e3.cc:546
STL namespace.
A tensor of degree 2 over a Euclidean vector space of dimension 3 (persistent version).
Definition: t2_e3.h:457
virtual value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
Definition: st2.cc:145
virtual t2_e3 * clone() const
Make a new handle, no state instance of current.
Definition: t2_e3.cc:1345
row_dofs_type _row_dofs
Row_dofs_type.
Definition: t2_e3.h:294
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 host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path<t2_e3>(xsuffix). Returns the host if it already exists...
Definition: t2_e3.cc:804
virtual const tp_lite & tp_prototype(int xp) const
Prototype for general tensors of degree xp over this vector space.
Definition: t2_e3.cc:461
virtual t2_e3 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: t2_e3.cc:910
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual int dd() const
Dimension of the underlying vector space.
Definition: t2_e3.cc:430
A tensor of degree 2 over an abstract vector space (volatile version).
Definition: t2.h:43
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
Definition: atp.h:44
virtual bool invariant() const
Class invariant.
Definition: t2_e3.cc:1378
A general tensor of "degree" p and given "variance" over an abstract vector space.
Definition: tp.h:253
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: t2_e3.cc:693
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
static const std::string & static_class_name()
The name of this class.
Definition: t2_e3.cc:565
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
t2_e3()
Default constructor.
Definition: t2_e3.cc:871
A client handle for a mutable partially ordered set.
Definition: poset.h:40
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
bool owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
virtual void detach_from_state()
Detach this handle from its state, if any.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: t2_e3.cc:987
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
virtual stp * new_stp(int xp, bool xauto_access) const
Virtual constructor for symmetric tensors of degree xp over vector space xvector_space.
Definition: t2_e3.cc:1275
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
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: t2_e3.cc:750
virtual ~t2_e3()
Destructor.
Definition: t2_e3.cc:953
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...
A tensor of degree 2 over a Euclidean vector space of dimension 3 (volatile version).
Definition: t2_e3.h:151
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
Definition: tp.h:59
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
t2_e3_lite()
Default constructor.
Definition: t2_e3.cc:49
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: t2_e3.cc:969
virtual void put_components(const value_type &xx_comp, const value_type &xy_comp, const value_type &xz_comp, const value_type &yx_comp, const value_type &yy_comp, const value_type &yz_comp, const value_type &zx_comp, const value_type &zy_comp, const value_type &zz_comp)
Set values of the components to the given arguments.
Definition: t2_e3.cc:364
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
virtual const atp_lite & atp_prototype(int xp) const
Prototype for antisymmetric tensors of degree xp over this vector space.
Definition: t2_e3.cc:482
static int d(const namespace_poset &xns, const poset_path &xschema_path, bool xauto_access)
The tensor dimension implied by the schema specified by xschema_path.
Definition: tp_space.cc:83
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
virtual void * row_dofs()
The row dofs for this instance (mutable version).
Definition: t2_e3.cc:664
int dd() const
The dimension of the underlying ("domain") vector space.
Definition: tp_space.cc:317
virtual const std::string & class_name() const
The name of this class.
Definition: t2_e3.cc:1307
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 3. (volatile version)...
Definition: at2_e3.h:142
virtual const stp_lite & stp_prototype(int xp) const
Prototype for symmetric tensors of degree xp over this vector space.
Definition: t2_e3.cc:503
virtual tp * new_tp(int xp, bool xauto_access) const
Virtual constructor for general tensors of degree xp over vector space xvector_space.
Definition: t2_e3.cc:1233
virtual ~t2_e3_lite()
Destructor.
Definition: t2_e3.cc:103
virtual value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
Definition: at2.cc:148
An abstract client handle for a member of a poset.
std::string path() const
The full path as a string.
Definition: poset_path.cc:450
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: t2_e3.cc:617
An abstract tensor space of degree p.
Definition: tp_space.h:47
t2_e3_row_dofs_type< double >::matrix_type matrix_type
The type of the associated matrix.
Definition: t2_e3.h:171
A symmetric tensor of degree p over an abstract vector space (volatile version).
Definition: stp.h:44
Namespace for the fiber_bundles component of the sheaf system.
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.
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