SheafSystem  0.0.0.0
write_sheaves_namespace.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 
20 
21 // NOTE: This example, produces the equivalent namespace to
22 // one obtained by instantiating a sheaves_namespace
23 // and writing it out.
24 
25 #include "SheafSystem/abstract_poset_member.h"
26 #include "SheafSystem/namespace_poset.h"
27 #include "SheafSystem/index_iterator.h"
28 #include "SheafSystem/namespace_poset_member.h"
29 #include "SheafSystem/poset.h"
30 #include "SheafSystem/poset_member_iterator.h"
31 #include "SheafSystem/postorder_iterator.h"
32 #include "SheafSystem/primitives_poset.h"
33 #include "SheafSystem/primitives_poset_schema.h"
34 #include "SheafSystem/schema_poset_member.h"
35 #include "SheafSystem/assert_contract.h"
36 #include "SheafSystem/storage_agent.h"
37 
38 using namespace sheaf;
39 
40 // Creates schema for standard base space types.
41 
42 void make_base_space_definitions();
43 
44 //Create local coordinate schema, poset, and poset members.
45 
46 void make_local_coordinate_definitions();
47 
48 // Create local coordinates schema.
49 
50 void make_local_coordinates_schema();
51 
52 // Creates a member (jim) in the local coordinates poset.
53 
54 void make_local_coordinates_jim(const string& name,
55  int dimension,
56  int orientation);
57 
58 // Create cell definitions
59 void make_cell_definitions();
60 void make_vertex();
61 void make_edge();
62 void make_triangle();
63 void make_quad();
64 void make_tetrahedron();
65 void make_hexahedron();
66 void make_wedge();
67 
68 // Globals (for convenience)
69 namespace_poset* ns;
70 poset* cell_definitions;
71 poset* local_coordinates;
72 
73 int main()
74 {
75  // Make sure the standard lps environment setting script has been executed.
76 
77  // check_lps_script_has_run();
78 
79  // Create the namespace poset and name it.
80 
81  ns = new namespace_poset("sheaves_namespace");
82 
83  // Get read-write access to the namespace.
84 
86 
87  // Make base space definitions.
88 
89  make_base_space_definitions();
90 
91  // Write it to a file.
92 
93  storage_agent sa("sheaves_namespace.hdf", sheaf_file::READ_WRITE);
94  sa.put_member_record_buffer_ub(15);
95  sa.put_dof_tuple_record_buffer_ub(15);
96  sa.write_entire(*ns);
97 
98  ns->detach_from_state();
99  delete ns;
100 
101  return 0;
102 }
103 
104 
106 void
107 make_base_space_definitions()
108 {
109 
110  // Preconditions:
111 
112  // Body:
113 
114  make_local_coordinate_definitions();
115 
116  make_cell_definitions();
117 
118  // // Make base space definitions group (jrm)
119 
120  // namespace_poset_member local_coordinates_defs(ns, "local coordinate definitions");
121  // namespace_poset_member cell_defs(ns, "cell definitions");
122  // total_poset_member* base_defs = local_coordinates_defs.l_join(&cell_defs);
123  // base_defs->put_name("base space definitions", true, false);
124 
125  // local_coordinates_defs.detach_from_state();
126  // cell_defs.detach_from_state();
127  // base_defs->detach_from_state();
128  // delete base_defs;
129 
130  // Postconditions:
131 
132  // Exit
133 
134  return;
135 }
136 
137 
139 void
140 make_local_coordinate_definitions()
141 {
142  // Preconditions:
143 
144  // Body:
145 
146  // Make schema for local coordinates
147 
148  make_local_coordinates_schema();
149 
150  // Make local coordinates
151 
152  total_poset_member local_coordinates_schema_mbr(ns,
153  "local_coordinates_schema/local_coordinates_schema");
154 
155  local_coordinates = new poset(ns, &local_coordinates_schema_mbr,
156  "local_coordinates");
157 
158  local_coordinates->begin_jim_edit_mode();
159 
160  make_local_coordinates_jim("vertex", 0, 1);
161  make_local_coordinates_jim("edge", 1, 1);
162  make_local_coordinates_jim("triangle", 2, 1);
163  make_local_coordinates_jim("quad", 2, 1);
164  make_local_coordinates_jim("tetrahedron", 3, 1);
165  make_local_coordinates_jim("hexahedron", 3, 1);
166  make_local_coordinates_jim("wedge", 3, 1);
167 
168 
169  // Finished writing to local_coordinates,
170  // but base space constructions
171  // will need read access.
172 
173  local_coordinates->end_jim_edit_mode();
174  local_coordinates->get_read_access();
175 
176  // Make local coordinates definitions group (jrm)
177 
178  namespace_poset_member lm1(ns, "local_coordinates_schema");
179  namespace_poset_member lm2(ns, "local_coordinates");
180 
181  total_poset_member* local_coordinates_defns = lm1.l_join(&lm2);
182  local_coordinates_defns->put_name("local coordinate definitions", true, false);
183  local_coordinates_defns->detach_from_state();
184  delete local_coordinates_defns;
185 
186  // Detach handles allocated on stack so state will not be
187  // deleted when pass out of scope
188 
189  local_coordinates_schema_mbr.detach_from_state();
190  lm1.detach_from_state();
191  lm2.detach_from_state();
192 
193  // Postconditions:
194 
195  // Exit
196 
197  return;
198 }
199 
200 
202 void
203 make_local_coordinates_schema()
204 {
205  // Preconditions:
206 
207  // Body:
208 
209  total_poset_member* primitives_schema = &(ns->primitives().schema());
210  poset* local_coordinates_schema = new poset(ns, primitives_schema,
211  "local_coordinates_schema");
212 
213  local_coordinates_schema->begin_jim_edit_mode();
214 
215  subposet table_dofs(local_coordinates_schema);
216  subposet row_dofs(local_coordinates_schema);
217 
218  poset_dof_map* pdof_map = &ns->primitives().member_dof_map(INT);
219 
220  total_poset_member mbr;
221 
222  mbr.new_jim_state(local_coordinates_schema, pdof_map, false, false);
223  mbr.put_name("dimension", true, false);
224  row_dofs.insert_member(&mbr);
225 
226  mbr.new_jim_state(local_coordinates_schema, pdof_map, false, false);
227  mbr.put_name("orientation", true, false);
228  row_dofs.insert_member(&mbr);
229 
230  local_coordinates_schema->end_jim_edit_mode();
231 
234 
235  local_coordinates_schema->get_read_write_access();
236  total_poset_member* local_coordinates_schema_mbr =
237  new total_poset_member(local_coordinates_schema->top(), true);
238  local_coordinates_schema_mbr->put_name("local_coordinates_schema", true, false);
239 
240  // Schematize the poset and all its members
241 
242  mbr.detach_from_state();
243  local_coordinates_schema->schematize(&table_dofs, &row_dofs, true);
244  table_dofs.detach_from_state();
245  row_dofs.detach_from_state();
246  local_coordinates_schema->release_access();
247 
248  // Postconditions:
249 
250  // Exit:
251 
252 }
253 
254 
256 
257 
258 
259 
260 void
261 make_local_coordinates_jim(const string& xname,
262  int xdimension,
263  int xorientation)
264 {
265  // Preconditions:
266 
267  require(!xname.empty());
268  require(xdimension >= 0);
269  require(xorientation >= 0);
270 
271  // Body:
272 
273  typedef struct
274  {
275  int dimension;
276  int orientation;
277  }
278  Local_coordinates_row_dofs;
279 
280  Local_coordinates_row_dofs* local_coordinates_dofs =
281  new Local_coordinates_row_dofs();
282  local_coordinates_dofs->dimension = xdimension;
283  local_coordinates_dofs->orientation = xorientation;
284 
285  total_poset_member mbr;
286  mbr.new_jim_state(local_coordinates, 0, false, false);
287  mbr.put_name(xname, true, false);
288  mbr.put_dof_tuple(reinterpret_cast<void*>(local_coordinates_dofs),
289  sizeof(Local_coordinates_row_dofs));
290  mbr.detach_from_state();
291 
292  // Postconditions:
293 
294  // Exit
295 
296  return;
297 }
298 
300 void
301 make_cell_definitions()
302 {
303 
304  // Preconditions:
305 
306  // Body:
307 
308  total_poset_member local_coordinates_schema_mbr(ns,
309  "local_coordinates_schema/local_coordinates_schema");
310 
311  cell_definitions = new poset(ns, &local_coordinates_schema_mbr,
312  "cell definitions");
313 
314  cell_definitions->get_read_write_access();
315  cell_definitions->begin_jim_edit_mode();
316 
317  make_vertex();
318  make_edge();
319  make_triangle();
320  make_quad();
321  make_tetrahedron();
322  make_hexahedron();
323  make_wedge();
324 
325  cell_definitions->end_jim_edit_mode();
326  cell_definitions->release_access();
327 
328  local_coordinates_schema_mbr.detach_from_state();
329 
330  // Postconditions:
331 
332  // Exit
333 
334  return;
335 }
336 
337 
339 void
340 make_vertex()
341 {
342  // Preconditions:
343 
344  // Body:
345 
346  total_poset_member local_coordinates_mbr;
347  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
348 
349  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
350 
351  total_poset_member mbr;
352  mbr.new_jim_state(cell_definitions, pdof_map, true, false);
353  mbr.put_name("vertex", true, false);
354 
355  mbr.detach_from_state();
356  local_coordinates_mbr.detach_from_state();
357 
358  // Postconditions:
359 
360  // Exit
361 
362  return;
363 }
364 
365 
367 void
368 make_edge()
369 {
370  // Preconditions:
371 
372  // Body:
373 
374  total_poset_member local_coordinates_mbr;
375  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
376 
377  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
378 
379  total_poset_member v0(cell_definitions, pdof_map, true, false);
380  v0.put_name("edge-vertex 0", true, false);
381 
382  total_poset_member v1(cell_definitions, pdof_map, true, false);
383  v1.put_name("edge-vertex 1", true, false);
384 
385  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
386  pdof_map = &(local_coordinates_mbr.dof_map());
387 
388  total_poset_member e(cell_definitions, pdof_map, true, false);
389  e.put_name("edge", true, false);
390 
391  e.create_cover_link(&v0);
392  e.create_cover_link(&v1);
393 
394  e.detach_from_state();
395  v0.detach_from_state();
396  v1.detach_from_state();
397  local_coordinates_mbr.detach_from_state();
398 
399  // Postconditions:
400 
401  // Exit
402 
403  return;
404 }
405 
406 
408 void
409 make_triangle()
410 {
411  // Preconditions:
412 
413  // Body:
414 
415  total_poset_member local_coordinates_mbr;
416  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
417 
418  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
419 
420  total_poset_member v0(cell_definitions, pdof_map, true, false);
421  v0.put_name("triangle-vertex 0", true, false);
422 
423  total_poset_member v1(cell_definitions, pdof_map, true, false);
424  v1.put_name("triangle-vertex 1", true, false);
425 
426  total_poset_member v2(cell_definitions, pdof_map, true, false);
427  v2.put_name("triangle-vertex 2", true, false);
428 
429  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
430  pdof_map = &(local_coordinates_mbr.dof_map());
431 
432  total_poset_member e0(cell_definitions, pdof_map, true, false);
433  e0.put_name("triangle-edge 0", true, false);
434  e0.create_cover_link(&v0);
435  e0.create_cover_link(&v1);
436 
437  total_poset_member e1(cell_definitions, pdof_map, true, false);
438  e1.put_name("triangle-edge 1", true, false);
439  e1.create_cover_link(&v1);
440  e1.create_cover_link(&v2);
441 
442  total_poset_member e2(cell_definitions, pdof_map, true, false);
443  e2.put_name("triangle-edge 2", true, false);
444  e2.create_cover_link(&v2);
445  e2.create_cover_link(&v0);
446 
447  local_coordinates_mbr.attach_to_state(local_coordinates, "triangle");
448  pdof_map = &(local_coordinates_mbr.dof_map());
449 
450  total_poset_member t(cell_definitions, pdof_map, true, false);
451  t.put_name("triangle", true, false);
452  t.create_cover_link(&e0);
453  t.create_cover_link(&e1);
454  t.create_cover_link(&e2);
455 
456  v0.detach_from_state();
457  v1.detach_from_state();
458  v2.detach_from_state();
459  e0.detach_from_state();
460  e1.detach_from_state();
461  e2.detach_from_state();
462  t.detach_from_state();
463  local_coordinates_mbr.detach_from_state();
464 
465  // Postconditions:
466 
467  // Exit
468 
469  return;
470 }
471 
472 
474 void
475 make_quad()
476 {
477  // Preconditions:
478 
479  // Body:
480 
481  total_poset_member local_coordinates_mbr;
482  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
483 
484  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
485 
486  total_poset_member v0(cell_definitions, pdof_map, true, false);
487  v0.put_name("quad-vertex 0", true, false);
488 
489  total_poset_member v1(cell_definitions, pdof_map, true, false);
490  v1.put_name("quad-vertex 1", true, false);
491 
492  total_poset_member v2(cell_definitions, pdof_map, true, false);
493  v2.put_name("quad-vertex 2", true, false);
494 
495  total_poset_member v3(cell_definitions, pdof_map, true, false);
496  v3.put_name("quad-vertex 3", true, false);
497 
498  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
499  pdof_map = &(local_coordinates_mbr.dof_map());
500 
501  total_poset_member e0(cell_definitions, pdof_map, true, false);
502  e0.put_name("quad-edge 0", true, false);
503  e0.create_cover_link(&v0);
504  e0.create_cover_link(&v1);
505 
506  total_poset_member e1(cell_definitions, pdof_map, true, false);
507  e1.put_name("quad-edge 1", true, false);
508  e1.create_cover_link(&v1);
509  e1.create_cover_link(&v2);
510 
511  total_poset_member e2(cell_definitions, pdof_map, true, false);
512  e2.put_name("quad-edge 2", true, false);
513  e2.create_cover_link(&v2);
514  e2.create_cover_link(&v3);
515 
516  total_poset_member e3(cell_definitions, pdof_map, true, false);
517  e3.put_name("quad-edge 3", true, false);
518  e3.create_cover_link(&v3);
519  e3.create_cover_link(&v0);
520 
521  local_coordinates_mbr.attach_to_state(local_coordinates, "quad");
522  pdof_map = &(local_coordinates_mbr.dof_map());
523 
524  total_poset_member q(cell_definitions, pdof_map, true, false);
525  q.put_name("quad", true, false);
526  q.create_cover_link(&e0);
527  q.create_cover_link(&e1);
528  q.create_cover_link(&e2);
529  q.create_cover_link(&e3);
530 
531  v0.detach_from_state();
532  v1.detach_from_state();
533  v2.detach_from_state();
534  v2.detach_from_state();
535  v3.detach_from_state();
536  e0.detach_from_state();
537  e1.detach_from_state();
538  e2.detach_from_state();
539  e3.detach_from_state();
540  q.detach_from_state();
541  local_coordinates_mbr.detach_from_state();
542 
543  // Postconditions:
544 
545  // Exit
546 
547  return;
548 }
549 
550 
552 void
553 make_tetrahedron()
554 {
555  // Preconditions:
556 
557  // Body:
558 
559  total_poset_member local_coordinates_mbr;
560  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
561 
562  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
563 
564  total_poset_member v0(cell_definitions, pdof_map, true, false);
565  v0.put_name("tetrahedron-vertex 0", true, false);
566 
567  total_poset_member v1(cell_definitions, pdof_map, true, false);
568  v1.put_name("tetrahedron-vertex 1", true, false);
569 
570  total_poset_member v2(cell_definitions, pdof_map, true, false);
571  v2.put_name("tetrahedron-vertex 2", true, false);
572 
573  total_poset_member v3(cell_definitions, pdof_map, true, false);
574  v3.put_name("tetrahedron-vertex 3", true, false);
575 
576  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
577  pdof_map = &(local_coordinates_mbr.dof_map());
578 
579  total_poset_member e0(cell_definitions, pdof_map, true, false);
580  e0.put_name("tetrahedron-edge 0", true, false);
581  e0.create_cover_link(&v0);
582  e0.create_cover_link(&v1);
583 
584  total_poset_member e1(cell_definitions, pdof_map, true, false);
585  e1.put_name("tetrahedron-edge 1", true, false);
586  e1.create_cover_link(&v1);
587  e1.create_cover_link(&v2);
588 
589  total_poset_member e2(cell_definitions, pdof_map, true, false);
590  e2.put_name("tetrahedron-edge 2", true, false);
591  e2.create_cover_link(&v2);
592  e2.create_cover_link(&v0);
593 
594  total_poset_member e3(cell_definitions, pdof_map, true, false);
595  e3.put_name("tetrahedron-edge 3", true, false);
596  e3.create_cover_link(&v2);
597  e3.create_cover_link(&v3);
598 
599  total_poset_member e4(cell_definitions, pdof_map, true, false);
600  e4.put_name("tetrahedron-edge 4", true, false);
601  e4.create_cover_link(&v3);
602  e4.create_cover_link(&v1);
603 
604  total_poset_member e5(cell_definitions, pdof_map, true, false);
605  e5.put_name("tetrahedron-edge 5", true, false);
606  e5.create_cover_link(&v3);
607  e5.create_cover_link(&v0);
608 
609  local_coordinates_mbr.attach_to_state(local_coordinates, "triangle");
610  pdof_map = &(local_coordinates_mbr.dof_map());
611 
612  total_poset_member f0(cell_definitions, pdof_map, true, false);
613  f0.put_name("tetrahedron-face 0", true, false);
614  f0.create_cover_link(&e0);
615  f0.create_cover_link(&e1);
616  f0.create_cover_link(&e2);
617 
618  total_poset_member f1(cell_definitions, pdof_map, true, false);
619  f1.put_name("tetrahedron-face 1", true, false);
620  f1.create_cover_link(&e2);
621  f1.create_cover_link(&e3);
622  f1.create_cover_link(&e5);
623 
624  total_poset_member f2(cell_definitions, pdof_map, true, false);
625  f2.put_name("tetrahedron-face 2", true, false);
626  f2.create_cover_link(&e5);
627  f2.create_cover_link(&e4);
628  f2.create_cover_link(&e0);
629 
630  total_poset_member f3(cell_definitions, pdof_map, true, false);
631  f3.put_name("tetrahedron-face 3", true, false);
632  f3.create_cover_link(&e1);
633  f3.create_cover_link(&e3);
634  f3.create_cover_link(&e4);
635 
636  local_coordinates_mbr.attach_to_state(local_coordinates, "tetrahedron");
637  pdof_map = &(local_coordinates_mbr.dof_map());
638 
639  total_poset_member t(cell_definitions, pdof_map, true, false);
640  t.put_name("tetrahedron", true, false);
641  t.create_cover_link(&f0);
642  t.create_cover_link(&f1);
643  t.create_cover_link(&f2);
644  t.create_cover_link(&f3);
645 
646  v0.detach_from_state();
647  v1.detach_from_state();
648  v2.detach_from_state();
649  v3.detach_from_state();
650  e0.detach_from_state();
651  e1.detach_from_state();
652  e2.detach_from_state();
653  e3.detach_from_state();
654  e4.detach_from_state();
655  e5.detach_from_state();
656  f0.detach_from_state();
657  f1.detach_from_state();
658  f2.detach_from_state();
659  f3.detach_from_state();
660  t.detach_from_state();
661  local_coordinates_mbr.detach_from_state();
662 
663  // Postconditions:
664 
665  // Exit
666 
667  return;
668 }
669 
670 
672 void
673 make_hexahedron()
674 {
675  // Preconditions:
676 
677  // Body:
678 
679  total_poset_member local_coordinates_mbr;
680  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
681 
682  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
683 
684  total_poset_member v0(cell_definitions, pdof_map, true, false);
685  v0.put_name("hexahedron-vertex 0", true, false);
686 
687  total_poset_member v1(cell_definitions, pdof_map, true, false);
688  v1.put_name("hexahedron-vertex 1", true, false);
689 
690  total_poset_member v2(cell_definitions, pdof_map, true, false);
691  v2.put_name("hexahedron-vertex 2", true, false);
692 
693  total_poset_member v3(cell_definitions, pdof_map, true, false);
694  v3.put_name("hexahedron-vertex 3", true, false);
695 
696  total_poset_member v4(cell_definitions, pdof_map, true, false);
697  v4.put_name("hexahedron-vertex 4", true, false);
698 
699  total_poset_member v5(cell_definitions, pdof_map, true, false);
700  v5.put_name("hexahedron-vertex 5", true, false);
701 
702  total_poset_member v6(cell_definitions, pdof_map, true, false);
703  v6.put_name("hexahedron-vertex 6", true, false);
704 
705  total_poset_member v7(cell_definitions, pdof_map, true, false);
706  v7.put_name("hexahedron-vertex 7", true, false);
707 
708  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
709  pdof_map = &(local_coordinates_mbr.dof_map());
710 
711  total_poset_member e0(cell_definitions, pdof_map, true, false);
712  e0.put_name("hexahedron-edge 0", true, false);
713  e0.create_cover_link(&v0);
714  e0.create_cover_link(&v1);
715 
716  total_poset_member e1(cell_definitions, pdof_map, true, false);
717  e1.put_name("hexahedron-edge 1", true, false);
718  e1.create_cover_link(&v1);
719  e1.create_cover_link(&v2);
720 
721  total_poset_member e2(cell_definitions, pdof_map, true, false);
722  e2.put_name("hexahedron-edge 2", true, false);
723  e2.create_cover_link(&v2);
724  e2.create_cover_link(&v3);
725 
726  total_poset_member e3(cell_definitions, pdof_map, true, false);
727  e3.put_name("hexahedron-edge 3", true, false);
728  e3.create_cover_link(&v3);
729  e3.create_cover_link(&v0);
730 
731  total_poset_member e4(cell_definitions, pdof_map, true, false);
732  e4.put_name("hexahedron-edge 4", true, false);
733  e4.create_cover_link(&v4);
734  e4.create_cover_link(&v5);
735 
736  total_poset_member e5(cell_definitions, pdof_map, true, false);
737  e5.put_name("hexahedron-edge 5", true, false);
738  e5.create_cover_link(&v5);
739  e5.create_cover_link(&v6);
740 
741  total_poset_member e6(cell_definitions, pdof_map, true, false);
742  e6.put_name("hexahedron-edge 6", true, false);
743  e6.create_cover_link(&v6);
744  e6.create_cover_link(&v7);
745 
746  total_poset_member e7(cell_definitions, pdof_map, true, false);
747  e7.put_name("hexahedron-edge 7", true, false);
748  e7.create_cover_link(&v7);
749  e7.create_cover_link(&v4);
750 
751  total_poset_member e8(cell_definitions, pdof_map, true, false);
752  e8.put_name("hexahedron-edge 8", true, false);
753  e8.create_cover_link(&v3);
754  e8.create_cover_link(&v7);
755 
756  total_poset_member e9(cell_definitions, pdof_map, true, false);
757  e9.put_name("hexahedron-edge 9", true, false);
758  e9.create_cover_link(&v2);
759  e9.create_cover_link(&v6);
760 
761  total_poset_member e10(cell_definitions, pdof_map, true, false);
762  e10.put_name("hexahedron-edge 10", true, false);
763  e10.create_cover_link(&v1);
764  e10.create_cover_link(&v5);
765 
766  total_poset_member e11(cell_definitions, pdof_map, true, false);
767  e11.put_name("hexahedron-edge 11", true, false);
768  e11.create_cover_link(&v0);
769  e11.create_cover_link(&v4);
770 
771  local_coordinates_mbr.attach_to_state(local_coordinates, "quad");
772  pdof_map = &(local_coordinates_mbr.dof_map());
773 
774  total_poset_member f0(cell_definitions, pdof_map, true, false);
775  f0.put_name("hexahedron-face 0", true, false);
776  f0.create_cover_link(&e0);
777  f0.create_cover_link(&e1);
778  f0.create_cover_link(&e2);
779  f0.create_cover_link(&e3);
780 
781  total_poset_member f1(cell_definitions, pdof_map, true, false);
782  f1.put_name("hexahedron-face 1", true, false);
783  f1.create_cover_link(&e4);
784  f1.create_cover_link(&e5);
785  f1.create_cover_link(&e6);
786  f1.create_cover_link(&e7);
787 
788  total_poset_member f2(cell_definitions, pdof_map, true, false);
789  f2.put_name("hexahedron-face 2", true, false);
790  f2.create_cover_link(&e10);
791  f2.create_cover_link(&e5);
792  f2.create_cover_link(&e9);
793  f2.create_cover_link(&e1);
794 
795  total_poset_member f3(cell_definitions, pdof_map, true, false);
796  f3.put_name("hexahedron-face 3", true, false);
797  f3.create_cover_link(&e11);
798  f3.create_cover_link(&e7);
799  f3.create_cover_link(&e8);
800  f3.create_cover_link(&e3);
801 
802  total_poset_member f4(cell_definitions, pdof_map, true, false);
803  f4.put_name("hexahedron-face 4", true, false);
804  f4.create_cover_link(&e0);
805  f4.create_cover_link(&e10);
806  f4.create_cover_link(&e4);
807  f4.create_cover_link(&e11);
808 
809  total_poset_member f5(cell_definitions, pdof_map, true, false);
810  f5.put_name("hexahedron-face 5", true, false);
811  f5.create_cover_link(&e2);
812  f5.create_cover_link(&e9);
813  f5.create_cover_link(&e6);
814  f5.create_cover_link(&e8);
815 
816  //make_6(h, name, f0, f1, f2, f3, f4, f5);
817 
818  local_coordinates_mbr.attach_to_state(local_coordinates, "hexahedron");
819  pdof_map = &(local_coordinates_mbr.dof_map());
820 
821  total_poset_member h(cell_definitions, pdof_map, true, false);
822  h.put_name("hexahedron", true, false);
823  h.create_cover_link(&f0);
824  h.create_cover_link(&f1);
825  h.create_cover_link(&f2);
826  h.create_cover_link(&f3);
827  h.create_cover_link(&f4);
828  h.create_cover_link(&f5);
829 
830  v0.detach_from_state();
831  v1.detach_from_state();
832  v2.detach_from_state();
833  v3.detach_from_state();
834  v4.detach_from_state();
835  v5.detach_from_state();
836  v6.detach_from_state();
837  v7.detach_from_state();
838  e0.detach_from_state();
839  e1.detach_from_state();
840  e2.detach_from_state();
841  e3.detach_from_state();
842  e4.detach_from_state();
843  e5.detach_from_state();
844  e6.detach_from_state();
845  e7.detach_from_state();
846  e8.detach_from_state();
847  e9.detach_from_state();
848  e10.detach_from_state();
849  e11.detach_from_state();
850  f0.detach_from_state();
851  f1.detach_from_state();
852  f2.detach_from_state();
853  f3.detach_from_state();
854  f4.detach_from_state();
855  f5.detach_from_state();
856  h.detach_from_state();
857  local_coordinates_mbr.detach_from_state();
858 
859  // Postconditions:
860 
861  // Exit
862 
863  return;
864 }
865 
866 
868 void
869 make_wedge()
870 {
871  // Preconditions:
872 
873  // Body:
874 
875  total_poset_member local_coordinates_mbr;
876  local_coordinates_mbr.attach_to_state(local_coordinates, "vertex");
877 
878  poset_dof_map* pdof_map = &(local_coordinates_mbr.dof_map());
879 
880  total_poset_member v0(cell_definitions, pdof_map, true, false);
881  v0.put_name("wedge-vertex 0", true, false);
882 
883  total_poset_member v1(cell_definitions, pdof_map, true, false);
884  v1.put_name("wedge-vertex 1", true, false);
885 
886  total_poset_member v2(cell_definitions, pdof_map, true, false);
887  v2.put_name("wedge-vertex 2", true, false);
888 
889  total_poset_member v3(cell_definitions, pdof_map, true, false);
890  v3.put_name("wedge-vertex 3", true, false);
891 
892  total_poset_member v4(cell_definitions, pdof_map, true, false);
893  v4.put_name("wedge-vertex 4", true, false);
894 
895  total_poset_member v5(cell_definitions, pdof_map, true, false);
896  v5.put_name("wedge-vertex 5", true, false);
897 
898 
899  local_coordinates_mbr.attach_to_state(local_coordinates, "edge");
900  pdof_map = &(local_coordinates_mbr.dof_map());
901 
902  total_poset_member e0(cell_definitions, pdof_map, true, false);
903  e0.put_name("wedge-edge 0", true, false);
904  e0.create_cover_link(&v0);
905  e0.create_cover_link(&v1);
906 
907  total_poset_member e1(cell_definitions, pdof_map, true, false);
908  e1.put_name("wedge-edge 1", true, false);
909  e1.create_cover_link(&v1);
910  e1.create_cover_link(&v2);
911 
912  total_poset_member e2(cell_definitions, pdof_map, true, false);
913  e2.put_name("wedge-edge 2", true, false);
914  e2.create_cover_link(&v2);
915  e2.create_cover_link(&v0);
916 
917  total_poset_member e3(cell_definitions, pdof_map, true, false);
918  e3.put_name("wedge-edge 3", true, false);
919  e3.create_cover_link(&v3);
920  e3.create_cover_link(&v4);
921 
922  total_poset_member e4(cell_definitions, pdof_map, true, false);
923  e4.put_name("wedge-edge 4", true, false);
924  e4.create_cover_link(&v4);
925  e4.create_cover_link(&v5);
926 
927  total_poset_member e5(cell_definitions, pdof_map, true, false);
928  e5.put_name("wedge-edge 5", true, false);
929  e5.create_cover_link(&v5);
930  e5.create_cover_link(&v3);
931 
932  total_poset_member e6(cell_definitions, pdof_map, true, false);
933  e6.put_name("wedge-edge 6", true, false);
934  e6.create_cover_link(&v0);
935  e6.create_cover_link(&v3);
936 
937  total_poset_member e7(cell_definitions, pdof_map, true, false);
938  e7.put_name("wedge-edge 7", true, false);
939  e7.create_cover_link(&v1);
940  e7.create_cover_link(&v4);
941 
942  total_poset_member e8(cell_definitions, pdof_map, true, false);
943  e8.put_name("wedge-edge 8", true, false);
944  e8.create_cover_link(&v2);
945  e8.create_cover_link(&v5);
946 
947 
948  local_coordinates_mbr.attach_to_state(local_coordinates, "quad");
949  pdof_map = &(local_coordinates_mbr.dof_map());
950 
951  total_poset_member f0(cell_definitions, pdof_map, true, false);
952  f0.put_name("wedge-face 0", true, false);
953  f0.create_cover_link(&e1);
954  f0.create_cover_link(&e8);
955  f0.create_cover_link(&e4);
956  f0.create_cover_link(&e7);
957 
958  total_poset_member f1(cell_definitions, pdof_map, true, false);
959  f1.put_name("wedge-face 1", true, false);
960  f1.create_cover_link(&e2);
961  f1.create_cover_link(&e6);
962  f1.create_cover_link(&e5);
963  f1.create_cover_link(&e8);
964 
965  total_poset_member f2(cell_definitions, pdof_map, true, false);
966  f2.put_name("wedge-face 2", true, false);
967  f2.create_cover_link(&e0);
968  f2.create_cover_link(&e7);
969  f2.create_cover_link(&e3);
970  f2.create_cover_link(&e6);
971 
972 
973  local_coordinates_mbr.attach_to_state(local_coordinates, "triangle");
974  pdof_map = &(local_coordinates_mbr.dof_map());
975 
976  total_poset_member f3(cell_definitions, pdof_map, true, false);
977  f3.put_name("wedge-face 3", true, false);
978  f3.create_cover_link(&e0);
979  f3.create_cover_link(&e1);
980  f3.create_cover_link(&e2);
981 
982  total_poset_member f4(cell_definitions, pdof_map, true, false);
983  f4.put_name("wedge-face 4", true, false);
984  f4.create_cover_link(&e3);
985  f4.create_cover_link(&e4);
986  f4.create_cover_link(&e5);
987 
988  local_coordinates_mbr.attach_to_state(local_coordinates, "wedge");
989  pdof_map = &(local_coordinates_mbr.dof_map());
990 
991  total_poset_member w(cell_definitions, pdof_map, true, false);
992  w.put_name("wedge", true, false);
993 
994  w.create_cover_link(&f0);
995  w.create_cover_link(&f1);
996  w.create_cover_link(&f2);
997  w.create_cover_link(&f3);
998  w.create_cover_link(&f4);
999 
1000  v0.detach_from_state();
1001  v1.detach_from_state();
1002  v2.detach_from_state();
1003  v3.detach_from_state();
1004  v4.detach_from_state();
1005  v5.detach_from_state();
1006 
1007  e0.detach_from_state();
1008  e1.detach_from_state();
1009  e2.detach_from_state();
1010  e3.detach_from_state();
1011  e4.detach_from_state();
1012  e5.detach_from_state();
1013  e6.detach_from_state();
1014  e7.detach_from_state();
1015  e8.detach_from_state();
1016 
1017  f0.detach_from_state();
1018  f1.detach_from_state();
1019  f2.detach_from_state();
1020  f3.detach_from_state();
1021  f4.detach_from_state();
1022 
1023  w.detach_from_state();
1024  local_coordinates_mbr.detach_from_state();
1025 
1026  // Postconditions:
1027 
1028  // Exit
1029 
1030  return;
1031 }
1032 
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...
A client handle for a subposet.
Definition: subposet.h:86
virtual void schematize(subposet *xtable_dof_subposet, subposet *xrow_dof_subposet, bool xall_members=false)
Prepare this poset and its top member for use as a schema. If xall_members = true, schematize all other members as well.
abstract_poset_member & top()
The top member of the poset (mutable version)
virtual void new_jim_state(poset_dof_map *xdof_map=0, bool xcopy_dof_map=false, bool xauto_access=true)
Creates a new jim (join-irreducible member) state in host() and attaches this to it. If xdof_map == 0 a new dof map is created. If xdof_map != 0 and xcopy_dof_map == false, xdof_map is used as the dof map. If xdof_map != 0 and xcopy_dof_map is true, a copy of xdof_map is used.
The default name space; a poset which contains other posets as members.
primitives_poset & primitives()
The poset of primitives for this namespace (mutable version)
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...
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
void put_dof_tuple(const void *xbuf, size_t xbuflen)
Copies the entire dof tuple between xbuf and internal storage.
A client handle for a member of a namespace poset.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
A client handle for a mutable partially ordered set.
Definition: poset.h:40
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.
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...
virtual void detach_from_state()
Detach this handle from its state, if any.
total_poset_member * l_join(abstract_poset_member *other, bool xnew_jem=true)
lattice join of this with other, auto-, pre-, and self-allocated versions the lattice join is the lea...
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
poset_dof_map & member_dof_map(pod_index_type xmbr_hub_id, bool xrequire_write_access=false)
The dof map associated with the member identified by hub id xmbr_hub_id (mutable version).
Namespace for the sheaves component of the sheaf system.
virtual void detach_from_state()
Detaches this from its state.
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
Prevent editing of jims and jim order relation.
Definition: poset.cc:253
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.
virtual void get_read_access() const
Get read access to the state associated with this.
virtual poset_dof_map & dof_map(bool xrequire_write_access=false)
The map from schema member ids or client ids to dof values for this poset member (mutable version) ...
Agent responsible for importing and exporting posets from an external name space which resides on dis...
Definition: storage_agent.h:74
A client handle for an unrestricted member of a poset. A total_poset_member is guaranteed not to be r...
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
Definition: poset.cc:230