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