SheafSystem  0.0.0.0
eval_iterator.cc
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 
18 // Implementation for class eval_iterator
19 
20 
21 #include "SheafSystem/eval_iterator.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/base_space_member.h"
25 #include "SheafSystem/eval_family.h"
26 #include "SheafSystem/sec_rep_descriptor.h"
27 #include "SheafSystem/section_evaluator.h"
28 #include "SheafSystem/section_space_schema_member.h"
29 #include "SheafSystem/section_space_schema_poset.h"
30 #include "SheafSystem/sec_vd.h"
31 #include "SheafSystem/subposet_member_iterator.h"
32 
33 using namespace fiber_bundle; // Workaround for MS C++ bug.
34 
35 //#define DIAGNOSTIC_OUTPUT
36 
37 namespace
38 {
42  const int BUFFER_UB = 16;
43 }
44 
48  _discretization_members(BUFFER_UB),
49  _non_discretization_members(BUFFER_UB)
50 {
51 
52  // Preconditions:
53 
54  // Body:
55 
56  initialize_order(BIORDER);
57  _schema_anchor = 0;
58  _down_set_collection_enabled = false;
59  _evaluators = 0;
60 
61  // Postconditions:
62 
63  ensure(invariant());
64  ensure(!is_initialized());
65 
66  // Exit
67 
68  return;
69 }
70 
73  : depth_first_iterator(xother),
74  _evaluators(0),
75  _discretization_members(BUFFER_UB),
76  _non_discretization_members(BUFFER_UB)
77 {
78 
79  // Preconditions:
80 
81  // Body:
82 
83  not_implemented();
84 
85  // Postconditions:
86 
87  ensure(invariant());
88 
89  // Exit
90 
91  return;
92 }
93 
96 {
97  // Preconditions:
98 
99  // Body:
100 
101  if(_schema_anchor != 0)
102  {
103  _schema_anchor->detach_from_state();
104  delete _schema_anchor;
105  }
106 
107  if(_evaluators != 0)
108  delete _evaluators;
109 
110  // Postconditions:
111 
112 }
113 
114 bool
116 is_ancestor_of(const any* xother) const
117 {
118  // Preconditions:
119 
120  // Body:
121 
122  bool result = dynamic_cast<const eval_iterator*>(xother) != 0;
123 
124  // Postconditions:
125 
126  // Exit
127 
128  return result;
129 }
130 
133 clone() const
134 {
135  // Preconditions:
136 
137  // Body:
138 
139  eval_iterator* result = new eval_iterator;
140 
141  // Postconditions:
142 
143  //ensure(invariant());
144  ensure(result != 0);
145  ensure(!result->is_initialized());
146 
147  // Exit
148 
149  return result;
150 }
151 
152 bool
154 invariant() const
155 {
156  bool result = true;
157 
158  // Preconditions:
159 
160  // Body:
161 
162  invariance(depth_first_iterator::invariant());
163 
164  if(invariant_check())
165  {
167 
168  invariance(order() == BIORDER);
169  invariance(is_initialized() ?
170  anchor().is_same_state(&(schema_anchor().base_space())) :
171  true);
172  invariance(unexecutable(evaluation subposet is above discretization subposet));
173 
174  // Finished, turn invariant checking back on.
175 
177  }
178 
179  // Postconditions:
180 
181  // Exit
182 
183  return result;
184 }
185 
186 // OTHER CONSTRUCTORS
187 
188 
190 eval_iterator(const section_space_schema_member& xschema_anchor, bool xvisit_once)
192  _discretization_members(BUFFER_UB),
193  _non_discretization_members(BUFFER_UB)
194 {
195 
196  // Preconditions:
197 
198  require(xschema_anchor.state_is_read_accessible());
199 
200  // Body:
201 
202  initialize_order(BIORDER);
203  _schema_anchor = 0;
204  _down_set_collection_enabled = false;
205  _evaluators = 0;
206  put_visit_once(xvisit_once);
207 
208  put_schema_anchor(xschema_anchor);
209 
210  reset();
211 
212  // Postconditions:
213 
214  ensure(invariant());
215  ensure(is_initialized());
216  ensure(schema_anchor().is_same_state(&xschema_anchor));
217  ensure(schema_anchor().is_same_type(&xschema_anchor));
218  ensure(descending());
219  ensure(!strict());
220  ensure(unexecutable(!is_done() implies this is first member));
221  ensure(visit_once() == xvisit_once);
222 
223  return;
224 }
225 
226 
227 // ITERATOR INTERFACE
228 
229 //$$SCRIBBLE jebutler const correctness
230 
231 bool
234 {
235  // Preconditions:
236 
237  // Body:
238 
239  bool result =
241  (_schema_anchor != 0) &&
242  (_base_space != 0);
243 
244  // Postconditions:
245 
246  // Exit
247 
248  return result;
249 }
250 
251 void
254 {
255  // Preconditions:
256 
257  // Body:
258 
259  // Clear the down set collection buffers.
260 
261  _down_set_collection_enabled = false;
262  _discretization_members.set_ct(0);
263  _non_discretization_members.set_ct(0);
264  _maximal_eval_id.invalidate();
265 
267 
268  // Postconditions:
269 
270  ensure(invariant());
271  ensure(is_done());
272 
273  // Exit
274 
275  return;
276 }
277 
278 void
280 next(bool xtruncate)
281 {
282  // Preconditions:
283 
284  require(!is_done());
285 
286  // Body:
287 
288  bool ltruncate = xtruncate;
289 
290  // Continue traversing the graph until the traversal is done
291  // or we are in the postvisit action of an evaluation member
292  // and return to the client.
293 
294  depth_first_iterator::next(ltruncate);
295 
296  while(!is_done())
297  {
298  if(action() == PREVISIT_ACTION)
299  {
300 
301  // The evaluation, and discretization are not necessarily distinct.
302  // So we have to test each independently of the other.
303 
304  bool lnone_of_the_above = true;
305 
306  if(!_maximal_eval_id.is_valid() && _eval_sp->contains_member(index()))
307  {
308  // This member is an evaluation member
309 
310  // If discretization is "__vertices", determine if we need to
311  // reverse the 0 and 1 discretization member ids for 2d "elements"
312  // (shell elements included).
313 
314  if(_vertex_discretization)
315  {
316  pod_index_type ltuple_id =
317  _base_space->member_dof_tuple_id(index().pod(), false);
318 
319  if(is_valid(ltuple_id))
320  {
321  // This member has a dof tuple; it is a jim
322  // (i.e. it is not a zone that has been refined into subzones).
323 
324  int ltype_id = _base_space->row_dof_tuple(ltuple_id)->type_id;
325 
328 
329  _disc_reversal_enabled =
330  (ltype_id == 5) || (ltype_id == 8) || (ltype_id == 9);
331 
332  }
333  }
334 
335  // Reset the down set collection buffers and turn on collection.
336 
337  _discretization_members.set_ct(0);
338  _non_discretization_members.set_ct(0);
339  _down_set_collection_enabled = true;
340 
341  _evaluator_id = index();
342  _maximal_eval_id = index();
343 
344  // Do not truncate, continue descending.
345 
346  ltruncate = false;
347 
348  lnone_of_the_above = false;
349  }
350 
351  if(_disc_sp->contains_member(index()))
352  {
353  // This is a discretization member.
354  // Invariant ensures discretization is below evaluation,
355  // so down set collection must be enabled.
356  // Enter this member in the discretization collection.
357 
358  _discretization_members.push_back(index());
359 
360  if(_disc_reversal_enabled)
361  {
362  // If 2D, check orientation of first member of upper cover:
363  //
364  // We assume that the current evaluator is 2-D, that its
365  // downset contains edges and vertices, and that the
366  // current discretization point is a vertex.
367  //
368  // The first evaluator to contain the edge which contains the
369  // current discretization point is the evaluator which constructed
370  // that edge, and it constructed that edge in a "positive"
371  // orientation wrt that evaluator. An edge in a 2-d space
372  // separates that space into 2 parts. So at most 1 other
373  // evaluator can share that edge and, if it exists, that evaluator
374  // views the edge as "negatively" oriented. In addition,
375  // that evaluator will be the second evaluator in the upper
376  // cover of that edge.
377 
378  // greater_index() refers to the edge containing this discretization
379  // point in the path from the current evaluator. If the current
380  // evaluator is the first evaluator in that edge's upper cover, then
381  // it constructed the edge, and the edge is in the positive orientation.
382  // Otherwise, the current evaluator did not construct the edge,
383  // the edge is negatively oriented, and the discretization member
384  // order should be reversed.
385 
386  // Only swap _discretization_members if the base space is 2D.
387 
388  pod_index_type first_eval = _anchor->host()->first_cover_member(UPPER, greater_index().hub_pod());
389  bool is_reversed = (_evaluator_id != first_eval);
390 
391  if(is_reversed && _discretization_members.ct() == 2)
392  {
393  const scoped_index& save = _discretization_members[0];
394  _discretization_members[0] = _discretization_members[1];
395  _discretization_members[1] = save;
396  }
397 
398  }
399 
400  // No need to go below this member; truncate.
401 
402  ltruncate = true;
403 
404  lnone_of_the_above = false;
405  }
406 
407  if(lnone_of_the_above)
408  {
409  // This member is neither an eval member nor a disc member.
410 
411  if(_down_set_collection_enabled)
412  {
413  // Enter this member in the non-discretization collection.
414 
415  _non_discretization_members.push_back(index());
416  }
417 
418  // Do not truncate, continue descending.
419 
420  ltruncate = false;
421  }
422  }
423  else if(action() == POSTVISIT_ACTION)
424  {
425  if(_maximal_eval_id ==~ index())
426  {
427  _maximal_eval_id.invalidate();
428 
429  // Postvisit of eval member;
430  // we are done iterating over discretization members
431  // associated with this evaluation member;
432  // return to the client with the discretization collection.
433 
434  // Turn off down set collection.
435 
436  _down_set_collection_enabled = false;
437 
438  // Reinitialize discretization reversal.
439 
440  _disc_reversal_enabled = false;
441 
442  // Clear the has visited markers for the down set
443 
444  for(int i=0; i<_discretization_members.ct(); ++i)
445  {
446  put_has_visited(_discretization_members[i], false);
447  }
448 
449  for(int i=0; i<_non_discretization_members.ct(); ++i)
450  {
451  put_has_visited(_non_discretization_members[i], false);
452  }
453 
454  // Return to the client.
455 
456  break;
457  }
458  else
459  {
460  // Not an evaluation member; nothing to do.
461  // Continue traversal.
462  }
463 
464  // If we invoke depth_first_iterator::next() from the postvisit action,
465  // the truncation flag will be ignored, since you can only truncate
466  // in the previsit action. But just to be specific, we'll set it false no
467  // matter what we've done here.
468 
469  ltruncate = false;
470  }
471  else
472  {
473  post_fatal_error_message("unrecognized action");
474  }
475 
476  depth_first_iterator::next(ltruncate);
477  } // end while(!is_done())
478 
479  // Postconditions:
480 
481  ensure(invariant());
482  ensure(!is_done() ? action() == POSTVISIT_ACTION : true);
483  ensure(!is_done() ? schema_anchor().evaluation().contains_member(index()) : true);
484 
485  // Exit
486 
487  return;
488 }
489 
493 {
494  // Preconditions:
495 
496  require(is_initialized());
497 
498  // Body:
499 
500  // Invariant ensures cast is appropriate.
501 
502  section_space_schema_member& result = *_schema_anchor;
503 
504  // Postconditions:
505 
506  // Exit
507 
508  return result;
509 }
510 
514 {
515  // Preconditions:
516 
517  require(is_initialized());
518 
519  // Body:
520 
521  // Invariant ensures cast is appropriate.
522 
523  section_space_schema_member& result = *_schema_anchor;
524 
525  // Postconditions:
526 
527  // Exit
528 
529  return result;
530 }
531 
532 void
535 {
536 
537  // Preconditions:
538 
539  require(xschema_anchor.state_is_read_accessible());
541 
542  // Body:
543 
544  define_old_variable(bool old_descending = _descending);
545  define_old_variable(bool old_strict = _strict);
546 
547  // Force iterator into a known clean state;
548  // also forces client to reset before using this.
549 
550  force_is_done();
551 
552  // Now (re)initialize.
553 
554  // Set the schema anchor.
555 
556  initialize_schema_anchor(xschema_anchor);
557 
558  // Set the anchor, has_visited markers and filter..
559 
560  initialize_traversal(_schema_anchor->base_space());
561 
562  // Set the local copies of various schema variables.
563 
564  put_schema_variables();
565 
566  // Postconditions:
567 
568  ensure(invariant());
569  ensure(is_initialized());
570  ensure(is_done());
571  ensure(anchor().is_same_state(&(xschema_anchor.base_space())));
572  ensure(anchor().is_same_type(&(xschema_anchor.base_space())));
573  ensure(anchor().version() == xschema_anchor.base_space().version());
574  ensure(filter().index() == anchor().version_index());
575  ensure(descending() == old_descending);
576  ensure(strict() == old_strict);
577  ensure(schema_anchor().is_same_state(&xschema_anchor));
578  ensure(schema_anchor().is_same_type(&xschema_anchor));
579  ensure(schema_anchor().version() == xschema_anchor.version());
580 
581  return;
582 }
583 
584 void
586 put_schema_anchor(pod_index_type xschema_anchor_index)
587 {
588 
589  // Preconditions:
590 
591  require(is_initialized());
592  require(schema_anchor().state_is_read_accessible());
593  require(schema_anchor().host()->contains_member(xschema_anchor_index));
594  require(schema_anchor().base_space().schema().conforms_to(base_space_member::standard_schema_path()));
595 
596  // Body:
597 
598  define_old_variable(bool old_descending = _descending);
599  define_old_variable(bool old_strict = _strict);
600  define_old_variable(scoped_index old_filter_index = filter().index());
601  define_old_variable(int old_anchor_version = anchor().version());
602  define_old_variable(int old_schema_anchor_version = schema_anchor().version());
603 
605 
606  // Force iterator into a known clean state;
607  // also forces client to reset before using this.
608 
609  force_is_done();
610 
611  // Now reinitialize.
612 
613  // Set the schema anchor.
614 
615  _schema_anchor->attach_to_state(xschema_anchor_index);
616 
617  // Set the base space.
618 
619  _base_space = &_schema_anchor->host()->base_space();
620 
621  // Set the anchor.
622 
623  initialize_traversal(_schema_anchor->base_space_id());
624 
626 
627  // Postconditions:
628 
629  ensure(invariant());
630  ensure(is_initialized());
631  ensure(is_done());
632  ensure(anchor().index() == schema_anchor().base_space_id());
633  ensure(anchor().version() == old_anchor_version);
634  ensure(filter().index() == old_filter_index);
635  ensure(descending() == old_descending);
636  ensure(strict() == old_strict);
637  ensure(schema_anchor().index() == xschema_anchor_index);
638  ensure(schema_anchor().version() == old_schema_anchor_version);
639 
640  // Exit
641 
642  return;
643 }
644 
645 void
647 put_schema_anchor(const scoped_index& xschema_anchor_index)
648 {
649 
650  // Preconditions:
651 
652  require(is_initialized());
653  require(schema_anchor().state_is_read_accessible());
654  require(schema_anchor().host()->contains_member(xschema_anchor_index));
655  require(schema_anchor().base_space().schema().conforms_to(base_space_member::standard_schema_path()));
656 
657  // Body:
658 
659  define_old_variable(bool old_descending = _descending);
660  define_old_variable(bool old_strict = _strict);
661  define_old_variable(scoped_index old_filter_index = filter().index());
662  define_old_variable(int old_anchor_version = anchor().version());
663  define_old_variable(int old_schema_anchor_version = schema_anchor().version());
664 
665  put_schema_anchor(xschema_anchor_index.hub_pod());
666 
667  // Postconditions:
668 
669  ensure(invariant());
670  ensure(is_initialized());
671  ensure(is_done());
672  ensure(anchor().index() == schema_anchor().base_space_id());
673  ensure(anchor().version() == old_anchor_version);
674  ensure(filter().index() == old_filter_index);
675  ensure(descending() == old_descending);
676  ensure(strict() == old_strict);
677  ensure(schema_anchor().index() ==~ xschema_anchor_index);
678  ensure(schema_anchor().version() == old_schema_anchor_version);
679 
680  // Exit
681 
682  return;
683 }
684 
688 {
689  // Preconditions:
690 
691  require(is_initialized());
692 
693  // Body:
694 
695  base_space_poset& result = *_base_space;
696 
697  // Postconditions:
698 
699  // Exit:
700 
701  return result;
702 }
703 
706 base_space() const
707 {
708  // Preconditions:
709 
710  require(is_initialized());
711 
712  // Body:
713 
714  const base_space_poset& result = *_base_space;
715 
716  // Postconditions:
717 
718  // Exit:
719 
720  return result;
721 }
722 
723 int
725 db() const
726 {
727  int result;
728 
729  // Preconditions:
730 
731  require(!is_done());
732 
733  // Body:
734 
735  result = _base_space->db(index());
736 
737  // Postconditions:
738 
739  ensure(result >= 0);
740 
741  // Exit:
742 
743  return result;
744 }
745 
746 
749 type_id() const
750 {
751  pod_index_type result;
752 
753  // Preconditions:
754 
755  require(!is_done());
756 
757  // Body:
758 
759  result = _base_space->type_id(index());
760 
761  // Postconditions:
762 
763 
764  // Exit:
765 
766  return result;
767 }
768 
769 
772 client_id() const
773 {
774  // Preconditions:
775 
776  require(!is_done());
777 
778  // Body:
779 
780  scoped_index result(*_eval_id_space, index());
781 
782  // Postconditions:
783 
784  // Exit:
785 
786  return result;
787 }
788 
792 {
793  // Preconditions:
794 
795  require(is_initialized());
796  require(!is_done());
797 
798  // Body:
799 
800  // The section space schema invariant ensures that the evaluator family
801  // is compatible with the base space and hence the following call to
802  // eval_family::member returns a non-void evaluator.
803 
804  section_evaluator& result = *_evaluators->member(type_id());
805 
806  // Postconditions:
807 
808  // Exit
809 
810  return result;
811 }
812 
815 evaluator() const
816 {
817  // Preconditions:
818 
819  require(is_initialized());
820  require(!is_done());
821 
822  // Body:
823 
824  // The section space schema invariant ensures that the evaluator family
825  // is compatible with the base space and hence the following call to
826  // eval_family::member returns a non-void evaluator.
827 
828  section_evaluator& result = *_evaluators->member(type_id());
829 
830  // Postconditions:
831 
832  // Exit
833 
834  return result;
835 }
836 
840 {
841  // Preconditions:
842 
843  require(!is_done());
844 
845  // Body:
846  block<scoped_index>& result = _discretization_members;
847 
848  // Postconditions:
849 
850  // Exit
851 
852  return result;
853 }
854 
858 {
859  // Preconditions:
860 
861  require(!is_done());
862 
863  // Body:
864  const block<scoped_index>& result = _discretization_members;
865 
866  // Postconditions:
867 
868  // Exit
869 
870  return result;
871 }
872 
876 {
877  // Preconditions:
878 
879  require(!is_done());
880  require((0 <= xi) && (xi < discretization_members().ct()));
881 
882  // Body:
883 
884  scoped_index result(*_disc_id_space, _discretization_members[xi]);
885 
886  // Postconditions:
887 
888  // Exit:
889 
890  return result;
891 }
892 
893 void
896 {
897  // Preconditions:
898 
899  require(!is_done());
900  require(xsec.state_is_read_accessible());
901 
902  // Body:
903 
905 
906  size_type ldisc_mbr_ct = ldisc_mbrs.ct();
907  int ldf = xsec.schema().df();
908  size_type ldof_ct = ldf*ldisc_mbr_ct;
909 
910  size_type old_xdofs_ct = xdofs.ct();
911  size_type lnew_xdofs_ct = old_xdofs_ct + ldof_ct;
912  xdofs.reserve(lnew_xdofs_ct);
913  xdofs.set_ct(lnew_xdofs_ct);
914 
915  // Gather the dofs by discretization member.
916 
917  size_type ldof_index = old_xdofs_ct;
918  for(int i=0; i<ldisc_mbr_ct; ++i)
919  {
920  xsec.get_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
921  ldf*sizeof(sec_vd::dof_type), false);
922  ldof_index += ldf;
923  }
924 
925  // Postconditions:
926 
927  ensure(xdofs.ct() ==
928  (old_xdofs_ct + xsec.schema().df()*discretization_members().ct()));
929 
930  // Exit:
931 
932  return;
933 }
934 
935 
936 void
939 {
940  // Preconditions:
941 
942  require(!is_done());
943  require(xsec.state_is_read_write_accessible());
944  require(xdofs.ub() >= xindex + xsec.schema().df()*discretization_members().ct());
945 
946  // Body:
947 
949 
950  size_type ldisc_mbr_ct = ldisc_mbrs.ct();
951  int ldf = xsec.schema().df();
952  size_type ldof_ct = ldf*ldisc_mbr_ct;
953 
954  size_type ldof_index = xindex;
955 
956  // Gather the dofs by discretization member.
957 
958  for(int i=0; i<ldisc_mbr_ct; ++i)
959  {
960  xsec.put_fiber(ldisc_mbrs[i], &xdofs[ldof_index],
961  ldf*sizeof(sec_vd::dof_type), false);
962  ldof_index += ldf;
963  }
964 
965  // Postconditions:
966 
967 
968  // Exit:
969 
970  return;
971 }
972 
973 
974 // ===========================================================
975 // PROTECTED MEMBER FUNCTIONS
976 // ===========================================================
977 
978 void
981 {
982  // Preconditions:
983 
984  require(xschema_anchor.state_is_read_accessible());
985  require(is_done());
986 
987  // Body:
988 
989  // Allocate the schema anchor if needed.
990 
991  if(_schema_anchor == 0)
992  {
993  _schema_anchor = xschema_anchor.clone();
994  }
995  else if(!_schema_anchor->is_same_type(&xschema_anchor))
996  {
997  _schema_anchor->detach_from_state();
998  delete _schema_anchor;
999  _schema_anchor = xschema_anchor.clone();
1000  }
1001 
1002  // Set the schema anchor.
1003 
1004  _schema_anchor->attach_to_state(&xschema_anchor);
1005 
1006  // Set the base space.
1007 
1008  _base_space = &_schema_anchor->host()->base_space();
1009 
1010  // Postconditions:
1011 
1012  // Can not ensure invariant because anchor has not been
1013  // reset to base space of schema anchor yet.
1014 
1015  ensure(is_done());
1016  ensure(_schema_anchor->is_same_state(&xschema_anchor));
1017  ensure(_schema_anchor->version() == xschema_anchor.version());
1018  ensure(_schema_anchor->is_same_type(&xschema_anchor));
1019 
1020  // Exit
1021 
1022  return;
1023 }
1024 
1025 void
1026 fiber_bundle::eval_iterator::
1027 put_schema_variables()
1028 {
1029  // Preconditions:
1030 
1031  require(schema_anchor().state_is_read_accessible());
1032 
1033  // Body:
1034 
1035  // Initialize access to schema subposets.
1036 
1037  _eval_sp = &schema_anchor().evaluation();
1038  _disc_sp = &schema_anchor().discretization();
1039 
1040  // Initialize data members used in discretization reversal.
1041 
1042  _disc_reversal_enabled = false;
1043  _vertex_discretization = (schema_anchor().discretization().name() == "__vertices");
1044 
1045  // Initialize access to client id spaces.
1046 
1047  _eval_id_space = &schema_anchor().evaluation().id_space();
1048  _disc_id_space = &schema_anchor().discretization().id_space();
1049 
1050  // Get the proper evaluator family.
1051 
1052  if(_evaluators != 0)
1053  delete _evaluators;
1054 
1055  _evaluators =
1056  eval_family::new_family(schema_anchor().evaluator_family_name(),
1057  *schema_anchor().name_space());
1058 
1059  // Postconditions:
1060 
1061 
1062  // Exit:
1063 
1064  return;
1065 }
poset_state_handle * host() const
The poset which this is a handle to a component of.
std::string name() const
Definition: subposet.h:796
virtual void force_is_done()
Force the iterator to be done.
A client handle for a subposet.
Definition: subposet.h:86
bool is_valid() const
True if this is a valid id.
Definition: scoped_index.h:832
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
int version(bool xunalias=true) const
The (possibly aliased) version of this component. The version of the host used when evaluating proper...
size_type ct() const
The number of items currently in use.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
bool visit_once() const
True if traversal should only visit a member once; that is, it should not revisit members it has alre...
void initialize_order(order_type xorder)
Initializes _order and _transition_fcn.
section_evaluator & evaluator()
The section evaluator associated with the current evaluation member (mutable version).
virtual eval_iterator * clone() const
Make a new instance of the same type as this.
action_type action() const
The type of action the client should take when the iterator returns control to the client...
abstract_poset_member * _anchor
The top member of the down set being iterated over.
row_dof_tuple_type * row_dof_tuple(pod_index_type xtuple_hub_id, bool xrequire_write_access=false) const
The row dof tuple with tuple hub id xtuple_hub_id.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
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
virtual void force_is_done()
Force the iterator to be done.
An iterator over the members of the evaluation subposet contained in the downset of the base space of...
Definition: eval_iterator.h:66
pod_index_type member_dof_tuple_id(pod_index_type xmbr_hub_id, bool xauto_access) const
The dof tuple hub id of the member with hub id xmbr_hub_id.
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
void put_visit_once(bool xvisit_once)
Set visit_once() to xvisit_once.
virtual bool is_ancestor_of(const any *xother) const
True if other conforms to this.
section_space_schema_member & schema_anchor()
The schema member whose base space is being iterated over; the top member of the domain of iteration ...
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
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
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.
void invalidate()
Make this id invalid.
Definition: scoped_index.h:852
pod_index_type type_id() const
The type id of the current evaluation member.
Abstract base class with useful features for all objects.
Definition: any.h:39
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
static eval_family * new_family(const std::string &xname)
Creates an instance of the evaluator family associated with name xname.
Definition: eval_family.cc:181
bool invariant() const
The class invariant.
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
virtual abstract_poset_member & anchor()
The poset member whose downset is being iterated over; the top member of the domain of iteration (mut...
order_type order() const
The order of the iteration. Determines which actions are exported to the client.
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...
void put_schema_anchor(const section_space_schema_member &xschema_anchor)
Set schema_anchor() to the same state as xschema_anchor.
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual poset_type type_id() const
Identifier for the type of this poset.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
bool descending() const
True if iterating over down set of anchor.
const bool UPPER
Selector for upper cover.
Definition: sheaf.h:72
int db(pod_index_type xmbr_hub_id) const
The base space dimension of the member with hub id xmbr_hub_id.
scoped_index client_id() const
The client id of the current evaluation member.
void next()
Makes this the next member of the subset.
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 initialize_schema_anchor(const section_space_schema_member &xanchor)
Initializes the schema anchor.
void scatter_dofs(sec_vd &xsec, const block< sec_vd::dof_type > &xdofs, size_type xindex)
Scatters the dofs for the current evalaution member from the location xindex and following of xdofs i...
const scoped_index & greater_index() const
The index of the greater member of the current link.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
bool is_done() const
True if iteration finished.
const scattered_insertion_index_space_handle & id_space() const
The id space for the members of with this (const version).
Definition: subposet.cc:508
static const poset_path & standard_schema_path()
The path of the schema required by this class.
int db() const
The dimension of the current evaluation member.
void first()
Moves this to the first member of the iteration.
virtual bool is_initialized() const
True if this has been initialized for iteration with respect to a specific anchor.
bool _descending
True if iterating over the up/down set of anchor.
void put_has_visited(pod_index_type xhub_id, bool xvalue)
Set the visited marker for hub id xhub_id to xvalue. Intended for use reseting iterator without havin...
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
virtual void detach_from_state()
Detach this handle from its state, if any.
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
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
eval_iterator()
Default constructor; creates an unattached iterator.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
void initialize_traversal(const abstract_poset_member &xanchor)
Initializes the anchor, has_visited markers and filter.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
bool invariant() const
The class invariant.
int ct(bool xreset=false)
The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.
sec_vd_dof_type dof_type
The type of degree of freedom.
Definition: sec_vd.h:91
void gather_dofs(const sec_vd &xsec, block< sec_vd::dof_type > &xdofs)
Gathers the dofs for the current evalaution member from section xsec and appends them to the back of ...
A client handle for a poset member which has been prepared for use as a schema for a section space...
base_space_poset & base_space()
The host of the anchor (mutable version).
bool _strict
True if iterating over the strict up/down set of anchor.
int df() const
The dimension of the fiber space component.
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
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...
subposet & filter()
The subposet which is the filter; Defines what is passed, not what is blocked.
block< scoped_index > & discretization_members()
The discretization members in the downset of the current evaluation member (mutable version)...
virtual schema_poset_member & schema()
The schema for this member (mutable version).
scoped_index discretization_client_id(size_type xi)
The client id of the xi-th discretization member in the downset of the current evaluation member...
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
Namespace for the fiber_bundles component of the sheaf system.
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79
virtual void attach_to_state(pod_index_type xbase_space_id, pod_index_type xfiber_schema_id)=0
Attach to the state in host() with component ids xbase_id and xfiber_schema_id.
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
bool strict() const
True if iterating over xstrict up/down set of anchor.
section_space_schema_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...
base_space_poset & base_space()
The base space for section spaces on this schema.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
const scoped_index & index() const
The index of the current member of the iteration.
pod_index_type base_space_id() const
The member id of the base space component of this.