SheafSystem  0.0.0.0
poset_table_state.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 
22 #include "SheafSystem/poset_table_state.h"
23 
24 #include "SheafSystem/array_poset_dof_map.h"
25 #include "SheafSystem/assert_contract.h"
26 #include "SheafSystem/index_space_iterator.h"
27 #include "SheafSystem/poset_dof_iterator.h"
28 #include "SheafSystem/poset_state_handle.h"
29 #include "SheafSystem/schema_poset_member.h"
30 #include "SheafSystem/std_iomanip.h"
31 #include "SheafSystem/primitive_value.h"
32 
33 using namespace std;
34 
35 // ===========================================================
36 // POSET_TABLE_STATE FACET
37 // ===========================================================
38 
39 // PUBLIC MEMBER FUNCTIONS
40 
41 // sheaf::poset_table_state::
42 // poset_table_state(const schema_poset_member& xschema, size_type xcapacity)
43 // {
44 // // Preconditions:
45 
46 // require(xschema->is_attached());
47 
48 // // Body:
49 
50 // // Prevent recursive calls to invariant.
51 
52 // disable_invariant_check();
53 
54 // // Initalize the upper bound of the row dofs.
55 
56 // _row_dof_tuple_index_ub.put(hub_id_space(), 0);
57 
58 // // Client may have provided a specialized schema member; clone it.
59 
60 // _schema = lschema->clone();
61 
62 // // Attach to the schema proved by the client.
63 
64 // _schema->attach_to_state(xschema);
65 
66 // // Can't create the dof map until we're sure we have a schema.
67 
68 // _table_dofs = 0;
69 
70 // _row_dof_tuples.reserve(xcapacity);
71 
72 // _standard_row_dof_tuple_ct = 0;
73 
74 // // Postconditions:
75 
76 // ensure( (xschema != 0) == schema().is_attached() );
77 // ensure(row_dof_tuple_index_ub().is_hub_scope());
78 // }
79 
80 sheaf::poset_table_state::
81 poset_table_state(const abstract_poset_member* xschema, size_type xcapacity)
82 {
83  // Preconditions:
84 
85  require(xschema != 0 ? xschema->is_attached() : true);
86 
87  // Body:
88 
89  // Prevent recursive calls to invariant.
90 
91  disable_invariant_check();
92 
93  // Initalize the upper bound of the row dofs.
94 
95  _row_dof_tuple_index_ub.put(hub_id_space(), 0);
96 
97  // Create the schema
98 
99  if(xschema != 0)
100  {
101  // Client has provided a valid schema
102 
103  const schema_poset_member* lschema = dynamic_cast<const schema_poset_member*>(xschema);
104  if(lschema != 0)
105  {
106  // Client may have provided a specialized schema member;
107  // clone it.
108  _schema = lschema->clone();
109  }
110  else
111  {
112  // Client has provided an ordinary member;
113  // make a new schema member.
114 
115  _schema = new schema_poset_member;
116  }
117 
118  // Attach to the schema proved by the client.
119 
120  _schema->attach_to_state(xschema);
121  }
122  else
123  {
124  // Client doesn't have a valid schema yet;
125  // just create an unattached schema member.
126 
127  _schema = new schema_poset_member;
128  }
129 
130  // Can't create the dof map until we're sure we have a schema.
131 
132  _table_dofs = 0;
133 
134  _row_dof_tuples.reserve(xcapacity);
135 
136  _standard_row_dof_tuple_ct = 0;
137 
138  // Postconditions:
139 
140  ensure( (xschema != 0) == schema().is_attached() );
141  ensure(row_dof_tuple_index_ub().is_hub_scope());
142 }
143 
146 {
147  // Preconditions:
148 
149  require(_schema != 0);
150 
151  // Body:
152 
153  // Deallocate schema
154 
155  _schema->detach_from_state();
156  delete _schema;
157 
158  // Deallocate poset dof map, if any.
159 
160  if(_table_dofs != 0)
161  {
162  _table_dofs->dec_ref_ct();
163  if(_table_dofs->ref_ct() == 0)
164  {
165  delete _table_dofs;
166  }
167  }
168 
169  // Delete row dof tuples.
170 
171  for(int i=0; i<_row_dof_tuple_index_ub.pod(); i++)
172  {
173  poset_dof_map* lmap = _row_dof_tuples[i];
174  lmap->dec_ref_ct();
175  if(lmap->ref_ct() == 0)
176  {
177  delete lmap;
178  }
179  }
180 
181  // Postconditions:
182 
183  // Exit:
184 
185  return;
186 }
187 
191 {
192  // Preconditions:
193 
194  // Body:
195 
196  schema_poset_member& result = *_schema;
197 
198  // Postconditions:
199 
200  // Exit
201 
202  return result;
203 }
204 
207 schema() const
208 {
209  // Preconditions:
210 
211  // Body:
212 
213  const schema_poset_member& result = *_schema;
214 
215  // Postconditions:
216 
217  // Exit
218 
219  return result;
220 }
221 
225 {
226  // Preconditions:
227 
228  // Body:
229 
230  array_poset_dof_map* result = _table_dofs;
231 
232  // Postconditions:
233 
234  // Exit
235 
236  return result;
237 }
238 
239 void
242 {
243  // Preconditions:
244 
245  // Body:
246 
247  _table_dofs = xtable_dofs;
248 
249  // Postconditions:
250 
251  // Exit
252 
253  return;
254 }
255 
256 bool
259 {
260  // Preconditions:
261 
262  // Body:
263 
264  bool result = hub_id_space().contains(xindex);
265 
266  // Postconditions:
267 
268  // Exit:
269 
270  return result;
271 }
272 
273 bool
276 {
277  return contains_row_dof_tuple(xindex.hub_pod());
278 }
279 
283 {
284  size_type result;
285 
286  // Preconditions:
287 
288  // Body:
289 
290  result = hub_id_space().ct();
291 
292  // Postconditions:
293 
294  ensure(result >= 0);
295 
296  // Exit
297 
298  return result;
299 }
300 
301 
302 const sheaf::scoped_index&
305 {
306  // Preconditions:
307 
308  // Body:
309 
310  const scoped_index& result = _row_dof_tuple_index_ub;
311 
312  // Postconditions:
313 
314  // Exit
315 
316  return result;
317 }
318 
322 {
323  size_type result;
324 
325  // Preconditions:
326 
327  // Body:
328 
329  result = _standard_row_dof_tuple_ct;
330 
331  // Postconditions:
332 
333  // Exit
334 
335  return result;
336 }
337 
338 void
341 {
342  // Preconditions:
343 
344  // Body:
345 
346  _standard_row_dof_tuple_ct = xct;
347 
348  // Postconditions:
349 
350  // Exit
351 
352  return;
353 }
354 
358 {
359  poset_dof_map* result;
360 
361  // Preconditions:
362 
363  // Body:
364 
365  if(contains_row_dof_tuple(xindex))
366  {
367  result = _row_dof_tuples[xindex];
368  }
369  else
370  {
371  result = 0;
372  }
373 
374  // Postconditions:
375 
376  // Exit
377 
378  return result;
379 }
380 
384 {
385  return row_dof_tuple(xindex.hub_pod());
386 }
387 
388 void
391 {
392  // Preconditions:
393 
394  // Body:
395 
396  define_old_variable(scoped_index old_row_dof_tuple_index_ub = row_dof_tuple_index_ub());
397  define_old_variable(size_type old_row_dof_tuple_ct = row_dof_tuple_ct());
398  define_old_variable(int old_ref_ct = xdof_tuple->ref_ct());
399 
400  // Create a new member in the id space.
401 
402  pod_index_type lindex = _id_spaces.new_id();
403 
404  // Set the references from the map back to the poset.
406 
407  xdof_tuple->put_index(hub_id(lindex));
408 
409  // Put the map in the table.
410 
411  _row_dof_tuples.force_item(lindex, xdof_tuple);
412 
413  // Set the row_dof_tuple upper bound.
414 
415  _row_dof_tuple_index_ub = hub_id_space().end();
416 
417  // Count the references to the dof map.
418  // This reference count is probably unnecessary,
419  // since there is only one direct reference,
420  // from the table to the map. Furthermore, there is
421  // currently no way to reclaim space in the table,
422  // so we just don't delete dof maps until we delete the table.
423 
424  xdof_tuple->inc_ref_ct();
425 
426  // Postconditions:
427 
428  ensure(row_dof_tuple_ct() == old_row_dof_tuple_ct+1);
429  ensure(row_dof_tuple_index_ub() >= old_row_dof_tuple_index_ub);
430  ensure(contains_row_dof_tuple(xdof_tuple->index()));
431  ensure(row_dof_tuple(xdof_tuple->index()) == xdof_tuple);
432  ensure(xdof_tuple->ref_ct() == old_ref_ct + 1);
433 
434  // Exit
435 
436  return;
437 }
438 
442 {
443  // Preconditions:
444 
445  // Body:
446 
447  index_space_iterator& result = hub_id_space().get_iterator();
448 
449  // Postconditions:
450 
451  ensure(hub_id_space().allocated_iterator(result));
452 
453  // Exit:
454 
455  return result;
456 }
457 
458 void
461 {
462  // Preconditions:
463 
464  require(hub_id_space().allocated_iterator(xitr));
465 
466  // Body:
467 
468  hub_id_space().release_iterator(xitr);
469 
470  // Postconditions:
471 
472  // Exit:
473 
474  return;
475 }
476 
477 // PROTECTED MEMBER FUNCTIONS
478 
479 // PRIVATE MEMBER FUNCTIONS
480 
481 
482 // ===========================================================
483 // ID SPACE FACET
484 // ===========================================================
485 
486 // PUBLIC MEMBER FUNCTIONS
487 
490 id_spaces() const
491 {
492  return _id_spaces;
493 }
494 
498 {
499  return _id_spaces.hub_id_space();
500 }
501 
502 const sheaf::scoped_index&
504 hub_id() const
505 {
506  // Preconditions:
507 
508  // Body:
509 
510  const scoped_index& result = row_dof_tuple_index_ub();
511 
512  // Postconditions:
513 
514  ensure(result.is_hub_scope());
515 
516  // Exit:
517 
518  return result;
519 }
520 
524 {
525  // Preconditions:
526 
527  // Body:
528 
529  scoped_index result(hub_id());
530  result = xid;
531 
532  // Postconditions:
533 
534  ensure(result.is_hub_scope());
535  ensure(result.pod() == xid);
536 
537  // Exit:
538 
539  return result;
540 }
541 
542 // PROTECTED MEMBER FUNCTIONS
543 
544 // PRIVATE MEMBER FUNCTIONS
545 
546 
547 // ===========================================================
548 // ANY FACET
549 // ===========================================================
550 
551 // PUBLIC MEMBER FUNCTIONS
552 
553 bool
555 is_ancestor_of(const any* xother) const
556 {
557  bool result;
558 
559  // Preconditions:
560 
561  // Body:
562 
563  result = dynamic_cast<const poset_table_state*>(xother) != 0;
564 
565  // Postconditions:
566 
567  // Exit
568 
569  return result;
570 }
571 
574 clone() const
575 {
576  poset_table_state* result = 0;
577 
578  // Preconditions:
579 
580  // Body:
581 
582  not_implemented();
584 
585  //result = new poset_table_state;
586 
587  // Postconditions:
588 
589  ensure(result != 0);
590 
591  // Exit
592 
593  return result;
594 }
595 
596 bool
598 invariant() const
599 {
600  bool result = true;
601 
602  // Preconditions:
603 
604  // Body:
605 
606  if(invariant_check())
607  {
608  disable_invariant_check();
609 
610  result = result && _schema->is_attached();
611 
612  enable_invariant_check();
613  }
614 
615  // Postconditions:
616 
617  // Exit
618 
619  return result;
620 }
621 
622 // PROTECTED MEMBER FUNCTIONS
623 
624 // PRIVATE MEMBER FUNCTIONS
625 
626 
627 // ===========================================================
628 // NONMEBER FUNCTIONS
629 // ===========================================================
630 
631 namespace
632 {
633 
637 void print_schema(std::ostream &os, const sheaf::poset_table_state& p)
638 {
639  // Preconditions:
640 
641  // Body:
642 
643  os << "Schema" << endl
644  << "------" << endl
645  << endl;
646 
647  p.schema().to_stream(os);
648 
649  // Postconditions:
650 
651  // Exit:
652 
653  return;
654 }
655 
659 void print_table_dofs(std::ostream &os, const sheaf::poset_table_state& p)
660 {
661  // Preconditions:
662 
663  // Body:
664 
665  os << endl
666  << "Table Attributes" << endl
667  << "----------------" << endl
668  << endl;
669 
670  // Print dof count and tuple size.
671 
672  size_t ldof_ct = p.schema().table_dof_ct();
673 
674  os << "table dof count: " << ldof_ct
675  << " table dof tuple size: " << p.schema().table_dof_tuple_ub()
676  << endl;
677 
678  const int NAME_WIDTH = 40;
679  const int VALUE_WIDTH = 40;
680 
681  if (ldof_ct > 0)
682  {
683  // Print out the table dofs
684 
685  os << "table dofs:" << endl
686  << setw(NAME_WIDTH) << "name"
687  << setw(VALUE_WIDTH) << "value"
688  << endl;
689 
690  for(int i=0; i<NAME_WIDTH; ++i)
691  {
692  os << "-";
693  }
694  os << ' ';
695  for(int i=0; i<VALUE_WIDTH; ++i)
696  {
697  os << "-";
698  }
699  os << endl;
700 
701  sheaf::poset_dof_iterator* table_dof_itr = p.schema().table_dof_iterator();
702  while(!table_dof_itr->is_done())
703  {
704  os << setw(NAME_WIDTH) << table_dof_itr->item().name().c_str();
705 
706  os << " " << setw(VALUE_WIDTH)
707  << const_cast<sheaf::poset_table_state&>(p).table_dofs()->dof(table_dof_itr->index()).to_string()
708  << endl;
709 
710  table_dof_itr->next();
711  }
712  delete table_dof_itr;
713  }
714 
715  // Postconditions:
716 
717  // Exit:
718 
719  return;
720 }
721 
725 void print_row_dofs(std::ostream &os, const sheaf::poset_table_state& p)
726 {
727  // Preconditions:
728 
729 
730  // Body:
731 
732  os << endl
733  << "Row Attributes" << endl
734  << "--------------" << endl
735  << endl;
736 
737  // The rows may be allocated on more than one
738  // version of the schema. So get a handle to the
739  // coarsest common refinement of the schema.
740 
741  sheaf::schema_poset_member* lccr_schema = p.schema().clone();
742  lccr_schema->attach_to_state(&(p.schema()));
743  lccr_schema->put_version(sheaf::COARSEST_COMMON_REFINEMENT_VERSION);
744 
745  size_t ldof_ct = lccr_schema->row_dof_ct();
746 
747  // Print dof count and tuple size.
748 
749  os << "row dof count: " << ldof_ct
750  << " row dof tuple size: " << lccr_schema->row_dof_tuple_ub()
751  << endl
752  << endl;
753 
754  // Print out headings for dof tuples
755 
756  const int INDEX_WIDTH = 6;
757  const int TYPE_WIDTH = 6;
758  const int OTHER_WIDTH = 10;
759  const int C_STRING_WIDTH = 48;
760 
761  os << setw(INDEX_WIDTH) << " index" << setw(TYPE_WIDTH) << " type";
762 
763  int ldof_id = 0;
764  sheaf::poset_dof_iterator* hdr_itr = lccr_schema->row_dof_iterator();
765  while(!hdr_itr->is_done())
766  {
767  int ltype = hdr_itr->item().type();
768  int lwidth = (ltype == sheaf::C_STRING) ? C_STRING_WIDTH - 2 : OTHER_WIDTH - 2;
769  os << setw(lwidth) << " dof " << setw(3) << ldof_id++;
770  hdr_itr->next();
771  }
772  os << endl;
773  delete hdr_itr;
774 
775  os << setw(INDEX_WIDTH) << " " << setw(TYPE_WIDTH) << " ";
776 
777  sheaf::poset_dof_iterator* name_itr = lccr_schema->row_dof_iterator();
778  while(!name_itr->is_done())
779  {
780  int ltype = name_itr->item().type();
781  int lwidth = (ltype == sheaf::C_STRING) ? C_STRING_WIDTH : OTHER_WIDTH;
782 
783  os << " " << setw(lwidth) << name_itr->item().name().substr(0, lwidth);
784  name_itr->next();
785  }
786  os << endl;
787  delete name_itr;
788 
789 
790  // Print out under lines
791 
792  os << setw(INDEX_WIDTH) << " -----";
793  os << setw(TYPE_WIDTH) << " -----";
794  sheaf::poset_dof_iterator* undr_itr = lccr_schema->row_dof_iterator();
795  while(!undr_itr->is_done())
796  {
797  os << ' ';
798  int ltype = undr_itr->item().type();
799  int lwidth = (ltype == sheaf::C_STRING) ? C_STRING_WIDTH : OTHER_WIDTH;
800  for(int i=0; i<lwidth; ++i)
801  {
802  os << '-';
803  }
804  undr_itr->next();
805  }
806  os << endl;
807  delete undr_itr;
808 
809 
810  // Print out the rows:
811 
812  sheaf::poset_dof_iterator* dof_itr = lccr_schema->row_dof_iterator();
813 
815  while(!tuple_itr.is_done())
816  {
817  // Print out the index and type for every dof tuple.
818 
819  sheaf::pod_index_type lid = tuple_itr.pod();
820 
821  os << setw(INDEX_WIDTH) << lid;
822  os << setw(TYPE_WIDTH) << " ";
823 
824  // Print out the dofs
825 
826  dof_itr->reset();
827  while(!dof_itr->is_done())
828  {
829  // The dof map of this row is allocated on some version of the schema.
830  // Print out the current dof only if it is contained in the version
831  // used by this row; other wise, just print white space.
832 
833  const sheaf::scoped_index& lindex = dof_itr->index();
834 
835  sheaf::poset_dof_map* ltuple =
836  const_cast<sheaf::poset_table_state&>(p).row_dof_tuple(p.hub_id(lid));
837  int lver = ltuple->version();
838  sheaf::schema_poset_member& lp_schema = ltuple->schema();
839 
840  if(lp_schema.host()->contains_member(lindex, lver) && lp_schema.ge(lindex))
841  {
842  // Current dof is contained in schema and version used by this row;
843  // print it out
844 
845  sheaf::primitive_value lprim = ltuple->dof(lindex);
846 
847  int lwidth;
848  string ldof_string;
849  if(lprim.id() == sheaf::VOID_STAR)
850  {
851  // This is a pointer, don't want to print out the actual address
852  // because it make files hard to compare.
853 
854  ldof_string = (lprim.value().void_star_primitive == 0) ? "<null>" : "<non-null>";
855  lwidth = OTHER_WIDTH;
856  }
857  else
858  {
859  ldof_string = lprim.to_string();
860  lwidth = (lprim.id() == sheaf::C_STRING) ? C_STRING_WIDTH : OTHER_WIDTH;
861  }
862 
863  os << " " << setw(lwidth) << ldof_string;
864  }
865  else
866  {
867  // Current dof is not contained in schema and version used by this row;
868  // print white space.
869 
870  int ltype = dof_itr->item().type();
871  int lwidth = (ltype == sheaf::C_STRING) ? C_STRING_WIDTH : OTHER_WIDTH;
872  os << ' ';
873  for(int i=0; i<lwidth; ++i)
874  {
875  os << ' ';
876  }
877  }
878 
879  dof_itr->next();
880  }
881 
882  tuple_itr.next();
883 
884  os << endl;
885  }
886 
888  delete dof_itr;
889  lccr_schema->detach_from_state();
890  delete lccr_schema;
891 
892  // Postconditions:
893 
894  // Exit:
895 
896  return;
897 }
898 
899 }
900 
901 // ===========================================================
902 // NON-MEBER FUNCTIONS
903 // ===========================================================
904 
905 std::ostream&
906 sheaf::
907 operator<<(std::ostream &os, const poset_table_state& p)
908 {
909 
910  // Preconditions:
911 
912  // Body:
913 
914  os << endl
915  << "TABLE" << endl
916  << "-----" << endl
917  << endl;
918 
919  print_schema(os, p);
920  print_table_dofs(os, p);
921  print_row_dofs(os, p);
922 
923  // Tuple id space family.
924 
925  os << endl
926  << "Tuple Id Space Family" << endl
927  << "----------------------" << endl
928  << endl;
929 
930  os << p.id_spaces() << endl;
931 
932 
933  // Postconditions:
934 
935  // Exit
936 
937  return os;
938 }
939 
940 size_t
941 sheaf::
942 deep_size(const poset_table_state& xp, bool xinclude_shallow)
943 {
944  size_t result;
945 
946  // Preconditions:
947 
948  // Body:
949 
950  result = xinclude_shallow ? sizeof(xp) : 0;
951 
952  // Add contributes from _id_spaces.
953 
954  result += deep_size(xp._id_spaces, false);
955 
956  // Calculate the deep size of data member: schema_poset_member* _schema.
957 
958  result += deep_size(*xp._schema, true);
959 
960  // Calculate the deep size of data member: _table_dofs
961 
962  result += deep_size(*xp._table_dofs, true);
963 
964  // Get size of memory allocated for row dof tuples.
965 
966  // The memory allocated for the various specializations of
967  // class poset_dof_map is available thru the base class methods,
968  // so here we can treat them all as if they were of the base
969  // class type.
970 
971  result += deep_size(xp._row_dof_tuples, false);
972 
973  // Postconditions:
974 
975  ensure(result >= 0);
976 
977  // Exit
978 
979  return result;
980 }
virtual void put_version(int xversion, bool xunalias=false)
Sets version to (possibly aliased) xversion. If unalias == true, set version to the actual version al...
poset_dof_iterator * table_dof_iterator(int xversion=CURRENT_MEMBER_VERSION) const
A postorder iterator over the table dofs defined by this. Synonym for dof_iterator(true).
poset_state_handle * host() const
The poset which this is a handle to a component of.
size_type standard_row_dof_tuple_ct() const
The number of standard row_dof_tuples automatically allocated by the poset handle constructor...
virtual bool is_ancestor_of(const any *other) const
True if other conforms to current.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
virtual void next()
Makes this the next member of the subset.
virtual void reset(bool xreset_markers=RESET)
Restarts the iteration over the down set of anchor() If xreset_markers, set !has_visited for all memb...
An abstract iterator over the ids of an id space.
poset_dof_iterator * row_dof_iterator(int xversion=CURRENT_MEMBER_VERSION) const
A postorder iterator over the row dofs defined by this.
void put_row_dof_tuple(poset_dof_map *xdof_tuple)
Sets the dof tuple at index xindex to xdof_tuple.
pod_type pod() const
The current id in the iteration.
schema_poset_member & item()
The current member of the iteration (mutable version).
bool contains_row_dof_tuple(pod_index_type xindex) const
True if xindex is a valid row dof tuple index.
virtual schema_poset_member & schema()
The schema on which this is allocated (mutable version).
primitive_value dof(pod_index_type xdof_id) const
The dof referred to by xdof_id.
int version() const
The version of the host of the schema this is defined on.
schema_poset_member & schema()
Schema (mutable version)
STL namespace.
void put_index(const scoped_index &xindex)
Sets the index of the member for which this provides the dofs.
virtual bool is_done() const
True if iteration finished.
virtual void next()=0
Makes id() the next id in the iteration.
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
virtual primitive_type type() const
The primitive type index of the dof defined by this.
An implementation of class sum_index_space_handle that has a primary sum id space state...
const hub_index_space_handle & hub_id_space() const
The hub id space.
virtual poset_table_state * clone() const
Make a new instance of the same type as this.
bool is_hub_scope() const
True if and only if the id space of this is the hub id space.
Definition: scoped_index.h:575
schema_poset_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...
Abstract base class with useful features for all objects.
Definition: any.h:39
std::string to_string() const
Converts this to a string (for stream insertion).
bool is_done() const
True if iteration is finished.
index_space_iterator & get_row_dof_tuple_id_space_iterator() const
Allocates an id space iterator over the row dof tuple ids from the iterator pool. ...
virtual void detach_from_state()
Detach this handle from its state, if any.
virtual void to_stream(std::ostream &xos=std::cout) const
Virtual stream insertion.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual bool is_attached() const
True if this handle is attached to a non-void state.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
const hub_index_space_handle & hub_id_space() const
Hub id space for this poset powerset.
void inc_ref_ct()
Increase the number of references to this map by one;.
poset_dof_map * row_dof_tuple(pod_index_type xindex)
The row dof tuple with index xindex.
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
std::string name(pod_index_type xdof_id, bool xis_table_dof) const
The name of the table dof (xis_table_dof true) or row dof referred to by xdof_id in the schema define...
size_t table_dof_tuple_ub() const
The size in bytes of the table dof tuple defined by this schema. Synonym for dof_tuple_ub(true).
static int row_dof_ct(const namespace_poset &xns, const poset_path &xpath, bool xauto_access=true)
The number of row dofs defined by the schema specified by xns and xpath. Synonym for dof_ct(xns...
virtual const scoped_index & index()
The index of the current member of the iteration.
const index_space_family & id_spaces() const
Collection of id spaces for this poset powerset.
primitive_buffer_type & value()
The value of this.
bool ge(pod_index_type xother_index) const
True if this is greater than or equal to the member with index xother_index.
void dec_ref_ct()
Decrease the number of references to this map by one.
const scoped_index & row_dof_tuple_index_ub() const
The upper bound of the index for row dof tuples.
array_poset_dof_map * table_dofs()
Get the table dof map.
primitive_type & id()
Type id of the primitive type.
size_t row_dof_tuple_ub() const
The size in bytes of the row dof tuple defined by this schema. Synonym for dof_tuple_ub(false).
Iterates in postorder over dofs of a schema member anchor. Attaches a handle of type schema_poset_mem...
const scoped_index & hub_id() const
A id in the hub id space; intended for copying to initialize ids to the hub id space.
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
void put_standard_row_dof_tuple_ct(size_type xct)
Put the number of standard row_dof_tuples automatically allocated by the poset handle constructor...
static int table_dof_ct(const namespace_poset &xns, const poset_path &xpath, bool xauto_access=true)
The number of tablr dofs defined by the schema specified by xns and xpath. Synonym for dof_ct(xns...
virtual bool invariant() const
Class invariant.
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.
Abstract object wrapper for an instance of a primitive type.
An abstract client handle for a member of a poset.
Factory and container for a family of id spaces.
An array representation of abstract class poset_dof_map.
void release_row_dof_tuple_id_space_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the row dof tuple iterator pool.
void put_table_dofs(array_poset_dof_map *xtable_dofs)
Put the table dof map.
unsigned int ref_ct() const
The number of references to this map.
A client handle for a poset member which has been prepared for use as a schema.
The data structure representing the table containing the dof tuples of the members of a poset...
const scoped_index & index() const
The index of this in host() dof tuple table.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
size_type row_dof_tuple_ct() const
The number of dof tuples in the dof tuple table.