SheafSystem  0.0.0.0
field_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/field_vd.h"
22 
23 #include "SheafSystem/arg_list.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/base_space_member.h"
26 #include "SheafSystem/block.impl.h"
27 #include "SheafSystem/chart_point.h"
28 #include "SheafSystem/discretization_iterator.h"
29 #include "SheafSystem/discretization_pusher.h"
30 #include "SheafSystem/error_message.h"
31 #include "SheafSystem/eval_family.h"
32 #include "SheafSystem/field_eval_iterator.h"
33 #include "SheafSystem/hash_index_space_state.h"
34 #include "SheafSystem/name_multimap.h"
35 #include "SheafSystem/namespace_poset_member.h"
36 #include "SheafSystem/poset_path.h"
37 #include "SheafSystem/print_property_dofs_action.h"
38 #include "SheafSystem/property_disc_iterator.h"
39 #include "SheafSystem/put_property_dofs_fcn_action.h"
40 #include "SheafSystem/sec_at1_space.h"
41 #include "SheafSystem/sec_ed_invertible.h"
42 #include "SheafSystem/sec_rep_descriptor.h"
43 #include "SheafSystem/sec_vd_space.h"
44 #include "SheafSystem/section_evaluator.h"
45 #include "SheafSystem/section_pusher.h"
46 #include "SheafSystem/section_space_schema_poset.h"
47 #include "SheafSystem/structured_block_1d.h"
48 #include "SheafSystem/structured_block_2d.h"
49 #include "SheafSystem/structured_block_3d.h"
50 #include "SheafSystem/subposet.h"
51 
52 using namespace std;
53 using namespace fields; // Workaround for MS C++ bug.
54 
55 // ===========================================================
56 // FIELD_VD FACET
57 // ===========================================================
58 
62 {
63  // Preconditions:
64 
65  // Body:
66 
67  _coordinates = new sec_ed_invertible;
68  _property = new sec_vd;
69  _base_space = new base_space_member;
70 
71  // Postconditions:
72 
73  ensure(invariant());
74  ensure(!is_attached());
75 
76  // Exit:
77 
78  return;
79 }
80 
83 field_vd(const field_vd& xother, bool xauto_access)
84 {
85  // Preconditions:
86 
87  require(xauto_access || !xother.is_attached() || \
88  xother.state_is_read_accessible());
89 
90  // Body:
91 
92  _coordinates = xother._coordinates->clone(false, xauto_access);
93  _property = xother._property->clone(false, xauto_access);
94  _base_space = xother._base_space->clone(false, xauto_access);
95 
96  // Postconditions:
97 
98  ensure(invariant());
99  ensure(coordinates().is_same_state(&xother.coordinates()));
100  ensure(property().is_same_state(&xother.property()));
101  ensure(base_space().is_same_state(&xother.base_space()));
102 
103  // Exit:
104 
105  return;
106 }
107 
110 field_vd(const sec_ed& xcoordinates, const sec_vd& xproperty,
111  bool xauto_access)
112 {
113  // Preconditions:
114 
115  require(xcoordinates.is_attached());
116  require(xproperty.is_attached());
117  require(xauto_access || xcoordinates.state_is_read_accessible());
118  require(xauto_access || xproperty.state_is_read_accessible());
119 
120  // Body:
121 
122  if(xauto_access)
123  {
124  xcoordinates.get_read_access();
125  xproperty.get_read_access();
126  }
127 
128  _coordinates = new sec_ed_invertible(xcoordinates);
129 
130  _property = xproperty.clone(false, false);
131 
134 
135  _base_space = new base_space_member(xproperty.schema().base_space());
136 
137  if(xauto_access)
138  {
139  xcoordinates.release_access();
140  xproperty.release_access();
141  }
142 
143  // Postconditions:
144 
145  ensure(invariant());
146  ensure(coordinates().is_same_state(&xcoordinates));
147  ensure(property().is_same_state(&xproperty));
148 
149  // Exit:
150 
151  return;
152 }
153 
157  const poset_path& xcoordinates_path,
158  const poset_path& xproperty_path,
159  bool xauto_access)
160 {
161 
162  // Preconditions:
163 
164  require(xauto_access || xns.state_is_read_accessible());
165  require(xns.contains_poset_member(xcoordinates_path));
166  require(xauto_access ||
167  xns.member_poset(xcoordinates_path).state_is_read_accessible());
168  require(xns.contains_poset_member(xproperty_path));
169  require(xauto_access ||
170  xns.member_poset(xproperty_path).state_is_read_accessible());
171 
172  // Body:
173 
174  if(xauto_access)
175  {
176  xns.get_read_access();
177  }
178 
179  _coordinates = new sec_ed_invertible(&xns, xcoordinates_path, xauto_access);
180 
182 
183  _property = new sec_vd(&xns, xproperty_path, xauto_access);
184 
185  if(xauto_access)
186  {
187  _coordinates->get_read_access();
188  _property->get_read_access();
189  }
190 
192 
193  _base_space = new base_space_member(_property->schema().base_space());
194 
195  if(xauto_access)
196  {
197  _coordinates->release_access();
198  _property->release_access();
199  }
200 
201  // Postconditions:
202 
203  ensure(invariant());
204  ensure(coordinates().path(true) == xcoordinates_path);
205  ensure(property().path(true) == xproperty_path);
206 
207  // Exit:
208 
209  return;
210 }
211 
214 field_vd(sec_vd* xproperty,
215  sec_ed_invertible* xcoordinates,
216  base_space_member* xbase_space)
217  : _property(xproperty), _coordinates(xcoordinates), _base_space(xbase_space)
218 {
219  // Preconditions:
220 
221  // Body:
222 
223  // Postconditions:
224 
225  // Exit:
226 
227 }
228 
232 {
233  // Preconditions:
234 
235  // Body:
236 
238  delete _coordinates;
239 
241  delete _property;
242 
244  delete _base_space;
245 
246  // Exit:
247 
248  return;
249 }
250 
252 int
254 dc() const
255 {
256  int result;
257 
258  // Preconditions:
259 
260  require(state_is_read_accessible());
261 
262  // Body:
263 
264  result = _coordinates->schema().df();
265 
266  // Postconditions:
267 
268  ensure(result >= 0);
269 
270  // Exit:
271 
272  return result;
273 }
274 
276 int
278 dp() const
279 {
280  int result;
281 
282  // Preconditions:
283 
284  require(state_is_read_accessible());
285 
286  // Body:
287 
288  result = _property->schema().df();
289 
290  // Postconditions:
291 
292  ensure(result >= 0);
293 
294  // Exit:
295 
296  return result;
297 }
298 
300 int
302 db() const
303 {
304  int result;
305 
306  // Preconditions:
307 
308  require(state_is_read_accessible());
309 
310  // Body:
311 
312  result = _property->schema().db();
313 
314  // Postconditions:
315 
318 
319  ensure(result > 0);
320 
321  // ensure(result >= -1);
322 
323  // Exit:
324 
325  return result;
326 }
327 
331 name_space() const
332 {
333  return *(_base_space->name_space());
334 }
335 
339 coordinates() const
340 {
341  // Preconditions:
342 
343 
344  // Body:
345 
346  // Postconditions:
347 
348 
349  // Exit:
350 
351  return *_coordinates;
352 }
353 
357 property() const
358 {
359  // Preconditions:
360 
361  // Body:
362 
363  // Postconditions:
364 
365  // Exit:
366 
367  return *_property;
368 }
369 
373 base_space() const
374 {
375  // Preconditions:
376 
377  // Body:
378 
379  // Postconditions:
380 
381  // Exit:
382 
383  return *_base_space;
384 }
385 
390 {
391  property_disc_iterator* result;
392 
393  // Preconditions:
394 
395  require(state_is_read_accessible());
396 
397  // Body:
398 
399  result =
401  property().schema());
402 
403  // Postconditions:
404 
405  ensure(result != 0);
406  ensure(result->coordinates_schema().is_same_state(&coordinates().schema()));
407  ensure(result->property_schema().is_same_state(&property().schema()));
408 
409  // Exit:
410 
411  return result;
412 }
413 
415 void
418  block<sec_vd_dof_type>& xproperty_dofs)
419 {
420  // Preconditions:
421 
422  require(xproperty_dofs.ct() > 0);
423 
424  // Body:
425 
426  sec_vd_value_type& lprop_dof0 = xproperty_dofs[0];
427 
428  sec_vd_value_type lfactor = 1000000.0;
429  lprop_dof0 = 0.0;
430  for(int i= 0; i<xglobal_coords.ct(); ++i)
431  {
432  lprop_dof0 += xglobal_coords[i]*lfactor;
433  lfactor /= 1000.0;
434 
435  }
436 
437  for(int i=1; i<xproperty_dofs.ct(); ++i)
438  {
439  xproperty_dofs[i] = 0.0;
440  }
441 
442  // Postconditions:
443 
444  ensure_for_all(i, 1, xproperty_dofs.ct(), xproperty_dofs[i] == 0.0);
445 
446  // Exit:
447 
448  return;
449 }
450 
452 void
454 put_property_dofs(property_dof_function_type xdof_fcn, bool xauto_access)
455 {
456  // Preconditions:
457 
458  require(is_attached());
459  require(xdof_fcn != 0);
460  require(xauto_access || state_is_read_write_accessible());
461 
462  define_old_variable(int old_access_request_depth = access_request_depth());
463 
464  // Body:
465 
466  if(xauto_access)
467  {
468  get_read_write_access(false, true);
469  }
470 
471  put_property_dofs(*_coordinates, *_property, xdof_fcn, false);
472 
473  if(xauto_access)
474  {
475  release_access();
476  }
477 
478  // Postconditions:
479 
480  ensure(access_request_depth() == old_access_request_depth);
481 
482  // Exit:
483 
484  return;
485 }
486 
488 void
490 put_property_dofs(const sec_vd& xcoordinates,
491  sec_vd& xproperty,
493  bool xauto_access)
494 {
495  // Preconditions:
496 
497  require(xcoordinates.is_attached());
498  require(xauto_access || xcoordinates.state_is_read_accessible());
499  require(xproperty.is_attached());
500  require(xauto_access || xproperty.state_is_read_write_accessible());
501  require(xdof_fcn != 0);
502 
503  define_old_variable(int old_coordinates_access_request_depth = xcoordinates.access_request_depth());
504  define_old_variable(int old_property_access_request_depth = xproperty.access_request_depth());
505 
506  // Body:
507 
508  if(xauto_access)
509  {
510  xcoordinates.get_read_access();
511  xproperty.get_read_write_access(true);
512  }
513 
514  int ldc = xcoordinates.schema().df();
515  block<sec_vd_value_type> lcoords(ldc);
516  lcoords.set_ct(ldc);
517 
518  int ldp = xproperty.schema().df();
519  block<sec_vd_dof_type> ldofs(ldp);
520  ldofs.set_ct(ldp);
521 
522  // Iterate over the property disc.
523 
524  property_disc_iterator* litr =
526  xcoordinates.schema(),
527  xproperty.schema());
528 
529  while(!litr->is_done())
530  {
531  // Get the conext for all the property disc members associated
532  // with the current iteration.
533 
534  litr->get_prop_disc_values(xcoordinates);
535 
536  // Iterate over all the property disc members.
537 
538  const block<discretization_context>& lprop_mbrs =
540  size_type lct = lprop_mbrs.ct();
541  for(size_type i=0; i<lct; ++i)
542  {
543  // Get the context for this disc member.
544 
545  discretization_context& lcontext = lprop_mbrs[i];
546 
549 
550  for(size_type c=0; c<ldc; ++c)
551  {
552  lcoords[c] = lcontext.values[c];
553  }
554 
555  // Evaluate the dof function at the coordinates
556 
557  xdof_fcn(lcoords, ldofs);
558 
559  // Scatter the dofs into the property section.
560 
561  xproperty.put_fiber(lcontext.disc_id, ldofs.base(),
562  ldofs.ct()*sizeof(sec_vd_dof_type), false);
563  }
564 
565  litr->next();
566  }
567 
568  delete litr;
569 
570  if(xauto_access)
571  {
572  xcoordinates.release_access();
573  xproperty.release_access();
574  }
575 
576  // Postconditions:
577 
578  ensure(xcoordinates.access_request_depth() == old_coordinates_access_request_depth);
579  ensure(xproperty.access_request_depth() == old_property_access_request_depth);
580 
581  // Exit:
582 
583  return;
584 }
585 
587 void
590  bool xauto_access)
591 {
592  // Preconditions:
593 
594  require(is_attached());
595  require(xproperty_dofs_action.property().is_same_state(&(property())));
596  require(xauto_access || state_is_read_write_accessible());
597 
598  define_old_variable(int old_access_request_depth = access_request_depth());
599 
600  // Body:
601 
602  if(xauto_access)
603  {
604  get_read_write_access(false, true);
605  }
606 
607 
608  discretization_pusher ldisc_pusher;
609  ldisc_pusher.push(property().schema(), coordinates(), xproperty_dofs_action, false);
610 
611 
612  if(xauto_access)
613  {
614  release_access();
615  }
616 
617  // Postconditions:
618 
619  ensure(access_request_depth() == old_access_request_depth);
620 
621  // Exit:
622 
623  return;
624 }
625 
627 void
629 put_property_dofs(const sec_vd& xcoordinates,
630  sec_vd& xproperty,
631  put_property_dofs_action& xproperty_dofs_action,
632  bool xauto_access)
633 {
634  // Preconditions:
635 
636  require(xcoordinates.is_attached());
637  require(xauto_access || xcoordinates.state_is_read_accessible());
638  require(xproperty.is_attached());
639  require(xauto_access || xproperty.state_is_read_write_accessible());
640 
641  define_old_variable(int old_coordinates_access_request_depth = xcoordinates.access_request_depth());
642  define_old_variable(int old_property_access_request_depth = xproperty.access_request_depth());
643 
644  // Body:
645 
646  if(xauto_access)
647  {
648  xcoordinates.get_read_access();
649  xproperty.get_read_write_access(true);
650  }
651 
652  int ldc = xcoordinates.schema().df();
653  block<sec_vd_value_type> lcoords(ldc);
654  lcoords.set_ct(ldc);
655 
656  int ldp = xproperty.schema().df();
657  block<sec_vd_dof_type> ldofs(ldp);
658  ldofs.set_ct(ldp);
659 
660  // Iterate over the property disc.
661 
662  property_disc_iterator* litr =
664  xcoordinates.schema(),
665  xproperty.schema());
666 
667  while(!litr->is_done())
668  {
669  // Get the conext for all the property disc members associated
670  // with the current iteration.
671 
672  litr->get_prop_disc_values(xcoordinates);
673 
674  // Iterate over all the property disc members.
675 
676  const block<discretization_context>& lprop_mbrs =
678  size_type lct = lprop_mbrs.ct();
679  for(size_type i=0; i<lct; ++i)
680  {
681  // Get the context for this disc member.
682 
683  discretization_context& lcontext = lprop_mbrs[i];
684 
687 
688  for(size_type c=0; c<ldc; ++c)
689  {
690  lcoords[c] = lcontext.values[c];
691  }
692 
693  // Evaluate the dof action at the coordinates
694 
695  xproperty_dofs_action(lcontext.disc_id, lcoords);
696  }
697 
698  litr->next();
699  }
700 
701  delete litr;
702 
703 
704  if(xauto_access)
705  {
706  xcoordinates.release_access();
707  xproperty.release_access();
708  }
709 
710  // Postconditions:
711 
712  ensure(xcoordinates.access_request_depth() == old_coordinates_access_request_depth);
713  ensure(xproperty.access_request_depth() == old_property_access_request_depth);
714 
715  // Exit:
716 
717  return;
718 }
719 
721 void
723 print_property_dofs(std::ostream& xos,
725  const std::string& xtitle_text,
726  bool xzero_specified,
727  bool xauto_access) const
728 {
729  // Preconditions:
730 
731  require(is_attached());
732  require(xauto_access || state_is_read_accessible());
733 
734  define_old_variable(int old_access_request_depth = access_request_depth());
735 
736  // Body:
737 
738  if(xauto_access)
739  {
740  get_read_access();
741  }
742 
743  xos << endl;
744  for(int i=0; i<8; ++i)
745  {
746  xos << "==========";
747  }
748  xos << endl << endl;
749 
750  if(!xtitle_text.empty())
751  {
752  xos << xtitle_text << endl << endl;
753  }
754 
755  xos << property().name() << " vs " << coordinates().name() << ":" << endl << endl;
756 
757 
758  print_property_dofs_action ldisc_push_action(property(), xdof_fcn, xzero_specified);
759  discretization_pusher ldisc_pusher;
760  ldisc_pusher.push(property().schema(), coordinates(), ldisc_push_action, false);
761 
762  xos << endl;
763  for(int i=0; i<8; ++i)
764  {
765  xos << "==========";
766  }
767  xos << endl << endl;
768 
769  if(xauto_access)
770  {
771  release_access();
772  }
773 
774  // Postconditions:
775 
776  ensure(access_request_depth() == old_access_request_depth);
777 
778  // Exit:
779 
780  return;
781 }
782 
784 bool
786 same_property_fiber_schema(const field_vd& xother, bool xauto_access) const
787 {
788  bool result;
789 
790  // Preconditions:
791 
792  require(xauto_access || state_is_read_accessible());
793 
794  // Body:
795 
796  if(xauto_access)
797  {
798  get_read_access();
799  xother.get_read_access();
800  }
801 
802  result = property().schema().fiber_schema().
803  is_same_state(&xother.property().schema().fiber_schema());
804 
805  if(xauto_access)
806  {
807  release_access();
808  xother.release_access();
809  }
810 
811  // Postconditions:
812 
813 
814  // Exit:
815 
816  return result;
817 }
818 
820 bool
823 {
824  bool result;
825 
826  // Preconditions:
827 
828  require(state_is_read_accessible());
829 
830  // Body:
831 
832  subposet& lcoord_eval_sp = coordinates().schema().evaluation();
833  subposet& lprop_eval_sp = property().schema().evaluation();
834 
835  result = lcoord_eval_sp.is_same_state(&lprop_eval_sp);
836 
837  // Postconditions:
838 
839 
840  // Exit:
841 
842  return result;
843 }
844 
846 bool
849 {
850  bool result;
851 
852  // Preconditions:
853 
854  require(state_is_read_accessible());
855 
856  // Body:
857 
858  subposet& lcoord_disc_sp = coordinates().schema().discretization();
859  subposet& lprop_disc_sp = property().schema().discretization();
860 
861  result = lcoord_disc_sp.is_same_state(&lprop_disc_sp);
862 
863  // Postconditions:
864 
865 
866  // Exit:
867 
868  return result;
869 }
870 
871 void
873 property_at_coordinates(const vd_lite& xcoord, vd_lite& xprop) const
874 {
875  // Preconditions:
876 
877  require(state_is_read_accessible());
878 
879  // Body:
880 
881  vd_lite& lcoord = const_cast<vd_lite&>(xcoord);
882 
883  vd_lite::dof_type* lcoord_dofs = reinterpret_cast<vd_lite::dof_type*>(&sheaf::row_dofs(lcoord));
884  vd_lite::dof_type* lprop_dofs = reinterpret_cast<vd_lite::dof_type*>(&sheaf::row_dofs(xprop));
885 
886  property_at_coordinates(lcoord_dofs, xcoord.d(), lprop_dofs, xprop.d());
887 
888  // Postconditions:
889 
890 
891  // Exit:
892 
893  return;
894 }
895 
897 void
900  block<sec_vd_value_type>& xprop) const
901 {
902  // Preconditions:
903 
904  require(state_is_read_accessible());
905 
906  // Body:
907 
908  property_at_coordinates(xcoord.base(), xcoord.ct(), xprop.base(), xprop.ub());
909 
910  xprop.set_ct(dp());
911 
912  // Postconditions:
913 
914 
915  // Exit:
916 
917  return;
918 }
919 
921 void
923 property_at_coordinates(sec_vd_value_type xcoord_base[], int xcoord_ct,
924  sec_vd_value_type xprop_base[], int xprop_ub) const
925 {
926  // Preconditions:
927 
928  require(state_is_read_accessible());
929 
930  // Body:
931 
932  if(!coordinates().is_invertible())
933  {
935  }
936 
937  // Find the point in the source base space
938  // with global coordinates xcoord.
939 
940  chart_point_3d lpt;
941 
942  coordinates().point_at_value_ua(xcoord_base, xcoord_ct, lpt);
943 
944  if(lpt.is_valid())
945  {
946  // Foound a valid point; evaluate the property
947 
948  property().value_at_point_ua(lpt, xprop_base, xprop_ub, false);
949  }
950  else
951  {
952  // Property isn't defined at given coordinate;
953  // extend by zero.
954 
955  for(int i=0; i<dp(); i++)
956  {
957  xprop_base[i] = 0.0;
958  }
959  }
960 
961  // Postconditions:
962 
963 
964  // Exit:
965 
966  return;
967 }
968 
972 embed_property(const std::string& xresult_name,
973  name_multimap& xresult_member_names,
974  bool xauto_access)
975 {
976  subposet* result;
977 
978  // Preconditions:
979 
980  require(xauto_access || state_is_read_write_accessible(true));
981 
982  if(xauto_access)
983  {
984  get_read_write_access(true, true);
985  }
986 
987  require(!base_space().host()->includes_subposet(xresult_name, false));
988  require(property().schema().rep().name() == "element_element_constant");
989  require(property().schema().evaluation().has_id_space());
990  require(unexecutable("Lower cover of property() base space contains only zones."));
991  require(unexecutable("property value positive"));
992 
993  // Body:
994 
996  pod_index_type lbase_id = lbase.index().pod();
997  poset_state_handle* lbase_host = property().schema().base_space().host();
998 
999  // Create the decomposition subposet.
1000 
1001  result = new subposet(lbase_host);
1002  result->put_name(xresult_name, true, false); // New_id_space requires name.
1003 
1004  scattered_insertion_index_space_handle& lresult_space = result->new_id_space("hash_index_space_state");
1005 
1006  pod_index_type lresult_mbr_client_id;
1007  pod_index_type lresult_mbr_id;
1008 
1009  // Get the client id map for the evaluation subposet,
1010  // which the precondition requires to be the zones subposet.
1011 
1012  subposet& leval_sp = property().schema().evaluation();
1013 
1014  // Assume that all zones and only zones are in the lower cover of the base space.
1015  // Iterate over the lower cover.
1016 
1017  sec_vd::fiber_type::volatile_type* lprop_fiber =
1018  _property->fiber_prototype().lite_prototype().clone();
1019 
1020  scoped_index lzone_id(lbase_host->member_hub_id_space(false));
1021 
1022  while(leval_sp.contains_member(lbase_host->first_cover_member(LOWER, lbase_id)))
1023  {
1024  lzone_id = lbase_host->first_cover_member(LOWER, lbase_id);
1025 
1026  // Get the property value for this zone;
1027 
1028  _property->get_fiber(lzone_id, *lprop_fiber, false);
1029 
1030  // Convert to a client id for the decomposition;
1031 
1032  lresult_mbr_client_id =
1033  static_cast<pod_index_type>((*lprop_fiber)[0] + 0.5);
1034 
1035  // Get the poset id of the decomposition member.
1036 
1037  lresult_mbr_id = lresult_space.hub_pod(lresult_mbr_client_id);
1038 
1039  if(!is_valid(lresult_mbr_id))
1040  {
1041  // Decomposition member for this property value
1042  // does not exist yet; create it.
1043 
1044  lresult_mbr_id = lbase_host->new_member(false);
1045 
1046  // Give it a name, if the client has provided one.
1047 
1048  string lresult_mbr_name = xresult_member_names.name(lresult_mbr_client_id);
1049  if(!lresult_mbr_name.empty())
1050  {
1051  lbase_host->put_member_name(lresult_mbr_id, lresult_mbr_name, true, false);
1052  }
1053 
1054  // Insert it in result.
1055 
1056  result->insert_member(lresult_mbr_id);
1057  lresult_space.insert(lresult_mbr_client_id, lresult_mbr_id);
1058 
1059  // Link the base space to the decomposition member.
1060  // This inserts lresult_id at the back of llc.
1061 
1062  lbase_host->new_link(lbase_id, lresult_mbr_id);
1063  }
1064 
1065  // Link the decomposition member to the zone.
1066 
1067  lbase_host->new_link(lresult_mbr_id, lzone_id.pod());
1068 
1069  // Delete the link from the base space to the zone.
1070  // Since lzone_id is at the front of llc, this
1071  // advances the iteration to the next member.
1072  // Eventually we reach the decomp members at the
1073  // back of llc and the iteration terminates.
1074 
1075  lbase_host->delete_link(lbase_id, lzone_id.pod());
1076  }
1077 
1078  // Clean up.
1079 
1080  delete lprop_fiber;
1081 
1082  // Postconditions:
1083 
1084  ensure(result != 0);
1085  ensure(result->name() == xresult_name);
1086  ensure(base_space().host()->includes_subposet(xresult_name, false));
1087 
1088  if(xauto_access)
1089  {
1090  release_access();
1091  }
1092 
1093  // Exit:
1094 
1095  return result;
1096 }
1097 
1099 void
1102  bool xdelete_coord_fiber,
1103  bool xdelete_prop_fiber)
1104 {
1105  // Preconditions:
1106 
1107 
1108  // Body:
1109 
1110  namespace_poset& lns = xfield->name_space();
1111  lns.begin_jim_edit_mode(true);
1112 
1113  // The prereq_id dofs define the outgoing adjacency links of the
1114  // member dependency graph. Build the incoming adjacency links.
1115  // The member id space is used to access the links.
1116 
1117  block< set<pod_index_type> > lin_links(lns.member_index_ub().pod());
1118 
1119  namespace_poset_member lmbr(lns.top());
1120 
1121  index_iterator lmbr_itr = lns.member_iterator();
1122  while(!lmbr_itr.is_done())
1123  {
1124  lmbr.attach_to_state(lmbr_itr.index());
1125 
1126  if(lmbr.is_jim(false))
1127  {
1128  for(int i=0; i<sheaf::PREREQ_IDS_UB; ++i)
1129  {
1130  pod_index_type lprereq_id = lmbr.poset_prereq_id(i);
1131 
1132  if(is_valid(lprereq_id))
1133  {
1134  lin_links[lprereq_id].insert(lmbr.index().pod());
1135  }
1136  }
1137  }
1138 
1139  lmbr_itr.next();
1140  }
1141  lmbr.detach_from_state();
1142 
1143  // Get the property and coordinate hosts, then delete the field.
1144 
1145  xfield->get_read_access();
1146 
1147  pod_index_type lprop_host_index = xfield->property().host()->index().pod();
1148  pod_index_type lprop_schema_host_index = xfield->property().host()->schema().host()->index().pod();
1149  pod_index_type lprop_fiber_space_index = xfield->property().host()->schema().host()->fiber_space().index().pod();
1150 
1151  pod_index_type lcoord_host_index = xfield->coordinates().host()->index().pod();
1152  pod_index_type lcoord_schema_host_index = xfield->coordinates().host()->schema().host()->index().pod();
1153  pod_index_type lcoord_fiber_space_index = xfield->coordinates().host()->schema().host()->fiber_space().index().pod();
1154 
1155  pod_index_type lbase_host_index = xfield->base_space().host()->index().pod();
1156 
1157  xfield->release_access();
1158 
1159  delete xfield;
1160 
1161  // Get the property schema host, remove the in link from the property
1162  // host to the property schema host, then delete the property host.
1163 
1164  lin_links[lprop_schema_host_index].erase(lprop_host_index);
1165 
1166  lns.delete_poset(lprop_host_index, true);
1167 
1168  if(lin_links[lprop_schema_host_index].empty())
1169  {
1170  // The prop schema host is no longer being used.
1171  // Get the fiber space, remove the proerty schema host
1172  // from the in links of the fiber space,
1173  // then delete the property schema host.
1174 
1175  lin_links[lprop_fiber_space_index].erase(lprop_schema_host_index);
1176  lin_links[lbase_host_index].erase(lprop_schema_host_index);
1177 
1178  lns.delete_poset(lprop_schema_host_index, true);
1179 
1180  if(lin_links[lprop_fiber_space_index].empty() && xdelete_prop_fiber)
1181  {
1182  // The prop fiber space is no longer being used; delete it..
1183 
1184  lns.delete_poset(lprop_fiber_space_index, true);
1185  }
1186  }
1187 
1188  // Get the coord schema host, then delete the coord host.
1189 
1190  lin_links[lcoord_schema_host_index].erase(lcoord_host_index);
1191 
1192  lns.delete_poset(lcoord_host_index, true);
1193 
1194  if(lin_links[lcoord_schema_host_index].empty())
1195  {
1196  // The coord schema host is no longer being used,
1197  // delete it, but first get the fiber space.
1198 
1199  lin_links[lcoord_fiber_space_index].erase(lcoord_schema_host_index);
1200  lin_links[lbase_host_index].erase(lcoord_schema_host_index);
1201 
1202  lns.delete_poset(lcoord_schema_host_index, true);
1203 
1204  if(lin_links[lcoord_fiber_space_index].empty() && xdelete_coord_fiber)
1205  {
1206  // The coord fiber space is no longer being used; delete it..
1207 
1208  lns.delete_poset(lcoord_fiber_space_index, true);
1209  }
1210  }
1211 
1212  if(lin_links[lbase_host_index].empty())
1213  {
1214  // The base space is no longer being used; delete it.
1215 
1216  lns.delete_poset(lbase_host_index, true);
1217  }
1218 
1219  // The fiber space group in the namespace may now be empty.
1220  // If so, it must be deleted because it is incorrectly connected to top.
1221 
1222  pod_index_type lfiber_spaces_id = lns.member_id("fiber_spaces", false);
1223 
1224  if(is_valid(lfiber_spaces_id) && lns.cover_is_empty(LOWER, lfiber_spaces_id))
1225  {
1226  lns.delete_link(TOP_INDEX, lfiber_spaces_id);
1227 
1228  lns.delete_member(lfiber_spaces_id);
1229  }
1230 
1231  // The section space group in the namespace may now be empty.
1232  // If so, it must be deleted because it is incorrectly connected to top.
1233 
1234  pod_index_type lsection_spaces_id = lns.member_id("section_spaces", false);
1235 
1236  if(is_valid(lsection_spaces_id) && lns.cover_is_empty(LOWER, lsection_spaces_id))
1237  {
1238  lns.delete_link(TOP_INDEX, lsection_spaces_id);
1239 
1240  lns.delete_member(lsection_spaces_id);
1241  }
1242 
1243 
1244  lns.end_jim_edit_mode(true, true);
1245 
1246  // Postconditions:
1247 
1248  // Exit:
1249 
1250  return;
1251 }
1252 
1253 
1254 // ===========================================================
1255 // READ_WRITE_MONITOR_HANDLE FACET
1256 // ===========================================================
1257 bool
1260 {
1262 }
1263 
1264 // void
1265 // fields::field_vd::
1266 // disable_access_control()
1267 // {
1268 // // cout << endl << "Entering field_vd::disable_access_control." << endl;
1269 
1270 // // Preconditions:
1271 
1272 // // Body:
1273 
1274 // read_write_monitor::disable_access_control();
1275 
1276 // // Postconditions:
1277 
1278 // ensure(access_control_disabled());
1279 
1280 // // Exit:
1281 
1282 // // cout << "Leaving field_vd::disable_access_control." << endl;
1283 // return;
1284 // }
1285 
1286 void
1289 {
1290  // cout << endl << "Entering field_vd::enable_access_control." << endl;
1291 
1292  // Preconditions:
1293 
1294  // Body:
1295 
1297 
1298  // Postconditions:
1299 
1300  ensure(!access_control_disabled());
1301 
1302  // Exit:
1303 
1304  // cout << "Leaving field_vd::enable_access_control." << endl;
1305  return;
1306 }
1307 
1309 bool
1312 {
1313  bool result;
1314 
1315  // Preconditions:
1316 
1317  // Body:
1318 
1319  result = (_coordinates->is_attached() && _property->is_attached());
1320 
1321  // Postconditions:
1322 
1323  ensure(result == (coordinates().is_attached() && property().is_attached()));
1324 
1325  // Exit:
1326 
1327  return result;
1328 }
1329 
1331 bool
1334 {
1335  bool result;
1336 
1337  // Preconditions:
1338 
1339  // Body:
1340 
1342 
1343  // Postconditions:
1344 
1346  ensure(!is_attached() ? !result : true);
1347  ensure((is_attached() && access_control_disabled()) ? !result : true);
1348 
1349  // Exit:
1350 
1351  return result;
1352 }
1353 
1354 bool
1357 {
1358  bool result;
1359 
1360  // Preconditions:
1361 
1362  // Body:
1363 
1365 
1366  // Postconditions:
1367 
1369  ensure(!is_attached() ? !result : true);
1370  ensure((is_attached() && access_control_disabled()) ? result : true);
1371 
1372  // Exit:
1373 
1374  return result;
1375 }
1376 
1378 bool
1381 {
1382  bool result;
1383 
1384  // Preconditions:
1385 
1386  // Body:
1387 
1389 
1390  // Postconditions:
1391 
1393  ensure(!is_attached() ? !result : true);
1394  ensure((is_attached() && access_control_disabled()) ? result : true);
1395 
1396  // Exit:
1397 
1398  return result;
1399 }
1400 
1401 bool
1404 {
1405  bool result;
1406 
1407  // Preconditions:
1408 
1409  // Body:
1410 
1412 
1413  // Postconditions:
1414 
1416  ensure(!is_attached() ? !result : true);
1417  ensure((is_attached() && access_control_disabled()) ? result : true);
1418 
1419  // Exit:
1420 
1421  return result;
1422 }
1423 
1424 
1426 bool
1428 state_is_read_write_accessible(bool xbase_access) const
1429 {
1430  bool result;
1431 
1432  // Preconditions:
1433 
1434 
1435  // Body:
1436 
1437  result =
1440  (xbase_access ? _base_space->state_is_read_write_accessible() : true));
1441 
1442  // Postconditions:
1443 
1444  ensure(result ==
1447  (xbase_access ? base_space().host()->state_is_read_write_accessible() : true)));
1448  ensure(!is_attached() ? !result : true);
1449  ensure((is_attached() && access_control_disabled()) ? result : true);
1450 
1451  // Exit:
1452 
1453  return result;
1454 }
1455 
1456 bool
1458 state_is_not_read_write_accessible(bool xbase_access) const
1459 {
1460  bool result;
1461 
1462  // Preconditions:
1463 
1464 
1465  // Body:
1466 
1467  result =
1470  (xbase_access ? _base_space->host()->state_is_not_read_write_accessible() : false));
1471 
1472  // Postconditions:
1473 
1474  ensure(result ==
1477  (xbase_access ? base_space().host()->state_is_read_write_accessible() : false)));
1478  ensure(!is_attached() ? !result : true);
1479  ensure((is_attached() && access_control_disabled()) ? result : true);
1480 
1481  // Exit:
1482 
1483  return result;
1484 }
1485 
1487 int
1490 {
1491  int result;
1492 
1493  // Preconditions:
1494 
1495  require(is_attached());
1496 
1497  // Body:
1498 
1499  int lprop_depth = _property->access_request_depth();
1500  int lcoord_depth = _coordinates->access_request_depth();
1501 
1502  result = lcoord_depth < lprop_depth ? lcoord_depth : lprop_depth;
1503 
1504  // Postconditions:
1505 
1506  ensure(result >= 0);
1507 
1508  // Exit:
1509 
1510  return result;
1511 }
1512 
1514 void
1517 {
1518  // Preconditions:
1519 
1520  require(is_attached());
1521 
1522  // Body:
1523 
1524  define_old_variable(int old_access_request_depth = access_request_depth());
1525 
1526  // Even though section access gets base space access,
1527  // must get base space access directly to keep requested depth
1528  // the same as when requesting write access, so release is
1529  // the same for both.
1530 
1532 
1535 
1536 
1537  // Postconditions:
1538 
1539  ensure(state_is_read_accessible());
1540  ensure(access_request_depth() == old_access_request_depth + 1);
1541 
1542  // Exit:
1543 
1544  return;
1545 }
1546 
1548 void
1550 get_read_write_access(bool xbase_access, bool xrelease_read_only_access)
1551 {
1552  // Preconditions:
1553 
1554  require(is_attached());
1555  require(xrelease_read_only_access || state_is_not_read_only_accessible());
1556  require(xrelease_read_only_access || base_space().state_is_not_read_only_accessible());
1557 
1558  // Body:
1559 
1560  define_old_variable(int old_access_request_depth = access_request_depth());
1561 
1562  if(xbase_access)
1563  {
1564  _base_space->get_read_write_access(xrelease_read_only_access);
1565  }
1566  else
1567  {
1568  // Even if base write access not requested,
1569  // get read access just so request depth is the
1570  // same either way.
1571 
1573  }
1574 
1575  _coordinates->get_read_write_access(xrelease_read_only_access);
1576  _property->get_read_write_access(xrelease_read_only_access);
1577 
1578  // Since section get access also gets access to base,
1579  // base request depth is now at least 2 greater than sections.
1580 
1581  // Postconditions:
1582 
1584  ensure(access_request_depth() == old_access_request_depth + 1);
1585 
1586  // Exit:
1587 
1588  return;
1589 }
1590 
1592 void
1594 release_access(bool xall) const
1595 {
1596  // Preconditions:
1597 
1598  require(state_is_read_accessible());
1599 
1600  // Body:
1601 
1602  define_old_variable(int old_access_request_depth = access_request_depth());
1603 
1605  _property->release_access(xall);
1606 
1607  // Sections have released the base access they acquired,
1608  // but still need to release the directly acquired access.
1609 
1610  _base_space->release_access(xall);
1611 
1612  // Postconditions:
1613 
1614  ensure(xall ? access_request_depth() == 0 : access_request_depth() == old_access_request_depth - 1);
1616 
1617  // Exit:
1618 
1619  return;
1620 }
1621 
1623 bool
1626 {
1627  bool result;
1628 
1629  // Preconditions:
1630 
1631  require(is_attached());
1632 
1633  // Body:
1634 
1636 
1637  // Postconditions:
1638 
1639  ensure(result == (coordinates().state_is_modified() ||
1641 
1642  // Exit:
1643 
1644  return result;
1645 }
1646 
1648 void
1651 {
1652  // Preconditions:
1653 
1654  require(is_attached());
1655 
1656  // Body:
1657 
1660 
1661 
1662  // Postconditions:
1663 
1664  ensure(!state_is_modified());
1665 
1666  // Exit:
1667 
1668  return;
1669 }
1670 
1671 
1672 // ===========================================================
1673 // ANY FACET
1674 // ===========================================================
1675 
1677 const std::string&
1679 class_name() const
1680 {
1681  // Preconditions:
1682 
1683  // Body:
1684 
1685  const string& result = static_class_name();
1686 
1687  // Postconditions:
1688 
1689  ensure(!result.empty());
1690 
1691  // Exit:
1692 
1693  return result;
1694 }
1695 
1697 const std::string&
1700 {
1701  // Preconditions:
1702 
1703  // Body:
1704 
1705  static const string result("field_vd");
1706 
1707  // Postconditions:
1708 
1709  ensure(!result.empty());
1710 
1711  // Exit:
1712 
1713  return result;
1714 }
1715 
1717 bool
1719 is_ancestor_of(const any* xother) const
1720 {
1721 
1722  // Preconditions:
1723 
1724  require(xother != 0);
1725 
1726  // Body:
1727 
1728  // True if other conforms to this
1729 
1730  bool result = dynamic_cast<const field_vd*>(xother) != 0;
1731 
1732  // Postconditions:
1733 
1734  return result;
1735 }
1736 
1740 clone() const
1741 {
1742  field_vd* result;
1743 
1744  // Preconditions:
1745 
1746  // Body:
1747 
1748  result = new field_vd();
1749 
1750  // Postconditions:
1751 
1752  ensure(result != 0);
1753  ensure(is_same_type(result));
1754 
1755  // Exit:
1756 
1757  return result;
1758 }
1759 
1763 operator=(const field_vd& xother)
1764 {
1765  // Preconditions:
1766 
1767  require(state_is_read_write_accessible());
1768  require(xother.state_is_read_accessible());
1769 
1770  // Body:
1771 
1773  _property->attach_to_state(&xother.property());
1775 
1776  // Postconditions:
1777 
1778  ensure(invariant());
1779  ensure(coordinates().is_same_state(&xother.coordinates()));
1780  ensure(property().is_same_state(&xother.property()));
1781  ensure(base_space().is_same_state(&xother.base_space()));
1782 
1783  // Exit:
1784 
1785  return *this;
1786 }
1787 
1791 operator=(const sec_vd& xsection)
1792 {
1793  // Preconditions:
1794 
1796  require(xsection.state_is_read_accessible());
1797 
1798  // Body:
1799 
1800  sec_vd& lproperty = property();
1801  lproperty = xsection;
1802 
1803  // Postconditions:
1804 
1805  //ensure();
1806 
1807  // Exit
1808 
1809  return *this;
1810 }
1811 
1815 operator=(const vd& xfiber)
1816 {
1817  // Preconditions:
1818 
1820  require(xfiber.state_is_read_accessible());
1821 
1822  // Body:
1823 
1824  sec_vd& lproperty = property();
1825  lproperty = xfiber;
1826 
1827  // Postconditions:
1828 
1829  //ensure();
1830 
1831  // Exit
1832 
1833  return *this;
1834 }
1835 
1839 operator=(const vd_lite& xfiber)
1840 {
1841  // Preconditions:
1842 
1844 
1845  // Body:
1846 
1847  sec_vd& lproperty = property();
1848  lproperty = xfiber;
1849 
1850  // Postconditions:
1851 
1852  //ensure();
1853 
1854  // Exit
1855 
1856  return *this;
1857 }
1858 
1860 bool
1862 invariant() const
1863 {
1864  bool result = true;
1865 
1866  if(invariant_check())
1867  {
1868  // Prevent recursive calls to invariant
1869 
1871 
1872  // Must satisfy base class invariant
1873 
1874  invariance(any::invariant());
1875 
1876  // Invariances for this class:
1877 
1878  invariance(state_is_read_accessible() ?
1879  base_space().is_same_state(&property().schema().base_space()) :
1880  true);
1881 
1882  invariance(state_is_read_accessible() ?
1883  property().schema().base_space().le(&coordinates().schema().base_space()) :
1884  true);
1885 
1886  // Finished, turn invariant checking back on.
1887 
1889  }
1890 
1891  // Exit
1892 
1893  return result;
1894 }
1895 
1896 
1897 // ===========================================================
1898 // NON-MEMBER FUNCTIONS
1899 // ===========================================================
1900 
1902 void
1903 fields::
1904 push(const field_vd& xsrc, field_vd& xdst, bool xauto_access)
1905 {
1906  // Preconditions:
1907 
1908  require(xsrc.is_attached());
1909  require(xdst.is_attached());
1910  require(xauto_access || xsrc.state_is_read_accessible());
1911  require(xauto_access || xdst.state_is_read_write_accessible(false));
1912  require(xsrc.same_property_fiber_schema(xdst, xauto_access));
1913 
1914  // Body:
1915 
1916  if(xauto_access)
1917  {
1918  xsrc.get_read_access();
1919  xdst.get_read_write_access(false, true);
1920  }
1921 
1922  section_pusher sp(xsrc, xdst, false);
1923  sp.push_pa(xsrc.property(), xdst.property(), false);
1924 
1925  if(xauto_access)
1926  {
1927  xsrc.release_access();
1928  xdst.release_access();
1929  }
1930 
1931  // Postconditions:
1932 
1933 
1934  // Exit:
1935 
1936  return;
1937 }
1938 
1941 fields::
1942 operator>>(const field_vd& xsrc, field_vd& xdst)
1943 {
1944  // Preconditions:
1945 
1946  require(precondition_of(push(xsrc, xdst, true)));
1947 
1948  // Body:
1949 
1950  push(xsrc, xdst, true);
1951 
1952  // Postconditions:
1953 
1954  ensure(postcondition_of(push(xsrc, xdst, true)));
1955 
1956  //Exit:
1957 
1958  return xdst;
1959 }
1960 
1962 std::ostream&
1963 fields::operator<<(std::ostream& xos, const field_vd& xfield)
1964 {
1965  // Preconditions:
1966 
1967  require(xfield.state_is_read_accessible());
1968 
1969  // Body:
1970 
1971  xfield.print_property_dofs(xos, 0, "", false, false);
1972 
1973  // Postconditions:
1974 
1975 
1976  // Exit:
1977 
1978  return xos;
1979 }
1980 
1981 //=============================================================================
1982 
1984 
1985 #include "SheafSystem/field_vd_funcs.impl.h"
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.
virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser)
Delete the cover link between hub id xgreater and hub id xlesser.
std::string name() const
Definition: subposet.h:796
A context for discretization members. Intended for implementing various iterators, especially concurrent iterations over multiple sections.
virtual void get_read_write_access(bool xbase_access, bool xrelease_read_only_access)
Get read write access to the coordinates and property sections, which implies read access to the base...
Definition: field_vd.cc:1550
A client handle for a subposet.
Definition: subposet.h:86
scoped_index disc_id
The global index of the disc member.
bool state_is_not_read_only_accessible() const
True if this is attached and if the coordinates and property are not accessible for read only access ...
Definition: field_vd.cc:1356
bool state_is_not_read_only_accessible() const
True if this is attached and the state is not accessible for read only access.
host_type * host() const
The poset this is a member of.
Definition: sec_vd.cc:1353
virtual field_vd & operator=(const field_vd &xother)
Assignment operator.
Definition: field_vd.cc:1763
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
virtual void new_link(pod_index_type xgreater, pod_index_type xlesser)
Insert a cover link from greater to lesser (that is, hub id xgreater covers hub id xlesser)...
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
void print_property_dofs(std::ostream &xos, property_dof_function_type xproperty_dofs_fcn, const std::string &xtitle_text, bool xzero_specified, bool xauto_access) const
Prints the property dofs and coordinates at the property discretization points. If xproperty_dof_fcn ...
Definition: field_vd.cc:723
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
A push-forward operator for discretization subposets; pushes members into the global coordinate space...
bool state_is_read_write_accessible(bool xbase_access=false) const
True if this is attached and if coordinates(), property() and (if xbase access) base_space() are acce...
Definition: field_vd.cc:1428
void(* property_dof_function_type)(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
The type of the function for computing the property dofs at given global coordinates.
Definition: field_vd.h:155
virtual void get_prop_disc_values(const sec_vd &xsec)=0
The gets the values of xsec at the property discretization points.
int db() const
The dimension of the base space.
Definition: field_vd.cc:302
static void property_dof_function_example(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
Example property dof function; property value is x*1000000 + y*1000 + z, intended to be easy to check...
Definition: field_vd.cc:417
virtual const std::string & class_name() const
The name of this class.
Definition: field_vd.cc:1679
const scoped_index & index() const
The member index of this poset within the namespace host()
schema_poset_member & fiber_schema()
The fiber schema component of this (mutable version).
A point in a 3D chart space.
namespace_poset & name_space() const
The namespace this resides in.
Definition: field_vd.cc:331
subposet * embed_property(const std::string &xresult_name, name_multimap &xresult_member_names, bool xauto_access)
Creates a decomposition of the base space such that the value of property() is constant on each membe...
Definition: field_vd.cc:972
Namespace for fields component of sheaf system.
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
base_space_member * _base_space
The base space of this field.
Definition: field_vd.h:299
virtual void get_read_access() const
Get read access to the state associated with this.
Definition: field_vd.cc:1516
virtual void initialize_point_locator(bool xauto_access)
Initializes point locater search structure using default values.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
int dc() const
The dimension of the coordinates (independent variable) space.
Definition: field_vd.cc:254
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
static const std::string & static_class_name()
The name of this class.
Definition: field_vd.cc:1699
virtual field_vd * clone() const
Virtual constructor, makes a new instance of the same type as this.
Definition: field_vd.cc:1740
bool state_is_not_read_write_accessible() const
True if state is attached and if not accessible for read and write or access control is disabled...
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
const section_space_schema_member & property_schema() const
The property field schema member which is being iterated over.
virtual ~field_vd()
Destructor.
Definition: field_vd.cc:231
bool same_property_fiber_schema(const field_vd &xother, bool xauto_access) const
True if this has the same property fiber as xother.
Definition: field_vd.cc:786
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
Definition: subposet.cc:955
A partial multi-valued relation with total injective inverse between names and indices of type index_...
Definition: name_multimap.h:63
STL namespace.
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
virtual void point_at_value_ua(const sec_vd_dof_type *xvalue, size_type xvalue_ub, chart_point &xresult)
Finds a chart point which is the preimage in this of xvalue; unattached version.
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
virtual void get_read_access() const
Get read access to the state associated with this.
host_type * host() const
The poset this is a member of.
Definition: sec_at1.cc:525
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 namespace_poset * name_space() const
The namespace of host()
virtual bool invariant() const
Class invariant.
Definition: field_vd.cc:1862
const scoped_index & index() const
The index of the component state this handle is attached to.
void property_at_coordinates(const vd_lite &xcoord, vd_lite &xprop) const
The value of the property at the given global coordinates.
Definition: field_vd.cc:873
std::string name() const
A name for this.
SHEAF_DLL_SPEC field_at0 & operator>>(const field_at0 &xsrc, field_at0 &xdst)
Pushes xsrc.property() to xdst.property().
Definition: field_at0.cc:513
virtual void put_member_name(pod_index_type xmbr_hub_id, const std::string &xname, bool xunique, bool xauto_access=false)
Make xname a name for the member with hub id xmbr_hub_id. if xunique, make xname the only name...
void clear_state_is_modified()
Sets the state_is_modified floag to false.
Definition: field_vd.cc:1650
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual pod_index_type new_member(bool xis_jim, pod_index_type xtuple_hub_id)
Create a disconnected member with is_jim == xis_jim and the dof tuple identified by hub id xtuple_hub...
bool same_discretization() const
True if the coordinates and property sections both use the same discretization subposet.
Definition: field_vd.cc:848
sec_vd & property()
The property section being acted on.
A client handle for a member of a base space poset.
void push_pa(const sec_vd &xinput, sec_vd &result, bool xauto_access)
Pushes field xinput from sec_rep_space domain() to sec_rep_space range(), pre-allocated.
A client handle for a member of a namespace poset.
bool is_valid() const
True if this ia a valid point in a chart.
Definition: chart_point.cc:303
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...
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
Definition: sec_ed.h:47
Abstract base class with useful features for all objects.
Definition: any.h:39
poset & fiber_space()
The fiber space for section spaces on this schema.
Abstract vector space over dof_type (volatile version).
Definition: vd.h:111
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
virtual void put_name(const std::string &xname, bool xunique, bool xauto_access)
Make xname a name for this; if xunique, make xname the only name.
Definition: subposet.cc:2782
void clear_state_is_modified()
Sets the state_is_modified floag to false.
An abstract invertible section of a fiber bundle with a d-dimensional base space and a d-dimensional ...
namespace_poset_member & top()
The top member of the poset (mutable version)
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...
poset * host() const
The poset which this is a handle to a member of.
pointer_type base() const
The underlying storage array.
virtual int d() const
Dimension of this as a vector space.
Definition: vd.cc:189
void set_ct(size_type xct)
Sets ct() == xct.
virtual scattered_insertion_index_space_handle & new_id_space(const std::string &xstate_class_name)
Creates an id space for the members of this.
Definition: subposet.cc:554
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
SHEAF_DLL_SPEC void push(const field_vd &xsrc, field_vd &xdst, bool xauto_access)
Pushes xsrc.property() to xdst.property().
Definition: field_vd.cc:1904
virtual bool is_attached() const
True if this handle is attached to a non-void state.
virtual void get_read_access() const
Get read access to the state associated with this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
property_disc_iterator * new_property_disc_iterator() const
Iterator over property discretiation.
Definition: field_vd.cc:389
A member of a Cartesian product space; a tuple of attributes (volatile version).
Definition: tuple.h:81
int access_request_depth() const
The number of times access has been requested and granted without being released. ...
Definition: field_vd.cc:1489
bool state_is_modified() const
True if write access has been granted and released since the last call to clear_state_is_modified().
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
Definition: subposet.cc:1091
A vd-valued property as a function of global coordinates.
Definition: field_vd.h:69
bool cover_is_empty(bool xlower, pod_index_type xmbr_hub_id) const
True if and only if the lower (xlower true) or upper (xlower false) cover set of the member with hub ...
sec_vd & property() const
The dependent variable of this field.
Definition: field_vd.cc:357
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...
Definition: field_vd.cc:1594
void push(const section_space_schema_member &xsrc, const sec_vd &xglobal_coord, discretization_push_action &xpush_action, bool xauto_access)
Pushes each member of the discretization of xsrc into the fiber space of xglobal_coord and then execu...
vd_dof_type dof_type
The type of the degrees of freedom.
Definition: vd.h:123
void insert(pod_type xid, const scoped_index &xhub_id)
Make id xid in this id space equivalent to xhub_id in the hub id space. synonym for insert(xid...
void next()
Makes this the next member of the subset.
subposet & discretization()
The discretization subposet for section spaces on this schema (mutable version).
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
Definition: any.h:97
void delete_poset(pod_index_type xhub_id, bool xauto_access)
Delete the poset with hub id xhub_id.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &xos, const field_at0 &xfield)
Inserts field_at0 xfield into ostream xos.
Definition: field_at0.cc:535
sec_vd_value_type values[values_ub]
The values of another section (typically the global coordinates) at this disc point.
base_space_member & base_space() const
The base space of this field.
Definition: field_vd.cc:373
const block< discretization_context > & property_discretization_members() const
The property discretization members in the downset of the current evaluation member.
The general section push-forward operator; moves sections from one sec_rep_space to another using ext...
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 is_done() const
True if iteration finished.
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
prevent editing of jims and jim order relation
Iterates over the subset of Zn defined by the characteristic function host().
void detach_from_state()
Detaches field from state it is currently attached to.
Definition: sec_tuple.cc:603
bool same_evaluation() const
True if the coordinates and property sections both use the same evaluation subposet.
Definition: field_vd.cc:822
const bool LOWER
Selector for lower cover.
Definition: sheaf.h:67
base_space_member * 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...
virtual void detach_from_state()
Detach this handle from its state, if any.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space; synonym for unglued_hub...
void put_property_dofs(property_dof_function_type xproperty_dofs_fcn, bool xauto_access)
Sets the dofs of property() to values computed by xproperty_dofs_fcn.
Definition: field_vd.cc:454
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...
int access_request_depth() const
The number of times access has been requested and granted without being released. ...
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
virtual bool is_attached() const
True if this handle has a state associated with it.
Definition: field_vd.cc:1311
An abstract discretization push action for field_vds::put_property_dofs.
bool state_is_not_read_accessible() const
True if this is attached and if the coordinates and property are not accessible for read or access co...
Definition: field_vd.cc:1403
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
static bool access_control_disabled()
True if access control mechanism is disabled. Default value is enabled (false) and access is controll...
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
sec_ed_invertible * _coordinates
The independent variable of this field.
Definition: field_vd.h:294
static property_disc_iterator * new_property_disc_iterator(const section_space_schema_member &xcoords_schema, const section_space_schema_member &xprop_schema)
Creates an iterator appropriate for xcoords and xprop.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
virtual sec_ed_invertible * clone() const
Make a new handle, no state instance of current.
A handle for a scattered_insertion_index_space_state.
static void enable_access_control()
Enables access control. Synonym for read_write_monitor::enable_access_control(). Should only be invok...
Definition: field_vd.cc:1288
int db() const
The dimension of the base space component.
sec_ed_invertible & coordinates() const
The independent variable of this field.
Definition: field_vd.cc:339
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
Definition: sec_vd.cc:421
bool state_is_read_accessible() const
True if this is attached and if the coordinates and property are accessible for read or access contro...
Definition: field_vd.cc:1380
virtual sec_vd * clone() const
Make a new handle, no state instance of current.
Definition: sec_vd.cc:1318
bool state_is_not_read_write_accessible(bool xbase_access=false) const
True if this is not attached or if coordinates(), property() or (if xbase access) base_space() are no...
Definition: field_vd.cc:1458
const section_space_schema_member & coordinates_schema() const
The coordinates field schema member which is being iterated over.
int df() const
The dimension of the fiber space component.
virtual void delete_member(pod_index_type xmbr_hub_id)
Delete the member with hub id xmbr_hub_id. Warning: this routine does not delete links; it will leave...
int dp() const
The dimension of the property (dependent variable) space.
Definition: field_vd.cc:278
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.
pod_index_type first_cover_member(bool xlower, pod_index_type xmbr_hub_id) const
Hub id of the first member of the lower (xlower true) or upper (xlower false) cover of the member wit...
static void delete_field_spaces(field_vd *xfield, bool xdelete_coord_fiber, bool xdelete_prop_fiber)
Deletes field xfield and all associated section spaces, section schema spaces, and base space...
Definition: field_vd.cc:1101
std::string name(index_type xindex) const
The primary (0-th) name associated with index xindex.
index_iterator member_iterator() const
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
sec_vd * _property
The dependent variable of this field.
Definition: field_vd.h:289
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Definition: pod_types.cc:37
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
Abstract vector space over dof_type.
Definition: vd.h:350
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
bool state_is_read_only_accessible() const
True if this is attached and if the coordinates and property are accessible for read access but not f...
Definition: field_vd.cc:1333
static void enable_access_control()
Enables access control. Should only be invoked once at beginning of a program, before any other Sheaf...
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...
bool state_is_read_only_accessible() const
True if this is attached and the state is accessible for read access but not for write.
field_vd()
Default constructor.
Definition: field_vd.cc:61
Abstract iterator over the discretization of the property section of a field_vd. Concurrently travers...
static bool access_control_disabled()
True if access control mechanism is disabled. Default value is enabled (false) and access is controll...
Definition: field_vd.cc:1259
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
Definition: field_vd.cc:1719
A client handle for an unrestricted member of a poset. A total_poset_member is guaranteed not to be r...
A discretization push action for field_vds::print_property_dofs.
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
const int PREREQ_IDS_UB
Number of prerequisites ids. Must be consistent with PREREQ_ID_*_INDEX below.
virtual const scoped_index & member_id(bool xauto_access) const
An id in the member hub id space; intended for copying to initialize ids to the member id space...
bool state_is_modified() const
True if write access has been granted and released since the last call to clear_state_is_modified().
Definition: field_vd.cc:1625