SheafSystem  0.0.0.0
sec_t3.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/sec_t3.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/binary_section_space_schema_member.impl.h"
25 #include "SheafSystem/binary_section_space_schema_poset.h"
26 #include "SheafSystem/fiber_bundles_namespace.h"
27 #include "SheafSystem/sec_at0.h"
28 #include "SheafSystem/sec_at0_space.h"
29 #include "SheafSystem/sec_tuple_space.impl.h"
30 #include "SheafSystem/section_space_schema_member.impl.h"
31 #include "SheafSystem/section_space_schema_poset.h"
32 #include "SheafSystem/tp.h"
33 #include "SheafSystem/tp_space.h"
34 
35 using namespace std;
36 using namespace fiber_bundle; // Workaround for MS C++ bug.
37 
38 //==============================================================================
39 // CLASS SEC_T3
40 //==============================================================================
41 
42 // ===========================================================
43 // HOST FACTORY FACET OF CLASS SEC_T3
44 // ===========================================================
45 
46 // PUBLIC MEMBER FUNCTIONS
47 
51  const poset_path& xhost_path,
52  const poset_path& xschema_path,
53  const poset_path& xscalar_space_path,
54  bool xauto_access)
55 {
56  // cout << endl << "Entering sec_t3::new_host." << endl;
57 
58  // Preconditions:
59 
60  require(xns.state_is_auto_read_write_accessible(xauto_access));
61 
62  require(!xhost_path.empty());
63  require(!xns.contains_path(xhost_path, xauto_access));
64 
65  require(xschema_path.full());
66  require(xns.path_is_auto_read_accessible<schema_type::host_type>(xschema_path, xauto_access));
67  require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
68 
69  require(xns.path_is_auto_read_accessible<scalar_type::host_type>(xscalar_space_path, xauto_access));
70 
71  require(host_type::same_scalar_fiber_space(xns, xschema_path, xscalar_space_path, xauto_access));
72 
73  // Body:
74 
75  host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xscalar_space_path, xauto_access);
76 
77  // Postconditions:
78 
79  ensure(xns.owns(result, xauto_access));
80  ensure(result.path(true) == xhost_path);
81  ensure(result.state_is_not_read_accessible());
82  ensure(result.schema(true).path(xauto_access) == xschema_path);
83 
84  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
85  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
86  ensure(result.d(true) == result.dd(true));
87  ensure(result.scalar_space_path(true) == xscalar_space_path);
88  ensure(result.p(true) == result.schema(true).fiber_space<fiber_type::host_type>().p(xauto_access));
89  ensure(result.p(true) == 3);
90  ensure(result.dd(true) == result.schema(true).fiber_space<fiber_type::host_type>().dd(xauto_access));
91  ensure(result.vector_space_path(true) == xhost_path);
92 
93  // Exit:
94 
95  // cout << "Leaving sec_t3::new_host." << endl;
96  return result;
97 }
98 
99 // PROTECTED MEMBER FUNCTIONS
100 
101 // PRIVATE MEMBER FUNCTIONS
102 
103 
104 //==============================================================================
105 // T3 FACET OF CLASS SEC_T3
106 //==============================================================================
107 
108 // PUBLIC MEMBER FUNCTIONS
109 
112 {
113  // Preconditions:
114 
115  // Body:
116 
117  // Postconditions:
118 
119  ensure(invariant());
120 }
121 
123 sec_t3(const sec_rep_space* xhost, pod_index_type xhub_id)
124 {
125  // Preconditions:
126 
127  require(xhost != 0);
128  require(xhost->state_is_read_accessible());
129  require(xhost->contains_member(xhub_id));
130 
131  // Body:
132 
133  attach_to_state(xhost, xhub_id);
134 
135  // Postconditions:
136 
137  ensure(invariant());
138  //ensure(host() == xhost);
139  ensure(index() == xhub_id);
140  ensure(is_attached());
141  ensure(!is_restricted());
142 }
143 
145 sec_t3(const sec_rep_space* xhost, const scoped_index& xid)
146 {
147  // Preconditions:
148 
149  require(xhost != 0);
150  require(xhost->state_is_read_accessible());
151  require(xhost->contains_member(xid));
152 
153  // Body:
154 
155  attach_to_state(xhost, xid.hub_pod());
156 
157  // Postconditions:
158 
159  ensure(invariant());
160  //ensure(host() == xhost);
161  ensure(index() ==~ xid);
162  ensure(is_attached());
163  ensure(!is_restricted());
164 }
165 
167 sec_t3(const sec_rep_space* xhost, const std::string& xname)
168 {
169 
170  // Preconditions:
171 
172  require(xhost != 0);
173  require(xhost->state_is_read_accessible());
174  require(!xname.empty());
175  require(xhost->contains_member(xname));
176 
177  // Body:
178 
179  attach_to_state(xhost, xname);
180 
181  // Postconditions:
182 
183  ensure(invariant());
184  //ensure(host() == xhost);
185  ensure(name() == xname);
186  ensure(is_attached());
187  ensure(!is_restricted());
188 
189 }
190 
191 
193 sec_t3(const namespace_poset* xnamespace,
194  const poset_path& xpath,
195  bool xauto_access)
196 {
197 
198  // Preconditions:
199 
200  require(precondition_of(attach_to_state(same args)));
201 
202  // Body:
203 
204  attach_to_state(xnamespace, xpath, xauto_access);
205 
206  // Postconditions:
207 
208  ensure(postcondition_of(attach_to_state(same args)));
209 
210  // Exit:
211 
212  return;
213 }
214 
215 
218 {
219 
220  // Preconditions:
221 
222  require(xother != 0);
223 
224  // Body:
225 
226  attach_to_state(xother);
227 
228  // Postconditions:
229 
230  ensure(invariant());
231  ensure(is_attached());
232  ensure(is_same_state(xother));
233  ensure(is_same_restriction(xother));
234 
235 }
236 
238 sec_t3(sec_rep_space* xhost, section_dof_map* xdof_map, bool xauto_access)
239 {
240 
241  // Preconditions:
242 
243  require(precondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
244 
245  // Body:
246 
247  new_jim_state(xhost, xdof_map, false, xauto_access);
248 
249  // Postconditions:
250 
251  ensure(postcondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
252 
253  // Exit:
254 
255  return;
256 }
257 
260  abstract_poset_member& xbase_mbr,
261  int xbase_version, bool xauto_access)
262 {
263 
264  // Preconditions:
265 
266  require(precondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
267 
268  // Body:
269 
270  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
271 
272  // Postconditions:
273 
274  ensure(postcondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
275 
276  // Exit:
277 
278  return;
279 }
280 
284 {
285  // Preconditions:
286 
287  require(is_ancestor_of(&xother));
288  require(precondition_of(attach_to_state(&xother)));
289 
290  // Body:
291 
292  attach_to_state(&xother);
293 
294  // Postconditions:
295 
296  ensure(postcondition_of(attach_to_state(&xother)));
297 
298  // Exit:
299 
300  return *this;
301 }
302 
305 operator=(const sec_t3& xother)
306 {
307  // Preconditions:
308 
309  require(precondition_of(attach_to_state(&xother)));
310 
311  // Body:
312 
313  attach_to_state(&xother);
314 
315  // Postconditions:
316 
317  ensure(postcondition_of(attach_to_state(&xother)));
318 
319  // Exit:
320 
321  return *this;
322 }
323 
326 operator=(const t3& xfiber)
327 {
328  // Preconditions:
329 
330  require(precondition_of(sec_vd::operator=(xfiber)));
331 
332  // Body:
333 
334  sec_vd::operator=(xfiber);
335 
336  // Postconditions:
337 
338  ensure(postcondition_of(sec_vd::operator=(xfiber)));
339 
340  // Exit:
341 
342  return *this;
343 }
344 
347 operator=(const t3_lite& xfiber)
348 {
349  // Preconditions:
350 
351  require(precondition_of(sec_vd::operator=(xfiber)));
352 
353  // Body:
354 
355  sec_vd::operator=(xfiber);
356 
357  // Postconditions:
358 
359  ensure(postcondition_of(sec_vd::operator=(xfiber)));
360 
361  // Exit:
362 
363  return *this;
364 }
365 
368 {
369  // Preconditions:
370 
371  // Body:
372 
373  // Postconditions:
374 
375 }
376 
380 {
381  // Preconditions:
382 
383  // Body:
384 
385  static const fiber_type result;
386 
387  // Postconditions:
388 
389  // Exit:
390 
391  return result;
392 }
393 
394 // PROTECTED MEMBER FUNCTIONS
395 
396 // PRIVATE MEMBER FUNCTIONS
397 
398 
399 //==============================================================================
400 // STP FACET OF CLASS SEC_T3
401 //==============================================================================
402 
403 // PUBLIC MEMBER FUNCTIONS
404 
405 // PROTECTED MEMBER FUNCTIONS
406 
407 // PRIVATE MEMBER FUNCTIONS
408 
409 
410 //==============================================================================
411 // TP FACET OF CLASS SEC_T3
412 //==============================================================================
413 
414 // PUBLIC MEMBER FUNCTIONS
415 
416 // PROTECTED MEMBER FUNCTIONS
417 
418 // PRIVATE MEMBER FUNCTIONS
419 
420 
421 //==============================================================================
422 // VD FACET OF CLASS SEC_T3
423 //==============================================================================
424 
425 // PUBLIC MEMBER FUNCTIONS
426 
427 // PROTECTED MEMBER FUNCTIONS
428 
429 // PRIVATE MEMBER FUNCTIONS
430 
431 
432 //==============================================================================
433 // TUPLE FACET OF CLASS SEC_T3
434 //==============================================================================
435 
436 // PUBLIC MEMBER FUNCTIONS
437 
438 // PROTECTED MEMBER FUNCTIONS
439 
440 // PRIVATE MEMBER FUNCTIONS
441 
442 
443 //==============================================================================
444 // ABSTRACT POSET MEMBER FACET OF CLASS SEC_T3
445 //==============================================================================
446 
447 const std::string&
449 class_name() const
450 {
451  // Preconditions:
452 
453  // Body:
454 
455  const string& result = static_class_name();
456 
457  // Postconditions:
458 
459  ensure(!result.empty());
460 
461  // Exit:
462 
463  return result;
464 }
465 
466 const std::string&
469 {
470  // Preconditions:
471 
472  // Body:
473 
474  static const string result("sec_t3");
475 
476  // Postconditions:
477 
478  ensure(!result.empty());
479 
480  // Exit:
481 
482  return result;
483 }
484 
487 clone() const
488 {
489 
490  // Preconditions:
491 
492  // Body:
493 
494  // create new handle of the current class.
495 
496  sec_t3 *result = new sec_t3();
497 
498  // Postconditions:
499 
500  ensure(result != 0);
501  ensure(result->invariant());
502 
503  // Exit:
504 
505  return result;
506 
507 }
508 
509 // PROTECTED MEMBER FUNCTIONS
510 
511 // PRIVATE MEMBER FUNCTIONS
512 
513 
514 //==============================================================================
515 // ANY FACET OF CLASS SEC_T3
516 //==============================================================================
517 
518 // PUBLIC MEMBER FUNCTIONS
519 
520 bool
522 fiber_is_ancestor_of(const any* xother) const
523 {
524 
525  // Preconditions:
526 
527  require(xother != 0);
528 
529  // Body:
530 
531  // If xother may be dynamically cast to the type of this fiber then this
532  // fiber is an ancestor of xother.
533 
534  bool result = dynamic_cast<const t3*>(xother) != 0;
535 
536  // Postconditions:
537 
538  ensure(invariant());
539  ensure(xother->invariant());
540 
541  // Exit:
542 
543  return result;
544 
545 }
546 
547 bool
549 is_ancestor_of(const any* xother) const
550 {
551  // Preconditions:
552 
553  require(xother != 0);
554 
555  // Body:
556 
557  // If other may be dynamically cast to the type of this then this is an
558  // ancestor of other.
559 
560  bool result = dynamic_cast<const sec_t3*>(xother) != 0;
561 
562  // Postconditions:
563 
564  //ensure(invariant());
565 
566  // Exit:
567 
568  return result;
569 
570 }
571 
572 bool
574 invariant() const
575 {
576  bool result = true;
577 
578  // Preconditions:
579 
580  // Body:
581 
582  // Must satisfy base class invariant
583 
584  invariance(sec_tp::invariant());
585 
586  if (invariant_check())
587  {
588  // Prevent recursive calls to invariant
589 
590  disable_invariant_check();
591 
592  invariance(is_attached() ? p() == 3 : true);
593 
594  // Finished, turn invariant checking back on.
595 
596  enable_invariant_check();
597  }
598 
599  // Postconditions:
600 
601  ensure(is_derived_query);
602 
603  // Exit:
604 
605  return result;
606 }
607 
608 // PROTECTED MEMBER FUNCTIONS
609 
610 // PRIVATE MEMBER FUNCTIONS
611 
612 //==============================================================================
613 // NON-MEMBER FUNCTIONS
614 //==============================================================================
615 
616 
617 namespace
618 {
619  using namespace fiber_bundle::tp_algebra;
620 
621  class alt_functor
622  {
623  public:
624  void operator()(const t3_lite& x0, at3_lite& xresult) const
625  {
626  alt(x0, xresult);
627  }
628 
629  void operator()(const t3_lite& x0, t3_lite& xresult) const
630  {
631  alt(x0, xresult);
632  }
633  };
634 
635  class sym_functor
636  {
637  public:
638  void operator()(const t3_lite& x0, st3_lite& xresult) const
639  {
640  sym(x0, xresult);
641  }
642 
643  void operator()(const t3_lite& x0, t3_lite& xresult) const
644  {
645  sym(x0, xresult);
646  }
647  };
648 
649  class contract_functor
650  {
651  public:
652  contract_functor(int xp, int xq) : _p(xp), _q(xq) {}
653  void operator()(const t3_lite& x0, at1_lite& xresult) const
654  {
655  contract(x0, _p, _q, xresult);
656  }
657  private:
658  int _p;
659  int _q;
660  };
661 
662  class tensor_functor
663  {
664  public:
665  void operator()(const t2_lite& xl0, const at1_lite& xl1,
666  t3_lite& xlresult) const
667  {
668  tensor(xl0, xl1, xlresult);
669  }
670 
671  void operator()(const at1_lite& xl0, const t2_lite& xl1,
672  t3_lite& xlresult) const
673  {
674  tensor(xl0, xl1, xlresult);
675  }
676 
677  void operator()(const at2_lite& xl0, const at1_lite& xl1,
678  t3_lite& xlresult) const
679  {
680  tensor(xl0, xl1, xlresult);
681  }
682 
683  void operator()(const at1_lite& xl0, const at2_lite& xl1,
684  t3_lite& xlresult) const
685  {
686  tensor(xl0, xl1, xlresult);
687  }
688 
689  void operator()(const st2_lite& xl0, const at1_lite& xl1,
690  t3_lite& xlresult) const
691  {
692  tensor(xl0, xl1, xlresult);
693  }
694 
695  void operator()(const at1_lite& xl0, const st2_lite& xl1,
696  t3_lite& xlresult) const
697  {
698  tensor(xl0, xl1, xlresult);
699  }
700  };
701 
702 } //end unnamed namespace
703 
704 //==============================================================================
705 //==============================================================================
706 
707 #include "SheafSystem/sec_at1.h"
708 #include "SheafSystem/sec_at2.h"
709 #include "SheafSystem/sec_at3.h"
710 #include "SheafSystem/sec_st2.h"
711 #include "SheafSystem/sec_st3.h"
712 #include "SheafSystem/sec_t2.h"
713 #include "SheafSystem/sec_t3.h"
714 #include "SheafSystem/sec_vd.impl.h"
715 
716 using namespace fiber_bundle::sec_vd_algebra;
717 
718 void
720 alt(const sec_t3& x0, sec_at3& xresult, bool xauto_access)
721 {
722  // Preconditions:
723 
724  require(x0.state_is_auto_read_accessible(xauto_access));
725  require(xresult.state_is_auto_read_write_accessible(xauto_access));
726  require(x0.dd(xauto_access) == xresult.dd(xauto_access));
727  require(!x0.variance(xauto_access).is_mixed());
728 
729  // Body:
730 
731  unary_op(x0, xresult, alt_functor(), xauto_access);
732 
733  // Set the variance of the result.
734 
735  xresult.put_variance(x0.variance(xauto_access), xauto_access);
736 
737  // Postconditions:
738 
739  ensure(xresult.variance(xauto_access) == x0.variance(xauto_access));
740  ensure(unexecutable("xresult is equal to the antisymmetric part of x0"));
741 
742  // Exit:
743 
744  return;
745 }
746 
747 void
749 alt(const sec_t3& x0, sec_t3& xresult, bool xauto_access)
750 {
751  // Preconditions:
752 
753  require(x0.state_is_auto_read_accessible(xauto_access));
754  require(xresult.state_is_auto_read_write_accessible(xauto_access));
755  require(x0.dd(xauto_access) == xresult.dd(xauto_access));
756  require(!x0.variance(xauto_access).is_mixed());
757 
758  // Body:
759 
760  unary_op(x0, xresult, alt_functor(), xauto_access);
761 
762  // Set the variance of the result.
763 
764  xresult.put_variance(x0.variance(xauto_access), xauto_access);
765 
766  // Postconditions:
767 
768  ensure(xresult.variance(xauto_access) == x0.variance(xauto_access));
769  ensure(unexecutable("xresult is equal to the antisymmetric part of x0"));
770 
771  // Exit:
772 
773  return;
774 }
775 
776 void
778 sym(const sec_t3& x0, sec_st3& xresult, bool xauto_access)
779 {
780  // Preconditions:
781 
782  require(x0.state_is_auto_read_accessible(xauto_access));
783  require(xresult.state_is_auto_read_write_accessible(xauto_access));
784  require(x0.dd(xauto_access) == xresult.dd(xauto_access));
785  require(!x0.variance(xauto_access).is_mixed());
786 
787  // Body:
788 
789  unary_op(x0, xresult, sym_functor(), xauto_access);
790 
791  // Set the variance of the result.
792 
793  xresult.put_variance(x0.variance(xauto_access), xauto_access);
794 
795  // Postconditions:
796 
797  ensure(xresult.variance(xauto_access) == x0.variance(xauto_access));
798  ensure(unexecutable("xresult is equal to the symmetric part of x0"));
799 
800  // Exit:
801 
802  return;
803 }
804 
805 void
807 sym(const sec_t3& x0, sec_t3& xresult, bool xauto_access)
808 {
809  // Preconditions:
810 
811  require(x0.state_is_auto_read_accessible(xauto_access));
812  require(xresult.state_is_auto_read_write_accessible(xauto_access));
813  require(x0.dd(xauto_access) == xresult.dd(xauto_access));
814  require(!x0.variance(xauto_access).is_mixed());
815 
816  // Body:
817 
818  unary_op(x0, xresult, sym_functor(), xauto_access);
819 
820  // Set the variance of the result.
821 
822  xresult.put_variance(x0.variance(xauto_access), xauto_access);
823 
824  // Postconditions:
825 
826  ensure(xresult.variance(xauto_access) == x0.variance(xauto_access));
827  ensure(unexecutable("xresult is equal to the symmetric part of x0"));
828 
829  // Exit:
830 
831  return;
832 }
833 
834 void
836 contract(const sec_t3& x0, int xp, int xq, sec_at1& xresult,
837  bool xauto_access)
838 {
839  // Preconditions:
840 
841  require(x0.state_is_auto_read_accessible(xauto_access));
842  require(xresult.state_is_auto_read_write_accessible(xauto_access));
843  require(xp != xq);
844  require(xp >= 0 && xp < x0.p(xauto_access));
845  require(xq >= 0 && xq < x0.p(xauto_access));
846  require(x0.is_contravariant(xp, xauto_access) != \
847  x0.is_contravariant(xq, xauto_access));
848 
849  // Body:
850 
851  unary_op(x0, xresult, contract_functor(xp, xq), xauto_access);
852 
853  // Postconditions:
854 
855  ensure(unexecutable("xresult is the contraction of x0 on indices xp and xq"));
856  //ensure(xresult.is_p_form(xauto_access) == x0.is_p_form(xauto_access));
857 
858  // Exit:
859 
860  return;
861 }
862 
863 void
865 tensor(const sec_t2& x0, const sec_at1& x1, sec_t3& xresult, bool xauto_access)
866 {
867  // Preconditions:
868 
869  require(x0.state_is_auto_read_accessible(xauto_access));
870  require(x1.state_is_auto_read_accessible(xauto_access));
871  require(xresult.state_is_auto_read_write_accessible(xauto_access));
872  require(x1.dd(xauto_access) == x0.dd(xauto_access));
873  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
874 
875  // Body:
876 
877  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
878 
879  // Set the variance of the result.
880 
881  xresult.put_variance(
882  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
883  xauto_access);
884 
885  // Postconditions:
886 
887  ensure(xresult.variance(xauto_access) == \
888  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
889 
890  // Exit:
891 
892  return;
893 }
894 
895 void
897 tensor(const sec_at1& x0, const sec_t2& x1, sec_t3& xresult, bool xauto_access)
898 {
899  // Preconditions:
900 
901  require(x0.state_is_auto_read_accessible(xauto_access));
902  require(x1.state_is_auto_read_accessible(xauto_access));
903  require(xresult.state_is_auto_read_write_accessible(xauto_access));
904  require(x1.dd(xauto_access) == x0.dd(xauto_access));
905  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
906 
907  // Body:
908 
909  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
910 
911  // Set the variance of the result.
912 
913  xresult.put_variance(
914  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
915  xauto_access);
916 
917  // Postconditions:
918 
919  ensure(xresult.variance(xauto_access) == \
920  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
921 
922  // Exit:
923 
924  return;
925 }
926 
927 void
929 tensor(const sec_at2& x0, const sec_at1& x1, sec_t3& xresult, bool xauto_access)
930 {
931  // Preconditions:
932 
933  require(x0.state_is_auto_read_accessible(xauto_access));
934  require(x1.state_is_auto_read_accessible(xauto_access));
935  require(xresult.state_is_auto_read_write_accessible(xauto_access));
936  require(x1.dd(xauto_access) == x0.dd(xauto_access));
937  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
938 
939  // Body:
940 
941  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
942 
943  // Set the variance of the result.
944 
945  xresult.put_variance(
946  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
947  xauto_access);
948 
949  // Postconditions:
950 
951  ensure(xresult.variance(xauto_access) == \
952  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
953 
954  // Exit:
955 
956  return;
957 }
958 
959 void
961 tensor(const sec_at1& x0, const sec_at2& x1, sec_t3& xresult, bool xauto_access)
962 {
963  // Preconditions:
964 
965  require(x0.state_is_auto_read_accessible(xauto_access));
966  require(x1.state_is_auto_read_accessible(xauto_access));
967  require(xresult.state_is_auto_read_write_accessible(xauto_access));
968  require(x1.dd(xauto_access) == x0.dd(xauto_access));
969  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
970 
971  // Body:
972 
973  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
974 
975  // Set the variance of the result.
976 
977  xresult.put_variance(
978  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
979  xauto_access);
980 
981  // Postconditions:
982 
983  ensure(xresult.variance(xauto_access) == \
984  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
985 
986  // Exit:
987 
988  return;
989 }
990 
991 void
993 tensor(const sec_st2& x0, const sec_at1& x1, sec_t3& xresult, bool xauto_access)
994 {
995  // Preconditions:
996 
997  require(x0.state_is_auto_read_accessible(xauto_access));
998  require(x1.state_is_auto_read_accessible(xauto_access));
999  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1000  require(x1.dd(xauto_access) == x0.dd(xauto_access));
1001  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
1002 
1003  // Body:
1004 
1005  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
1006 
1007  // Set the variance of the result.
1008 
1009  xresult.put_variance(
1010  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
1011  xauto_access);
1012 
1013  // Postconditions:
1014 
1015  ensure(xresult.variance(xauto_access) == \
1016  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
1017 
1018  // Exit:
1019 
1020  return;
1021 }
1022 
1023 void
1025 tensor(const sec_at1& x0, const sec_st2& x1, sec_t3& xresult, bool xauto_access)
1026 {
1027  // Preconditions:
1028 
1029  require(x0.state_is_auto_read_accessible(xauto_access));
1030  require(x1.state_is_auto_read_accessible(xauto_access));
1031  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1032  require(x1.dd(xauto_access) == x0.dd(xauto_access));
1033  require(xresult.dd(xauto_access) == x0.dd(xauto_access));
1034 
1035  // Body:
1036 
1037  binary_op(x0, x1, xresult, tensor_functor(), xauto_access);
1038 
1039  // Set the variance of the result.
1040 
1041  xresult.put_variance(
1042  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)),
1043  xauto_access);
1044 
1045  // Postconditions:
1046 
1047  ensure(xresult.variance(xauto_access) == \
1048  tensor_product(x0.variance(xauto_access), x1.variance(xauto_access)));
1049 
1050  // Exit:
1051 
1052  return;
1053 }
1054 
A tensor of degree 3 over an abstract vector space (volatile version).
Definition: t3.h:43
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
Definition: any.cc:153
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
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 ...
An antisymmetric rank 3 tensor over an abstract vector space (volatile version).
Definition: at3.h:43
virtual const std::string & class_name() const
The name of this class.
Definition: sec_t3.cc:449
SHEAF_DLL_SPEC void sym(const sec_t2 &x0, sec_st2 &xresult, bool xauto_access)
The symmetric part of tensor x0 (pre-allocated version).
Definition: sec_t2.cc:737
SHEAF_DLL_SPEC void alt(const t2_lite &x0, at2_lite &xresult)
The alternating (antisymmetric) part of tensor x0 (pre-allocated version for volatile types)...
Definition: t2.cc:1176
sec_t3()
Default constructor.
Definition: sec_t3.cc:111
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
A Cartesian product section space.
The abstract map from section dof ids to section dof values of heterogeneous type.
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...
void unary_op(const S0 &x0, SR &xresult, F xfunctor, bool xauto_access)
Unary operator.
Definition: sec_vd.impl.h:224
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
A tensor of degree 3 over an abstract vector space (persistent version).
Definition: t3.h:222
bool invariant() const
Class invariant.
Definition: sec_t3.cc:574
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
Definition: at1.h:44
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...
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: sec_t3.cc:50
SHEAF_DLL_SPEC void sym(const t2_lite &x0, st2_lite &xresult)
The symmetric part of tensor x0 (pre-allocated version for volatile types).
Definition: t2.cc:1301
SHEAF_DLL_SPEC void alt(const sec_t2 &x0, sec_at2 &xresult, bool xauto_access)
The alternating (antisymmetric) part of tensor x0 (pre-allocated version).
Definition: sec_t2.cc:679
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
A member of a sec_rep_space; a section.
poset_path vector_space_path() const
The path of the underlying vector space.
STL namespace.
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
A section of a bundle with fiber type at1.
Definition: sec_at1.h:48
virtual tensor_variance variance(bool xauto_access) const
The variance.
Definition: sec_tp.cc:589
void put_variance(const tensor_variance &xvariance, bool xauto_access)
Sets the variance to xvariance.
Definition: sec_tp.cc:627
SHEAF_DLL_SPEC tensor_variance tensor_product(const tensor_variance &x0, const tensor_variance &x1)
The variance of the tensor product of tensors with variance x0 and x1.
virtual int p() const
The degree of the tensors in host(); the sum of the contravariant and covariant degrees.
Definition: sec_tp.cc:391
bool is_mixed() const
True if and only if there exists at least one index that is covariant and at least one that is contra...
A tensor of degree 2 over an abstract vector space (volatile version).
Definition: t2.h:43
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
Definition: sec_t3.cc:549
A section of a bundle with fiber type t3.
Definition: sec_t3.h:46
Abstract base class with useful features for all objects.
Definition: any.h:39
int p() const
The tensor degree of this space.
A general symmetric tensor of degree 2 over an abstract vector space (volatile version).
Definition: st2.h:43
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
bool fiber_is_ancestor_of(const any *xother) const
True if xother conforms to an instance of the fiber of current.
Definition: sec_t3.cc:522
static const std::string & static_class_name()
The name of this class.
Definition: sec_t3.cc:468
virtual bool is_contravariant(bool xauto_access) const
True if and only if all tensor index positions are contravariant.
Definition: sec_tp.cc:748
An abstract tensor section space of degree p.
Definition: sec_tp_space.h:53
void binary_op(const S0 &x0, const S1 &x1, SR &xresult, F xfunctor, bool xauto_access)
Binary operator.
Definition: sec_vd.impl.h:48
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
A section of a bundle with fiber type at2.
Definition: sec_at2.h:46
virtual int dd() const
Dimension of the underlying vector space.
Definition: sec_tp.cc:433
A section of a bundle with fiber type st2.
Definition: sec_st2.h:46
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
A section of a bundle with fiber type at3.
Definition: sec_at3.h:46
int dd() const
The dimension of the underlying ("domain") vector space.
A symmetric rank 3 tensor over an abstract vector space. (volatile version).
Definition: st3.h:43
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
A section of a bundle with fiber type st3.
Definition: sec_st3.h:46
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
Definition: sec_t3.cc:379
virtual sec_t3 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: sec_t3.cc:283
A section of a bundle with fiber type tp.
Definition: sec_t2.h:46
SHEAF_DLL_SPEC void contract(const sec_t2 &x0, int xp, int xq, sec_at0 &xresult, bool xauto_access)
Contraction on contravariant index xp and covariant index xq (pre-allocated version).
Definition: sec_t2.cc:795
Namespace containing the general tensor algrebra functions for the fiber_bundles component of the she...
Definition: t2.h:496
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
poset_path scalar_space_path() const
The path of the underlying space of scalars.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
SHEAF_DLL_SPEC void tensor(const sec_at1 &x0, const sec_at1 &x1, sec_t2 &xresult, bool xauto_access)
Definition: sec_t2.cc:824
virtual int d(int xp, int xdd) const
Dimension d() as a function of degree xp and domain dimension xdd.
Namespace containing the algrebra functions for a a section of a fiber bundle with a d-dimensional ve...
Definition: sec_vd.h:691
A general antisymmetric tensor of degree 2 over an abstract vector space (volatile version)...
Definition: at2.h:43
An abstract client handle for a member of a poset.
~sec_t3()
Destructor.
Definition: sec_t3.cc:367
An abstract tensor space of degree p.
Definition: tp_space.h:47
SHEAF_DLL_SPEC void tensor(const at1_lite &x0, const at1_lite &x1, t2_lite &xresult)
Tensor product (pre-allocated version for volatile types).
Definition: t2.cc:1488
Namespace for the fiber_bundles component of the sheaf system.
bool state_is_not_read_accessible() const
True if this is attached and if the state is accessible for read or if access control is disabled...
virtual sec_t3 * clone() const
Make a new handle, no state instance of current.
Definition: sec_t3.cc:487
SHEAF_DLL_SPEC void contract(const t2_lite &x0, int xp, int xq, at0_lite &xresult)
Contraction on contravariant index xp and covariant index xq (pre-allocated version for volatime type...
Definition: t2.cc:1091
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61