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