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" 38 using namespace sheaf;
42 void make_base_space_definitions();
46 void make_local_coordinate_definitions();
50 void make_local_coordinates_schema();
54 void make_local_coordinates_jim(
const string& name,
59 void make_cell_definitions();
64 void make_tetrahedron();
65 void make_hexahedron();
70 poset* cell_definitions;
71 poset* local_coordinates;
89 make_base_space_definitions();
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);
107 make_base_space_definitions()
114 make_local_coordinate_definitions();
116 make_cell_definitions();
140 make_local_coordinate_definitions()
148 make_local_coordinates_schema();
153 "local_coordinates_schema/local_coordinates_schema");
155 local_coordinates =
new poset(ns, &local_coordinates_schema_mbr,
156 "local_coordinates");
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);
182 local_coordinates_defns->
put_name(
"local coordinate definitions",
true,
false);
184 delete local_coordinates_defns;
190 lm1.detach_from_state();
191 lm2.detach_from_state();
203 make_local_coordinates_schema()
210 poset* local_coordinates_schema =
new poset(ns, primitives_schema,
211 "local_coordinates_schema");
222 mbr.
new_jim_state(local_coordinates_schema, pdof_map,
false,
false);
223 mbr.
put_name(
"dimension",
true,
false);
226 mbr.
new_jim_state(local_coordinates_schema, pdof_map,
false,
false);
227 mbr.
put_name(
"orientation",
true,
false);
238 local_coordinates_schema_mbr->
put_name(
"local_coordinates_schema",
true,
false);
261 make_local_coordinates_jim(
const string& xname,
267 require(!xname.empty());
268 require(xdimension >= 0);
269 require(xorientation >= 0);
278 Local_coordinates_row_dofs;
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;
288 mbr.
put_dof_tuple(reinterpret_cast<void*>(local_coordinates_dofs),
289 sizeof(Local_coordinates_row_dofs));
301 make_cell_definitions()
309 "local_coordinates_schema/local_coordinates_schema");
311 cell_definitions =
new poset(ns, &local_coordinates_schema_mbr,
353 mbr.
put_name(
"vertex",
true,
false);
380 v0.put_name(
"edge-vertex 0",
true,
false);
383 v1.put_name(
"edge-vertex 1",
true,
false);
386 pdof_map = &(local_coordinates_mbr.
dof_map());
389 e.put_name(
"edge",
true,
false);
391 e.create_cover_link(&v0);
392 e.create_cover_link(&v1);
394 e.detach_from_state();
395 v0.detach_from_state();
396 v1.detach_from_state();
421 v0.put_name(
"triangle-vertex 0",
true,
false);
424 v1.put_name(
"triangle-vertex 1",
true,
false);
427 v2.put_name(
"triangle-vertex 2",
true,
false);
430 pdof_map = &(local_coordinates_mbr.
dof_map());
433 e0.put_name(
"triangle-edge 0",
true,
false);
434 e0.create_cover_link(&v0);
435 e0.create_cover_link(&v1);
438 e1.put_name(
"triangle-edge 1",
true,
false);
439 e1.create_cover_link(&v1);
440 e1.create_cover_link(&v2);
443 e2.put_name(
"triangle-edge 2",
true,
false);
444 e2.create_cover_link(&v2);
445 e2.create_cover_link(&v0);
448 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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();
487 v0.put_name(
"quad-vertex 0",
true,
false);
490 v1.put_name(
"quad-vertex 1",
true,
false);
493 v2.put_name(
"quad-vertex 2",
true,
false);
496 v3.put_name(
"quad-vertex 3",
true,
false);
499 pdof_map = &(local_coordinates_mbr.
dof_map());
502 e0.put_name(
"quad-edge 0",
true,
false);
503 e0.create_cover_link(&v0);
504 e0.create_cover_link(&v1);
507 e1.put_name(
"quad-edge 1",
true,
false);
508 e1.create_cover_link(&v1);
509 e1.create_cover_link(&v2);
512 e2.put_name(
"quad-edge 2",
true,
false);
513 e2.create_cover_link(&v2);
514 e2.create_cover_link(&v3);
517 e3.put_name(
"quad-edge 3",
true,
false);
518 e3.create_cover_link(&v3);
519 e3.create_cover_link(&v0);
522 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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();
565 v0.put_name(
"tetrahedron-vertex 0",
true,
false);
568 v1.put_name(
"tetrahedron-vertex 1",
true,
false);
571 v2.put_name(
"tetrahedron-vertex 2",
true,
false);
574 v3.put_name(
"tetrahedron-vertex 3",
true,
false);
577 pdof_map = &(local_coordinates_mbr.
dof_map());
580 e0.put_name(
"tetrahedron-edge 0",
true,
false);
581 e0.create_cover_link(&v0);
582 e0.create_cover_link(&v1);
585 e1.put_name(
"tetrahedron-edge 1",
true,
false);
586 e1.create_cover_link(&v1);
587 e1.create_cover_link(&v2);
590 e2.put_name(
"tetrahedron-edge 2",
true,
false);
591 e2.create_cover_link(&v2);
592 e2.create_cover_link(&v0);
595 e3.put_name(
"tetrahedron-edge 3",
true,
false);
596 e3.create_cover_link(&v2);
597 e3.create_cover_link(&v3);
600 e4.put_name(
"tetrahedron-edge 4",
true,
false);
601 e4.create_cover_link(&v3);
602 e4.create_cover_link(&v1);
605 e5.put_name(
"tetrahedron-edge 5",
true,
false);
606 e5.create_cover_link(&v3);
607 e5.create_cover_link(&v0);
610 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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);
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);
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);
636 local_coordinates_mbr.
attach_to_state(local_coordinates,
"tetrahedron");
637 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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();
685 v0.put_name(
"hexahedron-vertex 0",
true,
false);
688 v1.put_name(
"hexahedron-vertex 1",
true,
false);
691 v2.put_name(
"hexahedron-vertex 2",
true,
false);
694 v3.put_name(
"hexahedron-vertex 3",
true,
false);
697 v4.put_name(
"hexahedron-vertex 4",
true,
false);
700 v5.put_name(
"hexahedron-vertex 5",
true,
false);
703 v6.put_name(
"hexahedron-vertex 6",
true,
false);
706 v7.put_name(
"hexahedron-vertex 7",
true,
false);
709 pdof_map = &(local_coordinates_mbr.
dof_map());
712 e0.put_name(
"hexahedron-edge 0",
true,
false);
713 e0.create_cover_link(&v0);
714 e0.create_cover_link(&v1);
717 e1.put_name(
"hexahedron-edge 1",
true,
false);
718 e1.create_cover_link(&v1);
719 e1.create_cover_link(&v2);
722 e2.put_name(
"hexahedron-edge 2",
true,
false);
723 e2.create_cover_link(&v2);
724 e2.create_cover_link(&v3);
727 e3.put_name(
"hexahedron-edge 3",
true,
false);
728 e3.create_cover_link(&v3);
729 e3.create_cover_link(&v0);
732 e4.put_name(
"hexahedron-edge 4",
true,
false);
733 e4.create_cover_link(&v4);
734 e4.create_cover_link(&v5);
737 e5.put_name(
"hexahedron-edge 5",
true,
false);
738 e5.create_cover_link(&v5);
739 e5.create_cover_link(&v6);
742 e6.put_name(
"hexahedron-edge 6",
true,
false);
743 e6.create_cover_link(&v6);
744 e6.create_cover_link(&v7);
747 e7.put_name(
"hexahedron-edge 7",
true,
false);
748 e7.create_cover_link(&v7);
749 e7.create_cover_link(&v4);
752 e8.put_name(
"hexahedron-edge 8",
true,
false);
753 e8.create_cover_link(&v3);
754 e8.create_cover_link(&v7);
757 e9.put_name(
"hexahedron-edge 9",
true,
false);
758 e9.create_cover_link(&v2);
759 e9.create_cover_link(&v6);
762 e10.put_name(
"hexahedron-edge 10",
true,
false);
763 e10.create_cover_link(&v1);
764 e10.create_cover_link(&v5);
767 e11.put_name(
"hexahedron-edge 11",
true,
false);
768 e11.create_cover_link(&v0);
769 e11.create_cover_link(&v4);
772 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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);
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);
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);
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);
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);
818 local_coordinates_mbr.
attach_to_state(local_coordinates,
"hexahedron");
819 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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();
881 v0.put_name(
"wedge-vertex 0",
true,
false);
884 v1.put_name(
"wedge-vertex 1",
true,
false);
887 v2.put_name(
"wedge-vertex 2",
true,
false);
890 v3.put_name(
"wedge-vertex 3",
true,
false);
893 v4.put_name(
"wedge-vertex 4",
true,
false);
896 v5.put_name(
"wedge-vertex 5",
true,
false);
900 pdof_map = &(local_coordinates_mbr.
dof_map());
903 e0.put_name(
"wedge-edge 0",
true,
false);
904 e0.create_cover_link(&v0);
905 e0.create_cover_link(&v1);
908 e1.put_name(
"wedge-edge 1",
true,
false);
909 e1.create_cover_link(&v1);
910 e1.create_cover_link(&v2);
913 e2.put_name(
"wedge-edge 2",
true,
false);
914 e2.create_cover_link(&v2);
915 e2.create_cover_link(&v0);
918 e3.put_name(
"wedge-edge 3",
true,
false);
919 e3.create_cover_link(&v3);
920 e3.create_cover_link(&v4);
923 e4.put_name(
"wedge-edge 4",
true,
false);
924 e4.create_cover_link(&v4);
925 e4.create_cover_link(&v5);
928 e5.put_name(
"wedge-edge 5",
true,
false);
929 e5.create_cover_link(&v5);
930 e5.create_cover_link(&v3);
933 e6.put_name(
"wedge-edge 6",
true,
false);
934 e6.create_cover_link(&v0);
935 e6.create_cover_link(&v3);
938 e7.put_name(
"wedge-edge 7",
true,
false);
939 e7.create_cover_link(&v1);
940 e7.create_cover_link(&v4);
943 e8.put_name(
"wedge-edge 8",
true,
false);
944 e8.create_cover_link(&v2);
945 e8.create_cover_link(&v5);
949 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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);
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);
974 pdof_map = &(local_coordinates_mbr.
dof_map());
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);
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);
989 pdof_map = &(local_coordinates_mbr.
dof_map());
992 w.put_name(
"wedge",
true,
false);
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);
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();
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();
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();
1023 w.detach_from_state();
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.
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.
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.
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.
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...
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.