SheafSystem  0.0.0.0
st4.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/st4.h"
22 
23 #include "SheafSystem/abstract_poset_member.impl.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/at0.h"
26 #include "SheafSystem/stp_space.h"
27 #include "SheafSystem/fiber_bundles_namespace.h"
28 #include "SheafSystem/schema_poset_member.h"
29 #include "SheafSystem/wsv_block.h"
30 
31 
32 using namespace std;
33 using namespace fiber_bundle; // Workaround for MS C++ bug.
34 
35 
36 //==============================================================================
37 // CLASS ST4_LITE
38 //==============================================================================
39 
40 //==============================================================================
41 // ST4 FACET OF CLASS ST4_LITE
42 //==============================================================================
43 
44 // PUBLIC MEMBER FUNCTIONS
45 
48 {
49 
50  // Preconditions:
51 
52  // Body:
53 
54  // Postconditions:
55 
56  ensure(invariant());
57 
58  // Exit:
59 }
60 
62 st4_lite(const st4_lite& xother)
63 {
64  // Preconditions:
65 
66  // Body:
67 
68  *this = xother;
69 
70  // Postconditions:
71 
72  ensure(invariant());
73 
74  // Exit:
75 }
76 
79 operator=(const st4_lite& xother)
80 {
81 
82  // Preconditions:
83 
84 
85  // Body:
86 
87 
88  // Postconditions:
89 
90  ensure(invariant());
91 
92  // Exit:
93 
94  return *this;
95 }
96 
99 {
100  // Preconditions:
101 
102  // Body:
103 
104  // Postconditions:
105 
106  // Exit:
107 
108 }
109 
111 st4_lite(const row_dofs_type& xrow_dofs)
112 {
113  // Preconditions:
114 
115  // Body:
116 
117  *this = xrow_dofs;
118 
119  // Postconditions:
120 
121  ensure(invariant());
122 
123  // Exit:
124 }
125 
128 operator=(const row_dofs_type& xrow_dofs)
129 {
130  // Preconditions:
131 
132  // Body:
133 
134  vd_lite::operator=(xrow_dofs);
135 
136  // Postconditions:
137 
138  postcondition_of(vd_lite::operator=(xrow_dofs));
139 
140  // Exit:
141 
142  return *this;
143 
144 }
145 
146 // PROTECTED MEMBER FUNCTIONS
147 
148 // PRIVATE MEMBER FUNCTIONS
149 
150 
151 //==============================================================================
152 // STP FACET OF CLASS ST4_LITE
153 //==============================================================================
154 
155 // PUBLIC MEMBER FUNCTIONS
156 
157 int
159 p() const
160 {
161  // Preconditions:
162 
163  // Body:
164 
165  int result = 4;
166 
167  // Postconditions:
168 
169  ensure(invariant());
170  ensure(result == 4);
171 
172  // Exit:
173 
174  return result;
175 }
176 
177 // PROTECTED MEMBER FUNCTIONS
178 
179 // PRIVATE MEMBER FUNCTIONS
180 
181 
182 //==============================================================================
183 // VD FACET OF CLASS ST4_LITE
184 //==============================================================================
185 
186 // PUBLIC MEMBER FUNCTIONS
187 
190 component(int xi, int xj, int xk, int xl) const
191 {
192  // Preconditions:
193 
194  require((0 <= xi) && (xi < dd()));
195  require((0 <= xj) && (xj < dd()));
196  require((0 <= xk) && (xk < dd()));
197  require((0 <= xl) && (xl < dd()));
198 
199  // Body:
200 
201  value_type result = component(index_for_ijkl(xi, xj, xk, xl));
202 
203  // Postconditions:
204 
205  ensure(invariant());
206 
207  // Exit:
208 
209  return result;
210 }
211 
212 void
214 put_component(int xi, int xj, int xk, int xl, value_type xvalue)
215 {
216  // Preconditions:
217 
218  require((0 <= xi) && (xi < dd()));
219  require((0 <= xj) && (xj < dd()));
220  require((0 <= xk) && (xk < dd()));
221  require((0 <= xl) && (xl < dd()));
222 
223  // Body:
224 
225  put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
226 
227  // Postconditions:
228 
229  ensure(isunordered_or_equals(component(xi, xj, xk, xl), xvalue));
230 
231  // Exit:
232 
233  return;
234 }
235 
236 
237 int
239 index_for_ijkl(int xi, int xj, int xk, int xl) const
240 {
241  // Preconditions:
242 
243  require((0 <= xi) && (xi < dd()));
244  require((0 <= xj) && (xj < dd()));
245  require((0 <= xk) && (xk < dd()));
246  require((0 <= xl) && (xl < dd()));
247 
248  // Body:
249 
250  int ldd = dd();
251 
252  // Bubble sort the indices into ascending order (brute force).
253 
254  int ltmp;
255 
256  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
257  if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
258  if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
259  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
260  if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
261  if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
262  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
263 
264  //@todo Implement in st4_e2 and st4_e3.
265 
266  //int result = (xi*ldd + xj)*ldd + xk;
267  int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
268 
269  static const int iskip2[2] = {0, 7};
270  static const int jskip2[2] = {0, 3};
271  static const int kskip2[2] = {0, 1};
272 
273  static const int iskip3[3] = {0, 23, 49};
274  static const int jskip3[3] = {0, 6, 14};
275  static const int kskip3[3] = {0, 1, 3};
276 
277  if(ldd == 2)
278  {
279  result -= (iskip2[xi] + jskip2[xj] + kskip2[xk]);
280  }
281  else if(ldd == 3)
282  {
283  result -= (iskip3[xi] + jskip3[xj] + kskip3[xk]);
284  }
285  else
286  {
287  // error.
288  }
289 
290  // Postconditions:
291 
292  ensure(result >= 0);
293  ensure(result < d());
294 
295  // Exit:
296 
297  return result;
298 }
299 
300 // PROTECTED MEMBER FUNCTIONS
301 
302 // PRIVATE MEMBER FUNCTIONS
303 
304 
305 //==============================================================================
306 // TUPLE FACET OF CLASS ST4_LITE
307 //==============================================================================
308 
309 // PUBLIC MEMBER FUNCTIONS
310 
311 // PROTECTED MEMBER FUNCTIONS
312 
313 // PRIVATE MEMBER FUNCTIONS
314 
315 
316 //==============================================================================
317 // ABSTRACT POSET MEMBER FACET OF CLASS ST4_LITE
318 //==============================================================================
319 
320 // PUBLIC MEMBER FUNCTIONS
321 
322 const std::string&
324 class_name() const
325 {
326  // Preconditions:
327 
328  // Body:
329 
330  const string& result = static_class_name();
331 
332  // Postconditions:
333 
334  ensure(!result.empty());
335 
336  // Exit:
337 
338  return result;
339 }
340 
341 const std::string&
344 {
345  // Preconditions:
346 
347  // Body:
348 
349  static const string result("st4_lite");
350 
351  // Postconditions:
352 
353  ensure(!result.empty());
354 
355  // Exit:
356 
357  return result;
358 }
359 
362 clone() const
363 {
364  st4_lite* result = 0;
365 
366  // Preconditions:
367 
368  // Body:
369 
370  result = new st4_lite();
371 
372  // Postconditions:
373 
374  ensure(result != 0);
375  ensure(is_same_type(*result));
376 
377  // Exit:
378 
379  return result;
380 }
381 
382 // PROTECTED MEMBER FUNCTIONS
383 
384 // PRIVATE MEMBER FUNCTIONS
385 
386 
387 //==============================================================================
388 // ANY FACET OF CLASS ST4_LITE
389 //==============================================================================
390 
391 // PUBLIC MEMBER FUNCTIONS
392 
393 bool
395 is_ancestor_of(const any_lite& xother) const
396 {
397  // Preconditions:
398 
399  require(&xother != 0);
400 
401  // Body:
402 
403  // True if other conforms to this.
404 
405  bool result = dynamic_cast<const st4_lite*>(&xother) != 0;
406 
407  // Postconditions:
408 
409  return result;
410 }
411 
412 
413 bool
415 invariant() const
416 {
417  bool result = true;
418 
419  if(invariant_check())
420  {
421  // Prevent recursive calls to invariant.
422 
423  disable_invariant_check();
424 
425  // Must satisfy base class invariant.
426 
427  invariance(stp_lite::invariant());
428 
429  // Invariances for this class:
430 
431  // Finished, turn invariant checking back on.
432 
433  enable_invariant_check();
434  }
435 
436  // Exit
437 
438  return result;
439 }
440 
441 // PROTECTED MEMBER FUNCTIONS
442 
443 // PRIVATE MEMBER FUNCTIONS
444 
445 
446 //==============================================================================
447 // CLASS ST4
448 //==============================================================================
449 
450 // ===========================================================
451 // HOST FACTORY FACET OF CLASS ST2
452 // ===========================================================
453 
454 // PUBLIC MEMBER FUNCTIONS
455 
456 const sheaf::poset_path&
459 {
460  // Preconditions:
461 
462 
463  // Body:
464 
465  static const poset_path result(standard_schema_poset_name(), "st4_schema");
466 
467  // Postconditions:
468 
469  // Exit:
470 
471  return result;
472 }
473 
474 void
477 {
478  // Preconditions:
479 
480  require(xns.state_is_read_write_accessible());
481  require(xns.contains_poset(standard_schema_poset_name()));
482  require(!xns.contains_poset_member(standard_schema_path()));
483 
484 
485  // Body:
486 
487  schema_poset_member lschema(xns,
488  standard_schema_path().member_name(),
489  stp::standard_schema_path(),
490  "",
491  false);
492 
493  lschema.detach_from_state();
494 
495  // Postconditions:
496 
497  ensure(xns.contains_poset_member(standard_schema_path()));
498 
499  // Exit:
500 
501  return;
502 }
503 
507  const poset_path& xhost_path,
508  const poset_path& xschema_path,
509  const poset_path& xvector_space_path,
510  bool xauto_access)
511 {
512  // cout << endl << "Entering st4::new_host." << endl;
513 
514  // Preconditions:
515 
516  require(xns.state_is_auto_read_write_accessible(xauto_access));
517 
518  require(!xhost_path.empty());
519  require(!xns.contains_path(xhost_path, xauto_access));
520 
521  require(xschema_path.full());
522  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
523  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
524 
525  require(xns.path_is_auto_read_accessible(xvector_space_path, xauto_access));
526  require(xns.contains_poset<scalar_type::host_type>(xvector_space_path, xauto_access));
527 
528  // Body:
529 
530  host_type& result =
531  host_type::new_table(xns, xhost_path, xschema_path, 4, xvector_space_path, xauto_access);
532 
533  // Postconditions:
534 
535  ensure(xns.owns(result, xauto_access));
536  ensure(result.path(true) == xhost_path);
537  ensure(result.state_is_not_read_accessible());
538  ensure(result.schema(true).path(xauto_access) == xschema_path);
539 
540  ensure(result.factor_ct(true) == result.d(true));
541  ensure(result.d(true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
542  ensure(result.vector_space_path(true) == xvector_space_path );
543  ensure(result.p(true) == 4);
544  ensure(result.dd(true) == result.d(true));
545  ensure(result.vector_space_path(true) == xhost_path );
546 
547  // Exit:
548 
549  // cout << "Leaving st4::new_host." << endl;
550  return result;
551 }
552 
553 // PROTECTED MEMBER FUNCTIONS
554 
555 // PRIVATE MEMBER FUNCTIONS
556 
557 
558 //==============================================================================
559 // ST4 FACET OF CLASS ST4
560 //==============================================================================
561 
562 // PUBLIC MEMBER FUNCTIONS
563 
566 {
567 
568  // Preconditions:
569 
570  // Body:
571 
572  // Postconditions:
573 
574  ensure(invariant());
575 }
576 
578 st4(const poset_state_handle* xhost, pod_index_type xhub_id)
579 {
580  // Preconditions:
581 
582  require(xhost != 0);
583  require(xhost->state_is_read_accessible());
584  require(xhost->contains_member(xhub_id));
585 
586  // Body:
587 
588  attach_to_state(xhost, xhub_id);
589 
590  // Postconditions:
591 
592  ensure(invariant());
593  // ensure(host() == xhost);
594  ensure(index() == xhub_id);
595  ensure(is_attached());
596 }
597 
599 st4(const poset_state_handle* xhost, const scoped_index& xid)
600 {
601  // Preconditions:
602 
603  require(xhost != 0);
604  require(xhost->state_is_read_accessible());
605  require(xhost->contains_member(xid));
606 
607  // Body:
608 
609  attach_to_state(xhost, xid.hub_pod());
610 
611  // Postconditions:
612 
613  ensure(invariant());
614  // ensure(host() == xhost);
615  ensure(index() ==~ xid);
616  ensure(is_attached());
617 }
618 
620 st4(const poset_state_handle* xhost, const std::string& xname)
621 {
622 
623  // Preconditions:
624 
625  require(xhost != 0);
626  require(xhost->state_is_read_accessible());
627  require(!xname.empty());
628  require(xhost->contains_member(xname));
629 
630  // Body:
631 
632  attach_to_state(xhost, xname);
633 
634  // Postconditions:
635 
636  ensure(invariant());
637  // ensure(host() == xhost);
638  ensure(name() == xname);
639  ensure(is_attached());
640 
641 }
642 
645 {
646 
647  // Preconditions:
648 
649  require(xother != 0);
650 
651  // Body:
652 
653  attach_to_state(xother);
654 
655  // Postconditions:
656 
657  ensure(invariant());
658  ensure(is_attached());
659  ensure(is_same_state(xother));
660 
661 }
662 
664 st4(poset_state_handle* xhost, bool xauto_access)
665 {
666 
667  // Preconditions:
668 
669  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
670 
671  // Body:
672 
673  new_jim_state(xhost, 0, false, xauto_access);
674 
675  // Postconditions:
676 
677  ensure(postcondition_of(new_jim_state(xhost, 0, false, xauto_access)));
678 
679  // Exit:
680 
681  return;
682 }
683 
688 {
689  // Preconditions:
690 
691  require(is_ancestor_of(&xother));
692  require(precondition_of(attach_to_state(&xother)));
693 
694  // Body:
695 
696  attach_to_state(&xother);
697 
698  // Postconditions:
699 
700  ensure(postcondition_of(attach_to_state(&xother)));
701 
702  // Exit:
703 
704  return *this;
705 }
706 
710 operator=(const st4& xother)
711 {
712  // Preconditions:
713 
714  require(precondition_of(attach_to_state(&xother)));
715 
716  // Body:
717 
718  attach_to_state(&xother);
719 
720  // Postconditions:
721 
722  ensure(postcondition_of(attach_to_state(&xother)));
723 
724  // Exit:
725 
726  return *this;
727 }
728 
731 {
732 
733  // Preconditions:
734 
735  // Body:
736 
737  // Postconditions:
738 
739 }
740 
741 
745 {
746  // Preconditions:
747 
748  // Body:
749 
750  static const volatile_type result;
751 
752  // Postconditions:
753 
754  // Exit:
755 
756  return result;
757 }
758 
762 lite_type() const
763 {
764  // Preconditions:
765 
766  // Body:
767 
768  volatile_type* result = new volatile_type(sheaf::row_dofs(*this));
769 
770  // Postconditions:
771 
772  // Exit:
773 
774  return result;
775 }
776 
777 // PROTECTED MEMBER FUNCTIONS
778 
779 // PRIVATE MEMBER FUNCTIONS
780 
781 
782 //==============================================================================
783 // VD FACET OF CLASS ST4
784 //==============================================================================
785 
786 // PUBLIC MEMBER FUNCTIONS
787 
790 component(int xi, int xj, int xk, int xl) const
791 {
792  // Preconditions:
793 
794  require(state_is_read_accessible());
795  require((0 <= xi) && (xi < dd()));
796  require((0 <= xj) && (xj < dd()));
797  require((0 <= xk) && (xk < dd()));
798  require((0 <= xl) && (xl < dd()));
799 
800  // Body:
801 
802  value_type result = component(index_for_ijkl(xi, xj, xk, xl));
803 
804  // Postconditions:
805 
806  ensure(invariant());
807 
808  // Exit:
809 
810  return result;
811 }
812 
815 component(int xi, int xj, int xk, int xl, bool xauto_access) const
816 {
817  // Preconditions:
818 
819  require(state_is_auto_read_accessible(xauto_access));
820  require((0 <= xi) && (xi < dd(xauto_access)));
821  require((0 <= xj) && (xj < dd(xauto_access)));
822  require((0 <= xk) && (xk < dd(xauto_access)));
823  require((0 <= xl) && (xl < dd()));
824 
825  // Body:
826 
827  if(xauto_access)
828  {
829  get_read_access();
830  }
831 
832  value_type result = component(index_for_ijkl(xi, xj, xk, xl));
833 
834  if(xauto_access)
835  {
836  release_access();
837  }
838 
839  // Postconditions:
840 
841  ensure(invariant());
842 
843  // Exit:
844 
845  return result;
846 }
847 
848 
849 void
851 put_component(int xi, int xj, int xk, int xl, value_type xvalue)
852 {
853 
854  // Preconditions:
855 
856  require(state_is_read_write_accessible());
857  require((0 <= xi) && (xi < dd()));
858  require((0 <= xj) && (xj < dd()));
859  require((0 <= xk) && (xk < dd()));
860  require((0 <= xl) && (xl < dd()));
861 
862  // Body:
863 
864  put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
865 
866  // Postconditions:
867 
868  ensure(isunordered_or_equals(component(xi, xj, xk, xl), xvalue));
869 
870  // Exit:
871 
872  return;
873 }
874 
875 void
877 put_component(int xi, int xj, int xk, int xl, value_type xvalue,
878  bool xauto_access)
879 {
880  // Preconditions:
881 
882  require(state_is_auto_read_write_accessible(xauto_access));
883  require((0 <= xi) && (xi < dd()));
884  require((0 <= xj) && (xj < dd()));
885  require((0 <= xk) && (xk < dd()));
886  require((0 <= xl) && (xl < dd()));
887 
888  // Body:
889 
890  if(xauto_access)
891  {
892  get_read_write_access(true);
893  }
894 
895  put_component(index_for_ijkl(xi, xj, xk, xk), xvalue);
896 
897  if(xauto_access)
898  {
899  release_access();
900  }
901 
902  // Postconditions:
903 
904  ensure(isunordered_or_equals(component(xi, xj, xk, xl), xvalue));
905 
906  // Exit:
907 
908  return;
909 }
910 
911 
912 int
914 index_for_ijkl(int xi, int xj, int xk, int xl) const
915 {
916  // Preconditions:
917 
918  require(state_is_read_write_accessible());
919  require((0 <= xi) && (xi < dd()));
920  require((0 <= xj) && (xj < dd()));
921  require((0 <= xk) && (xk < dd()));
922  require((0 <= xl) && (xl < dd()));
923 
924  // Body:
925 
926  int ldd = dd();
927 
928  // Bubble sort the indices into ascending order (brute force).
929 
930  int ltmp;
931 
932  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
933  if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
934  if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
935  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
936  if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
937  if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
938  if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
939 
940  //int result = (xi*ldd + xj)*ldd + xk;
941  int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
942 
943  //@todo Implement in st4_e2 and st4_e3.
944 
945  static const int iskip2[2] = {0, 7};
946  static const int jskip2[2] = {0, 3};
947  static const int kskip2[2] = {0, 1};
948 
949  static const int iskip3[3] = {0, 23, 49};
950  static const int jskip3[3] = {0, 6, 14};
951  static const int kskip3[3] = {0, 1, 3};
952 
953  if(ldd == 2)
954  {
955  result -= (iskip2[xi] + jskip2[xj] + kskip2[xk]);
956  }
957  else if(ldd == 3)
958  {
959  result -= (iskip3[xi] + jskip3[xj] + kskip3[xk]);
960  }
961  else
962  {
963  // error.
964  }
965 
966  // Postconditions:
967 
968  ensure(result >= 0);
969  ensure(result < d());
970 
971  // Exit:
972 
973  return result;
974 }
975 
976 // PROTECTED MEMBER FUNCTIONS
977 
978 // PRIVATE MEMBER FUNCTIONS
979 
980 
981 //==============================================================================
982 // TUPLE FACET OF CLASS ST4
983 //==============================================================================
984 
985 // PUBLIC MEMBER FUNCTIONS
986 
987 // PROTECTED MEMBER FUNCTIONS
988 
989 // PRIVATE MEMBER FUNCTIONS
990 
991 
992 //==============================================================================
993 // ABSTRACT POSET MEMBER FACET OF CLASS ST4
994 //==============================================================================
995 
996 // PUBLIC MEMBER FUNCTIONS
997 
998 const std::string&
1000 class_name() const
1001 {
1002  // Preconditions:
1003 
1004  // Body:
1005 
1006  const string& result = static_class_name();
1007 
1008  // Postconditions:
1009 
1010  ensure(!result.empty());
1011 
1012  // Exit:
1013 
1014  return result;
1015 }
1016 
1017 const std::string&
1020 {
1021  // Preconditions:
1022 
1023  // Body:
1024 
1025  static const string result("st4");
1026 
1027  // Postconditions:
1028 
1029  ensure(!result.empty());
1030 
1031  // Exit:
1032 
1033  return result;
1034 }
1035 
1038 clone() const
1039 {
1040 
1041  // Preconditions:
1042 
1043  // Body:
1044 
1045  // Create new handle of the current class.
1046 
1047  st4* result = new st4();
1048 
1049  // Postconditions:
1050 
1051  ensure(result != 0);
1052  ensure(result->invariant());
1053 
1054  // Exit:
1055 
1056  return result;
1057 
1058 }
1059 
1060 // PROTECTED MEMBER FUNCTIONS
1061 
1062 // PRIVATE MEMBER FUNCTIONS
1063 
1064 
1065 //==============================================================================
1066 // ANY FACET OF CLASS ST4
1067 //==============================================================================
1068 
1069 // PUBLIC MEMBER FUNCTIONS
1070 
1071 bool
1073 is_ancestor_of(const any* xother) const
1074 {
1075 
1076  // Preconditions:
1077 
1078  require(xother != 0);
1079 
1080  // Body:
1081 
1082  // If xother may be dynamically cast to the type of this then this is an
1083  // ancestor of other.
1084 
1085  bool result = dynamic_cast<const st4*>(xother) != 0;
1086 
1087  // Postconditions:
1088 
1089  //ensure(invariant());
1090  //ensure(other->invariant());
1091 
1092  // Exit:
1093 
1094  return result;
1095 
1096 }
1097 
1098 bool
1100 invariant() const
1101 {
1102  bool result = true;
1103 
1104  // Body:
1105 
1106  if (invariant_check())
1107  {
1108  // Prevent recursive calls to invariant.
1109 
1110  disable_invariant_check();
1111 
1112  // Must satisfy base class invariant.
1113 
1114  invariance(stp::invariant());
1115 
1116  // Invariances for this class:
1117 
1118  invariance((state_is_read_accessible() ? p() == 4 : true));
1119 
1120  // Finished, turn invariant checking back on.
1121 
1122  enable_invariant_check();
1123  }
1124 
1125  // Exit:
1126 
1127  return result;
1128 }
1129 
1130 // PROTECTED MEMBER FUNCTIONS
1131 
1132 // PRIVATE MEMBER FUNCTIONS
1133 
static const std::string & static_class_name()
The name of this class.
Definition: st4.cc:1019
~st4()
Destructor.
Definition: st4.cc:730
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
virtual void put_component(int xi, int xj, int xk, int xl, value_type xvalue)
Sets the component with indices xi, xj, xk, xl to xvalue.
Definition: st4.cc:851
virtual void put_component(int xi, int xj, int xk, int xl, value_type xvalue)
Sets the component with indices xi, xj, xk, xl to xvalue.
Definition: st4.cc:214
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: vd.h:129
st4_lite & operator=(const st4_lite &xother)
Assignment operator.
Definition: st4.cc:79
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
poset_path path(bool xauto_access=true) const
A path to this component.
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
virtual st4 * clone() const
Make a new handle, no state instance of current.
Definition: st4.cc:1038
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
poset_path vector_space_path() const
The path of the underlying vector space.
Definition: tp_space.cc:365
virtual int index_for_ijkl(int xi, int xj, int xk, int xl) const
The index into linear storage of the component for specified indices xi, xj, xk, xl.
Definition: st4.cc:239
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
static const std::string & static_class_name()
The name of this class.
Definition: st4.cc:343
STL namespace.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
Definition: st4.cc:458
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual int index_for_ijkl(int xi, int xj, int xk, int xl) const
The index into linear storage of the component for specified indices xi, xj, xk, xl.
Definition: st4.cc:914
static int d(const namespace_poset &xns, int xp, const poset_path &xvector_space_path, bool xauto_access)
The tensor dimension implied by tensor degree xp and the dimension of the domain vector space specifi...
Definition: stp_space.cc:86
A symmetric rank 4 tensor over an abstract vector space (persistent version).
Definition: st4.h:230
st4_lite()
Default constructor.
Definition: st4.cc:47
bool invariant() const
Class invariant.
Definition: st4.cc:415
Abstract base class with useful features for all volatile objects.
Definition: any_lite.h:48
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
A space of scalars viewed as an antisymmetric tensor space of degree 0.
Definition: at0_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...
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)
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual st4_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: st4.cc:362
virtual st4 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: st4.cc:687
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 value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
Definition: st4.cc:190
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 volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
Definition: st4.cc:762
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
virtual int p() const
Degree of this as a symmetric tensor space.
Definition: st4.cc:159
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
Definition: st4.cc:476
bool invariant() const
Class invariant.
Definition: st4.cc:1100
virtual const std::string & class_name() const
The name of this class.
Definition: st4.cc:324
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
vd_value_type value_type
The POD ("plain old data") type of scalar in the vector space of this.
Definition: vd.h:423
virtual ~st4_lite()
Destructor.
Definition: st4.cc:98
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: st4.cc:1000
st4()
Default constructor.
Definition: st4.cc:565
An abstract client handle for a member of a poset.
An abstract symmetric tensor space of degree p.
Definition: stp_space.h:42
Namespace for the fiber_bundles component of the sheaf system.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Definition: st4.cc:744
virtual value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
Definition: st4.cc:790
Row dofs type for class vd.
Definition: vd.h:61
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
Definition: st4.cc:1073
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.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
Definition: st4.cc:395
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: st4.cc:506
A symmetric rank 4 tensor over an abstract vector space. (volatile version).
Definition: st4.h:43
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