SheafSystem  0.0.0.0
structured_block_2d.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #include "SheafSystem/structured_block_2d.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/arg_list.h"
25 //#include "SheafSystem/base_space_member_prototype.h"
26 #include "SheafSystem/chart_point_3d.h"
27 #include "SheafSystem/fiber_bundles_namespace.h"
28 #include "SheafSystem/namespace_poset.h"
29 #include "SheafSystem/poset_path.h"
30 #include "SheafSystem/preorder_iterator.h"
31 #include "SheafSystem/quad_connectivity.h"
32 #include "SheafSystem/tern.h"
33 #include "SheafSystem/wsv_block.h"
34 
35 using namespace fiber_bundle; // Workaround for MS C++ bug.
36 
37 // ===========================================================
38 // HOST FACTORY FACET
39 // ===========================================================
40 
41 // PUBLIC DATA MEMBERS
42 
43 
44 const sheaf::poset_path&
47 {
48 
49  // Preconditions:
50 
51  // Body:
52 
53  static const poset_path
54  STATIC_PROTOTYPE_PATH(base_space_member::prototypes_poset_name(), "structured_block_2d");
55 
56  const poset_path& result = STATIC_PROTOTYPE_PATH;
57 
58  // Postconditions:
59 
61  ensure(result.member_name() == "structured_block_2d");
62 
63  // Exit
64 
65  return result;
66 }
67 
70 new_host(namespace_type& xns, const poset_path& xhost_path, const poset_path& xschema_path, bool xauto_access)
71 {
72  // cout << endl << "Entering structured_block_2d::new_host." << endl;
73 
74  // Preconditions:
75 
76  require(xns.state_is_auto_read_write_accessible(xauto_access));
77 
78  require(!xhost_path.empty());
79  require(!xns.contains_path(xhost_path, xauto_access));
80 
81  require(xschema_path.full());
82  require(xns.path_is_auto_read_accessible(xschema_path, xauto_access));
83  require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path(), xauto_access));
84 
85  // Body:
86 
87  host_type& result =
88  host_type::new_table(xns, xhost_path, xschema_path, 2, xauto_access);
89 
90  // Postconditions:
91 
92  ensure(xns.owns(result, xauto_access));
93  ensure(result.path(true) == xhost_path);
94  ensure(result.state_is_not_read_accessible());
95  ensure(result.schema(true).path(xauto_access) == xschema_path);
96 
97  ensure(result.max_db() == 2);
98 
99  // Exit:
100 
101  // cout << "Leaving structured_block_2d::new_host." << endl;
102  return result;
103 }
104 
107 standard_host(namespace_type& xns, const poset_path& xhost_path, bool xauto_access)
108 {
109  // cout << endl << "Entering structured_block_2d::standard_host." << endl;
110 
111  // Preconditions:
112 
113  require(xns.state_is_auto_read_write_accessible(xauto_access));
114 
115  require(poset_path::is_valid_name(xhost_path.poset_name()));
116  require(xns.path_is_auto_read_write_available<host_type>(xhost_path.poset_name(), xauto_access));
117 
118  require(xns.path_is_auto_read_accessible(standard_schema_path(), xauto_access));
119 
120  // Body:
121 
122  host_type* result_ptr;
123  if(xns.contains_path(xhost_path.poset_name(), xauto_access))
124  {
125  result_ptr = &xns.member_poset<host_type>(xhost_path, xauto_access);
126  }
127  else
128  {
129  result_ptr = &new_host(xns, xhost_path, standard_schema_path(), xauto_access);
130  }
131 
132  host_type& result = *result_ptr;
133 
134  // Postconditions:
135 
136  ensure(xns.owns(result, xauto_access));
137  ensure(result.path(true) == xhost_path);
138  ensure(result.state_is_not_read_accessible());
139  ensure(result.schema(true).path(xauto_access) == standard_schema_path());
140 
141  ensure(result.max_db() == 2);
142 
143  // Exit:
144 
145  // cout << "Leaving structured_block_2d::standard_host." << endl;
146  return result;
147 }
148 
149 // PROTECTED DATA MEMBERS
150 
151 // PRIVATE DATA MEMBERS
152 
153 
154 // ===========================================================
155 // STRUCTURED_BLOCK_2D FACET
156 // ===========================================================
157 
158 // PUBLIC DATA MEMBERS
159 
162 {
163  // Preconditions:
164 
165  // Body:
166 
167  // Postconditions:
168 
169  ensure(invariant());
170  ensure(!is_attached());
171 }
172 
174 structured_block_2d(const abstract_poset_member& xother, bool xnew_jem)
175 {
176  // Preconditions:
177 
178  require(xnew_jem ? xother.is_attached() : true);
179 
180  // Body:
181 
182  if(xnew_jem)
183  {
184  new_jem_state(const_cast<abstract_poset_member*>(&xother), true, true);
185  }
186  else
187  {
188  attach_to_state(&xother);
189  }
190 
191  // postconditions:
192 
193  ensure(invariant());
194  ensure(is_attached() == xother.is_attached() );
195 }
196 
199 {
200  // Preconditions:
201 
202  // Body:
203 
204  // Exit
205 
206  return;
207 }
208 
209 // NEW HANDLE, NEW STATE CONSTRUCTORS:
210 
213  const size_type& xi_size,
214  const size_type& xj_size,
215  bool xauto_access)
216 {
217  // Preconditions:
218 
219  require(precondition_of(new_state(same args)));
220 
221  // Body:
222 
223  new_state(xhost, xi_size, xj_size, xauto_access);
224 
225  // Postconditions:
226 
227  ensure(postcondition_of(new_state(same args)));
228 
229  // Exit:
230 
231  return;
232 }
233 
234 // NEW HANDLE, EXISTING STATE CONSTRUCTORS:
235 
238 {
239  // Preconditions:
240 
241  require(precondition_of(attach_to_state(xhost, xhub_id)));
242 
243  // Body:
244 
245  attach_to_state(xhost, xhub_id);
246 
247  // Postconditions:
248 
249  ensure(postcondition_of(attach_to_state(xhost, xhub_id)));
250 }
251 
253 structured_block_2d(const poset* xhost, const scoped_index& xid)
254 {
255  // Preconditions:
256 
257  require(precondition_of(attach_to_state(xhost, xid)));
258 
259  // Body:
260 
261  attach_to_state(xhost, xid.hub_pod());
262 
263  // Postconditions:
264 
265  ensure(postcondition_of(attach_to_state(xhost, xid)));
266 }
267 
268 
270 structured_block_2d(const poset* xhost, const std::string& xname)
271 {
272  // Preconditions:
273 
274  require(precondition_of(attach_to_state(same args)));
275 
276  // Body:
277 
278  attach_to_state(xhost, xname);
279 
280  // Postconditions:
281 
282  ensure(postcondition_of(attach_to_state(same args)));
283 }
284 
287  const poset_path& xpath,
288  bool xauto_access)
289 {
290 
291  // Preconditions:
292 
294 
295  require(precondition_of(attach_to_state(same args)));
296 
297  // Body:
298 
299  attach_to_state(xnamespace, xpath, xauto_access);
300 
301  // Postconditions:
302 
303  ensure(postcondition_of(attach_to_state(same args)));
304 
305  // Exit:
306 
307  return;
308 }
309 
312  pod_index_type xposet_id,
313  pod_index_type xmember_id)
314 {
315  // Preconditions:
316 
318 
319  require(precondition_of(attach_to_state(same args)));
320 
321  // Body:
322 
323  attach_to_state(xnamespace, xposet_id, xmember_id);
324 
325  // Postconditions:
326 
327  ensure(postcondition_of(attach_to_state(same args)));
328 
329  // Exit:
330 
331  return;
332 }
333 
336  const scoped_index& xposet_id,
337  const scoped_index& xmember_id)
338 {
339  // Preconditions:
340 
342 
343  require(precondition_of(attach_to_state(same args)));
344 
345  // Body:
346 
347  attach_to_state(xnamespace, xposet_id.hub_pod(), xmember_id.hub_pod());
348 
349  // Postconditions:
350 
351  ensure(postcondition_of(attach_to_state(same args)));
352 
353  // Exit:
354 
355  return;
356 }
357 
358 // EXISTING HANDLE, NEW STATE "CONSTRUCTORS":
359 
360 void
362 new_state(const size_type& xi_size,
363  const size_type& xj_size,
364  bool xauto_access)
365 {
366  // Preconditions:
367 
368  require(precondition_of(new_state(host(), xi_size, xj_size, xauto_access)));
369 
370  // Body:
371 
372  new_state(host(), xi_size, xj_size, xauto_access);
373 
374  // Postconditions:
375 
376  ensure(postcondition_of(new_state(host(), xi_size, xj_size, xauto_access)));
377 
378  // Exit:
379 
380  return;
381 }
382 
383 void
386  const size_type& xi_size,
387  const size_type& xj_size,
388  bool xauto_access)
389 {
390  // Preconditions:
391 
392  require(xhost != 0);
393  require(xauto_access ? xhost->is_attached() : xhost->in_jim_edit_mode());
394  require(xauto_access || xhost->name_space()->state_is_read_accessible());
395  require(xhost->name_space()->contains_poset_member(static_prototype_path(), true));
396  require(xauto_access || xhost->name_space()->member_poset(prototypes_poset_name(), true).state_is_read_accessible());
397 
398  // Get access if auto access is requested. Need to do it here so the
399  // remaining preconditions can be executed.
400 
401  if(xauto_access)
402  {
403  xhost->begin_jim_edit_mode(true);
404  xhost->name_space()->get_read_access();
405  xhost->name_space()->member_poset(prototypes_poset_name(), false).get_read_access();
406  }
407 
408  require(namespace_is_ancestor_of(xhost->name_space()));
409  require(xhost->schema().row_conforms_to(standard_schema_path()));
410 
412 
413  require(dynamic_cast<base_space_poset*>(xhost) != 0);
414 
415  // Body:
416 
417  base_space_poset* lhost = dynamic_cast<base_space_poset*>(xhost);
418 
419  // Get the size for the interval.
420 
421  size_type lsize;
422  structured_block_2d_crg_interval::get_size(xi_size, xj_size, lsize);
423 
424  // Get the dof tuple_ids.
425 
426  block<pod_index_type> ldof_tuple_ids;
427  structured_block_2d_crg_interval::get_dof_tuple_ids(*xhost, xi_size, xj_size, ldof_tuple_ids);
428 
429  // Get the private data for the interval
430 
431  block<pod_index_type> ldata;
433 
434  // Create the implicit crg interval for the block.
435 
436  pod_index_type lindex =
437  lhost->new_member_interval("structured_block_2d_crg_interval", lsize, ldof_tuple_ids, ldata);
438 
439  // Attach this handle to it.
440 
441  attach_to_state(lhost, lindex);
442 
443  // Block is linked to bottom via implicit lower cover of vertices,
444  // but not linked to top; link it now.
445 
446  lhost->top().create_cover_link(this);
447 
448  // Postconditions:
449 
450  ensure(invariant());
451  ensure(host() == xhost);
452  ensure(is_attached());
453  ensure(db() == 2);
454  ensure(prototype_path() == static_prototype_path());
455  ensure(local_cell_type_name() == static_local_cell_prototype_path().member_name());
456  ensure(i_size() == xi_size);
457  ensure(j_size() == xj_size);
458 
459  // Release access if auto access was requested.
460 
461  if(xauto_access)
462  {
463  xhost->name_space()->member_poset(prototypes_poset_name(), false).release_access();
464  xhost->name_space()->release_access();
465 
466  // End jim edit mode without ensure_lattice_invariant;
467  // the check is unnecessary and expensive.
468 
469  xhost->end_jim_edit_mode(false, true);
470  }
471 
472  // Exit:
473 
474  return;
475 }
476 
477 // FEATURES:
478 
481 i_size() const
482 {
483  // Preconditions:
484 
485  require(state_is_read_accessible());
486 
487  // Body:
488 
489  size_type result = interval().i_size();
490 
491  // Postconditions:
492 
493  // Exit
494 
495  return result;
496 }
497 
500 j_size() const
501 {
502  // Preconditions:
503 
504  require(state_is_read_accessible());
505 
506  // Body:
507 
508  size_type result = interval().j_size();
509 
510  // Postconditions:
511 
512  // Exit
513 
514  return result;
515 }
516 
517 // PROTECTED DATA MEMBERS
518 
521 new_row_dof_map(poset_state_handle& xhost, size_type xi_size, size_type xj_size, bool xauto_access)
522 {
523  // Preconditions:
524 
525  require(xhost.state_is_auto_read_write_accessible(xauto_access));
526  require(xauto_access || xhost.name_space()->poset_state_is_read_accessible(static_prototype_path()));
527  require(xhost.name_space()->contains_poset_member(static_prototype_path()));
528  require(xhost.name_space()->contains_poset_member(static_local_cell_prototype_path()));
529 
530  // Body:
531 
532  if(xauto_access)
533  {
534  xhost.get_read_write_access();
535  }
536 
537  define_old_variable(int old_xhost_row_dof_tuple_ct = xhost.row_dof_tuple_ct());
538 
539  // Create the dof map and set dofs to defaults.
540 
541  scoped_index result = xhost.new_row_dof_map();
542  row_dof_tuple_type* ltuple =
543  reinterpret_cast<row_dof_tuple_type*>(xhost.row_dof_map(result, true).dof_tuple());
544 
545  // Get the block prototype.
546 
547  base_space_member lproto(xhost.name_space(), static_prototype_path(), xauto_access);
548 
549  // Get the local cell prototype.
550 
551  base_space_member local_proto(xhost.name_space(), static_local_cell_prototype_path(), xauto_access);
552 
553  // Copy the dofs from the prototypes..
554 
555  ltuple->db = lproto.db();
556  ltuple->type_id = lproto.type_id();
557  ltuple->type_name = strdup(lproto.type_name());
558  ltuple->refinement_depth = lproto.refinement_depth();
559  ltuple->local_cell_type_id = local_proto.type_id();
560  ltuple->local_cell_type_name = strdup(local_proto.type_name());
561  ltuple->size = xi_size*xj_size;
562  ltuple->i_size = xi_size;
563  ltuple->j_size = xj_size;
564 
565  // Release the prototypes.
566 
567  local_proto.detach_from_state();
568  lproto.detach_from_state();
569 
570  if(xauto_access)
571  {
572  xhost.release_access();
573  }
574 
575  // Postconditions:
576 
577  ensure(xhost.row_dof_tuple_ct() == old_xhost_row_dof_tuple_ct + 1);
578 
579  // Exit:
580 
581  return result;
582 }
583 
584 // PRIVATE DATA MEMBERS
585 
586 
587 // ===========================================================
588 // STRUCTURED_BLOCK FACET
589 // ===========================================================
590 
591 // PUBLIC DATA MEMBERS
592 
593 // PROTECTED DATA MEMBERS
594 
595 // PRIVATE DATA MEMBERS
596 
597 
598 // ===========================================================
599 // LOCAL_BASE_SPACE_MEMBER FACET
600 // ===========================================================
601 
602 // PUBLIC DATA MEMBERS
603 
604 void
606 refine_point_pa(const chart_point& xpt, chart_point& result) const
607 {
608  // Preconditions:
609 
610  require(state_is_read_accessible());
611 
612  require(xpt.chart_id() == index().pod());
613 
614  // See comment at structured_block::refine_point_pa.
615 
616  require(xpt.db() >= db());
617  require(result.db() >= db());
618 
619 
620  // Body:
621 
622  // Transform to zone-local coordinates..
623 
624  chart_point_coord_type lu_coord = xpt.local_coords()[0];
625  scoped_index::pod_type lu_chart_id;
626  refine_coordinate(lu_coord, lu_chart_id, i_size());
627 
628  chart_point_coord_type lv_coord = xpt.local_coords()[1];
629  scoped_index::pod_type lv_chart_id;
630  refine_coordinate(lv_coord, lv_chart_id, j_size());
631 
632  // Compute chart sequence id from components.
633 
634  pod_index_type lref_chart_id =
635  _elements_id_space->hub_pod(offset(lu_chart_id, lv_chart_id));
636 
637  // Store result.
638 
639  result.put_chart_id(lref_chart_id);
640  result.put_local_coord(0, lu_coord);
641  result.put_local_coord(1, lv_coord);
642 
643  // Postconditions:
644 
645  // see $$ISSUE at structured_block::unrefine_pt_pa.
646  // ensure(covers(result.chart_id()));
647 
648  // Exit:
649 
650  return;
651 }
652 
653 void
656 {
657  // Preconditions:
658 
659  require(state_is_read_accessible());
660 
661  require(xpt.chart_id() == index().pod());
662 
663  // See comment at structured_block::refine_point_pa.
664 
665  require(xpt.db() >= db());
666 
667  // Body:
668 
669  // Transform to zone-local coordinates..
670 
671  chart_point_coord_type lu_coord = xpt.local_coords()[0];
672  scoped_index::pod_type lu_chart_id;
673  refine_coordinate(lu_coord, lu_chart_id, i_size());
674 
675  chart_point_coord_type lv_coord = xpt.local_coords()[1];
676  scoped_index::pod_type lv_chart_id;
677  refine_coordinate(lv_coord, lv_chart_id, j_size());
678 
679  // Compute chart sequence id from components.
680 
681  pod_index_type lref_chart_id = offset(lu_chart_id, lv_chart_id);
682 
683  // Convert sequence id to poset id and store result.
684 
685  chart_point_3d lref_pt(_elements_id_space->hub_pod(lref_chart_id),
686  lu_coord, lv_coord, 0.0);
687  result.set_ct(0);
688  result.push_back(lref_pt);
689 
690  // The computation above computes a sort of "principal value"
691  // chart point: if xpt is on the boundary between two zones,
692  // refine_coordinate always returns the coordinate lower bound
693  // in the greater zone. Since zones are closed and share boundaries,
694  // a point on a boundary is really in multiple zones. To return
695  // all the zones a point is in we have to figure out if it is on a
696  // boundary and if so, which boundary it is on. Then we have to
697  // generate the chart points for all the neighboring zones which
698  // contain the boundary. To do this, we first compute a 2 bit code:
699  // bit 0 = is on u boundary, bit 1 = is on v boundary.
700  // Then we test the code to generate the appropriate chart points.
701 
702 
703  unsigned int lbit_code = 0;
704 
705  if(is_close_enough(lu_coord, -1.0) && (lu_chart_id > 0))
706  {
707  // Point is on an u-boundary.
708 
709  lbit_code |= static_cast<unsigned int>(1);
710  }
711 
712  if(is_close_enough(lv_coord, -1.0) && (lv_chart_id > 0))
713  {
714  // Point is on a v-boundary.
715 
716  lbit_code |= static_cast<unsigned int>(2);
717  }
718 
719  // Consider the "principal value" chart to be in the u > 0, v > 0 quadrant.
720 
721  if((lbit_code & 1) == 1)
722  {
723  // Point is on the u = 0 edge; return the u < 0, v > 0 zone.
724 
725  --lu_chart_id;
726  lref_chart_id = offset(lu_chart_id, lv_chart_id);
727 
728  // Convert sequence id to poset id and store result.
729 
730  lref_pt.put(_elements_id_space->hub_pod(lref_chart_id),
731  1.0, lv_coord, 0.0);
732  result.push_back(lref_pt);
733  }
734 
735  if((lbit_code & 2) == 2)
736  {
737  // Point is on the v = 0 edge; return the u > 0, v < 0 zone.
738 
739  --lv_chart_id;
740  lref_chart_id = offset(lu_chart_id, lv_chart_id);
741 
742  // Convert sequence id to poset id and store result.
743 
744  lref_pt.put(_elements_id_space->hub_pod(lref_chart_id),
745  lu_coord, 1.0, 0.0);
746  result.push_back(lref_pt);
747  }
748 
749  if((lbit_code & 3) == 3)
750  {
751  // Point is on the u = 0, v = 0 vertex; return the u < 0, v < 0 zone.
752 
753  --lu_chart_id;
754  --lv_chart_id;
755  lref_chart_id = offset(lu_chart_id, lv_chart_id);
756 
757  // Convert sequence id to poset id and store result.
758 
759  lref_pt.put(_elements_id_space->hub_pod(lref_chart_id),
760  1.0, 1.0, 0.0);
761  result.push_back(lref_pt);
762  }
763 
764  // Postconditions:
765 
766  // see $$ISSUE at structured_block::unrefine_pt_pa.
767  // ensure(covers(result.chart_id()));
768 
769  // Exit:
770 
771  return;
772 }
773 
774 void
776 unrefine_point_pa(const chart_point& xpt, chart_point& result) const
777 {
778  // Preconditions:
779 
780  require(state_is_read_accessible());
781 
782  // see $$ISSUE at structured_block::unrefine_pt_pa.
783  // require(covers(xpt.chart_id()));
784 
785  // See comment at structured_block::unrefine_point_pa.
786 
787  require(xpt.db() >= db());
788  require(result.db() >= db());
789  require(host()->contains_member(xpt.chart_id()));
790 
791  // Body:
792 
793  // Convert poset id to sequence id.
794 
795  pod_index_type lref_chart_id = _elements_id_space->pod(xpt.chart_id());
796 
797  // Assume refined local coordinates [-1, 1]; map to [0, 1] ...
798 
799  double lxcoord = (xpt.local_coord(0) + 1.0)*0.5;
800  double lycoord = (xpt.local_coord(1) + 1.0)*0.5;
801 
802  // ... and then to unrefined coord [0, i_size] ...
803 
804  size_type l_id = lref_chart_id;
805  lxcoord = lxcoord + l_id/j_size();
806  lycoord = lycoord + l_id%j_size();
807 
808  // ... and then to unrefined [-1, 1]
811 
812  lxcoord = (lxcoord/i_size())*2.0 - 1.0;
813  lycoord = (lycoord/j_size())*2.0 - 1.0;
814 
815  // Store result.
816 
817  result.put_chart_id(index().pod());
818 
819  result.put_local_coord(0, lxcoord);
820  result.put_local_coord(1, lycoord);
821 
822  // Exit:
823 
824  return;
825 }
826 
827 void
830 {
831  // Preconditions:
832 
833  require(state_is_read_write_accessible());
834  require(is_jim());
835 
836  // Body:
837 
838  not_implemented();
839 
840  // Postconditions:
841 
842  ensure(!is_jim());
843 
844  // Exit:
845 
846  return;
847 }
848 
849 
850 void
853 {
854  // Preconditions:
855 
856  require(state_is_read_write_accessible());
857  require(!is_jim());
858 
859  // Body:
860 
861  not_implemented();
862 
863  // Postconditions:
864 
865  ensure(is_jim());
866 
867  // Exit:
868 
869  return;
870 }
871 
872 void
875 {
876  // Preconditions:
877 
878  require(state_is_read_write_accessible());
879  require(is_jim());
880 
881  // Body:
882 
883  not_implemented();
884 
885  // Postconditions:
886 
887  ensure(!is_jim());
888 
889  // Exit:
890 
891  return;
892 }
893 
894 
895 void
898 {
899  // Preconditions:
900 
901  require(state_is_read_write_accessible());
902  require(!is_jim());
903 
904  // Body:
905 
906  not_implemented();
907 
908  // Postconditions:
909 
910  ensure(is_jim());
911 
912  // Exit:
913 
914  return;
915 }
916 
917 // PROTECTED DATA MEMBERS
918 
919 // PRIVATE DATA MEMBERS
920 
921 
922 // ===========================================================
923 // HOMOGENEOUS_BLOCK FACET
924 // ===========================================================
925 
926 // PUBLIC DATA MEMBERS
927 
928 const sheaf::poset_path&
931 {
932 
933  // Preconditions:
934 
935  // Body:
936 
939 
940  static const poset_path
941  STATIC_LOCAL_CELL_PROTOTYPE_PATH(base_space_member::prototypes_poset_name(),
942  "quad_nodes");
943 
944  const poset_path& result = STATIC_LOCAL_CELL_PROTOTYPE_PATH;
945 
946  // Postconditions:
947 
949  ensure(result.member_name() == "quad_nodes");
950 
951  // Exit
952 
953  return result;
954 }
955 
956 // PROTECTED DATA MEMBERS
957 
960 interval() const
961 {
962  return *reinterpret_cast<const structured_block_2d_crg_interval*>(_interval);
963 }
964 
965 // PRIVATE DATA MEMBERS
966 
967 
968 // ===========================================================
969 // BASE_SPACE_MEMBER FACET
970 // ===========================================================
971 
972 // PUBLIC DATA MEMBERS
973 
974 // PROTECTED DATA MEMBERS
975 
976 // PRIVATE DATA MEMBERS
977 
978 
979 // ===========================================================
980 // TOTAL_POSET_MEMBER FACET
981 // ===========================================================
982 
983 // PUBLIC DATA MEMBERS
984 
985 // PROTECTED DATA MEMBERS
986 
987 // PRIVATE DATA MEMBERS
988 
989 
990 // ===========================================================
991 // ABSTRACT_POSET_MEMBER FACET
992 // ===========================================================
993 
994 // PUBLIC DATA MEMBERS
995 
998 clone() const
999 {
1000 
1001  // Preconditions:
1002 
1003  // Body:
1004 
1005  // create new handle of the current class.
1006 
1007  structured_block_2d *result = new structured_block_2d();
1008 
1009  // Postconditions:
1010 
1011  ensure(result != 0);
1012  ensure(result->invariant());
1013 
1014  // Exit:
1015 
1016  return result;
1017 
1018 }
1019 
1020 // PROTECTED DATA MEMBERS
1021 
1022 // PRIVATE DATA MEMBERS
1023 
1024 
1025 // ===========================================================
1026 // ANY FACET
1027 // ===========================================================
1028 
1029 // PUBLIC DATA MEMBERS
1030 
1031 bool
1033 invariant() const
1034 {
1035  // Preconditions:
1036 
1037  // Body:
1038 
1039  // Must satisfy base class invariant
1040 
1041  invariance(structured_block::invariant());
1042 
1043  if(invariant_check())
1044  {
1045  // Prevent recursive calls to invariant
1046 
1047  disable_invariant_check();
1048 
1049  // Invariants for this class:
1050 
1051  invariance(state_is_read_accessible() ? is_jim(false) : true);
1052  invariance(state_is_read_accessible() ? size() == i_size()*j_size() : true);
1053 
1054  // Finished, turn invariant checking back on.
1055 
1056  enable_invariant_check();
1057  }
1058 
1059  // Postconditions:
1060 
1061  // Exit
1062 
1063  return true;
1064 }
1065 
1066 
1067 bool
1069 is_ancestor_of(const any* xother) const
1070 {
1071  bool result;
1072 
1073  // Preconditions:
1074 
1075  // Body:
1076 
1077  result = dynamic_cast<const structured_block_2d*>(xother) != 0;
1078 
1079  // Postconditions:
1080 
1081  // Exit
1082 
1083  return result;
1084 }
1085 
1089 {
1090  // Preconditions:
1091 
1092  // Body:
1093 
1094  attach_to_state(&xother);
1095 
1096  // Postconditions:
1097 
1098  ensure(is_same_state(&xother));
1099 
1100  // Exit
1101 
1102  return *this;
1103 }
1104 
1108 {
1109 
1110  // Preconditions:
1111 
1112  require(is_ancestor_of(&xother));
1113 
1114  // Body
1115 
1116  not_implemented();
1117 
1118  // Postconditions
1119 
1120  ensure(invariant());
1121 
1122  // Exit
1123 
1124  return *this;
1125 
1126 }
1127 
1128 // PROTECTED DATA MEMBERS
1129 
1130 // PRIVATE DATA MEMBERS
1131 
1132 
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...
double chart_point_coord_type
The type of local coordinate in the base space; the scalar type for the local coordinate vector space...
Definition: fiber_bundle.h:57
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
structured_block_2d()
Default constructor; creates a new, unattached structured_block_2d handle.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
virtual structured_block_2d & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
bool path_is_auto_read_write_available(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath does not exist or exists and is auto read-write accessible...
virtual void create_cover_link(abstract_poset_member *xlesser)
Insert a link from this to lesser; make lesser <= this.
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
abstract_poset_member & top()
The top member of the poset (mutable version)
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
A homogeneous collection of connected quads arranged in an i_size() x j_size() array.
size_type size
The number of local cells.
A point in a 3D chart space.
poset_path path(bool xauto_access=true) const
A path to this component.
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...
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
const char * local_cell_type_name
The local cell type name.
virtual int db() const =0
The dimension of this chart.
Definition: chart_point.cc:141
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
virtual void * dof_tuple()=0
The dof tuple (mutable version).
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
static const poset_path & static_prototype_path()
The path of the prototype required by this class.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
Definition: chart_point.cc:103
A point in chart space.
Definition: chart_point.h:52
virtual bool invariant() const
Class invariant.
pod_index_type chart_id() const
The id of the chart this point is in.
Definition: chart_point.cc:96
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
static const poset_path & static_local_cell_prototype_path()
The path of the local cell prototype required by this class.
static const std::string & prototypes_poset_name()
The name of the prototypes poset.
Emulator for a interval of implicit base space members representing a 2 dimensional structured block...
virtual structured_block_2d * clone() const
Make a new handle, no state instance of current.
A client handle for a member of a base space poset.
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...
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
Struct representing the closed interval [_begin, _end].
Definition: interval_set.h:48
virtual coord_type * local_coords()=0
The array of local coordinates.
Definition: chart_point.cc:209
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
virtual const structured_block_2d_crg_interval & interval() const
The implicit interval member for this block.
size_type i_size
The upper bound on the x direction index for structured blocks.
A client handle for a mutable partially ordered set.
Definition: poset.h:40
virtual const scoped_index & new_row_dof_map()
Creates a new row dof map.
bool owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
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.
virtual void unrefine_point_pa(const chart_point &xpt, chart_point &result) const
The point in this which is the same as xpt in the direct refinement of this; pre-allocated version...
virtual void get_read_access() const
Get read access to the state associated with this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
std::string poset_name() const
The poset name part of the path.
Definition: poset_path.cc:473
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
size_type row_dof_tuple_ct() const
The number of row_dof_tuples of this poset.
virtual void refine_point_pa(const chart_point &xpt, chart_point &result) const
The point in the direct refinement of this which is the same as xpt in this; pre-allocated version...
size_type i_size() const
The number of local cells (zones) in the i direction. The number of vertices in the i direction is i_...
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
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 ~structured_block_2d()
Destructor; deletes a poset member and its attached state, if any.
static void get_private_data(size_type xi_size, size_type xj_size, block< pod_index_type > &result)
The private data for an instance with parameter xi_size.
virtual void unsimplify()
Removes the standard simplex refinement of this from its lower cover and changes this from a jrm to a...
size_type j_size
The upper bound on the y direction index for structured blocks.
bool poset_state_is_read_accessible(const poset_path &xpath, bool xauto_access=true) const
True if the poset referred to by xpath is read accessible.
virtual poset_dof_map & row_dof_map(pod_index_type xtuple_hub_id, bool xrequire_write_access=false) const
The map from row dof client_ids to row dof values for dof tuple hub id xtuple_hub_id.
namespace_poset * name_space() const
The namespace this poset resides in.
virtual bool is_attached() const
True if this is attached to a state.
static void get_dof_tuple_ids(poset_state_handle &xhost, size_type xi_size, size_type xj_size, block< pod_index_type > &result)
The dof tuple ids for an instance created with parameter xi_size.
pod_index_type pod_type
The "plain old data" storage type for this.
Definition: scoped_index.h:128
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
void put(pod_index_type xchart_id, coord_type xu, coord_type xv, coord_type xw)
Sets chart_id() == xchart_id, u() == xu, v() == xv, w() == xw.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, bool xauto_access)
Creates a new host poset for members of this type. The poset is created in namespace xns with path xh...
std::string member_name() const
The member name part of the path.
Definition: poset_path.cc:511
virtual pod_index_type new_member_interval(const std::string &xinterval_type, size_type xsize, const block< pod_index_type > &xdof_tuple_ids, const block< pod_index_type > &xdata)
Create a disconnected member interval of type xinterval_type with size xsize, dof tuple ids xdof_tupl...
virtual bool invariant() const
Class invariant.
virtual void put_local_coord(int xi, coord_type xvalue)=0
Sets the xi-th local coordinate of this point to xvalue.
Definition: chart_point.cc:187
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
static bool is_valid_name(const std::string &xname)
True if xname is not empty and contains only name legal characters.
Definition: poset_path.cc:331
virtual void get_read_access() const
Get read access to the state associated with this.
int max_db() const
The maximum dimension of the members of this base space.
An abstract client handle for a member of a poset.
static scoped_index new_row_dof_map(poset_state_handle &xhost, size_type xi_size, size_type xj_size, bool xauto_access)
Creates a new row dof map and initializes it.
bool row_conforms_to(const schema_poset_member &xother) const
True if the row dofs defined by this agree in type and in order with the dofs defined by xother...
The type of row dof tuple for base_space_member.
bool in_jim_edit_mode() const
True if editing jims and jim order relation is allowed.
static void get_size(size_type xi_size, size_type xj_size, size_type &result)
The size for an instance created with parameter xi_size.
void new_state(const size_type &xi_size, const size_type &xj_size, bool xauto_access=true)
Creates a new structured_block_2d state in host() with i_size() == xi_size and j_size() == xj_size an...
Namespace for the fiber_bundles component of the sheaf system.
virtual coord_type local_coord(int xi) const =0
The xi-th local coordinate of this point.
Definition: chart_point.cc:163
bool state_is_not_read_accessible() const
True if this is attached and if the state is accessible for read or if access control is disabled...
virtual void unrefine()
Removes the standard refinement of this from its lower cover and changes this from a jrm to a jim...
virtual void simplify()
Inserts the standard simplex refinement of this into its lower cover and changes this from a jim to a...
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 refine()
Inserts the standard refinement of this into its lower cover and changes this from a jim to a jrm...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
Definition: poset.cc:230
size_type j_size() const
The number of local cells (zones) in the j direction. The number of vertices in the j direction is j_...