SheafSystem  0.0.0.0
sec_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/sec_vd.h"
22 
23 #include "SheafSystem/array_section_dof_map.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/at0.h"
26 #include "SheafSystem/binary_section_space_schema_member.impl.h"
27 #include "SheafSystem/binary_section_space_schema_poset.h"
28 #include "SheafSystem/chart_point.h"
29 #include "SheafSystem/eval_family.h"
30 #include "SheafSystem/eval_iterator.h"
31 #include "SheafSystem/fiber_bundles_namespace.h"
32 #include "SheafSystem/index_space_iterator.h"
33 #include "SheafSystem/namespace_poset.h"
34 #include "SheafSystem/sec_at0.h"
35 #include "SheafSystem/sec_tuple_space.impl.h"
36 #include "SheafSystem/sec_vd_space.h"
37 #include "SheafSystem/section_evaluator.h"
38 #include "SheafSystem/section_space_schema_member.impl.h"
39 #include "SheafSystem/section_space_schema_poset.h"
40 #include "SheafSystem/vd.h"
41 #include "SheafSystem/vd_space.h"
42 
43 using namespace std;
44 using namespace fiber_bundle; // Workaround for MS C++ bug.
45 
46 //==============================================================================
47 // CLASS SEC_VD
48 //==============================================================================
49 // ===========================================================
50 // HOST FACTORY FACET
51 // ===========================================================
52 
53 // PUBLIC MEMBER FUNCTIONS
54 
58  const poset_path& xhost_path,
59  const poset_path& xschema_path,
60  const poset_path& xscalar_space_path,
61  bool xauto_access)
62 {
63  // cout << endl << "Entering sec_vd::new_host." << endl;
64 
65  // Preconditions:
66 
67  require(xns.state_is_auto_read_write_accessible(xauto_access));
68 
69  require(!xhost_path.empty());
70  require(!xns.contains_path(xhost_path, xauto_access));
71 
72  require(xschema_path.full());
73  require(xns.path_is_auto_read_accessible<schema_type::host_type>(xschema_path, xauto_access));
74  require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
75 
76  require(xns.path_is_auto_read_accessible<scalar_type::host_type>(xscalar_space_path, xauto_access));
77 
78  require(host_type::same_scalar_fiber_space(xns, xschema_path, xscalar_space_path, xauto_access));
79 
80  // Body:
81 
82  host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xscalar_space_path, xauto_access);
83 
84  // Postconditions:
85 
86  ensure(xns.owns(result, xauto_access));
87  ensure(result.path(true) == xhost_path);
88  ensure(result.state_is_not_read_accessible());
89  ensure(result.schema(true).path(xauto_access) == xschema_path);
90 
91  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
92  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
93  ensure(result.scalar_space_path(true) == xscalar_space_path);
94 
95  // Exit:
96 
97  // cout << "Leaving sec_vd::new_host." << endl;
98  return result;
99 }
100 
101 // PROTECTED MEMBER FUNCTIONS
102 
103 // PRIVATE MEMBER FUNCTIONS
104 
105 //==============================================================================
106 // VD FACET OF CLASS SEC_VD
107 //==============================================================================
108 
109 // PUBLIC MEMBER FUNCTIONS
110 
113 {
114  // Preconditions:
115 
116  // Body:
117 
118  // Postconditions:
119 
120  ensure(invariant());
121 }
122 
124 sec_vd(const sec_rep_space* xhost, pod_index_type xhub_id)
125 {
126  // Preconditions:
127 
128  require(xhost != 0);
129  require(xhost->state_is_read_accessible());
130  require(xhost->contains_member(xhub_id));
131 
132  // Body:
133 
134  attach_to_state(xhost, xhub_id);
135 
136  // Postconditions:
137 
138  ensure(invariant());
139  //ensure(host() == xhost);
140  ensure(index() == xhub_id);
141  ensure(is_attached());
142  ensure(!is_restricted());
143 }
144 
146 sec_vd(const sec_rep_space* xhost, const scoped_index& xid)
147 {
148  // Preconditions:
149 
150  require(xhost != 0);
151  require(xhost->state_is_read_accessible());
152  require(xhost->contains_member(xid));
153 
154  // Body:
155 
156  attach_to_state(xhost, xid.hub_pod());
157 
158  // Postconditions:
159 
160  ensure(invariant());
161  //ensure(host() == xhost);
162  ensure(index() ==~ xid);
163  ensure(is_attached());
164  ensure(!is_restricted());
165 }
166 
168 sec_vd(const sec_rep_space* xhost, const std::string& xname)
169 {
170 
171  // Preconditions:
172 
173  require(xhost != 0);
174  require(xhost->state_is_read_accessible());
175  require(!xname.empty());
176  require(xhost->contains_member(xname));
177 
178  // Body:
179 
180  attach_to_state(xhost, xname);
181 
182  // Postconditions:
183 
184  ensure(invariant());
185  //ensure(host() == xhost);
186  ensure(name() == xname);
187  ensure(is_attached());
188  ensure(!is_restricted());
189 
190 }
191 
193 sec_vd(const namespace_poset* xnamespace,
194  const poset_path& xpath,
195  bool xauto_access)
196 {
197  // Preconditions:
198 
199  require(precondition_of(attach_to_state(same args)));
200 
201  // Body:
202 
203  attach_to_state(xnamespace, xpath, xauto_access);
204 
205  // Postconditions:
206 
207  ensure(postcondition_of(attach_to_state(same args)));
208 
209  // Exit:
210 
211  return;
212 }
213 
214 
217 {
218 
219  // Preconditions:
220 
221  require(xother != 0);
222 
223  // Body:
224 
225  attach_to_state(xother);
226 
227  // Postconditions:
228 
229  ensure(invariant());
230  ensure(is_attached());
231  ensure(is_same_state(xother));
232  ensure(is_same_restriction(xother));
233 
234 }
235 
237 sec_vd(sec_rep_space* xhost, section_dof_map* xdof_map, bool xauto_access)
238 {
239 
240  // Preconditions:
241 
242  require(precondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
243 
244  // Body:
245 
246  new_jim_state(xhost, xdof_map, false, xauto_access);
247 
248  // Postconditions:
249 
250  ensure(postcondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
251 
252  // Exit:
253 
254  return;
255 }
256 
259  abstract_poset_member& xbase_mbr,
260  int xbase_version, bool xauto_access)
261 {
262 
263  // Preconditions:
264 
265  require(precondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
266 
267  // Body:
268 
269  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
270 
271  // Postconditions:
272 
273  ensure(postcondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
274 
275  // Exit:
276 
277  return;
278 }
279 
283 {
284  // Preconditions:
285 
286  require(is_ancestor_of(&xother));
287  require(precondition_of(attach_to_state(&xother)));
288 
289  // Body:
290 
291  attach_to_state(&xother);
292 
293  // Postconditions:
294 
295  ensure(postcondition_of(attach_to_state(&xother)));
296 
297  // Exit:
298 
299  return *this;
300 }
301 
304 operator=(const sec_vd& xother)
305 {
306  // Preconditions:
307 
308  require(precondition_of(attach_to_state(&xother)));
309 
310  // Body:
311 
312  attach_to_state(&xother);
313 
314  // Postconditions:
315 
316  ensure(postcondition_of(attach_to_state(&xother)));
317 
318  // Exit:
319 
320  return *this;
321 }
322 
325 operator=(const vd& xfiber)
326 {
327  // Preconditions:
328 
329  require(is_attached());
330  require(state_is_read_write_accessible());
331  //require(); @todo: Complete.
332 
333  // Body:
334 
337 
338  void* lrow_dofs = const_cast<void*>(xfiber.row_dofs());
339  dof_type* lxfiber_dptr = static_cast<dof_type*>(lrow_dofs);
340  size_type lfiber_size = xfiber.d()*sizeof(dof_type);
341  size_type ldisc_ct = discretization_ct();
342  for(size_type i=0; i<ldisc_ct; ++i)
343  {
344  put_fiber(i, lxfiber_dptr, lfiber_size);
345  }
346 
347  // Postconditions:
348 
349  //ensure(); @todo: Complete.
350 
351  // Exit:
352 
353  return *this;
354 }
355 
358 operator=(const vd_lite& xfiber)
359 {
360  // Preconditions:
361 
362  // Body:
363 
364  index_space_iterator& ldisc_itr =
365  schema().discretization_id_space().get_iterator();
366  while(!ldisc_itr.is_done())
367  {
368  put_fiber(ldisc_itr.pod(), xfiber);
369 
370  ldisc_itr.next();
371  }
372  schema().discretization_id_space().release_iterator(ldisc_itr);
373 
374  // Postconditions:
375 
376  // Exit:
377 
378  return *this;
379 }
380 
383 {
384  // Preconditions:
385 
386  // Body:
387 
388  // Postconditions:
389 
390 }
391 
392 bool
394 fiber_is_ancestor_of(const any* xother) const
395 {
396 
397  // Preconditions:
398 
399  require(xother != 0);
400 
401  // Body:
402 
403  // If xother may be dynamically cast to the type of this fiber then this
404  // fiber is an ancestor of xother.
405 
406  bool result = dynamic_cast<const vd*>(xother) != 0;
407 
408  // Postconditions:
409 
410  ensure(invariant());
411  ensure(xother->invariant());
412 
413  // Exit:
414 
415  return result;
416 
417 }
418 
422 {
423  // Preconditions:
424 
425  // Body:
426 
427  static const fiber_type result;
428 
429  // Postconditions:
430 
431  // Exit:
432 
433  return result;
434 }
435 
436 int
438 d() const
439 {
440  // Preconditions:
441 
442  require(state_is_read_accessible());
443 
444  // Body:
445 
446  int result = host()->d();
447 
448  // Postconditions:
449 
450  ensure(result >= 0);
451 
452  // Exit:
453 
454  return result;
455 }
456 
457 int
459 d(bool xauto_access) const
460 {
461  // Preconditions:
462 
463  require(state_is_auto_read_accessible(xauto_access));
464 
465  // Body:
466 
467  int result = host()->d(xauto_access);
468 
469  // Postconditions:
470 
471  ensure(result >= 0);
472 
473  // Exit:
474 
475  return result;
476 }
477 
481 {
482  // Preconditions:
483 
484  require(state_is_read_accessible());
485 
486  // Body:
487 
488  poset_path result(host()->scalar_space_path());
489 
490  // Postconditions:
491 
492  ensure(!result.empty());
493 
494  // Exit:
495 
496  return result;
497 }
498 
501 scalar_space_path(bool xauto_access) const
502 {
503  // Preconditions:
504 
505  require(state_is_auto_read_accessible(xauto_access));
506 
507  // Body:
508 
509  poset_path result(host()->scalar_space_path(xauto_access));
510 
511  // Postconditions:
512 
513  ensure(!result.empty());
514 
515  // Exit:
516 
517  return result;
518 }
519 
520 bool
522 is_vector(bool xauto_access) const
523 {
524  // Preconditions:
525 
526  require(state_is_auto_read_accessible(xauto_access));
527 
528  // Body:
529 
530  bool result = host()->is_vector(_index, xauto_access);
531 
532  // Postconditions:
533 
534  // Exit:
535 
536  return result;
537 }
538 
539 void
541 put_is_vector(bool xauto_access)
542 {
543  // Preconditions:
544 
545  require(state_is_auto_read_accessible(xauto_access));
546 
547  // Body:
548 
549  host()->put_is_vector(_index, xauto_access);
550 
551  // Postconditions:
552 
553  ensure(is_vector(xauto_access));
554 
555  // Exit:
556 
557  return;
558 }
559 
560 bool
562 is_covector(bool xauto_access) const
563 {
564  // Preconditions:
565 
566  require(state_is_auto_read_accessible(xauto_access));
567 
568  // Body:
569 
570  bool result = host()->is_covector(_index, xauto_access);
571 
572  // Postconditions:
573 
574  // Exit:
575 
576  return result;
577 }
578 
579 void
581 put_is_covector(bool xauto_access)
582 {
583  // Preconditions:
584 
585  require(state_is_auto_read_accessible(xauto_access));
586 
587  // Body:
588 
589  host()->put_is_covector(_index, xauto_access);
590 
591  // Postconditions:
592 
593  ensure(is_covector(xauto_access));
594 
595  // Exit:
596 
597  return;
598 }
599 
602 comp(int i) const
603 {
604  // Preconditions:
605 
606  require(0 <= i && i < df());
607 
608  // Body:
609 
610  scalar_type* result = 0;
611 
612  not_implemented();
613 
614  // Postconditions:
615 
616  ensure(result != 0);
617  ensure(invariant());
618  ensure(result->invariant());
619 
620  // Exit:
621 
622  return result;
623 
624 }
625 
626 void
628 set_comp(int i, scalar_type* component)
629 {
630 
631  // Preconditions:
632 
633  require(0 <= i && i < df());
634  require(component != 0);
635 
636  // Body:
637 
638  // Place component into the component storage.
639 
640  not_implemented();
641 
642  // Postconditions:
643 
644  //ensure(comp(i) == component);
645  ensure(invariant());
646 
647 }
648 
649 
652 value_at_point(const chart_point& xpt, bool xauto_access) const
653 {
654  vd* result;
655 
656  // Preconditions:
657 
658  require(precondition_of(fiber_prototype().clone()));
659  require(precondition_of(value_at_point_pa(xpt, fiber_prototype().clone(), xauto_access)));
660 
661  // Body:
662 
663  result = fiber_prototype().clone();
664  value_at_point_pa(xpt, *result, xauto_access);
665 
666  // Postconditions:
667 
668  ensure(postcondition_of(fiber_prototype().clone()));
669  ensure(postcondition_of(value_at_point_pa(xpt, fiber_prototype().clone(), xauto_access)));
670 
671  // Exit:
672 
673  return result;
674 }
675 
676 void
678 value_at_point_pa(const chart_point& xpt, vd& result, bool xauto_access) const
679 {
680  // Preconditions:
681 
682  require(!xauto_access ? result.state_is_read_accessible() : true);
683 
684  if(xauto_access)
685  {
686  result.get_read_access();
687  }
688 
689  require(precondition_of(value_at_point_ua(xptr, result.row_dof_tuple(), xauto_access)));
690 
691  // Body:
692 
693  dof_type* ldofs = reinterpret_cast<dof_type*>(result.dof_map().dof_tuple());
694 
695  value_at_point_ua(xpt, ldofs, result.d());
696 
697  // Postconditions:
698 
699  ensure(postcondition_of(value_at_point_ua(xptr, result.row_dof_tuple(), xauto_access)));
700 
701  if(xauto_access)
702  {
703  result.release_access();
704  }
705 
706  // Exit:
707 
708  return;
709 }
710 
711 void
714  value_type* xresult,
715  size_type xresult_ub,
716  bool xauto_access) const
717 {
718  // Preconditions:
719 
720  require(!xauto_access ? state_is_read_accessible() : true);
721 
722  if(xauto_access)
723  {
724  get_read_access();
725  }
726 
727  require(xpt.is_valid());
728 
729  require(schema().evaluation().contains_member(xpt.chart_id()));
730 
733 
734  require(unexecutable("@hack not more than 32 dofs per eval member"));
735  require(xresult != 0);
736  require(xresult_ub >= schema().df());
737 
738 
739  // Body:
740 
741  // Gather the dofs for xpt.chart_id().
742 
744 
745  sec_vd_dof_type lgathered_dofs[32];
746  sec_vd_dof_type* ldofs = lgathered_dofs;
747  size_type ldofs_ct = 0;
748  int ldf = schema().df();
749 
750  poset_state_handle* lbase_host = base().host();
751 
752  typedef base_space_member::row_dof_tuple_type tuple_type;
753  tuple_type* lchart_tuple =
754  reinterpret_cast<tuple_type*>(lbase_host->member_dof_map(xpt.chart_id()).dof_tuple());
755 
756  int lchart_depth = lchart_tuple->refinement_depth;
757 
758  index_space_iterator& litr =
759  lbase_host->get_cover_id_space_iterator(LOWER, xpt.chart_id());
760  scoped_index ldisc_id(lbase_host->member_hub_id_space(false));
761  while(!litr.is_done())
762  {
763  ldisc_id = litr.hub_pod();
764 
765  assertion(schema().discretization().contains_member(ldisc_id));
766 
767  tuple_type* ltuple =
768  reinterpret_cast<tuple_type*>(lbase_host->member_dof_map(ldisc_id).dof_tuple());
769 
770  if(ltuple->refinement_depth <= lchart_depth)
771  {
772  // This is a disc mbr for this chart.
773 
774  get_fiber(ldisc_id, ldofs, ldf*sizeof(dof_type), false);
775 
776  ldofs += ldf;
777  ldofs_ct += ldf;
778 
779  assertion(ldofs_ct < 32);
780  }
781  else
782  {
783  // This is a discretization member for some more refined chart
784  // adjacent to this chart; ignore it.
785  }
786  litr.next();
787  }
788 
789  lbase_host->release_cover_id_space_iterator(litr);
790 
791  // cout << endl;
792 
793  // Get the evaluator for xpt.chart_id().
794 
795  sec_rep_descriptor& lrep = schema().host()->rep();
796  eval_family* leval_family = lrep.evaluators();
797  section_evaluator* leval = leval_family->member(*base().host(), xpt.chart_id());
798 
799  // Evaluate the field at xpt.local_coords()
800 
801  leval->value_at_coord(lgathered_dofs,
802  ldofs_ct,
803  xpt.local_coords(),
804  xpt.db(),
805  xresult,
806  ldf);
807 
808  if(xauto_access)
809  {
810  release_access();
811  }
812 
813  // Postconditions:
814 
815  ensure(unexecutable("for 0 <= i < schema.df(), xresult[i] = i-th component of value"));
816 
817 
818  // Exit:
819 
820  return;
821 }
822 
823 int
826 {
827 
828  // Preconditions:
829 
830 
831  // Body:
832 
833  static const int result = 10000;
834 
835  // Postconditions:
836 
837  ensure(invariant());
838 
839  // Exit:
840 
841  return result;
842 
843 }
844 
845 void
847 dof_tuple(dof_type* xbuf, int xbuflen) const
848 {
849 
850  // Preconditions:
851 
852  require(xbuflen >= dof_ct());
853 
854  // Body:
855 
856  // implementation is same as in sec_tuple
857 
858  sec_tuple::dof_tuple(reinterpret_cast<void*>(xbuf), xbuflen* sizeof(dof_type));
859 
860  // Postconditions:
861  ensure(invariant());
862  ensure(unexecutable(xbuf contains copy of dof tuple));
863 
864 }
865 
866 
869 deep_copy(bool xauto_access)
870 {
871  sec_vd* result;
872 
873  // Preconditions:
874 
875  require(xauto_access || host()->in_jim_edit_mode());
876 
877  // Body:
878 
879  result = clone(true, xauto_access);
880  deep_copy(*result, xauto_access);
881 
882  // Postconditions:
883 
884  ensure(result != 0);
885  ensure(is_same_type(result));
886 
887  // Exit:
888 
889  return result;
890 }
891 
892 void
894 deep_copy(sec_vd& xother, bool xauto_access)
895 {
896  // Preconditions:
897 
898  require(xauto_access || xother.state_is_read_write_accessible());
899  require(xauto_access || state_is_read_accessible());
900 
901  if(xauto_access)
902  {
903  xother.get_read_write_access(true);
904  get_read_access();
905  }
906 
907  require(same_schema(&xother));
908 
909  // Body:
910 
912  fiber_prototype().lite_prototype().clone();
913 
914  const index_space_handle& ldisc_id_space = schema().discretization_id_space();
915  index_space_iterator& ldisc_itr = ldisc_id_space.get_iterator();
916  scoped_index ldisc_id(ldisc_id_space);
917  while(!ldisc_itr.is_done())
918  {
919  ldisc_id = ldisc_itr.pod();
920 
921  get_fiber(ldisc_id.pod(), *lfiber);
922  xother.put_fiber(ldisc_id, *lfiber, false);
923 
924  ldisc_itr.next();
925  }
926  ldisc_id_space.release_iterator(ldisc_itr);
927  delete lfiber;
928 
929  if(xauto_access)
930  {
931  release_access();
932  xother.release_access();
933  }
934 
935  // Postconditions:
936 
937 
938  // Exit:
939 
940  return;
941 }
942 
943 // PROTECTED MEMBER FUNCTIONS
944 
948 {
949  scalar_type* result;
950 
951  // Preconditions:
952 
953  // Body:
954 
955  // Create an unattached handle.
956 
957  result = new scalar_type;
958 
959  // Postconditions:
960 
962  ensure(result != 0);
963  ensure(!result->is_attached());
964  ensure(unexecutable(result conforms to scalar_type));
965 
966  // Exit:
967 
968  return result;
969 }
970 
971 // PRIVATE MEMBER FUNCTIONS
972 
973 
974 //=============================================================================
975 // MULTISECTION FACET
976 //=============================================================================
977 
978 // PUBLIC MEMBER FUNCTIONS
979 
981 fiber_bundle::sec_vd::
982 unify(bool xauto_access)
983 {
984  sec_vd* result;
985 
986  // Preconditions:
987 
988  require(is_multisection(xauto_access));
989  require(xauto_access || host()->in_jim_edit_mode());
990 
991  // Body:
992 
993  result = clone(true, xauto_access);
994  unify(*result, xauto_access);
995 
996  // Postconditions:
997 
998  ensure(!result->is_multisection(xauto_access));
999 
1000  // Exit:
1001 
1002  return result;
1003 }
1004 
1005 void
1006 fiber_bundle::sec_vd::
1007 unify(sec_vd& xresult, bool xauto_access)
1008 {
1009  // Preconditions:
1010 
1011  require(is_multisection(xauto_access));
1012 
1013  require(xresult.in_same_space(this));
1014  require(!xresult.is_multisection(xauto_access));
1015  require(xauto_access || xresult.state_is_read_write_accessible());
1016 
1017  // Body:
1018 
1019  if(xauto_access)
1020  {
1021  xresult.get_read_write_access(true); // Implies read access to this.
1022  }
1023 
1024  sec_vd lbranch;
1025 
1026  int ldf = schema().df();
1027  sec_vd_dof_type* ldofs = new sec_vd_dof_type[ldf];
1028 
1029  // Iterate over the poset ids of the branches.
1030 
1031  index_space_iterator& lbranch_itr = get_branch_id_space_iterator(false);
1032 
1033  while(!lbranch_itr.is_done())
1034  {
1035  lbranch.attach_to_state(_host, lbranch_itr.hub_pod());
1036 
1037  // Iterate over disc seq ids of this branch.
1038 
1039  const index_space_handle& ldisc_id_space = lbranch.schema().discretization_id_space();
1040  index_space_iterator& ldisc_itr = ldisc_id_space.get_iterator();
1041  scoped_index ldisc_id(ldisc_id_space);
1042  while(!ldisc_itr.is_done())
1043  {
1044  ldisc_id = ldisc_itr.pod();
1045 
1046  lbranch.get_fiber(ldisc_id.pod(), ldofs,
1047  ldf*sizeof(sec_vd_dof_type));
1048  xresult.put_fiber(ldisc_id, ldofs,
1049  ldf*sizeof(sec_vd_dof_type), false);
1050 
1051  ldisc_itr.next();
1052  }
1053  ldisc_id_space.release_iterator(ldisc_itr);
1054  lbranch_itr.next();
1055  }
1056  release_branch_id_space_iterator(lbranch_itr, false);
1057  lbranch.detach_from_state();
1058 
1059  delete[] ldofs;
1060 
1061  if(xauto_access)
1062  {
1063  xresult.release_access();
1064  }
1065 
1066  // Postconditions:
1067 
1068 
1069  // Exit:
1070 
1071  return;
1072 }
1073 
1074 // PROTECTED MEMBER FUNCTIONS
1075 
1076 // PRIVATE MEMBER FUNCTIONS
1077 
1078 
1079 // ===========================================================
1080 // NEW DOF ACCESS FACET
1081 // ===========================================================
1082 
1083 // PUBLIC MEMBER FUNCTIONS
1084 
1085 void
1087 get_fiber(pod_index_type xdisc_id, vd_lite& xfiber) const
1088 {
1089  // Preconditions:
1090 
1091  require(state_is_read_accessible());
1092  require(schema().discretization_id_space().contains(xdisc_id));
1094  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1095 
1096 
1097  // Body:
1098 
1099  dof_map(false).get_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1100 
1101  // Postconditions:
1102 
1103 
1104  // Exit:
1105 
1106  return;
1107 }
1108 
1109 void
1111 get_fiber(const scoped_index& xdisc_id, vd_lite& xfiber, bool xauto_access) const
1112 {
1113  // Preconditions:
1114 
1115  require(state_is_auto_read_accessible(xauto_access));
1116  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1118  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1119 
1120  // Body:
1121 
1122  if(xauto_access)
1123  {
1124  get_read_access();
1125  }
1126 
1127  dof_map(false).get_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1128 
1129  if(xauto_access)
1130  {
1131  release_access();
1132  }
1133 
1134  // Postconditions:
1135 
1136 
1137  // Exit:
1138 
1139  return;
1140 }
1141 
1142 void
1144 put_fiber(pod_index_type xdisc_id, const vd_lite& xfiber)
1145 {
1146  // Preconditions:
1147 
1148  require(state_is_read_write_accessible());
1149  require(schema().discretization_id_space().contains(xdisc_id));
1150  require(unexecutable("dof_map().fiber_in_bounds(xdisc_id, false)"));
1152  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1153 
1154  // Body:
1155 
1156  dof_map(true).put_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1157 
1158  // Postconditions:
1159 
1160 
1161  // Exit:
1162 
1163  return;
1164 }
1165 
1166 void
1168 put_fiber(const scoped_index& xdisc_id, const vd_lite& xfiber, bool xauto_access)
1169 {
1170  // Preconditions:
1171 
1172  require(state_is_auto_read_write_accessible(xauto_access));
1173  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1174  require(unexecutable("dof_map().fiber_in_bounds(xdisc_id, false)"));
1176  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1177 
1178  // Body:
1179 
1180  if(xauto_access)
1181  {
1182  get_read_write_access(true);
1183  }
1184 
1185  dof_map(true).put_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1186 
1187  if(xauto_access)
1188  {
1189  release_access();
1190  }
1191 
1192  // Postconditions:
1193 
1194 
1195  // Exit:
1196 
1197  return;
1198 }
1199 
1200 void
1202 force_fiber(pod_index_type xdisc_id, const vd_lite& xfiber)
1203 {
1204  // Preconditions:
1205 
1206  require(state_is_read_write_accessible());
1207  require(schema().discretization_id_space().contains(xdisc_id));
1209  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1210 
1211  // Body:
1212 
1213  dof_map(true).force_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1214 
1215  // Postconditions:
1216 
1217 
1218  // Exit:
1219 
1220  return;
1221 }
1222 
1223 void
1225 force_fiber(const scoped_index& xdisc_id, const vd_lite& xfiber, bool xauto_access)
1226 {
1227  // Preconditions:
1228 
1229  require(state_is_auto_read_write_accessible(xauto_access));
1230  require(schema(xauto_access).discretization_id_space(xauto_access).contains(xdisc_id));
1232  require(xfiber.d()*sizeof(dof_type) >= schema().fiber_size());
1233 
1234  // Body:
1235 
1236  if(xauto_access)
1237  {
1238  get_read_write_access(true);
1239  }
1240 
1241  dof_map(true).force_fiber(xdisc_id, xfiber.row_dofs(), xfiber.d()*sizeof(dof_type));
1242 
1243  if(xauto_access)
1244  {
1245  release_access();
1246  }
1247 
1248  // Postconditions:
1249 
1250 
1251  // Exit:
1252 
1253  return;
1254 }
1255 
1256 // PROTECTED MEMBER FUNCTIONS
1257 
1258 // PRIVATE MEMBER FUNCTIONS
1259 
1260 
1261 //==============================================================================
1262 // TUPLE FACET OF CLASS SEC_VD
1263 //==============================================================================
1264 
1265 // PUBLIC MEMBER FUNCTIONS
1266 
1267 // PROTECTED MEMBER FUNCTIONS
1268 
1269 // PRIVATE MEMBER FUNCTIONS
1270 
1271 
1272 //==============================================================================
1273 // ABSTRACT POSET MEMBER FACET OF CLASS SEC_VD
1274 //==============================================================================
1275 
1276 // PUBLIC MEMBER FUNCTIONS
1277 
1278 const std::string&
1280 class_name() const
1281 {
1282  // Preconditions:
1283 
1284  // Body:
1285 
1286  const string& result = static_class_name();
1287 
1288  // Postconditions:
1289 
1290  ensure(!result.empty());
1291 
1292  // Exit:
1293 
1294  return result;
1295 }
1296 
1297 const std::string&
1300 {
1301  // Preconditions:
1302 
1303  // Body:
1304 
1305  static const string result("sec_vd");
1306 
1307  // Postconditions:
1308 
1309  ensure(!result.empty());
1310 
1311  // Exit:
1312 
1313  return result;
1314 }
1315 
1318 clone() const
1319 {
1320 
1321  // Preconditions:
1322 
1323  // Body:
1324 
1325  // create new handle of the current class.
1326 
1327  sec_vd* result = new sec_vd();
1328 
1329  // Postconditions:
1330 
1331  ensure(result != 0);
1332  ensure(result->invariant());
1333 
1334  // Exit:
1335 
1336  return result;
1337 
1338 }
1339 
1340 // PROTECTED MEMBER FUNCTIONS
1341 
1342 // PRIVATE MEMBER FUNCTIONS
1343 
1344 
1345 // ===========================================================
1346 // HOST POSET FACET
1347 // ===========================================================
1348 
1349 // PUBLIC MEMBER FUNCTIONS
1350 
1353 host() const
1354 {
1355  return reinterpret_cast<host_type*>(_host);
1356 }
1357 
1358 bool
1361 {
1362  return dynamic_cast<const host_type*>(xother) != 0;
1363 }
1364 
1365 // PROTECTED MEMBER FUNCTIONS
1366 
1367 // PRIVATE MEMBER FUNCTIONS
1368 
1369 
1370 //==============================================================================
1371 // ANY FACET OF CLASS SEC_VD
1372 //==============================================================================
1373 
1374 // PUBLIC MEMBER FUNCTIONS
1375 
1376 bool
1378 is_ancestor_of(const any* xother) const
1379 {
1380  // Preconditions:
1381 
1382  require(xother != 0);
1383 
1384  // Body:
1385 
1386  // If other may be dynamically cast to the type of this then this is an
1387  // ancestor of other.
1388 
1389  bool result = dynamic_cast<const sec_vd*>(xother) != 0;
1390 
1391  // Postconditions:
1392 
1393  //ensure(invariant());
1394 
1395  // Exit:
1396 
1397  return result;
1398 
1399 }
1400 
1401 bool
1403 invariant() const
1404 {
1405  bool result = true;
1406 
1407  // Preconditions:
1408 
1409  // Body:
1410 
1411  // Must satisfy base class invariant
1412 
1413  invariance(sec_tuple::invariant());
1414 
1415  if (invariant_check())
1416  {
1417  // Prevent recursive calls to invariant
1418 
1419  disable_invariant_check();
1420 
1421  // Nothing additional to do.
1422 
1423  // Finished, turn invariant checking back on.
1424 
1425  enable_invariant_check();
1426  }
1427 
1428  // Postconditions:
1429 
1430  ensure(is_derived_query);
1431 
1432  // Exit:
1433 
1434  return result;
1435 }
1436 
1437 // PROTECTED MEMBER FUNCTIONS
1438 
1439 // PRIVATE MEMBER FUNCTIONS
1440 
1441 
1442 //==============================================================================
1443 // NON-MEMBER FUNCTIONS
1444 //==============================================================================
1445 
1446 size_t
1447 fiber_bundle::
1448 deep_size(const sec_vd& x0, bool xinclude_shallow)
1449 {
1450  size_t result;
1451 
1452  // Preconditions:
1453 
1454  // Body:
1455 
1458 
1459  result = 0;
1460 
1461  // Postconditions:
1462 
1463  ensure(result == 0);
1464  //ensure(result >= 0);
1465 
1466  // Exit
1467 
1468  return result;
1469 }
1470 
1471 namespace
1472 {
1473  using namespace fiber_bundle::vd_algebra;
1474 
1475  class add_functor
1476  {
1477  public:
1478  void operator()(const vd_lite& xl0, const vd_lite& xl1,
1479  vd_lite& xlresult) const
1480  {
1481  add(xl0, xl1, xlresult);
1482  }
1483  };
1484 
1485  class subtract_functor
1486  {
1487  public:
1488  void operator()(const vd_lite& xl0, const vd_lite& xl1,
1489  vd_lite& xlresult) const
1490  {
1491  subtract(xl0, xl1, xlresult);
1492  }
1493  };
1494 
1495  class multiply_functor
1496  {
1497  public:
1498  void operator()(const vd_lite& xl0, const at0_lite& xl1,
1499  vd_lite& xlresult) const
1500  {
1501  multiply(xl0, xl1, xlresult);
1502  }
1503  };
1504 
1505  class divide_functor
1506  {
1507  public:
1508  void operator()(const vd_lite& xl0, const at0_lite& xl1,
1509  vd_lite& xlresult) const
1510  {
1511  divide(xl0, xl1, xlresult);
1512  }
1513  };
1514 
1515  class contract_functor
1516  {
1517  public:
1518  void operator()(const vd_lite& x0, const vd_lite& x1,
1519  at0_lite& xresult) const
1520  {
1521  xresult = contract(x0, x1);
1522  }
1523  };
1524 
1525 
1526 } //end unnamed namespace
1527 
1530 
1531 #include "SheafSystem/e2.h"
1532 #include "SheafSystem/sec_vd.impl.h"
1533 
1534 void
1536 add(const sec_vd& x0, const sec_vd& x1, sec_vd& xresult, bool xauto_access)
1537 {
1538  // Preconditions:
1539 
1540  require(x0.state_is_auto_read_accessible(xauto_access));
1541  require(x1.state_is_auto_read_accessible(xauto_access));
1542  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1543  require(x0.d(xauto_access) >= xresult.d(xauto_access));
1544  require(x1.d(xauto_access) >= xresult.d(xauto_access));
1545  require(x0.is_vector(xauto_access) == x1.is_vector(xauto_access));
1546 
1547  // Body:
1548 
1549  binary_op(x0, x1, xresult, add_functor(), xauto_access);
1550 
1551  // Set the variance of the result.
1552 
1553  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1554 
1555  // Postconditions:
1556 
1557  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1558  ensure(unexecutable("for_all: i, 0, xresult.d(),\
1559  xresult.component(i)==old_x0.component(i)+old_x1.component(i)"));
1560 
1561  // Exit:
1562 
1563  return;
1564 }
1565 
1566 void
1568 subtract(const sec_vd& x0, const sec_vd& x1, sec_vd& xresult, bool xauto_access)
1569 {
1570  // Preconditions:
1571 
1572  require(x0.state_is_auto_read_accessible(xauto_access));
1573  require(x1.state_is_auto_read_accessible(xauto_access));
1574  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1575  require(x0.d(xauto_access) >= xresult.d(xauto_access));
1576  require(x1.d(xauto_access) >= xresult.d(xauto_access));
1577  require(x0.is_vector(xauto_access) == x1.is_vector(xauto_access));
1578 
1579  // Body:
1580 
1581  binary_op(x0, x1, xresult, subtract_functor(), xauto_access);
1582 
1583  // Set the variance of the result.
1584 
1585  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1586 
1587  // Postconditions:
1588 
1589  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1590  ensure(unexecutable("for_all: i, 0, xresult.d(),\
1591  xresult.component(i)==old_x0.component(i)-old_x1.component(i)"));
1592 
1593  // Exit:
1594 
1595  return;
1596 }
1597 
1598 void
1600 multiply(const sec_vd& x0, const sec_at0& x1, sec_vd& xresult,
1601  bool xauto_access)
1602 {
1603  // Preconditions:
1604 
1605  require(x0.state_is_auto_read_accessible(xauto_access));
1606  require(x1.state_is_auto_read_accessible(xauto_access));
1607  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1608 
1609  // Body:
1610 
1611  binary_op(x0, x1, xresult, multiply_functor(), xauto_access);
1612 
1613  // Set the variance of the result.
1614 
1615  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1616 
1617  // Postconditions:
1618 
1619  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1620 
1621  // Exit:
1622 
1623  return;
1624 }
1625 
1626 void
1628 multiply(const sec_vd& x0, const vd_value_type& x1, sec_vd& xresult,
1629  bool xauto_access)
1630 {
1631  // Preconditions:
1632 
1633  require(x0.state_is_auto_read_accessible(xauto_access));
1634  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1635 
1636  // Body:
1637 
1638  binary_op(x0, x1, xresult, multiply_functor(), xauto_access);
1639 
1640  // Set the variance of the result.
1641 
1642  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1643 
1644  // Postconditions:
1645 
1646  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1647 
1648  // Exit:
1649 
1650  return;
1651 }
1652 
1653 void
1655 divide(const sec_vd& x0, const sec_at0& x1, sec_vd& xresult, bool xauto_access)
1656 {
1657  // Preconditions:
1658 
1659  require(x0.state_is_auto_read_accessible(xauto_access));
1660  require(x1.state_is_auto_read_accessible(xauto_access));
1661  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1662 
1663  // Body:
1664 
1665  binary_op(x0, x1, xresult, divide_functor(), xauto_access);
1666 
1667  // Set the variance of the result.
1668 
1669  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1670 
1671  // Postconditions:
1672 
1673  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1674 
1675  // Exit:
1676 
1677  return;
1678 }
1679 
1680 void
1682 divide(const sec_vd& x0, const vd_value_type& x1, sec_vd& xresult,
1683  bool xauto_access)
1684 {
1685  // Preconditions:
1686 
1687  require(x0.state_is_auto_read_accessible(xauto_access));
1688  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1689 
1690  // Body:
1691 
1692  binary_op(x0, x1, xresult, divide_functor(), xauto_access);
1693 
1694  // Set the variance of the result.
1695 
1696  x0.is_vector(xauto_access) ? xresult.put_is_vector(xauto_access) : xresult.put_is_covector(xauto_access);
1697 
1698  // Postconditions:
1699 
1700  ensure(xresult.is_vector(xauto_access) == x0.is_vector(xauto_access));
1701 
1702  // Exit:
1703 
1704  return;
1705 }
1706 
1707 //==============================================================================
1708 
1709 void
1711 add_equal(sec_vd& xresult, const sec_vd& xother, bool xauto_access)
1712 {
1713  // Preconditions:
1714 
1715  require(precondition_of(add(xresult, xother, xresult, xauto_access)));
1716 
1717  // Body:
1718 
1719  add(xresult, xother, xresult, xauto_access);
1720 
1721  // Postconditions:
1722 
1723  ensure(postcondition_of(add(xresult, xother, xresult, xauto_access)));
1724 
1725  // Exit:
1726 
1727 }
1728 
1729 void
1731 subtract_equal(sec_vd& xresult, const sec_vd& xother, bool xauto_access)
1732 {
1733  // Preconditions:
1734 
1735  require(precondition_of(subtract(xresult, xother, xresult, xauto_access)));
1736 
1737  // Body:
1738 
1739  subtract(xresult, xother, xresult, xauto_access);
1740 
1741  // Postconditions:
1742 
1743  ensure(postcondition_of(subtract(xresult, xother, xresult, xauto_access)));
1744 
1745  // Exit:
1746 }
1747 
1748 void
1750 multiply_equal(sec_vd& xresult, const sec_at0& xother, bool xauto_access)
1751 {
1752  // Preconditions:
1753 
1754  require(precondition_of(multiply(xresult, xother, xresult, xauto_access)));
1755 
1756  // Body:
1757 
1758  multiply(xresult, xother, xresult, xauto_access);
1759 
1760  // Postconditions:
1761 
1762  ensure(postcondition_of(multiply(xresult, xother, xresult, xauto_access)));
1763 
1764  // Exit:
1765 }
1766 
1767 void
1769 multiply_equal(sec_vd& xresult, const vd_value_type& xother, bool xauto_access)
1770 {
1771  // Preconditions:
1772 
1773  require(precondition_of(multiply(xresult, xother, xresult, xauto_access)));
1774 
1775  // Body:
1776 
1777  multiply(xresult, xother, xresult, xauto_access);
1778 
1779  // Postconditions:
1780 
1781  ensure(postcondition_of(multiply(xresult, xother, xresult, xauto_access)));
1782 
1783  // Exit:
1784 }
1785 
1786 void
1788 divide_equal(sec_vd& xresult, const sec_at0& xother, bool xauto_access)
1789 {
1790  // Preconditions:
1791 
1792  require(precondition_of(divide(xresult, xother, xresult, xauto_access)));
1793 
1794  // Body:
1795 
1796  divide(xresult, xother, xresult, xauto_access);
1797 
1798  // Postconditions:
1799 
1800  ensure(postcondition_of(divide(xresult, xother, xresult, xauto_access)));
1801 
1802  // Exit:
1803 }
1804 
1805 void
1807 divide_equal(sec_vd& xresult, const vd_value_type& xother, bool xauto_access)
1808 {
1809  // Preconditions:
1810 
1811  require(precondition_of(divide(xresult, xother, xresult, xauto_access)));
1812 
1813  // Body:
1814 
1815  divide(xresult, xother, xresult, xauto_access);
1816 
1817  // Postconditions:
1818 
1819  ensure(postcondition_of(divide(xresult, xother, xresult, xauto_access)));
1820 
1821  // Exit:
1822 }
1823 
1824 void
1826 contract(const sec_vd& xvector, const sec_vd& xcovector, sec_at0& xresult,
1827  bool xauto_access)
1828 {
1829  // Preconditions:
1830 
1831  require(xvector.state_is_auto_read_accessible(xauto_access));
1832  require(xcovector.state_is_auto_read_accessible(xauto_access));
1833  require(xresult.state_is_auto_read_write_accessible(xauto_access));
1834  require(xcovector.is_same_type(&xvector));
1835  require(xvector.is_vector(xauto_access) && xcovector.is_covector(xauto_access));
1836 
1837  // Body:
1838 
1839  binary_op(xvector, xcovector, xresult, contract_functor(), xauto_access);
1840 
1841  // Postconditions:
1842 
1843  // ensure(unexecutable("result == sum(i, xvector[i]*xcovector[i])"));
1844 
1845  // Exit:
1846 
1847  return;
1848 }
1849 
1850 //==============================================================================
1851 
1852 void
1854 max(const sec_vd& x0, vd_lite& xresult, bool xauto_access)
1855 {
1856  // Preconditions:
1857 
1858  require(x0.state_is_auto_read_accessible(xauto_access));
1859 
1860  // Body:
1861 
1862  if(xauto_access)
1863  {
1864  x0.get_read_access();
1865  }
1866 
1867  sec_vd& lx0 = const_cast<sec_vd&>(x0);
1868 
1869  typedef sec_vd::dof_type dof_type;
1870 
1871  // Allocate a buffer for the gathered local dofs of the source.
1872 
1873  block<dof_type> lsrc_dofs;
1874 
1875  // Allocate and initialize the result buffer.
1876 
1877  block<dof_type> lresult_dofs;
1878  lresult_dofs.reserve(lx0.df());
1879  lresult_dofs.set_ct(lx0.df());
1880  lresult_dofs.assign(-numeric_limits<dof_type>::max());
1881 
1882  block<dof_type> leval_dofs(lresult_dofs);
1883 
1884  eval_iterator leval_itr(lx0.schema());
1885 
1886  while(!leval_itr.is_done())
1887  {
1888  // Get the evaluator for this eval member.
1889 
1890  section_evaluator& levaluator = leval_itr.evaluator();
1891 
1892  // Gather the dofs from x0.
1893 
1894  leval_itr.gather_dofs(lx0, lsrc_dofs);
1895 
1896  // Compute the maximum for this evaluator.
1897 
1898  levaluator.max(lsrc_dofs, leval_dofs);
1899 
1900  // Accumulate in result buffer.
1901 
1902  for(int i=0; i<leval_dofs.ct(); ++i)
1903  {
1904  if(leval_dofs[i] > lresult_dofs[i])
1905  {
1906  lresult_dofs[i] = leval_dofs[i];
1907  }
1908  }
1909 
1910  // Move to the next evaluation member.
1911 
1912  leval_itr.next();
1913  }
1914 
1915  xresult.put_components(lresult_dofs.base(), lresult_dofs.ct());
1916 
1917  if(xauto_access)
1918  {
1919  x0.release_access();
1920  }
1921 
1922  // Postconditions:
1923 
1924  //ensure(const_cast<sec_vd&>(x0).invariant());
1925 
1926  // Exit:
1927 
1928  return;
1929 }
1930 
1933 max(const sec_vd& x0, bool xauto_access)
1934 {
1935  // Preconditions:
1936 
1937  require(precondition_of(max(x0, *result, xauto_access)));
1938 
1939  // Body:
1940 
1941  vd_lite* result = new vd_lite();
1942 
1943  max(x0, *result, xauto_access);
1944 
1945  // Postconditions:
1946 
1947  ensure(postcondition_of(max(x0, *result, xauto_access)));
1948 
1949  // Exit:
1950 
1951  return result;
1952 }
1953 
1954 void
1956 min(const sec_vd& x0, vd_lite& xresult, bool xauto_access)
1957 {
1958  // Preconditions:
1959 
1960  require(x0.state_is_auto_read_accessible(xauto_access));
1961 
1962  // Body:
1963 
1964  if(xauto_access)
1965  {
1966  x0.get_read_access();
1967  }
1968 
1969  sec_vd& lx0 = const_cast<sec_vd&>(x0);
1970 
1971  typedef sec_vd::dof_type dof_type;
1972 
1973  // Allocate a buffer for the gathered local dofs of the source.
1974 
1975  block<dof_type> lsrc_dofs;
1976 
1977  // Allocate and initialize the result buffer.
1978 
1979  block<dof_type> lresult_dofs;
1980  lresult_dofs.reserve(lx0.df());
1981  lresult_dofs.set_ct(lx0.df());
1982  lresult_dofs.assign(numeric_limits<dof_type>::max());
1983 
1984  block<dof_type> leval_dofs(lresult_dofs);
1985 
1986  eval_iterator leval_itr(lx0.schema());
1987 
1988  while(!leval_itr.is_done())
1989  {
1990  // Get the evaluator for this eval member.
1991 
1992  section_evaluator& levaluator = leval_itr.evaluator();
1993 
1994  // Gather the dofs from x0.
1995 
1996  leval_itr.gather_dofs(lx0, lsrc_dofs);
1997 
1998  // Compute the maximum for this evaluator.
1999 
2000  levaluator.max(lsrc_dofs, leval_dofs);
2001 
2002  // Accumulate in result buffer.
2003 
2004  for(int i=0; i<leval_dofs.ct(); ++i)
2005  {
2006  if(leval_dofs[i] < lresult_dofs[i])
2007  {
2008  lresult_dofs[i] = leval_dofs[i];
2009  }
2010  }
2011 
2012  // Move to the next evaluation member.
2013 
2014  leval_itr.next();
2015  }
2016 
2017  xresult.put_components(lresult_dofs.base(), lresult_dofs.ct());
2018 
2019  if(xauto_access)
2020  {
2021  x0.release_access();
2022  }
2023 
2024  // Postconditions:
2025 
2026  //ensure(const_cast<sec_vd&>(x0).invariant());
2027 
2028  // Exit:
2029 
2030  return;
2031 }
2032 
2035 min(const sec_vd& x0, bool xauto_access)
2036 {
2037  // Preconditions:
2038 
2039  require(precondition_of(min(x0, *result, xauto_access)));
2040 
2041  // Body:
2042 
2043  vd_lite* result = new vd_lite();
2044 
2045  min(x0, *result, xauto_access);
2046 
2047  // Postconditions:
2048 
2049  ensure(postcondition_of(min(x0, *result, xauto_access)));
2050 
2051  // Exit:
2052 
2053  return result;
2054 }
2055 
2056 
2057 void
2059 extrema(const sec_vd& x0,
2060  sec_vd_value_type xmin[],
2061  size_type xmin_ub,
2062  sec_vd_value_type xmax[],
2063  size_type xmax_ub)
2064 {
2065  // Preconditions:
2066 
2067  require(x0.state_is_read_accessible());
2068  require(xmin != 0);
2069  require(xmin_ub >= x0.schema().df());
2070  require(xmax != 0);
2071  require(xmax_ub >= x0.schema().df());
2072 
2073  // Body:
2074 
2075  int ldf = x0.schema().df();
2076  for(int i=0; i<ldf; ++i)
2077  {
2080  }
2081 
2082  sec_vd_dof_type* ldofs = new sec_vd_dof_type[ldf];
2083 
2087 
2088  sec_rep_descriptor& lrep = x0.schema().host()->rep();
2089  eval_family* leval_family =
2090  eval_family::new_family(lrep.evaluator_family_name(), *(x0.name_space()));
2091 
2092  if(leval_family->extrema_are_dofs())
2093  {
2094  // The extrema occur at the dofs; can just check dofs,
2095  // don't need to gather dofs and use evaluators.
2096 
2097  index_space_iterator& litr =
2099  while(!litr.is_done())
2100  {
2101  x0.get_fiber(litr.pod(), ldofs, ldf*sizeof(sec_vd_dof_type));
2102  for(int i=0; i < ldf; ++i)
2103  {
2104  sec_vd_value_type ldof = ldofs[i];
2105 
2106  sec_vd_value_type& lmin = xmin[i];
2107  lmin = (lmin < ldof) ? lmin : ldof;
2108 
2109  sec_vd_value_type& lmax = xmax[i];
2110  lmax = (lmax > ldof) ? lmax : ldof;
2111  }
2112 
2113  litr.next();
2114  }
2116  }
2117  else
2118  {
2119  // Don't support this case yet.
2120 
2121  post_fatal_error_message("!extrema_are_dofs() not supported yet.");
2122  }
2123 
2124  delete leval_family;
2125  delete[] ldofs;
2126 
2127  // Postconditions:
2128 
2129 
2130  // Exit:
2131 
2132  return;
2133 }
2134 
2135 void
2137 extrema(const sec_vd& x0, vd_lite& xmin, vd_lite& xmax, bool xauto_access)
2138 {
2139  // Preconditions:
2140 
2141  require(x0.state_is_auto_read_accessible(xauto_access));
2142 
2143  // Body:
2144 
2145  if(xauto_access)
2146  {
2147  x0.get_read_access();
2148  }
2149 
2150  sec_vd& lx0 = const_cast<sec_vd&>(x0);
2151 
2152  typedef sec_vd::dof_type dof_type;
2153 
2154  // Allocate a buffer for the gathered local dofs of the source.
2155 
2156  block<dof_type> lsrc_dofs;
2157 
2158  // Allocate and initialize the result buffer.
2159 
2160  int ldf = lx0.df();
2161 
2162  block<dof_type> lmin_dofs;
2163  lmin_dofs.reserve(ldf);
2164  lmin_dofs.set_ct(ldf);
2166 
2167  block<dof_type> lmin_eval_dofs(lmin_dofs);
2168 
2169  block<dof_type> lmax_dofs;
2170  lmax_dofs.reserve(ldf);
2171  lmax_dofs.set_ct(ldf);
2172  lmax_dofs.assign(-numeric_limits<dof_type>::max());
2173 
2174  block<dof_type> lmax_eval_dofs(lmax_dofs);
2175 
2176  eval_iterator leval_itr(lx0.schema());
2177 
2178  while(!leval_itr.is_done())
2179  {
2180  // Get the evaluator for this eval member.
2181 
2182  section_evaluator& levaluator = leval_itr.evaluator();
2183 
2184  // Gather the dofs from x0.
2185 
2186  leval_itr.gather_dofs(lx0, lsrc_dofs);
2187 
2188  // Compute the min and max for this evaluator.
2189 
2190  levaluator.min(lsrc_dofs, lmin_eval_dofs);
2191  levaluator.max(lsrc_dofs, lmax_eval_dofs);
2192 
2193  // Accumulate in result buffer.
2194 
2195  for(int i=0; i<ldf; ++i)
2196  {
2197  if(lmin_eval_dofs[i] < lmin_dofs[i])
2198  {
2199  lmin_dofs[i] = lmin_eval_dofs[i];
2200  }
2201 
2202  if(lmax_eval_dofs[i] > lmax_dofs[i])
2203  {
2204  lmax_dofs[i] = lmax_eval_dofs[i];
2205  }
2206  }
2207 
2208  // Move to the next evaluation member.
2209 
2210  leval_itr.next();
2211  }
2212 
2213  xmin.put_components(lmin_dofs.base(), lmin_dofs.ct());
2214  xmax.put_components(lmax_dofs.base(), lmax_dofs.ct());
2215 
2216  if(xauto_access)
2217  {
2218  x0.release_access();
2219  }
2220 
2221  // Postconditions:
2222 
2223  //ensure(const_cast<sec_vd&>(x0).invariant());
2224 
2225  // Exit:
2226 
2227  return;
2228 
2229 }
2230 
2231 //==============================================================================
2232 
2233 void
2235 assign(sec_vd& x0, const sec_vd& x1, bool xauto_access)
2236 {
2237  // Preconditions:
2238 
2239  require(x0.state_is_auto_read_write_accessible(xauto_access));
2240  require(x1.state_is_auto_read_accessible(xauto_access));
2241 
2242  // Body:
2243 
2244  if(xauto_access)
2245  {
2246  // Since precondition ensures same host,
2247  // only need to get access to x0.
2248 
2249  x0.get_read_write_access(true);
2250  x1.get_read_access();
2251  }
2252 
2253  require(x0.schema(xauto_access).base_space().le(&(x1.schema(xauto_access).base_space())));
2254  require(x0.schema(xauto_access).same_discretization(x1.schema(xauto_access)));
2255 
2256  sec_vd::fiber_type::volatile_type* lfiber = x0.fiber_prototype().lite_prototype().clone();
2257 
2258  const index_space_handle& ldisc_id_space = x0.schema().discretization_id_space();
2259  index_space_iterator& ldisc_itr = ldisc_id_space.get_iterator();
2260  scoped_index ldisc_id(ldisc_id_space);
2261  while(!ldisc_itr.is_done())
2262  {
2263  ldisc_id = ldisc_itr.pod();
2264 
2265  x1.get_fiber(ldisc_id, *lfiber, false);
2266  x0.put_fiber(ldisc_id.pod(), *lfiber);
2267 
2268  ldisc_itr.next();
2269  }
2270  ldisc_id_space.release_iterator(ldisc_itr);
2271  delete lfiber;
2272 
2273  if(xauto_access)
2274  {
2275  x1.release_access();
2276  x0.release_access();
2277  }
2278 
2279  // Postconditions:
2280 
2281  //ensure(x0.invariant());
2282 
2283  // Exit:
2284 
2285  return;
2286 
2287 }
2288 
2289 void
2291 assign(sec_vd& x0, const vd_lite& x1, bool xauto_access)
2292 {
2293  // Preconditions:
2294 
2295  require(x0.state_is_auto_read_write_accessible(xauto_access));
2296 
2297  // Body:
2298 
2299  if(xauto_access)
2300  {
2301  x0.get_read_write_access(true);
2302  }
2303 
2304  index_space_iterator& ldisc_itr =
2306  while(!ldisc_itr.is_done())
2307  {
2308  x0.put_fiber(ldisc_itr.pod(), x1);
2309 
2310  ldisc_itr.next();
2311  }
2313 
2314  if(xauto_access)
2315  {
2316  x0.release_access();
2317  }
2318 
2319  // Postconditions:
2320 
2321  //ensure(x0.invariant());
2322 
2323  // Exit:
2324 
2325  return;
2326 
2327 }
2328 
2329 void
2331 assign(sec_vd& x0, const vd_value_type& xvalue, bool xauto_access)
2332 {
2333  // Preconditions:
2334 
2335  require(x0.state_is_auto_read_write_accessible(xauto_access));
2336 
2337  // Body:
2338 
2339  if(xauto_access)
2340  {
2341  x0.get_read_write_access(true);
2342  }
2343 
2344 // section_dof_map& ldof_map = x0.dof_map(true);
2345 // section_dof_iterator* itr = x0.schema().row_dof_iterator();
2346 // typedef sec_vd::dof_type dof_type;
2347 // dof_type lvalue = xvalue;
2348 
2349 // while(! itr->is_done())
2350 // {
2351 // ldof_map.put_dof(itr->index(), &lvalue, sizeof(lvalue));
2352 // itr->next();
2353 // }
2354 
2355 // delete itr;
2356 
2357  section_dof_map& ldof_map = x0.dof_map(true);
2359  typedef sec_vd::dof_type dof_type;
2360  dof_type lvalue = xvalue;
2361 
2362  while(!itr.is_done())
2363  {
2364  ldof_map.put_dof(itr.index(), &lvalue, sizeof(lvalue));
2365  itr.next();
2366  }
2367 
2369 
2370 
2371  if(xauto_access)
2372  {
2373  x0.release_access();
2374  }
2375 
2376  // Postconditions:
2377 
2378  //ensure(x0.invariant());
2379 
2380  // Exit:
2381 
2382  return;
2383 
2384 }
virtual int d() const
The fiber dimension.
Definition: sec_vd.cc:438
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
Definition: any.cc:153
poset_state_handle * host() const
The poset which this is a handle to a component of.
eval_family * evaluators() const
The family of evaluators for this rep. /.
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
virtual void * row_dofs()
The row dofs for this instance (mutable version).
Definition: any_lite.cc:225
int df() const
The dimension of the restricted fiber.
host_type * host() const
The poset this is a member of.
Definition: sec_vd.cc:1353
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
poset_dof_map * row_dof_tuple(const scoped_index &xindex) const
The row dof tuple associated with xindex.
std::string evaluator_family_name() const
The name of the evaluator family.
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
SHEAF_DLL_SPEC void min(const sec_vd &x0, vd_lite &xresult, bool xauto_access)
Minimum (pre-allocated version).
Definition: sec_vd.cc:1956
virtual bool extrema_are_dofs() const =0
True if the extrema (minima or maxima) of the members of this family occur at the discretization poin...
size_type ct() const
The number of items currently in use.
SHEAF_DLL_SPEC void multiply_equal(sec_vd &xresult, const sec_at0 &xother, bool xauto_access)
xresult multiply_equal xresult (pre-allocated version); synonym for multiply(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1750
vd * value_at_point(const chart_point &xpt, bool xauto_access=true) const
Value of the field at xpt, auto-allocated version.
Definition: sec_vd.cc:652
A Cartesian product section space.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
const index_space_handle & row_dof_id_space() const
The row dof id space for the schema defined by this.
~sec_vd()
Destructor.
Definition: sec_vd.cc:382
The abstract map from section dof ids to section dof values of heterogeneous type.
An abstract iterator over the ids of an id space.
index_space_iterator & get_cover_id_space_iterator(bool xlower, pod_index_type xmbr_hub_id) const
Allocates an iterator for the lower (xlower true) or upper (xlower false) cover id space of the membe...
virtual array_poset_dof_map & dof_map(bool xrequire_write_access=false)
The map from client_ids to dof values for this poset member (mutable version)
Definition: tuple.cc:589
poset_path path(bool xauto_access=true) const
A path to this component.
pod_type pod() const
The current id in the iteration.
A section of a bundle with fiber type tuple.
Definition: sec_tuple.h:53
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 get_fiber(pod_index_type xdisc_id, vd_lite &xfiber) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
Definition: sec_vd.cc:1087
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...
virtual void value_at_point_pa(const chart_point &xpt, vd &xresult, bool xauto_access=true) const
Value of the field at xpt, pre-allocated version.
Definition: sec_vd.cc:678
An iterator over the members of the evaluation subposet contained in the downset of the base space of...
Definition: eval_iterator.h:66
virtual int db() const =0
The dimension of this chart.
Definition: chart_point.cc:141
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.
SHEAF_DLL_SPEC void subtract_equal(sec_vd &xresult, const sec_vd &xother, bool xauto_access)
x0 subtract_equal x1 (self-allocated version); synonym for subtract(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1731
virtual void value_at_point_ua(const chart_point &xpt, value_type *xresult, size_type xresult_ub, bool xauto_access=true) const
Value of the field at xpt, unattached version.
Definition: sec_vd.cc:713
virtual void * dof_tuple()=0
The dof tuple (mutable version).
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.
STL namespace.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
A point in chart space.
Definition: chart_point.h:52
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
tuple * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
Definition: tuple.h:387
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
pod_index_type chart_id() const
The id of the chart this point is in.
Definition: chart_point.cc:96
An abstract vector section space of dimension d.
Definition: sec_vd_space.h:52
A Cartesian product space.
Definition: tuple_space.h:52
virtual void get_read_access() const
Get read access to the state associated with this.
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_vd.cc:57
virtual namespace_poset * name_space() const
The namespace of host()
virtual void next()=0
Makes id() the next id in the iteration.
void force_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
Definition: sec_vd.cc:1202
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
namespace_poset * host() const
The namespace this poset resides in. Obsolete; use name_space() instead.
SHEAF_DLL_SPEC void assign(sec_vd &x0, const sec_vd &x1, bool xauto_access)
Assignment to another section; makes x0 have the same value as x1 on the meet of their bases...
Definition: sec_vd.cc:2235
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
virtual dof_type value_at_coord(const dof_type xdofs[], size_type xdofs_ub, const dof_type xlocal_coords[], size_type xlocal_coords_ub) const
Value at a specified local_coordinate. Single component version.
bool is_valid() const
True if this ia a valid point in a chart.
Definition: chart_point.cc:303
sec_vd_value_type value_type
The type of component in the value; the scalar type in the fiber space.
Definition: sec_vd.h:86
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...
bool invariant() const
Clsss invariant.
Definition: sec_vd.cc:1403
Abstract base class with useful features for all objects.
Definition: any.h:39
Abstract vector space over dof_type (volatile version).
Definition: vd.h:111
bool in_same_space(const poset_component *xother) const
Synonym for has_same_host(xother)
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
void dof_tuple(dof_type *xbuf, int xbuflen) const
Copies the entire dof tuple into xbuf.
Definition: sec_vd.cc:847
virtual coord_type * local_coords()=0
The array of local coordinates.
Definition: chart_point.cc:209
virtual void put_is_covector(bool xauto_access)
Sets is_covector true.
Definition: sec_vd.cc:581
bool is_done() const
True if iteration is finished.
virtual dof_type max(const dof_type xdofs[], size_type xdofs_ub) const
The maximum value of the scalar or component section defined by xdofs.
virtual int dof_packet_ub()
Definition: sec_vd.cc:825
void assign(const_reference_type xitem)
Sets the values of all items to xitem.
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 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...
SHEAF_DLL_SPEC void subtract(const sec_vd &x0, const sec_vd &x1, sec_vd &xresult, bool xauto_access)
x0 subtract x1 (pre-allocated version).
Definition: sec_vd.cc:1568
SHEAF_DLL_SPEC void divide_equal(sec_vd &xresult, const sec_at0 &xother, bool xauto_access)
xresult divide_equal xresult (pre-allocated version); synonym for divide(xresult, xother...
Definition: sec_vd.cc:1788
pointer_type base() const
The underlying storage array.
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 void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
virtual int d() const
Dimension of this as a vector space.
Definition: vd.cc:189
void set_comp(int i, scalar_type *xcomponent)
Sets ith component of section.
Definition: sec_vd.cc:628
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
A family of compatible section evaluators, one for each member of some family of cell types; a map fr...
Definition: eval_family.h:67
SHEAF_DLL_SPEC void add_equal(sec_vd &xresult, const sec_vd &xother, bool xauto_access)
x0 add_equal x1 (self-allocated version); synonym for add(xresult, xother, xresult, xauto_access).
Definition: sec_vd.cc:1711
bool invariant() const
Class invariant.
Definition: sec_tuple.cc:539
virtual bool is_attached() const
True if this handle is attached to a non-void state.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
A member of a Cartesian product space; a tuple of attributes (volatile version).
Definition: tuple.h:81
void * row_dofs()
The row dofs for this instance (mutable version).
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
scalar_type * comp(int i) const
Ith component of section.
Definition: sec_vd.cc:602
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. ...
bool le(pod_index_type xother_index) const
True if this is less than or equal to the member with index xother_index.
sec_rep_descriptor & rep()
The representation for section spaces on this schema.
virtual sec_vd & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(xother).
Definition: sec_vd.cc:282
A member of a Cartesian product space; a tuple of attributes (persistent version).
Definition: tuple.h:191
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
sec_vd * deep_copy(bool xauto_access)
Virtual constructor; makes a new handle of the same type as this, attached to a copy of the state of ...
Definition: sec_vd.cc:869
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
virtual pod_type index() const =0
Index of this space.
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
SHEAF_DLL_SPEC void add(const sec_vd &x0, const sec_vd &x1, sec_vd &xresult, bool xauto_access)
x0 add x1 (pre-allocated version).
Definition: sec_vd.cc:1536
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
const hub_index_space_handle & member_hub_id_space(bool xauto_access) const
The member hub id space.
bool same_discretization(const section_space_schema_member &xother) const
True if this has the same discretization as xother.
virtual const std::string & class_name() const
The name of this class.
Definition: sec_vd.cc:1280
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
void detach_from_state()
Detaches field from state it is currently attached to.
Definition: sec_tuple.cc:603
const bool LOWER
Selector for lower cover.
Definition: sheaf.h:67
int factor_ct() const
The number of factors in this product.
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
virtual void * dof_tuple()
The dof tuple (mutable version).
virtual bool is_covector(bool xauto_access) const
True if and only if this is a covector.
Definition: sec_vd.cc:562
virtual void put_is_vector(bool xauto_access)
Sets is_vector true.
Definition: sec_vd.cc:541
virtual dof_type min(const dof_type xdofs[], size_type xdofs_ub) const
The minimum value of the scalar or component section defined by xdofs.
total_poset_member & base_space()
The base space component of this (mutable version).
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
Definition: sec_vd.cc:1144
const index_space_handle & discretization_id_space() const
The id space for the discretization members in the down set of the base space of this (const version)...
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
SHEAF_DLL_SPEC void multiply(const sec_vd &x0, const sec_at0 &x1, sec_vd &xresult, bool xauto_access)
x0 multiplied by x1 (pre-allocated version).
Definition: sec_vd.cc:1600
poset_path scalar_space_path() const
The path of the underlying scalar space.
Definition: sec_vd.cc:480
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
poset_dof_map & member_dof_map(pod_index_type xmbr_hub_id, bool xrequire_write_access=false)
The dof map associated with the member identified by hub id xmbr_hub_id (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_vd.cc:394
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
sec_vd_dof_type dof_type
The type of degree of freedom.
Definition: sec_vd.h:91
virtual void put_dof(pod_index_type xdisc_id, pod_index_type xfiber_dof_id, const void *xdof, size_type xdof_size)=0
Sets the dof referred to by xdof_id to the value at xdof.
SHEAF_DLL_SPEC void extrema(const sec_vd &x0, vd_lite &xmin, vd_lite &xmax, bool xauto_access)
Extrema (pre-allocated version).
Definition: sec_vd.cc:2137
virtual tuple_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: tuple.cc:189
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
Definition: sec_vd.cc:421
virtual int d() const
Dimension of this as a vector space.
Definition: vd.cc:1017
SHEAF_DLL_SPEC void max(const sec_vd &x0, vd_lite &xresult, bool xauto_access)
Maximum (pre-allocated version).
Definition: sec_vd.cc:1854
virtual sec_vd * clone() const
Make a new handle, no state instance of current.
Definition: sec_vd.cc:1318
int df() const
The dimension of the fiber space component.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
section_evaluator * member(pod_index_type xtype_id) const
The evaluator associated with cell type xtype_id. Note that the result may be void.
Definition: eval_family.cc:301
SHEAF_DLL_SPEC void divide(const sec_vd &x0, const sec_at0 &x1, sec_vd &xresult, bool xauto_access)
x0 divided by x1 (pre-allocated version).
Definition: sec_vd.cc:1655
An abstract client handle for a member of a poset.
vd * clone(bool xnew_state, bool xauto_access=true) const
Make a new handle instance of current. Attach the new instance to a new state if xnew_state is true...
Definition: vd.h:607
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
The type of row dof tuple for base_space_member.
bool is_multisection(bool xauto_access) const
True if this is a multisection.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
Definition: sec_vd.cc:1360
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
Definition: sec_vd.cc:1378
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
static const std::string & static_class_name()
The name of this class.
Definition: sec_vd.cc:1299
Namespace containing the vector algrebra functions for the fiber_bundles component of the sheaf syste...
Definition: e3.h:1135
An auto_block with a no-initialization initialization policy.
SHEAF_DLL_SPEC void contract(const sec_vd &xvector, const sec_vd &xcovector, sec_at0 &xresult, bool xauto_access)
Contraction of vector xvector on covector xcovector (pre-allocated version).
Definition: sec_vd.cc:1826
Namespace for the fiber_bundles component of the sheaf system.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
Definition: fiber_bundle.h:73
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79
virtual sec_tuple::scalar_type * new_comp()
Creates a new component for attach_handle_data_members. A "virtual constructor" for components...
Definition: sec_vd.cc:947
Abstract vector space over dof_type.
Definition: vd.h:350
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
Definition: sec_at0.h:51
sec_vd()
Default constructor.
Definition: sec_vd.cc:112
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 section_dof_map & dof_map(bool xrequire_write_access=false)
The map from client_ids to dof values for this poset member (mutable version)
void release_cover_id_space_iterator(index_space_iterator &xcover_itr) const
Returns xcover_itr to the pool of id space iterators.
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
Definition: fiber_bundle.h:63
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
virtual bool is_vector(bool xauto_access) const
True if and only if this is a vector (as opposed to a covector).
Definition: sec_vd.cc:522
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
A description for a section representation scheme.
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