SheafSystem  0.0.0.0
sec_at2_e2.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 
22 #include "SheafSystem/sec_at2_e2.h"
23 
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/base_space_poset.h"
26 #include "SheafSystem/binary_section_space_schema_member.impl.h"
27 #include "SheafSystem/at1_space.h"
28 #include "SheafSystem/fiber_bundles_namespace.h"
29 #include "SheafSystem/index_space_iterator.h"
30 #include "SheafSystem/sec_at0.h"
31 #include "SheafSystem/sec_at0_space.h"
32 #include "SheafSystem/sec_at1_space.h"
33 #include "SheafSystem/sec_e2.h"
34 #include "SheafSystem/sec_tuple.impl.h"
35 #include "SheafSystem/sec_tuple_space.impl.h"
36 #include "SheafSystem/sec_vd.impl.h"
37 #include "SheafSystem/at2_e2.h"
38 
39 using namespace std;
40 using namespace fiber_bundle; // Workaround for MS C++ bug.
41 
42 //==============================================================================
43 // CLASS SEC_AT2_E2
44 //==============================================================================
45 
46 // ===========================================================
47 // HOST FACTORY FACET OF CLASS SEC_AT2_E2
48 // ===========================================================
49 
50 // PUBLIC MEMBER FUNCTIONS
51 
55  const poset_path& xhost_path,
56  const poset_path& xschema_path,
57  const poset_path& xvector_space_path,
58  bool xauto_access)
59 {
60  // cout << endl << "Entering sec_at2_e2::new_host." << endl;
61 
62  // Preconditions:
63 
64  require(xns.state_is_auto_read_write_accessible(xauto_access));
65 
66  require(!xhost_path.empty());
67  require(!xns.contains_path(xhost_path, xauto_access));
68 
69  require(xschema_path.full());
70  require(xns.path_is_auto_read_accessible<schema_type::host_type>(xschema_path, xauto_access));
71  require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
72 
73  require(xns.path_is_auto_read_accessible<vector_space_type::host_type>(xvector_space_path, xauto_access));
74 
75  require(host_type::same_vector_fiber_space(xns, xschema_path, xvector_space_path, xauto_access));
76 
77  // Body:
78 
79  host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xvector_space_path, xauto_access);
80 
81  // Postconditions:
82 
83  ensure(xns.owns(result, xauto_access));
84  ensure(result.path(true) == xhost_path);
85  ensure(result.state_is_not_read_accessible());
86  ensure(result.schema(true).path(xauto_access) == xschema_path);
87 
88  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
89  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
90  ensure(result.scalar_space_path(true) ==
91  xns.member_poset<vector_space_type::host_type>(xvector_space_path, xauto_access).scalar_space_path(xauto_access));
92  ensure(result.p(true) == result.schema(true).fiber_space<fiber_type::host_type>().p(xauto_access));
93  ensure(result.p(true) == 2);
94  ensure(result.dd(true) == result.schema(true).fiber_space<fiber_type::host_type>().dd(xauto_access));
95  ensure(result.vector_space_path(true) == xvector_space_path);
96 
97  // Exit:
98 
99  // cout << "Leaving sec_at2_e2::new_host." << endl;
100  return result;
101 }
102 
106  const poset_path& xbase_path,
107  const poset_path& xrep_path,
108  const std::string& xsection_suffix,
109  const std::string& xfiber_suffix,
110  bool xauto_access)
111 {
112  // cout << endl << "Entering sec_at2_e2::new_host." << endl;
113 
114  // Preconditions:
115 
116  require(xns.state_is_auto_read_write_accessible(xauto_access));
117 
118  require(xbase_path.full());
119  require(xns.path_is_auto_read_accessible<base_space_poset>(xbase_path, xauto_access));
120 
121  require(xrep_path.empty() || xrep_path.full());
122  require(xrep_path.empty() || xns.path_is_auto_read_accessible<sec_rep_descriptor_poset>(xrep_path, xauto_access));
123 
124  require(xsection_suffix.empty() || poset_path::is_valid_name(xsection_suffix));
125 
126  require(xfiber_suffix.empty() || poset_path::is_valid_name(xfiber_suffix));
127 
128  require(standard_host_is_available<sec_at2_e2>(xns, xbase_path, xrep_path, xsection_suffix, xfiber_suffix, xauto_access));
129  require(fiber_type::standard_host_is_available<fiber_type>(xns, xfiber_suffix, xauto_access));
130  require(schema_type::standard_host_is_available<sec_at2_e2>(xns, xbase_path, xrep_path, xfiber_suffix, xauto_access));
131 
132  // Body:
133 
134  poset_path lstd_path = standard_host_path<sec_at2_e2>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix);
135 
136  host_type* lresult_ptr;
137 
138  if(xns.contains_path(lstd_path, xauto_access))
139  {
140  // Standard host already exists, just return it.
141 
142  lresult_ptr = &xns.member_poset<host_type>(lstd_path, xauto_access);
143  }
144  else
145  {
146  // Standard host doesn't exist, have to create it.
147 
148  // Apply default for rep path if needed.
149 
150  poset_path lrep_path = (!xrep_path.empty() ? xrep_path : standard_rep_path());
151 
152  // Find or create the standard schema member.
153 
154  poset_path lstd_schema_path =
155  schema_type::standard_member<sec_at2_e2>(xns, xbase_path, lrep_path, xfiber_suffix, xauto_access);
156 
157  // Find or create the standard vector space.
158 
159  poset_path lvector_space_path =
160  vector_space_type::standard_host(xns, xbase_path, lrep_path, xsection_suffix, xfiber_suffix, xauto_access).path(xauto_access);
161 
162  // Create the standard host.
163 
164  lresult_ptr = &new_host(xns, lstd_path, lstd_schema_path, lvector_space_path, xauto_access);
165  }
166 
167  host_type& result = *lresult_ptr;
168 
169  // Postconditions:
170 
171  ensure(xns.owns(result, xauto_access));
172  ensure(result.path(true) == standard_host_path<sec_at2_e2>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix));
173  ensure(result.state_is_not_read_accessible());
174  ensure(result.schema(true).path(xauto_access) ==
175  schema_type::standard_member_path<sec_at2_e2>(xbase_path, xrep_path, xfiber_suffix));
176 
177  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
178  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
179  ensure(result.scalar_space_path(true) ==
180  scalar_type::standard_host_path<scalar_type>(xbase_path, result.rep().path(xauto_access), xsection_suffix, xfiber_suffix));
181  ensure(result.p(true) == result.schema(true).fiber_space<fiber_type::host_type>().p(xauto_access));
182  ensure(result.p(true) == 2);
183  ensure(result.dd(true) == result.schema(true).fiber_space<fiber_type::host_type>().dd(xauto_access));
184  ensure(result.vector_space_path(true) ==
185  vector_space_type::standard_host_path<vector_space_type>(xbase_path, result.rep().path(xauto_access), xsection_suffix, xfiber_suffix));
186 
187  // Exit:
188 
189  // cout << "Leaving sec_at2_e2::new_host." << endl;
190  return result;
191 }
192 
193 // PROTECTED MEMBER FUNCTIONS
194 
195 // PRIVATE MEMBER FUNCTIONS
196 
197 
198 //==============================================================================
199 // AT2_E2 FACET OF CLASS SEC_AT2_E2
200 //==============================================================================
201 
202 // PUBLIC MEMBER FUNCTIONS
203 
206 {
207 
208  // Preconditions:
209 
210  // Body:
211 
212  // Postconditions:
213 
214  ensure(invariant());
215 }
216 
219 {
220 
221  // Preconditions:
222 
223  require(xother.is_attached() ? xother.state_is_read_accessible() : true);
224 
225  // Body:
226 
227  attach_to_state(&xother);
228 
229  // Postconditions:
230 
231  ensure(invariant());
232  ensure(is_attached() == xother.is_attached());
233  ensure(is_same_state(&xother));
234  ensure(is_same_restriction(&xother));
235 
236 }
237 
240  abstract_poset_member& xbase_mbr,
241  int xbase_version, bool xauto_access)
242 {
243 
244  // Preconditions:
245 
246  require(precondition_of(new_jim_state(\
247  xhost, xbase_mbr, xbase_version, xauto_access)));
248 
249  // Body:
250 
251  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
252 
253  // Postconditions:
254 
255  ensure(postcondition_of(new_jim_state(\
256  xhost, xbase_mbr, xbase_version, xauto_access)));
257 
258  // Exit:
259 
260  return;
261 }
262 
264 sec_at2_e2(sec_rep_space* xhost, section_dof_map* xdof_map, bool xauto_access)
265 {
266 
267  // Preconditions:
268 
269  require(precondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
270 
271  // Body:
272 
273  new_jim_state(xhost, xdof_map, false, xauto_access);
274 
275  // Postconditions:
276 
277  ensure(postcondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
278 
279  // Exit:
280 
281  return;
282 }
283 
286 {
287  // Preconditions:
288 
289  require(xhost != 0);
290  require(xhost->state_is_read_accessible());
291  require(xhost->contains_member(xhub_id));
292 
293  // Body:
294 
295  attach_to_state(xhost, xhub_id);
296 
297  // Postconditions:
298 
299  ensure(invariant());
300  //ensure(host() == xhost);
301  ensure(index() == xhub_id);
302  ensure(is_attached());
303  ensure(!is_restricted());
304 }
305 
307 sec_at2_e2(const sec_rep_space* xhost, const scoped_index& xid)
308 {
309  // Preconditions:
310 
311  require(xhost != 0);
312  require(xhost->state_is_read_accessible());
313  require(xhost->contains_member(xid));
314 
315  // Body:
316 
317  attach_to_state(xhost, xid.hub_pod());
318 
319  // Postconditions:
320 
321  ensure(invariant());
322  //ensure(host() == xhost);
323  ensure(index() ==~ xid);
324  ensure(is_attached());
325  ensure(!is_restricted());
326 }
327 
329 sec_at2_e2(const sec_rep_space* xhost, const std::string& xname)
330 {
331 
332  // Preconditions:
333 
334  require(xhost != 0);
335  require(xhost->state_is_read_accessible());
336  require(!xname.empty());
337  require(xhost->contains_member(xname));
338 
339  // Body:
340 
341  attach_to_state(xhost, xname);
342 
343  // Postconditions:
344 
345  ensure(invariant());
346  //ensure(host() == xhost);
347  ensure(name() == xname);
348  ensure(is_attached());
349  ensure(!is_restricted());
350 
351 }
352 
353 
355 sec_at2_e2(const namespace_poset* xnamespace,
356  const poset_path& xpath,
357  bool xauto_access)
358 {
359 
360  // Preconditions:
361 
362  require(precondition_of(attach_to_state(same args)));
363 
364  // Body:
365 
366  attach_to_state(xnamespace, xpath, xauto_access);
367 
368  // Postconditions:
369 
370  ensure(postcondition_of(attach_to_state(same args)));
371 
372  // Exit:
373 
374  return;
375 }
376 
380 {
381  // Preconditions:
382 
383  require(is_ancestor_of(&xother));
384  require(precondition_of(attach_to_state(&xother)));
385 
386  // Body:
387 
388  attach_to_state(&xother);
389 
390  // Postconditions:
391 
392  ensure(postcondition_of(attach_to_state(&xother)));
393 
394  // Exit:
395 
396  return *this;
397 }
398 
401 operator=(const sec_at2_e2& xother)
402 {
403  // Preconditions:
404 
405  require(precondition_of(attach_to_state(&xother)));
406 
407  // Body:
408 
409  attach_to_state(&xother);
410 
411  // Postconditions:
412 
413  ensure(postcondition_of(attach_to_state(&xother)));
414 
415  // Exit:
416 
417  return *this;
418 }
419 
422 operator=(const at2_e2& xfiber)
423 {
424  // Preconditions:
425 
426  require(precondition_of(sec_vd::operator=(xfiber)));
427 
428  // Body:
429 
430  sec_vd::operator=(xfiber);
431 
432  // Postconditions:
433 
434  ensure(postcondition_of(sec_vd::operator=(xfiber)));
435 
436  // Exit:
437 
438  return *this;
439 }
440 
443 operator=(const at2_e2_lite& xfiber)
444 {
445  // Preconditions:
446 
447  require(precondition_of(sec_vd::operator=(xfiber)));
448 
449  // Body:
450 
451  sec_vd::operator=(xfiber);
452 
453  // Postconditions:
454 
455  ensure(postcondition_of(sec_vd::operator=(xfiber)));
456 
457  // Exit:
458 
459  return *this;
460 }
461 
464 {
465  // Preconditions:
466 
467  // Body:
468 
469  // Postconditions:
470 
471 }
472 
476 {
477  // Preconditions:
478 
479  // Body:
480 
481  static const fiber_type result;
482 
483  // Postconditions:
484 
485  // Exit:
486 
487  return result;
488 }
489 
490 // PROTECTED MEMBER FUNCTIONS
491 
492 // PRIVATE MEMBER FUNCTIONS
493 
494 
495 //==============================================================================
496 // AT2 FACET OF CLASS SEC_AT2_E2
497 //==============================================================================
498 
499 // PUBLIC MEMBER FUNCTIONS
500 
501 // PROTECTED MEMBER FUNCTIONS
502 
503 // PRIVATE MEMBER FUNCTIONS
504 
505 
506 //==============================================================================
507 // TP FACET OF CLASS SEC_AT2_E2
508 //==============================================================================
509 
510 // PUBLIC MEMBER FUNCTIONS
511 
512 // PROTECTED MEMBER FUNCTIONS
513 
514 // PRIVATE MEMBER FUNCTIONS
515 
516 
517 //==============================================================================
518 // VD FACET OF CLASS SEC_AT2_E2
519 //==============================================================================
520 
521 // PUBLIC MEMBER FUNCTIONS
522 
523 // PROTECTED MEMBER FUNCTIONS
524 
525 // PRIVATE MEMBER FUNCTIONS
526 
527 
528 //==============================================================================
529 // TUPLE FACET OF CLASS SEC_AT2_E2
530 //==============================================================================
531 
532 // PUBLIC MEMBER FUNCTIONS
533 
534 // PROTECTED MEMBER FUNCTIONS
535 
536 // PRIVATE MEMBER FUNCTIONS
537 
538 
539 //==============================================================================
540 // ABSTRACT POSET MEMBER FACET OF CLASS SEC_AT2_E2
541 //==============================================================================
542 
543 // PUBLIC MEMBER FUNCTIONS
544 
545 const std::string&
547 class_name() const
548 {
549  // Preconditions:
550 
551  // Body:
552 
553  const string& result = static_class_name();
554 
555  // Postconditions:
556 
557  ensure(!result.empty());
558 
559  // Exit:
560 
561  return result;
562 }
563 
564 const std::string&
567 {
568  // Preconditions:
569 
570  // Body:
571 
572  static const string result("sec_at2_e2");
573 
574  // Postconditions:
575 
576  ensure(!result.empty());
577 
578  // Exit:
579 
580  return result;
581 }
582 
585 clone() const
586 {
587 
588  // Preconditions:
589 
590  // Body:
591 
592  // create new handle of the current class.
593 
594  sec_at2_e2 *result = new sec_at2_e2();
595 
596  // Postconditions:
597 
598  ensure(result != 0);
599  ensure(result->invariant());
600 
601  // Exit:
602 
603  return result;
604 
605 }
606 
607 // PROTECTED MEMBER FUNCTIONS
608 
609 // PRIVATE MEMBER FUNCTIONS
610 
611 
612 //==============================================================================
613 // ANY FACET OF CLASS SEC_AT2_E2
614 //==============================================================================
615 
616 // PUBLIC MEMBER FUNCTIONS
617 
618 bool
620 fiber_is_ancestor_of(const any* xother) const
621 {
622 
623  // Preconditions:
624 
625  require(xother != 0);
626 
627  // Body:
628 
629  bool result = dynamic_cast<const at2_e2*>(xother) != 0;
630 
631  // Postconditions:
632 
633  ensure(invariant());
634  ensure(xother->invariant());
635 
636  // Exit:
637 
638  return result;
639 
640 }
641 
642 bool
644 is_ancestor_of(const any* xother) const
645 {
646 
647  // Preconditions:
648 
649  require(xother != 0);
650 
651  // Body:
652 
653  bool result = dynamic_cast<const sec_at2_e2*>(xother) != 0;
654 
655  // Postconditions:
656 
657  //ensure(invariant());
658 
659  // Exit:
660 
661  return result;
662 
663 }
664 
665 bool
667 invariant() const
668 {
669  bool result = true;
670 
671  // Body:
672 
673  if (invariant_check())
674  {
675  // Prevent recursive calls to invariant
676 
677  disable_invariant_check();
678 
679  // Must satisfy base class invariant
680 
681  invariance(sec_atp::invariant());
682 
683  // Invariances for this class:
684 
685  invariance(state_is_read_accessible() ? dd() == 2 : true);
686 
687  // Finished, turn invariant checking back on.
688 
689  enable_invariant_check();
690  }
691 
692  // Exit:
693 
694  return result;
695 }
696 
697 // PROTECTED MEMBER FUNCTIONS
698 
699 // PRIVATE MEMBER FUNCTIONS
700 
701 
702 //==============================================================================
703 // NON-MEMBER FUNCTIONS
704 //==============================================================================
705 
706 namespace
707 {
708  using namespace fiber_bundle::atp_algebra;
709 
710  class hook_functor
711  {
712  public:
713  void operator()(const e2_lite& x0, const e2_lite& x1,
714  at0_lite& xresult) const
715  {
716  hook(x0, x1, xresult);
717  }
718 
719  void operator()(const at2_e2_lite& x0, const e2_lite& x1,
720  e2_lite& xresult) const
721  {
722  hook(x0, x1, xresult);
723  }
724  };
725 
726  class star_functor
727  {
728  public:
729  void operator()(const at2_e2_lite& x0, at0_lite& xresult) const
730  {
731  star(x0, xresult);
732  }
733 
734  void operator()(const at0_lite& x0, at2_e2_lite& xresult) const
735  {
736  star(x0, xresult);
737  }
738 
739  void operator()(const e2_lite& x0, e2_lite& xresult) const
740  {
741  star(x0, xresult);
742  }
743  };
744 
745  class wedge_functor
746  {
747  public:
748  void operator()(const e2_lite& x0, const e2_lite& x1,
749  at2_e2_lite& xresult) const
750  {
751  wedge(x0, x1, xresult);
752  }
753  };
754 
755 } //end unnamed namespace
756 
757 //==============================================================================
758 
759 #include "SheafSystem/sec_vd.impl.h"
760 #include "SheafSystem/sec_e2.h"
761 #include "SheafSystem/sec_at0.h"
762 
763 using namespace fiber_bundle::sec_vd_algebra;
764 
765 void
767 hook(const sec_e2& x0, const sec_e2& x1, sec_at0& xresult,
768  bool xauto_access)
769 {
770  // Preconditions:
771 
772  require(x0.state_is_auto_read_accessible(xauto_access));
773  require(x1.state_is_auto_read_accessible(xauto_access));
774  require(xresult.state_is_auto_read_write_accessible(xauto_access));
775  require(x1.dd(xauto_access) == x0.dd(xauto_access));
776  require(x0.is_p_form(xauto_access) == x1.is_p_form(xauto_access));
777  require(xresult.p(xauto_access) == x0.p(xauto_access) - 1);
778 
779  // Body:
780 
781  binary_op(x0, x1, xresult, hook_functor(), xauto_access);
782 
783  // Set the variance of the result.
784 
785  xresult.put_variance(hook(x0.variance(xauto_access)), xauto_access);
786 
787  // Postconditions:
788 
789  ensure(xresult.variance(xauto_access) == hook(x0.variance(xauto_access)));
790 
791  // Exit:
792 
793  return;
794 }
795 
796 void
798 hook(const sec_at2_e2& x0, const sec_e2& x1, sec_e2& xresult,
799  bool xauto_access)
800 {
801  // Preconditions:
802 
803  require(x0.state_is_auto_read_accessible(xauto_access));
804  require(x1.state_is_auto_read_accessible(xauto_access));
805  require(xresult.state_is_auto_read_write_accessible(xauto_access));
806  require(x1.dd(xauto_access) == x0.dd(xauto_access));
807  require(x0.is_p_form(xauto_access) == x1.is_p_form(xauto_access));
808  require(xresult.p(xauto_access) == x0.p(xauto_access) - 1);
809 
810  // Body:
811 
812  binary_op(x0, x1, xresult, hook_functor(), xauto_access);
813 
814  // Set the variance of the result.
815 
816  xresult.put_variance(hook(x0.variance(xauto_access)), xauto_access);
817 
818  // Postconditions:
819 
820  ensure(xresult.variance(xauto_access) == hook(x0.variance(xauto_access)));
821 
822  // Exit:
823 
824  return;
825 }
826 
827 
828 void
830 star(const sec_at2_e2& x0, sec_at0& xresult, bool xauto_access)
831 {
832  // Preconditions:
833 
834  require(x0.state_is_auto_read_accessible(xauto_access));
835  require(xresult.state_is_auto_read_write_accessible(xauto_access));
836 
837  // Body:
838 
839  unary_op(x0, xresult, star_functor(), xauto_access);
840 
841  // Set the variance of the result.
842 
843  // If the x0.p() == 0 then x0 is a sec_at0 which is both a p_form
844  // and a p_vector. In that case we do not need to set the variance
845  // of the result because it does not change.
846 
847  define_old_variable(\
848  bool old_xresult_is_p_form = xresult.is_p_form(xauto_access));
849 
850  if(x0.p(xauto_access) > 0)
851  {
852  xresult.put_variance(star(x0.variance(xauto_access), x0.dd(xauto_access)),
853  xauto_access);
854  }
855 
856  // Postconditions:
857 
858  ensure((x0.p(xauto_access)>0) \
859  ? (xresult.is_p_form(xauto_access) == x0.is_p_form(xauto_access)) : true);
860  ensure((x0.p(xauto_access)==0) \
861  ? (xresult.is_p_form(xauto_access) == old_xresult_is_p_form): true );
862 
863  // Exit:
864 
865  return;
866 }
867 
868 void
870 star(const sec_at0& x0, sec_at2_e2& xresult, bool xauto_access)
871 {
872  // Preconditions:
873 
874  require(x0.state_is_auto_read_accessible(xauto_access));
875  require(xresult.state_is_auto_read_write_accessible(xauto_access));
876 
877  // Body:
878 
879  unary_op(x0, xresult, star_functor(), xauto_access);
880 
881  // Set the variance of the result.
882 
883  // If the x0.p() == 0 then x0 is a sec_at0 which is both a p_form
884  // and a p_vector. In that case we do not need to set the variance
885  // of the result because it does not change.
886 
887  define_old_variable(\
888  bool old_xresult_is_p_form = xresult.is_p_form(xauto_access));
889 
890  if(x0.p(xauto_access) > 0)
891  {
892  xresult.put_variance(star(x0.variance(xauto_access), x0.dd(xauto_access)),
893  xauto_access);
894  }
895 
896  // Postconditions:
897 
898  ensure((x0.p(xauto_access)>0) \
899  ? (xresult.is_p_form(xauto_access) == x0.is_p_form(xauto_access)) : true);
900  ensure((x0.p(xauto_access)==0) \
901  ? (xresult.is_p_form(xauto_access) == old_xresult_is_p_form): true );
902 
903  // Exit:
904 
905  return;
906 }
907 
908 void
910 star(const sec_e2& x0, sec_e2& xresult, bool xauto_access)
911 {
912  // Preconditions:
913 
914  require(x0.state_is_auto_read_accessible(xauto_access));
915  require(xresult.state_is_auto_read_write_accessible(xauto_access));
916 
917  // Body:
918 
919  unary_op(x0, xresult, star_functor(), xauto_access);
920 
921  // Set the variance of the result.
922 
923  // If the x0.p() == 0 then x0 is a sec_at0 which is both a p_form
924  // and a p_vector. In that case we do no need to set the variance
925  // of the result because it does not change.
926 
927  define_old_variable(\
928  bool old_xresult_is_p_form = xresult.is_p_form(xauto_access));
929 
930  if(x0.p(xauto_access) > 0)
931  {
932  xresult.put_variance(star(x0.variance(xauto_access), x0.dd(xauto_access)),
933  xauto_access);
934  }
935 
936  // Postconditions:
937 
938  ensure((x0.p(xauto_access)>0) \
939  ? (xresult.is_p_form(xauto_access) == x0.is_p_form(xauto_access)) : true);
940  ensure((x0.p(xauto_access)==0) \
941  ? (xresult.is_p_form(xauto_access) == old_xresult_is_p_form): true );
942 
943  // Exit:
944 
945  return;
946 }
947 
948 void
950 wedge(const sec_e2& x0, const sec_e2& x1, sec_at2_e2& xresult,
951  bool xauto_access)
952 {
953  // Preconditions:
954 
955  require(x0.state_is_auto_read_accessible(xauto_access));
956  require(x1.state_is_auto_read_accessible(xauto_access));
957  require(xresult.state_is_auto_read_write_accessible(xauto_access));
958 
959  require(x0.dd(xauto_access) >= xresult.dd(xauto_access));
960  require(x1.dd(xauto_access) >= xresult.dd(xauto_access));
961  require(xresult.p(xauto_access) == x0.p(xauto_access) + x1.p(xauto_access));
962  require(x0.is_p_form(xauto_access) == x1.is_p_form(xauto_access));
963 
964  // Body:
965 
966  binary_op(x0, x1, xresult, wedge_functor(), xauto_access);
967 
968  // Set the variance of the result.
969 
970  xresult.put_variance(wedge(x0.variance(xauto_access),
971  x1.variance(xauto_access)), xauto_access);
972 
973  // Postconditions:
974 
975  ensure(xresult.variance(xauto_access) == \
976  wedge(x0.variance(xauto_access), x1.variance(xauto_access)));
977 
978  // Exit:
979 
980  return;
981 }
982 
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 ...
SHEAF_DLL_SPEC void wedge(const sec_e2 &x0, const sec_e2 &x1, sec_at2_e2 &xresult, bool xauto_access)
The exterior (wedge) product of two antisymmetric tensors (pre-allocated version).
Definition: sec_at2_e2.cc:950
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (persistent version)...
Definition: at2_e2.h:412
The abstract map from section dof ids to section dof values of heterogeneous type.
A space of scalars viewed as an antisymmetric tensor section space of degree 1.
Definition: sec_at1_space.h:48
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...
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 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 ...
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
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
The poset for sec_rep_descriptors.
virtual const std::string & class_name() const
The name of this class.
Definition: sec_at2_e2.cc:547
An antisymmetric rank 2 tensor over a Euclidean vector space of dimension 2 (volatile version)...
Definition: at2_e2.h:146
virtual int p() const
The degree of the tensors in host(); the sum of the contravariant and covariant degrees.
Definition: sec_tp.cc:391
Abstract base class with useful features for all objects.
Definition: any.h:39
int p() const
The tensor degree of this space.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
sec_rep_descriptor & rep()
A representation descriptor for this sec rep space (mutable version).
SHEAF_DLL_SPEC void wedge(const e2 &x0, const e2 &x1, at2_e2 &xresult, bool xauto_access)
The exterior (wedge) product of two antisymmetric tensors (pre-allocated version for persistent types...
Definition: at2_e2.cc:1779
An abstract antisymmetric tensor section space of degree p.
Definition: sec_atp_space.h:47
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
SHEAF_DLL_SPEC void hook(const e2 &x0, const e2 &x1, at0 &xresult, bool xauto_access)
The interior (hook) product of two antisymmetric tensors (pre-allocated version for persistent types)...
Definition: at2_e2.cc:1328
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
Definition: sec_at2_e2.cc:644
bool fiber_is_ancestor_of(const any *xother) const
True if xother conforms to an instance of the fiber of current.
Definition: sec_at2_e2.cc:620
A section of a bundle with fiber type at2_e2.
Definition: sec_at2_e2.h:48
Euclidean vector space of dimension 2 (volatile version).
Definition: e2.h:112
An abstract antisymmetric tensor space of degree p.
Definition: atp_space.h:42
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)
virtual sec_at2_e2 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
Definition: sec_at2_e2.cc:379
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
SHEAF_DLL_SPEC void star(const sec_at2_e2 &x0, sec_at0 &xresult, bool xauto_access)
The Hodge star operator for antisymmetric tensors (pre-allocated version).
Definition: sec_at2_e2.cc:830
virtual bool is_attached() const
True if this handle is attached to a non-void state.
Namespace containing the antisymmetric tensor algrebra functions for the fiber_bundles component of t...
Definition: at2_e2.h:737
virtual int dd() const
Dimension of the underlying vector space.
Definition: sec_tp.cc:433
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
Antisymetric tensor of degree 0 (volatile version).
Definition: at0.h:127
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. ...
static const std::string & static_class_name()
The name of this class.
Definition: sec_at2_e2.cc:566
int dd() const
The dimension of the underlying ("domain") vector space.
sec_at2_e2()
Default constructor; creates an unattached handle.
Definition: sec_at2_e2.cc:205
bool is_p_form(bool xauto_access) const
True if this is a p-form.
Definition: sec_atp.cc:396
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
bool invariant() const
Class invariant.
Definition: sec_at2_e2.cc:667
SHEAF_DLL_SPEC void hook(const sec_e2 &x0, const sec_e2 &x1, sec_at0 &xresult, bool xauto_access)
The interior (hook) product of two antisymmetric tensors (pre-allocated version for persistent types)...
Definition: sec_at2_e2.cc:767
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
Definition: sec_at2_e2.cc:475
static host_type & standard_host(namespace_type &xns, const poset_path &xbase_path, const poset_path &xrep_path, const std::string &xsection_suffix, const std::string &xfiber_suffix, bool xauto_access)
The standard host for sections of this type with base space xbase_path, representation xrep_path...
Definition: sec_at2_e2.cc:105
~sec_at2_e2()
Destructor.
Definition: sec_at2_e2.cc:463
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).
Namespace containing the algrebra functions for a a section of a fiber bundle with a d-dimensional ve...
Definition: sec_vd.h:691
An abstract client handle for a member of a poset.
std::string path() const
The full path as a string.
Definition: poset_path.cc:450
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xvector_space_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
Definition: sec_at2_e2.cc:54
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC void star(const at2_e2 &x0, at0 &xresult, bool xauto_access)
The Hodge star operator for antisymmetric tensors (pre-allocated version persistent types)...
Definition: at2_e2.cc:1518
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
Definition: sec_at0.h:51
A general antisymmetric tensor of degree 2 over an abstract vector space.
Definition: at2.h:233
virtual int d(int xp, int xdd) const
Dimension d() as a function of degree xp and domain dimension xdd.
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_at2_e2 * clone() const
Make a new handle, no state instance of current.
Definition: sec_at2_e2.cc:585
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
A section of a fiber bundle with a 2-dimensional Euclidean vector space fiber.
Definition: sec_e2.h:48
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61