SheafSystem  0.0.0.0
sec_e3_uniform.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/sec_e3_uniform.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/base_space_poset.h"
25 #include "SheafSystem/binary_section_space_schema_member.impl.h"
26 #include "SheafSystem/at0_space.h"
27 #include "SheafSystem/at1_space.h"
28 #include "SheafSystem/e3.h"
29 #include "SheafSystem/fiber_bundles_namespace.h"
30 #include "SheafSystem/sec_at0.h"
31 #include "SheafSystem/sec_at0_space.h"
32 #include "SheafSystem/sec_at1_space.h"
33 #include "SheafSystem/sec_rep_space.h"
34 #include "SheafSystem/structured_block_3d.h"
35 #include "SheafSystem/sec_tuple.impl.h"
36 #include "SheafSystem/sec_tuple_space.impl.h"
37 #include "SheafSystem/sec_vd.impl.h"
38 
39 using namespace std;
40 using namespace fiber_bundle; // Workaround for MS C++ bug.
41 
42 //==============================================================================
43 // CLASS SEC_E3_UNIFORM
44 //==============================================================================
45 
46 // ===========================================================
47 // HOST FACTORY FACET OF CLASS SEC_E3_UNIFORM
48 // ===========================================================
49 
50 // PUBLIC MEMBER FUNCTIONS
51 
55  const poset_path& xhost_path,
56  const poset_path& xschema_path,
57  const poset_path& xscalar_space_path,
58  bool xauto_access)
59 {
60  // cout << endl << "Entering sec_e3_uniform::new_host." << endl;
61 
62  // Preconditions:
63 
64  require(xns.state_is_auto_read_write_accessible(xauto_access));
65 
66  require(!xhost_path.empty());
67  require(!xns.contains_path(xhost_path, xauto_access));
68 
69  require(xschema_path.full());
70  require(xns.path_is_auto_read_accessible<schema_type::host_type>(xschema_path, xauto_access));
71  require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
72 
73  require(xns.path_is_auto_read_accessible<scalar_type::host_type>(xscalar_space_path, xauto_access));
74 
75  require(host_type::same_scalar_fiber_space(xns, xschema_path, xscalar_space_path, xauto_access));
76 
77  // Body:
78 
79  host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xscalar_space_path, xauto_access);
80 
81  // Postconditions:
82 
83  ensure(xns.owns(result, xauto_access));
84  ensure(result.path(true) == xhost_path);
85  ensure(result.state_is_not_read_accessible());
86  ensure(result.schema(true).path(xauto_access) == xschema_path);
87 
88  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
89  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
90  ensure(result.d(true) == result.dd(true));
91  ensure(result.scalar_space_path(true) == xscalar_space_path);
92  ensure(result.p(true) == result.schema(true).fiber_space<fiber_type::host_type>().p(xauto_access));
93  ensure(result.p(true) == 1);
94  ensure(result.dd(true) == result.schema(true).fiber_space<fiber_type::host_type>().dd(xauto_access));
95  ensure(result.vector_space_path(true) == xhost_path);
96 
97  // Exit:
98 
99  // cout << "Leaving sec_e3_uniform::new_host." << endl;
100  return result;
101 }
102 
106  const poset_path& xbase_path,
107  const poset_path& xrep_path,
108  const std::string& xsection_suffix,
109  const std::string& xfiber_suffix,
110  bool xauto_access)
111 {
112  // cout << endl << "Entering sec_e3_uniform::new_host." << endl;
113 
114  // Preconditions:
115 
116  require(xns.state_is_auto_read_write_accessible(xauto_access));
117 
118  require(xbase_path.full());
119  require(xns.path_is_auto_read_accessible<base_space_poset>(xbase_path, xauto_access));
120 
121  require(xrep_path.empty() || xrep_path.full());
122  require(xrep_path.empty() || xns.path_is_auto_read_accessible<sec_rep_descriptor_poset>(xrep_path, xauto_access));
123 
124  require(xsection_suffix.empty() || poset_path::is_valid_name(xsection_suffix));
125 
126  require(xfiber_suffix.empty() || poset_path::is_valid_name(xfiber_suffix));
127 
128  require(standard_host_is_available<sec_e3_uniform>(xns, xbase_path, xrep_path, xsection_suffix, xfiber_suffix, xauto_access));
129  require(fiber_type::standard_host_is_available<fiber_type>(xns, xfiber_suffix, xauto_access));
130  require(schema_type::standard_host_is_available<sec_e3_uniform>(xns, xbase_path, xrep_path, xfiber_suffix, xauto_access));
131 
132  // Body:
133 
134  poset_path lstd_path = standard_host_path<sec_e3_uniform>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix);
135 
136  host_type* lresult_ptr;
137 
138  if(xns.contains_path(lstd_path, xauto_access))
139  {
140  // Standard host already exists, just return it.
141 
142  lresult_ptr = &xns.member_poset<host_type>(lstd_path, xauto_access);
143  }
144  else
145  {
146  // Standard host doesn't exist, have to create it.
147 
148  // Apply default for rep path if needed.
149 
150  poset_path lrep_path = (!xrep_path.empty() ? xrep_path : standard_rep_path());
151 
152  // Find or create the standard schema member.
153 
154  poset_path lstd_schema_path =
155  schema_type::standard_member<sec_e3_uniform>(xns, xbase_path, lrep_path, xfiber_suffix, xauto_access);
156 
157  // Find or create the standard scalar space.
158 
159  poset_path lscalar_space_path =
160  scalar_type::standard_host(xns, xbase_path, lrep_path, xsection_suffix, xfiber_suffix, xauto_access).path(xauto_access);
161 
162  // Create the standard host.
163 
164  lresult_ptr = &new_host(xns, lstd_path, lstd_schema_path, lscalar_space_path, xauto_access);
165  }
166 
167  host_type& result = *lresult_ptr;
168 
169  // Postconditions:
170 
171  ensure(xns.owns(result, xauto_access));
172  ensure(result.path(true) == standard_host_path<sec_e3_uniform>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix));
173  ensure(result.state_is_not_read_accessible());
174  ensure(result.schema(true).path(xauto_access) ==
175  schema_type::standard_member_path<sec_e3_uniform>(xbase_path, xrep_path, xfiber_suffix));
176 
177  ensure(result.factor_ct(true) == result.schema(true).fiber_space<fiber_type::host_type>().factor_ct(xauto_access));
178  ensure(result.d(true) == result.schema(true).fiber_space<fiber_type::host_type>().d(xauto_access));
179  ensure(result.d(true) == result.dd(true));
180  ensure(result.scalar_space_path(true) ==
181  scalar_type::standard_host_path<scalar_type>(xbase_path, result.rep().path(xauto_access), xsection_suffix, xfiber_suffix));
182  ensure(result.p(true) == result.schema(true).fiber_space<fiber_type::host_type>().p(xauto_access));
183  ensure(result.p(true) == 1);
184  ensure(result.dd(true) == result.schema(true).fiber_space<fiber_type::host_type>().dd(xauto_access));
185  ensure(result.vector_space_path(true) == result.path(true));
186 
187  // Exit:
188 
189  // cout << "Leaving sec_e3_uniform::new_host." << endl;
190  return result;
191 }
192 
193 // PROTECTED MEMBER FUNCTIONS
194 
195 // PRIVATE MEMBER FUNCTIONS
196 
197 
198 //==============================================================================
199 // E3_UNIFORM FACET OF CLASS SEC_E3_UNIFORM
200 //==============================================================================
201 
202 // PUBLIC MEMBER FUNCTIONS
203 
206 {
207 
208  // Preconditions:
209 
210  // Body:
211 
212  // Postconditions:
213 
214  ensure(invariant());
215 }
216 
217 // =============================================================================
218 // NEW HANDLE, NEW STATE CONSTRUCTORS
219 // =============================================================================
220 
223  const block<dof_type>& xmin,
224  const block<dof_type>& xmax,
225  bool xauto_access)
226 {
227  // Preconditions:
228 
229  require(precondition_of(new_jim_state(xhost, xmin, xmax, xauto_access)));
230 
231  // Body:
232 
233  new_jim_state(xhost, xmin, xmax, xauto_access);
234 
235  // Postconditions:
236 
237  ensure(postcondition_of(new_jim_state(xhost, xmin, xmax, xauto_access)));
238 
239  // Exit:
240 
241  return;
242 }
243 
244 
246 sec_e3_uniform(sec_rep_space* xhost, section_dof_map* xdof_map, bool xauto_access)
247 {
248  // Preconditions:
249 
250  require(precondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
251 
252  // Body:
253 
254  new_jim_state(xhost, xdof_map, false, xauto_access);
255 
256  // Postconditions:
257 
258  ensure(postcondition_of(new_jim_state(xhost, xdof_map, false, xauto_access)));
259 
260  // Exit:
261 
262  return;
263 }
264 
267  abstract_poset_member& xbase_mbr,
268  int xbase_version,
269  bool xauto_access)
270 {
271 
272  // Preconditions:
273 
274  require(precondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
275 
276  // Body:
277 
278  new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
279 
280  // Postconditions:
281 
282  ensure(postcondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
283 
284  // Exit:
285 
286  return;
287 }
288 
290 sec_e3_uniform(sec_rep_space* xhost, const subposet& xbase_parts, bool xauto_access)
291 {
292  // Preconditions:
293 
294  require(precondition_of(new_jim_state(xhost, xbase_parts, xauto_access)));
295 
296  // Body:
297 
298  new_jrm_state(xhost, xbase_parts, xauto_access);
299 
300  // Postconditions:
301 
302  require(postcondition_of(new_jim_state(xhost, xbase_parts, xauto_access)));
303 
304  // Exit:
305 
306  return;
307 }
308 
309 // =============================================================================
310 // NEW HANDLE, EXISTING STATE CONSTRUCTORS
311 // =============================================================================
312 
315 {
316  // Preconditions:
317 
318  require(xhost != 0);
319  require(xhost->state_is_read_accessible());
320  require(xhost->contains_member(xindex));
321 
322  // Body:
323 
324  attach_to_state(xhost, xindex);
325 
326  // Postconditions:
327 
328  ensure(invariant());
329  //ensure(host() == xhost);
330  ensure(index() == xindex);
331  ensure(is_attached());
332  ensure(!is_restricted());
333 }
334 
336 sec_e3_uniform(const sec_rep_space* xhost, const scoped_index& xindex)
337 {
338 
339  // Preconditions:
340 
341  require(xhost != 0);
342  require(xhost->state_is_read_accessible());
343  require(xhost->contains_member(xindex));
344 
345  // Body:
346 
347  attach_to_state(xhost, xindex.hub_pod());
348 
349  // Postconditions:
350 
351  ensure(invariant());
352  //ensure(host() == xhost);
353  ensure(index() ==~ xindex);
354  ensure(is_attached());
355  ensure(!is_restricted());
356 
357 }
358 
360 sec_e3_uniform(const sec_rep_space* xhost, const std::string& xname)
361 {
362 
363  // Preconditions:
364 
365  require(xhost != 0);
366  require(xhost->state_is_read_accessible());
367  require(!xname.empty());
368  require(xhost->contains_member(xname));
369 
370  // Body:
371 
372  attach_to_state(xhost, xname);
373 
374  // Postconditions:
375 
376  ensure(invariant());
377  //ensure(host() == xhost);
378  ensure(name() == xname);
379  ensure(is_attached());
380  ensure(!is_restricted());
381 
382 }
383 
384 
386 sec_e3_uniform(const namespace_poset* xnamespace,
387  const poset_path& xpath,
388  bool xauto_access)
389 {
390 
391  // Preconditions:
392 
393  require(precondition_of(attach_to_state(same args)));
394 
395  // Body:
396 
397  attach_to_state(xnamespace, xpath, xauto_access);
398 
399  // Postconditions:
400 
401  ensure(postcondition_of(attach_to_state(same args)));
402 
403  // Exit:
404 
405  return;
406 }
407 
408 
411 {
412 
413  // Preconditions:
414 
415  require(xother != 0);
416 
417  // Body:
418 
419  attach_to_state(xother);
420 
421  // Postconditions:
422 
423  ensure(invariant());
424  ensure(is_attached());
425  ensure(is_same_state(xother));
426  ensure(is_same_restriction(xother));
427 
428 }
429 
432 {
433 
434  // Preconditions:
435 
436  // Body:
437 
438  // Postconditions:
439 
440 }
441 
442 // =============================================================================
443 // EXISTING HANDLE, NEW STATE "CONSTRUCTORS"
444 // =============================================================================
445 
446 void
449  const block<dof_type>& xmin,
450  const block<dof_type>& xmax,
451  bool xauto_access)
452 {
453  // Preconditions:
454 
455  require(precondition_of(new_jim_state(xhost, 0, false, xauto_access)));
456  require(xmin.ct() >= 3);
457  require(xmax.ct() >= 3);
458  require_for_all(i, 0, 3, xmin[i] <= xmax[i]);
459 
460  // Body:
461 
462  new_jim_state(xhost, static_cast<poset_dof_map*>(0), false, xauto_access);
463  put_bounds(xmin, xmax, xauto_access);
464 
465  // Postconditions:
466 
467  ensure(min_x(xauto_access) == xmin[0]);
468  ensure(min_y(xauto_access) == xmin[1]);
469  ensure(min_z(xauto_access) == xmin[2]);
470  ensure(max_x(xauto_access) == xmax[0]);
471  ensure(max_y(xauto_access) == xmax[1]);
472  ensure(max_z(xauto_access) == xmax[2]);
473 
474  // Exit:
475 
476  return;
477 }
478 
479 // ===========================================================================
480 // OTHER
481 // ===========================================================================
482 
486 {
487  // Preconditions:
488 
489  require(is_ancestor_of(&xother));
490  require(precondition_of(attach_to_state(&xother)));
491 
492  // Body:
493 
494  attach_to_state(&xother);
495 
496  // Postconditions:
497 
498  ensure(postcondition_of(attach_to_state(&xother)));
499 
500  // Exit:
501 
502  return *this;
503 }
504 
507 operator=(const sec_e3_uniform& xother)
508 {
509  // Preconditions:
510 
511  require(precondition_of(attach_to_state(&xother)));
512 
513  // Body:
514 
515  attach_to_state(&xother);
516 
517  // Postconditions:
518 
519  ensure(postcondition_of(attach_to_state(&xother)));
520 
521  // Exit:
522 
523  return *this;
524 }
525 
528 operator=(const e3& xfiber)
529 {
530  // Preconditions:
531 
532  require(precondition_of(sec_vd::operator=(xfiber)));
533 
534  // Body:
535 
536  sec_vd::operator=(xfiber);
537 
538  // Postconditions:
539 
540  ensure(postcondition_of(sec_vd::operator=(xfiber)));
541 
542  // Exit:
543 
544  return *this;
545 }
546 
549 operator=(const e3_lite& xfiber)
550 {
551  // Preconditions:
552 
553  require(precondition_of(sec_vd::operator=(xfiber)));
554 
555  // Body:
556 
557  sec_vd::operator=(xfiber);
558 
559  // Postconditions:
560 
561  ensure(postcondition_of(sec_vd::operator=(xfiber)));
562 
563  // Exit:
564 
565  return *this;
566 }
567 
571 {
572  // Preconditions:
573 
574  // Body:
575 
576  static const fiber_type result;
577 
578  // Postconditions:
579 
580  // Exit:
581 
582  return result;
583 }
584 
585 void
588  const block<dof_type>& xmax,
589  bool xauto_access)
590 {
591  // Preconditions:
592 
593  require(xmin.ct() >= 2);
594  require(xmax.ct() >= 2);
595  require_for_all(i, 0, 2, xmin[i] <= xmax[i]);
596  require(xauto_access || state_is_read_write_accessible());
597 
598  // Body:
599 
600  if(xauto_access)
601  {
602  get_read_write_access(true);
603  }
604 
605  // Set the coordinates dofs;
606  // uniform coordinates have only 24 dofs in 3d,
607  // the x,y, z coordinates at the corners of the domain.
608  // (Even these aren't all independent).
609 
611 
612  // Structured _block_3d ctor sets client ids to match the order
613  // for a normal hex.
614 
615  // xmin, ymin, zmin; client id 0.
616 
617  lfiber[0] = xmin[0];
618  lfiber[1] = xmin[1];
619  lfiber[2] = xmin[2];
620  put_fiber(0, lfiber);
621 
622  // xmax, ymin, zmin; client id 1:
623 
624  lfiber[0] = xmax[0];
625  lfiber[1] = xmin[1];
626  lfiber[2] = xmin[2];
627  put_fiber(1, lfiber);
628 
629  // xmax, ymax, zmin; client id 2.
630 
631  lfiber[0] = xmax[0];
632  lfiber[1] = xmax[1];
633  lfiber[2] = xmin[2];
634  put_fiber(2, lfiber);
635 
636  // xmin, ymax, zmin; client id 3.
637 
638  lfiber[0] = xmin[0];
639  lfiber[1] = xmax[1];
640  lfiber[2] = xmin[2];
641  put_fiber(3, lfiber);
642 
643  // xmin, ymin, zmax; client id 4.
644 
645  lfiber[0] = xmin[0];
646  lfiber[1] = xmin[1];
647  lfiber[2] = xmax[2];
648  put_fiber(4, lfiber);
649 
650  // xmax, ymin, zmax; client id 5:
651 
652  lfiber[0] = xmax[0];
653  lfiber[1] = xmin[1];
654  lfiber[2] = xmax[2];
655  put_fiber(5, lfiber);
656 
657  // xmax, ymax, zmax; client id 6.
658 
659  lfiber[0] = xmax[0];
660  lfiber[1] = xmax[1];
661  lfiber[2] = xmax[2];
662  put_fiber(6, lfiber);
663 
664  // xmin, ymax, zmax; client id 7.
665 
666  lfiber[0] = xmin[0];
667  lfiber[1] = xmax[1];
668  lfiber[2] = xmax[2];
669  put_fiber(7, lfiber);
670 
671  if(xauto_access)
672  {
673  release_access();
674  }
675 
676  // Postconditions:
677 
678  ensure(min_x(xauto_access) == xmin[0]);
679  ensure(min_y(xauto_access) == xmin[1]);
680  ensure(min_z(xauto_access) == xmin[2]);
681  ensure(max_x(xauto_access) == xmax[0]);
682  ensure(max_y(xauto_access) == xmax[1]);
683  ensure(max_z(xauto_access) == xmax[2]);
684 
685  // Exit:
686 
687  return;
688 }
689 
690 void
692 get_bounds(block<dof_type>& xmin, block<dof_type>& xmax, bool xauto_access) const
693 {
694  // Preconditions:
695 
696  require(xauto_access || state_is_read_accessible());
697 
698  // Body:
699 
700  if(xauto_access)
701  {
702  get_read_access();
703  }
704 
705  xmin.reserve(3);
706  xmin.set_ct(3);
707 
708  xmax.reserve(3);
709  xmax.set_ct(3);
710 
711  // Structured_block_3d ctor sets client ids to match the order
712  // for a normal hex.
713 
714  // xmin, ymin, zmin; client id 0.
715 
716  get_fiber(0, xmin.base(), xmin.ct()*sizeof(dof_type));
717 
718  // xmax, ymax, zmax; client id 6.
719 
720  get_fiber(6, xmax.base(), xmax.ct()*sizeof(dof_type));
721 
722  if(xauto_access)
723  {
724  release_access();
725  }
726 
727  // Postconditions:
728 
729  ensure(xmin.ct() == 3);
730  ensure(xmax.ct() == 3);
731  ensure_for_all(i, 0, 3, xmin[i] <= xmax[i]);
732 
733  // Exit:
734 
735  return;
736 }
737 
740 min_x(bool xauto_access) const
741 {
742  dof_type result;
743 
744  // Preconditions:
745 
746  require(xauto_access || state_is_read_accessible());
747 
748  // Body:
749 
750  if(xauto_access)
751  {
752  get_read_access();
753  }
754 
755  // min; client id 0.
756 
758  get_fiber(0, lfiber);
759 
760  result = lfiber[0];
761 
762  if(xauto_access)
763  {
764  release_access();
765  }
766 
767  // Postconditions:
768 
769 
770  // Exit:
771 
772  return result;
773 }
774 
777 min_y(bool xauto_access) const
778 {
779  dof_type result;
780 
781  // Preconditions:
782 
783  require(xauto_access || state_is_read_accessible());
784 
785  // Body:
786 
787  if(xauto_access)
788  {
789  get_read_access();
790  }
791 
792  // min; client id 0.
793 
795  get_fiber(0, lfiber);
796 
797  result = lfiber[1];
798 
799  if(xauto_access)
800  {
801  release_access();
802  }
803 
804  // Postconditions:
805 
806 
807  // Exit:
808 
809  return result;
810 }
811 
814 min_z(bool xauto_access) const
815 {
816  dof_type result;
817 
818  // Preconditions:
819 
820  require(xauto_access || state_is_read_accessible());
821 
822  // Body:
823 
824  if(xauto_access)
825  {
826  get_read_access();
827  }
828 
829  // min; client id 0.
830 
832  get_fiber(0, lfiber);
833 
834  result = lfiber[2];
835 
836  if(xauto_access)
837  {
838  release_access();
839  }
840 
841  // Postconditions:
842 
843 
844  // Exit:
845 
846  return result;
847 }
848 
851 max_x(bool xauto_access) const
852 {
853  dof_type result;
854 
855  // Preconditions:
856 
857  require(xauto_access || state_is_read_accessible());
858 
859  // Body:
860 
861  if(xauto_access)
862  {
863  get_read_access();
864  }
865 
866  // max; client id 6.
867 
869  get_fiber(6, lfiber);
870 
871  result = lfiber[0];
872 
873  if(xauto_access)
874  {
875  release_access();
876  }
877 
878  // Postconditions:
879 
880 
881  // Exit:
882 
883  return result;
884 }
885 
888 max_y(bool xauto_access) const
889 {
890  dof_type result;
891 
892  // Preconditions:
893 
894  require(xauto_access || state_is_read_accessible());
895 
896  // Body:
897 
898  if(xauto_access)
899  {
900  get_read_access();
901  }
902 
903  // max; client id 6.
904 
906  get_fiber(6, lfiber);
907 
908  result = lfiber[1];
909 
910  if(xauto_access)
911  {
912  release_access();
913  }
914 
915  // Postconditions:
916 
917 
918  // Exit:
919 
920  return result;
921 }
922 
925 max_z(bool xauto_access) const
926 {
927  dof_type result;
928 
929  // Preconditions:
930 
931  require(xauto_access || state_is_read_accessible());
932 
933  // Body:
934 
935  if(xauto_access)
936  {
937  get_read_access();
938  }
939 
940  // max; client id 6.
941 
943  get_fiber(6, lfiber);
944 
945  result = lfiber[2];
946 
947  if(xauto_access)
948  {
949  release_access();
950  }
951 
952  // Postconditions:
953 
954 
955  // Exit:
956 
957  return result;
958 }
959 
962 inc_x(bool xauto_access) const
963 {
964  dof_type result;
965 
966  // Preconditions:
967 
968  require(xauto_access || state_is_read_accessible());
969 
970  // Body:
971 
972  if(xauto_access)
973  {
974  get_read_access();
975  }
976 
977  // Get the number of zones in the x direction.
978 
979  base_space_poset& lbase_host = schema().host()->base_space();
980  pod_index_type lbase_id = schema().base_space_id();
982  lbase_host.member_dof_tuple(lbase_id, &ltuple, sizeof(ltuple), false);
983 
984  if(ltuple.i_size == 0)
985  {
986  result = 0;
987  }
988  else
989  {
990  result = (max_x(false) - min_x(false))/ltuple.i_size;
991  }
992 
993  if(xauto_access)
994  {
995  release_access();
996  }
997 
998  // Postconditions:
999 
1000 
1001  // Exit:
1002 
1003  return result;
1004 }
1005 
1008 inc_y(bool xauto_access) const
1009 {
1010  dof_type result;
1011 
1012  // Preconditions:
1013 
1014  require(xauto_access || state_is_read_accessible());
1015 
1016  // Body:
1017 
1018  if(xauto_access)
1019  {
1020  get_read_access();
1021  }
1022 
1023  // Get the number of zones in the x direction.
1024 
1025  base_space_poset& lbase_host = schema().host()->base_space();
1026  pod_index_type lbase_id = schema().base_space_id();
1028  lbase_host.member_dof_tuple(lbase_id, &ltuple, sizeof(ltuple), false);
1029 
1030  if(ltuple.j_size == 0)
1031  {
1032  result = 0;
1033  }
1034  else
1035  {
1036  result = (max_y(false) - min_y(false))/ltuple.j_size;
1037  }
1038 
1039  if(xauto_access)
1040  {
1041  release_access();
1042  }
1043 
1044  // Postconditions:
1045 
1046 
1047  // Exit:
1048 
1049  return result;
1050 }
1051 
1054 inc_z(bool xauto_access) const
1055 {
1056  dof_type result;
1057 
1058  // Preconditions:
1059 
1060  require(xauto_access || state_is_read_accessible());
1061 
1062  // Body:
1063 
1064  if(xauto_access)
1065  {
1066  get_read_access();
1067  }
1068 
1069  // Get the number of zones in the x direction.
1070 
1071  base_space_poset& lbase_host = schema().host()->base_space();
1072  pod_index_type lbase_id = schema().base_space_id();
1074  lbase_host.member_dof_tuple(lbase_id, &ltuple, sizeof(ltuple), false);
1075 
1076  if(ltuple.k_size == 0)
1077  {
1078  result = 0;
1079  }
1080  else
1081  {
1082  result = (max_z(false) - min_z(false))/ltuple.k_size;
1083  }
1084 
1085  if(xauto_access)
1086  {
1087  release_access();
1088  }
1089 
1090  // Postconditions:
1091 
1092 
1093  // Exit:
1094 
1095  return result;
1096 }
1097 
1098 // PROTECTED MEMBER FUNCTIONS
1099 
1100 // PRIVATE MEMBER FUNCTIONS
1101 
1102 
1103 //==============================================================================
1104 // E3 FACET OF CLASS SEC_E3_UNIFORM
1105 //==============================================================================
1106 
1107 // PUBLIC MEMBER FUNCTIONS
1108 
1109 // PROTECTED MEMBER FUNCTIONS
1110 
1111 // PRIVATE MEMBER FUNCTIONS
1112 
1113 
1114 //==============================================================================
1115 // ED FACET OF CLASS SEC_E3_UNIFORM
1116 //==============================================================================
1117 
1118 // PUBLIC MEMBER FUNCTIONS
1119 
1120 // PROTECTED MEMBER FUNCTIONS
1121 
1122 // PRIVATE MEMBER FUNCTIONS
1123 
1124 
1125 //==============================================================================
1126 // AT1 FACET OF CLASS SEC_E3_UNIFORM
1127 //==============================================================================
1128 
1129 // PUBLIC MEMBER FUNCTIONS
1130 
1131 // PROTECTED MEMBER FUNCTIONS
1132 
1133 // PRIVATE MEMBER FUNCTIONS
1134 
1135 
1136 //==============================================================================
1137 // ATP FACET OF CLASS SEC_E3_UNIFORM
1138 //==============================================================================
1139 
1140 // PUBLIC MEMBER FUNCTIONS
1141 
1142 // PROTECTED MEMBER FUNCTIONS
1143 
1144 // PRIVATE MEMBER FUNCTIONS
1145 
1146 
1147 //==============================================================================
1148 // TP FACET OF CLASS SEC_E3_UNIFORM
1149 //==============================================================================
1150 
1151 // PUBLIC MEMBER FUNCTIONS
1152 
1153 // PROTECTED MEMBER FUNCTIONS
1154 
1155 // PRIVATE MEMBER FUNCTIONS
1156 
1157 
1158 //==============================================================================
1159 // VD FACET OF CLASS SEC_E3_UNIFORM
1160 //==============================================================================
1161 
1162 // PUBLIC MEMBER FUNCTIONS
1163 
1164 // PROTECTED MEMBER FUNCTIONS
1165 
1166 // PRIVATE MEMBER FUNCTIONS
1167 
1168 
1169 //==============================================================================
1170 // TUPLE FACET OF CLASS SEC_E3_UNIFORM
1171 //==============================================================================
1172 
1173 // PUBLIC MEMBER FUNCTIONS
1174 
1175 const sheaf::poset_path&
1178 {
1179 
1180  // Preconditions:
1181 
1182 
1183  // Body:
1184 
1185  static const poset_path
1186  result(sec_rep_descriptor::standard_host_path().poset_name(), "vertex_block_uniform");
1187 
1188  // Postconditions:
1189 
1190  ensure(result.full());
1191 
1192  // Exit:
1193 
1194  return result;
1195 }
1196 
1197 // PROTECTED MEMBER FUNCTIONS
1198 
1199 // PRIVATE MEMBER FUNCTIONS
1200 
1201 
1202 //==============================================================================
1203 // ABSTRACT POSET MEMBER FACET OF CLASS SEC_E3_UNIFORM
1204 //==============================================================================
1205 
1206 // PUBLIC MEMBER FUNCTIONS
1207 
1208 const std::string&
1210 class_name() const
1211 {
1212  // Preconditions:
1213 
1214  // Body:
1215 
1216  const string& result = static_class_name();
1217 
1218  // Postconditions:
1219 
1220  ensure(!result.empty());
1221 
1222  // Exit:
1223 
1224  return result;
1225 }
1226 
1227 const std::string&
1230 {
1231  // Preconditions:
1232 
1233  // Body:
1234 
1235  static const string result("sec_e3_uniform");
1236 
1237  // Postconditions:
1238 
1239  ensure(!result.empty());
1240 
1241  // Exit:
1242 
1243  return result;
1244 }
1245 
1248 clone() const
1249 {
1250 
1251  // Preconditions:
1252 
1253  // Body:
1254 
1255  // create new handle of the current class.
1256 
1257  sec_e3_uniform *result = new sec_e3_uniform();
1258 
1259  // Postconditions:
1260 
1261  ensure(result != 0);
1262  ensure(result->invariant());
1263 
1264  // Exit:
1265 
1266  return result;
1267 
1268 }
1269 
1270 // PROTECTED MEMBER FUNCTIONS
1271 
1272 // PRIVATE MEMBER FUNCTIONS
1273 
1274 
1275 //==============================================================================
1276 // ANY FACET OF CLASS SEC_E3_UNIFORM
1277 //==============================================================================
1278 
1279 // PUBLIC MEMBER FUNCTIONS
1280 
1281 bool
1283 is_ancestor_of(const any* xother) const
1284 {
1285 
1286  // Preconditions:
1287 
1288  require(xother != 0);
1289 
1290  // Body:
1291 
1292  // If other may be dynamically cast to the type of this then this is an
1293  // ancestor of other.
1294 
1295  bool result = dynamic_cast<const sec_e3_uniform*>(xother) != 0;
1296 
1297  // Postconditions:
1298 
1299  //ensure(invariant());
1300 
1301  // Exit:
1302 
1303  return result;
1304 
1305 }
1306 
1307 bool
1309 invariant() const
1310 {
1311  bool result = true;
1312 
1313  // Preconditions:
1314 
1315  // Body:
1316 
1317  // Must satisfy base class invariant
1318 
1319  invariance(sec_e3::invariant());
1320 
1321  if (invariant_check())
1322  {
1323  // Prevent recursive calls to invariant
1324 
1325  disable_invariant_check();
1326 
1327  // Finished, turn invariant checking back on.
1328 
1329  enable_invariant_check();
1330  }
1331 
1332  // Postconditions:
1333 
1334  ensure(is_derived_query);
1335 
1336  // Exit:
1337 
1338  return result;
1339 }
1340 
1341 // PROTECTED MEMBER FUNCTIONS
1342 
1343 // PRIVATE MEMBER FUNCTIONS
1344 
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
static host_type & standard_host(namespace_type &xns, const poset_path &xbase_path, const poset_path &xrep_path, const std::string &xsection_suffix, const std::string &xfiber_suffix, bool xauto_access)
The standard host for sections of this type with base space xbase_path, representation xrep_path...
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
virtual const std::string & class_name() const
The name of this class.
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 ...
A client handle for a subposet.
Definition: subposet.h:86
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
size_type ct() const
The number of items currently in use.
A Cartesian product section space.
dof_type inc_z(bool xauto_access) const
The increment of the z component; the change in the z component when the z vertex index is incremente...
Euclidean vector space of dimension 3 (volatile version).
Definition: e3.h:116
The abstract map from section dof ids to section dof values of heterogeneous type.
A space of scalars viewed as an antisymmetric tensor section space of degree 1.
Definition: sec_at1_space.h:48
virtual sec_e3_uniform * clone() const
Virtual constructor; makes a new instance of the same type as this.
poset_path path(bool xauto_access=true) const
A path to this component.
The default name space; a poset which contains other posets as members.
A section of a fiber bundle with a 3-dimensional Euclidean vector space fiber.
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.
A general antisymmetric tensor of degree 1 over an abstract vector space (persistent version)...
Definition: at1.h:211
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
Definition: at1.h:44
dof_type min_y(bool xauto_access) const
The minimum value of the y component.
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
A member of a sec_rep_space; a section.
poset_path vector_space_path() const
The path of the underlying vector space.
STL namespace.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
void put_bounds(const block< dof_type > &xmin, const block< dof_type > &xmax, bool xauto_access)
Sets the dofs to match the rectangle defined by xmin and xmax.
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
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.
The poset for sec_rep_descriptors.
namespace_poset * host() const
The namespace this poset resides in. Obsolete; use name_space() instead.
Euclidean vector space of dimension 3 (persistent version).
Definition: e3.h:467
virtual sec_e3_uniform & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
dof_type min_z(bool xauto_access) const
The minimum value of the z component.
Abstract base class with useful features for all objects.
Definition: any.h:39
int p() const
The tensor degree of this space.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
sec_rep_descriptor & rep()
A representation descriptor for this sec rep space (mutable version).
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
size_type k_size
The upper bound on the z direction index for structured blocks.
bool is_ancestor_of(const any *other) const
True if other conforms to current.
size_type i_size
The upper bound on the x direction index for structured blocks.
pointer_type base() const
The underlying storage array.
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)
dof_type inc_y(bool xauto_access) const
The increment of the y component; the change in the y component when the y vertex index is incremente...
dof_type max_z(bool xauto_access) const
The maximum value of the z component.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
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. ...
int dd() const
The dimension of the underlying ("domain") vector space.
static const std::string & static_class_name()
The name of this class.
sec_e3_uniform()
Default constructor; creates an unattached handle.
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
size_type j_size
The upper bound on the y direction index for structured blocks.
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
dof_type inc_x(bool xauto_access) const
The increment of the x component; the change in the x component when the x vertex index is incremente...
bool invariant() const
Class invariant.
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
Definition: at1_space.h:42
static const poset_path & standard_rep_path()
The path to the standard rep for sections of this type.
void new_jim_state(sec_rep_space *xhost, const block< dof_type > &xmin, const block< dof_type > &xmax, bool xauto_access)
Attaches this to a new state in xhost with min_x() == xmin_x and max_x() == xmax_x.
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
poset_path scalar_space_path() const
The path of the underlying space of scalars.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
sec_vd_dof_type dof_type
The type of degree of freedom.
Definition: sec_vd.h:91
void get_bounds(block< dof_type > &xmin, block< dof_type > &xmax, bool xauto_access) const
Gets the bounds.
dof_type max_y(bool xauto_access) const
The maximum value of the y component.
dof_type max_x(bool xauto_access) const
The maximum value of the x component.
An abstract client handle for a member of a poset.
std::string path() const
The full path as a string.
Definition: poset_path.cc:450
The type of row dof tuple for base_space_member.
row_dof_tuple_type * member_dof_tuple(pod_index_type xmbr_hub_id, bool xrequire_write_access=false) const
The row dof tuple for the member with member hub id xmbr_hub_id.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xscalar_space_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
An auto_block with a no-initialization initialization policy.
Namespace for the fiber_bundles component of the sheaf system.
dof_type min_x(bool xauto_access) const
The minimum value of the x component.
virtual int d(int xp, int xdd) const
Dimension d() as a function of degree xp and domain dimension xdd.
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...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61