SheafSystem  0.0.0.0
field_factory.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/field_factory.h"
22 
23 #include "SheafSystem/arg_list.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/block.impl.h"
26 #include "SheafSystem/error_message.h"
27 #include "SheafSystem/fiber_bundles_namespace.h"
28 #include "SheafSystem/namespace_poset_member.h"
29 #include "SheafSystem/sec_at0.h"
30 #include "SheafSystem/sec_at0_space.h"
31 #include "SheafSystem/sec_at1_space.h"
32 #include "SheafSystem/sec_e1.h"
33 #include "SheafSystem/sec_e2.h"
34 #include "SheafSystem/sec_e3.h"
35 #include "SheafSystem/sec_ed_invertible.h"
36 #include "SheafSystem/sec_vd_space.h"
37 #include "SheafSystem/section_space_schema_poset.h"
38 #include "SheafSystem/std_iostream.h"
39 #include "SheafSystem/std_set.h"
40 #include "SheafSystem/std_string.h"
41 #include "SheafSystem/structured_block_1d.h"
42 #include "SheafSystem/structured_block_2d.h"
43 #include "SheafSystem/structured_block_3d.h"
44 #include "SheafSystem/unstructured_block.h"
45 #include "SheafSystem/field_vd.h"
46 
47 #ifdef HAVE_VTK
48 
49 #include "vtkConnectivityFilter.h"
50 #include "vtkDelaunay2D.h"
51 #include "vtkDelaunay3D.h"
52 #include "vtkMath.h"
53 #include "vtkPoints.h"
54 #include "vtkPolyData.h"
55 #include "vtkUnstructuredGrid.h"
56 
57 #endif
58 
59 using namespace std;
60 using namespace fields; // Workaround for MS C++ bug.
61 
62 // #define DIAGNOSTIC_OUTPUT
63 
64 
68  const std::string& xname,
69  size_type xi_size,
73  const poset_path& xproperty_rep_path)
74 {
75 
76 #ifdef DIAGNOSTIC_OUTPUT
77  post_information_message("new_scalar_field_1d_points:");
78 #endif
79 
80  // Preconditions:
81 
82  require(xns.state_is_read_write_accessible());
83  require(xns.contains_poset(xproperty_rep_path));
84  require(!xname.empty());
85  require(xi_size > 0);
86  require(xlower.ct() >= 1);
87  require(xupper.ct() >= 1);
88  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
89 
90  // Body:
91 
92  // Create the mesh.
93 
94  unstructured_block* lbase_space =
95  new_0d_point_base_space(xns, xname, xi_size);
96 
97  // Create the coordinates ection.
98 
99  sec_e1* lcoords =
100  new_1d_unstructured_coordinates(xns,
101  xname,
102  xi_size,
103  xlower,
104  xupper,
105  *lbase_space,
106  "sec_rep_descriptors/vertex_vertex_constant");
107 
108  // Create the property section.
109 
110  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
111 
112  // Create the field.
113 
114  field_vd* result = new field_vd(*lcoords, *lprop, true);
115 
116  // Set the property values.
117 
118  if(xfcn == 0)
119  {
120  xfcn = field_vd::property_dof_function_example;
121  }
122 
123  result->put_property_dofs(xfcn, true);
124 
125  // Clean up.
126 
127  lbase_space->detach_from_state();
128  delete lbase_space;
129 
130  lcoords->detach_from_state();
131  delete lcoords;
132 
133  lprop->detach_from_state();
134  delete lprop;
135 
136  // Postconditions:
137 
138  ensure(result != 0);
139  ensure(result->state_is_not_read_accessible());
140 
141  // Exit:
142 
143  return result;
144 }
145 
146 
150  const std::string& xname,
151  size_type xi_size,
152  block<sec_vd_value_type>& xlower,
153  block<sec_vd_value_type>& xupper,
155  const poset_path& xproperty_rep_path)
156 {
157 
158 #ifdef DIAGNOSTIC_OUTPUT
159  post_information_message("new_scalar_field_1d_unstructured:");
160 #endif
161 
162  // Preconditions:
163 
164  require(xns.state_is_read_write_accessible());
165  require(xns.contains_poset(xproperty_rep_path));
166  require(!xname.empty());
167  require(xi_size > 0);
168  require(xlower.ct() >= 1);
169  require(xupper.ct() >= 1);
170  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
171 
172  // Body:
173 
174  // Create the mesh.
175  post_information_message("")
176  unstructured_block* lbase_space =
177  new_1d_unstructured_base_space(xns, xname+"_base_space", xi_size);
178 
179  // Create the coordinates section.
180 
181  sec_e1* lcoords =
182  new_1d_unstructured_coordinates(xns, xname, xi_size, xlower, xupper,
183  *lbase_space);
184 
185  // Create the property section.
186 
187  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
188 
189  // Create the field.
190 
191  field_vd* result = new field_vd(*lcoords, *lprop, true);
192  post_information_message("")
193  // Set the property values.
194 
195  if(xfcn == 0)
196  {
197  xfcn = field_vd::property_dof_function_example;
198  }
199 
200  result->put_property_dofs(xfcn, true);
201 
202  // Clean up.
203 
204  lbase_space->detach_from_state();
205  delete lbase_space;
206  post_information_message("")
207  lcoords->detach_from_state();
208  delete lcoords;
209 
210  lprop->detach_from_state();
211  delete lprop;
212 
213  // Postconditions:
214 
215  ensure(result != 0);
216  ensure(result->state_is_not_read_accessible());
217 
218  // Exit:
219 
220  return result;
221 }
222 
223 
227  const std::string& xname,
228  size_type xi_size,
229  block<sec_vd_value_type>& xlower,
230  block<sec_vd_value_type>& xupper,
232  const poset_path& xproperty_rep_path)
233 {
234 
235 #ifdef DIAGNOSTIC_OUTPUT
236  post_information_message("new_scalar_field_1d_uniform:");
237 #endif
238 
239  // Preconditions:
240 
241  require(xns.state_is_read_write_accessible());
242  require(xns.contains_poset(xproperty_rep_path));
243  require(!xname.empty());
244  require(xi_size > 0);
245  require(xlower.ct() >= 1);
246  require(xupper.ct() >= 1);
247  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
248 
249  // Body:
250 
251  // Create the mesh.
252 
253  structured_block_1d* lbase_space =
254  new_1d_structured_base_space(xns, xname+"_base_space", xi_size);
255 
256  // Create the coordinates section.
257 
258  sec_e1* lcoords =
259  new_1d_uniform_coordinates(xns, xname, xi_size, xlower, xupper,
260  *lbase_space);
261 
262  // Create the property section.
263 
264  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
265 
266  // Create the field.
267 
268  field_vd* result = new field_vd(*lcoords, *lprop, true);
269 
270  // Set the property values.
271 
272  if(xfcn == 0)
273  {
274  xfcn = field_vd::property_dof_function_example;
275  }
276 
277  result->put_property_dofs(xfcn, true);
278 
279  // Clean up.
280 
281  lbase_space->detach_from_state();
282  delete lbase_space;
283 
284  lcoords->detach_from_state();
285  delete lcoords;
286 
287  lprop->detach_from_state();
288  delete lprop;
289 
290  // Postconditions:
291 
292  ensure(result != 0);
293  ensure(result->state_is_not_read_accessible());
294 
295  // Exit:
296 
297  return result;
298 }
299 
300 
304  const std::string& xname,
305  size_type xi_size,
306  size_type xj_size,
307  block<sec_vd_value_type>& xlower,
308  block<sec_vd_value_type>& xupper,
310  const poset_path& xproperty_rep_path)
311 {
312 
313 #ifdef DIAGNOSTIC_OUTPUT
314  post_information_message("new_scalar_field_2d_unstructured:");
315 #endif
316 
317  // Preconditions:
318 
319  require(xns.state_is_read_write_accessible());
320  require(xns.contains_poset(xproperty_rep_path));
321  require(!xname.empty());
322  require(xi_size > 0);
323  require(xj_size > 0);
324  require(xlower.ct() >= 2);
325  require(xupper.ct() >= 2);
326  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
327 
328  // Body:
329 
330  // Create the mesh.
331 
332  unstructured_block* lbase_space =
333  new_0d_point_base_space(xns, xname, xi_size, xj_size);
334 
335  // Create the coordinates ection.
336 
337  sec_e2* lcoords =
338  new_2d_unstructured_coordinates(xns,
339  xname,
340  xi_size,
341  xj_size,
342  xlower,
343  xupper,
344  *lbase_space,
345  "sec_rep_descriptors/vertex_vertex_constant");
346 
347  // Create the property section.
348 
349  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
350 
351  // Create the field.
352 
353  field_vd* result = new field_vd(*lcoords, *lprop, true);
354 
355  // Set the property values.
356 
357  if(xfcn == 0)
358  {
359  xfcn = field_vd::property_dof_function_example;
360  }
361 
362  result->put_property_dofs(xfcn, true);
363 
364  // Clean up.
365 
366  lbase_space->detach_from_state();
367  delete lbase_space;
368 
369  lcoords->detach_from_state();
370  delete lcoords;
371 
372  lprop->detach_from_state();
373  delete lprop;
374 
375  // Postconditions:
376 
377  ensure(result != 0);
378  ensure(result->state_is_not_read_accessible());
379 
380  // Exit:
381 
382  return result;
383 }
384 
385 
389  const std::string& xname,
390  size_type xi_size,
391  size_type xj_size,
392  bool xuse_quads,
393  block<sec_vd_value_type>& xlower,
394  block<sec_vd_value_type>& xupper,
396  const poset_path& xproperty_rep_path)
397 {
398 
399 #ifdef DIAGNOSTIC_OUTPUT
400  post_information_message("new_scalar_field_2d_unstructured:");
401 #endif
402 
403  // Preconditions:
404 
405  require(xns.state_is_read_write_accessible());
406  require(xns.contains_poset(xproperty_rep_path));
407  require(!xname.empty());
408  require(xi_size > 0);
409  require(xj_size > 0);
410  require(xlower.ct() >= 2);
411  require(xupper.ct() >= 2);
412  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
413 
414  // Body:
415 
416  // Create the mesh.
417 
418  unstructured_block* lbase_space =
419  new_2d_unstructured_base_space(xns, xname, xi_size, xj_size, xuse_quads);
420 
421  // Create the coordinates ection.
422 
423  sec_e2* lcoords =
424  new_2d_unstructured_coordinates(xns, xname, xi_size, xj_size,
425  xlower, xupper, *lbase_space);
426 
427  // Create the property section.
428 
429  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
430 
431  // Create the field.
432 
433  field_vd* result = new field_vd(*lcoords, *lprop, true);
434 
435  // Set the property values.
436 
437  if(xfcn == 0)
438  {
439  xfcn = field_vd::property_dof_function_example;
440  }
441 
442  result->put_property_dofs(xfcn, true);
443 
444  // Clean up.
445 
446  lbase_space->detach_from_state();
447  delete lbase_space;
448 
449  lcoords->detach_from_state();
450  delete lcoords;
451 
452  lprop->detach_from_state();
453  delete lprop;
454 
455  // Postconditions:
456 
457  ensure(result != 0);
458  ensure(result->state_is_not_read_accessible());
459 
460  // Exit:
461 
462  return result;
463 }
464 
465 
466 #ifdef HAVE_VTK
470  const std::string& xname,
471  size_type xpt_ct,
472  block<sec_vd_value_type>& xlower,
473  block<sec_vd_value_type>& xupper,
475  const poset_path& xproperty_rep_path)
476 {
477 
478 #ifdef DIAGNOSTIC_OUTPUT
479  post_information_message("new_scalar_field_2d_unstructured:");
480 #endif
481 
482  // Preconditions:
483 
484  require(xns.state_is_read_write_accessible());
485  require(xns.contains_poset(xproperty_rep_path));
486  require(!xname.empty());
487  require(xpt_ct > 0);
488  require(xlower.ct() >= 2);
489  require(xupper.ct() >= 2);
490  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
491 
492  // Body:
493 
494  // Create the mesh.
495 
496  block<sec_vd_value_type> lpt_coords;
497 
498  unstructured_block* lbase_space =
499  new_2d_unstructured_base_space(xns, xname, xpt_ct, lpt_coords);
500 
501  // Create the coordinates ection.
502 
503  sec_e2* lcoords =
504  new_2d_unstructured_coordinates(xns,
505  xname,
506  xpt_ct,
507  xlower,
508  xupper,
509  *lbase_space,
510  lpt_coords);
511 
512  // Create the property section.
513 
514  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
515 
516  // Create the field.
517 
518  field_vd* result = new field_vd(*lcoords, *lprop, true);
519 
520  // Set the property values.
521 
522  if(xfcn == 0)
523  {
524  xfcn = field_vd::property_dof_function_example;
525  }
526 
527  result->put_property_dofs(xfcn, true);
528 
529  // Clean up.
530 
531  lbase_space->detach_from_state();
532  delete lbase_space;
533 
534  lcoords->detach_from_state();
535  delete lcoords;
536 
537  lprop->detach_from_state();
538  delete lprop;
539 
540  // Postconditions:
541 
542  ensure(result != 0);
543  ensure(result->state_is_not_read_accessible());
544 
545  // Exit:
546 
547  return result;
548 }
549 
550 #endif
551 
552 
556  const std::string& xname,
557  size_type xi_size,
558  size_type xj_size,
559  block<sec_vd_value_type>& xlower,
560  block<sec_vd_value_type>& xupper,
562  const poset_path& xproperty_rep_path)
563 {
564 
565 #ifdef DIAGNOSTIC_OUTPUT
566  post_information_message("new_scalar_field_2d_uniform:");
567 #endif
568 
569  // Preconditions:
570 
571  require(xns.state_is_read_write_accessible());
572  require(xns.contains_poset(xproperty_rep_path));
573  require(!xname.empty());
574  require(xi_size > 0);
575  require(xj_size > 0);
576  require(xlower.ct() >= 2);
577  require(xupper.ct() >= 2);
578  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
579 
580  // Body:
581 
582  // Create the mesh.
583 
584  structured_block_2d* lbase_space =
585  new_2d_structured_base_space(xns, xname+"_base_space", xi_size, xj_size);
586 
587  // Create the coordinates section.
588 
589  sec_e2* lcoords =
590  new_2d_uniform_coordinates(xns, xname, xi_size, xj_size,
591  xlower, xupper, *lbase_space);
592 
593  // Create the property section.
594 
595  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
596 
597  // Create the field.
598 
599  field_vd* result = new field_vd(*lcoords, *lprop, true);
600 
601  // Set the property values.
602 
603  if(xfcn == 0)
604  {
605  xfcn = field_vd::property_dof_function_example;
606  }
607 
608  result->put_property_dofs(xfcn, true);
609 
610  // Clean up.
611 
612  lbase_space->detach_from_state();
613  delete lbase_space;
614 
615  lcoords->detach_from_state();
616  delete lcoords;
617 
618  lprop->detach_from_state();
619  delete lprop;
620 
621  // Postconditions:
622 
623  ensure(result != 0);
624  ensure(result->state_is_not_read_accessible());
625 
626  // Exit:
627 
628  return result;
629 }
630 
634  const std::string& xname,
635  size_type xi_size,
636  size_type xj_size,
637  size_type xk_size,
638  block<sec_vd_value_type>& xlower,
639  block<sec_vd_value_type>& xupper,
641  const poset_path& xproperty_rep_path)
642 {
643 
644 #ifdef DIAGNOSTIC_OUTPUT
645  post_information_message("new_scalar_field_2d_unstructured:");
646 #endif
647 
648  // Preconditions:
649 
650  require(xns.state_is_read_write_accessible());
651  require(xns.contains_poset(xproperty_rep_path));
652  require(!xname.empty());
653  require(xi_size > 0);
654  require(xj_size > 0);
655  require(xk_size > 0);
656  require(xlower.ct() >= 3);
657  require(xupper.ct() >= 3);
658  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
659 
660  // Body:
661 
662  // Create the mesh.
663 
664  unstructured_block* lbase_space =
665  new_0d_point_base_space(xns, xname, xi_size, xj_size, xk_size);
666 
667  // Create the coordinates ection.
668 
669  sec_e3* lcoords =
670  new_3d_unstructured_coordinates(xns,
671  xname,
672  xi_size,
673  xj_size,
674  xk_size,
675  xlower,
676  xupper,
677  *lbase_space,
678  "sec_rep_descriptors/vertex_vertex_constant");
679 
680  // Create the property section.
681 
682  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
683 
684  // Create the field.
685 
686  field_vd* result = new field_vd(*lcoords, *lprop, true);
687 
688  // Set the property values.
689 
690  if(xfcn == 0)
691  {
692  xfcn = field_vd::property_dof_function_example;
693  }
694 
695  result->put_property_dofs(xfcn, true);
696 
697  // Clean up.
698 
699  lbase_space->detach_from_state();
700  delete lbase_space;
701 
702  lcoords->detach_from_state();
703  delete lcoords;
704 
705  lprop->detach_from_state();
706  delete lprop;
707 
708  // Postconditions:
709 
710  ensure(result != 0);
711  ensure(result->state_is_not_read_accessible());
712 
713  // Exit:
714 
715  return result;
716 }
717 
721  const std::string& xname,
722  size_type xi_size,
723  size_type xj_size,
724  size_type xk_size,
725  bool xuse_hexs,
726  block<sec_vd_value_type>& xlower,
727  block<sec_vd_value_type>& xupper,
729  const poset_path& xproperty_rep_path)
730 {
731 
732 #ifdef DIAGNOSTIC_OUTPUT
733  post_information_message("new_scalar_field_3d_unstructured:");
734 #endif
735 
736  // Preconditions:
737 
738  require(xns.state_is_read_write_accessible());
739  require(xns.contains_poset(xproperty_rep_path));
740  require(!xname.empty());
741  require(xi_size > 0);
742  require(xj_size > 0);
743  require(xk_size > 0);
744  require(xlower.ct() >= 3);
745  require(xupper.ct() >= 3);
746  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
747 
748  // Body:
749 
750  // Create the mesh.
751 
752  unstructured_block* lbase_space =
753  new_3d_unstructured_base_space(xns, xname, xi_size, xj_size, xk_size, xuse_hexs);
754 
755  // Create the coordinates ection.
756 
757  sec_e3* lcoords =
758  new_3d_unstructured_coordinates(xns, xname, xi_size, xj_size, xk_size,
759  xlower, xupper, *lbase_space);
760 
761  // Create the property section.
762 
763  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
764 
765  // Create the field.
766 
767  field_vd* result = new field_vd(*lcoords, *lprop, true);
768 
769  // Set the property values.
770 
771  if(xfcn == 0)
772  {
773  xfcn = field_vd::property_dof_function_example;
774  }
775 
776  result->put_property_dofs(xfcn, true);
777 
778  // Clean up.
779 
780  lbase_space->detach_from_state();
781  delete lbase_space;
782 
783  lcoords->detach_from_state();
784  delete lcoords;
785 
786  lprop->detach_from_state();
787  delete lprop;
788 
789  // Postconditions:
790 
791  ensure(result != 0);
792  ensure(result->state_is_not_read_accessible());
793 
794  // Exit:
795 
796  return result;
797 }
798 
799 #ifdef HAVE_VTK
800 
804  const std::string& xname,
805  size_type xpt_ct,
806  block<sec_vd_value_type>& xlower,
807  block<sec_vd_value_type>& xupper,
809  const poset_path& xproperty_rep_path)
810 {
811 
812 #ifdef DIAGNOSTIC_OUTPUT
813  post_information_message("new_scalar_field_2d_unstructured:");
814 #endif
815 
816  // Preconditions:
817 
818  require(xns.state_is_read_write_accessible());
819  require(xns.contains_poset(xproperty_rep_path));
820  require(!xname.empty());
821  require(xpt_ct > 0);
822  require(xlower.ct() >= 3);
823  require(xupper.ct() >= 3);
824  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
825 
826  // Body:
827 
828  // Create the mesh.
829 
830  block<sec_vd_value_type> lpt_coords;
831 
832  unstructured_block* lbase_space =
833  new_3d_unstructured_base_space(xns, xname, xpt_ct, lpt_coords);
834 
835  // Create the coordinates ection.
836 
837  sec_e3* lcoords =
838  new_3d_unstructured_coordinates(xns,
839  xname,
840  xpt_ct,
841  xlower,
842  xupper,
843  *lbase_space,
844  lpt_coords);
845 
846  // Create the property section.
847 
848  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
849 
850  // Create the field.
851 
852  field_vd* result = new field_vd(*lcoords, *lprop, true);
853 
854  // Set the property values.
855 
856  if(xfcn == 0)
857  {
858  xfcn = field_vd::property_dof_function_example;
859  }
860 
861  result->put_property_dofs(xfcn, true);
862 
863  // Clean up.
864 
865  lbase_space->detach_from_state();
866  delete lbase_space;
867 
868  lcoords->detach_from_state();
869  delete lcoords;
870 
871  lprop->detach_from_state();
872  delete lprop;
873 
874  // Postconditions:
875 
876  ensure(result != 0);
877  ensure(result->state_is_not_read_accessible());
878 
879  // Exit:
880 
881  return result;
882 }
883 
884 #endif
885 
889  const std::string& xname,
890  size_type xi_size,
891  size_type xj_size,
892  size_type xk_size,
893  block<sec_vd_value_type>& xlower,
894  block<sec_vd_value_type>& xupper,
896  const poset_path& xproperty_rep_path)
897 {
898 
899 #ifdef DIAGNOSTIC_OUTPUT
900  post_information_message("new_scalar_field_3d_uniform:");
901 #endif
902 
903  // Preconditions:
904 
905  require(xns.state_is_read_write_accessible());
906  require(xns.contains_poset(xproperty_rep_path));
907  require(!xname.empty());
908  require(xi_size > 0);
909  require(xj_size > 0);
910  require(xk_size > 0);
911  require(xlower.ct() >= 3);
912  require(xupper.ct() >= 3);
913  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
914 
915  // Body:
916 
917  // Create the mesh.
918 
919  structured_block_3d* lbase_space =
920  new_3d_structured_base_space(xns, xname, xi_size, xj_size, xk_size);
921 
922  // Create the coordinates ection.
923 
924  sec_e3* lcoords =
925  new_3d_uniform_coordinates(xns, xname, xi_size, xj_size, xk_size,
926  xlower, xupper, *lbase_space);
927 
928  // Create the property section.
929 
930  sec_at0* lprop = new_property(xns, xname, *lbase_space, xproperty_rep_path);
931 
932  // Create the field.
933 
934  field_vd* result = new field_vd(*lcoords, *lprop, true);
935 
936  // Set the property values.
937 
938  if(xfcn == 0)
939  {
940  xfcn = field_vd::property_dof_function_example;
941  }
942 
943  result->put_property_dofs(xfcn, true);
944 
945  // Clean up.
946 
947  lbase_space->detach_from_state();
948  delete lbase_space;
949 
950  lcoords->detach_from_state();
951  delete lcoords;
952 
953  lprop->detach_from_state();
954  delete lprop;
955 
956  // Postconditions:
957 
958  ensure(result != 0);
959  ensure(result->state_is_not_read_accessible());
960 
961  // Exit:
962 
963  return result;
964 }
965 
966 
967 
968 // ===========================================================
969 // JAVA WRAPPER SUPPORT FACET
970 // ===========================================================
971 
975  const std::string& xname,
976  size_type xi_size,
977  block<sec_vd_value_type>& xlower,
978  block<sec_vd_value_type>& xupper,
979  const std::string& xfcn)
980 {
981 
982 #ifdef DIAGNOSTIC_OUTPUT
983  post_information_message("new_scalar_field_1d_unstructured:");
984 #endif
985 
986  // Preconditions:
987 
988  require(xns.state_is_read_write_accessible());
989  require(!xname.empty());
990  require(xi_size > 0);
991  require(xlower.ct() >= 1);
992  require(xupper.ct() >= 1);
993  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
994  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
995 
996  // Body:
997 
998  field_vd* result =
999  new_scalar_field_1d_unstructured(xns,
1000  xname,
1001  xi_size,
1002  xlower,
1003  xupper,
1004  property_dof_function(xfcn));
1005 
1006  // Postconditions:
1007 
1008  ensure(result != 0);
1009  ensure(result->state_is_not_read_accessible());
1010 
1011  // Exit:
1012 
1013  return result;
1014 }
1015 
1016 
1020  const std::string& xname,
1021  size_type xi_size,
1022  block<sec_vd_value_type>& xlower,
1023  block<sec_vd_value_type>& xupper,
1024  const std::string& xfcn)
1025 {
1026 
1027 #ifdef DIAGNOSTIC_OUTPUT
1028  post_information_message("new_scalar_field_1d_uniform:");
1029 #endif
1030 
1031  // Preconditions:
1032 
1033  require(xns.state_is_read_write_accessible());
1034  require(!xname.empty());
1035  require(xi_size > 0);
1036  require(xlower.ct() >= 1);
1037  require(xupper.ct() >= 1);
1038  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
1039  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1040 
1041  // Body:
1042 
1043  field_vd* result =
1044  new_scalar_field_1d_uniform(xns,
1045  xname,
1046  xi_size,
1047  xlower,
1048  xupper,
1049  property_dof_function(xfcn));
1050 
1051  // Postconditions:
1052 
1053  ensure(result != 0);
1054  ensure(result->state_is_not_read_accessible());
1055 
1056  // Exit:
1057 
1058  return result;
1059 }
1060 
1061 
1065  const std::string& xname,
1066  size_type xi_size,
1067  size_type xj_size,
1068  bool xuse_quads,
1069  block<sec_vd_value_type>& xlower,
1070  block<sec_vd_value_type>& xupper,
1071  const std::string& xfcn)
1072 {
1073 
1074 #ifdef DIAGNOSTIC_OUTPUT
1075  post_information_message("new_scalar_field_2d_unstructured:");
1076 #endif
1077 
1078  // Preconditions:
1079 
1080  require(xns.state_is_read_write_accessible());
1081  require(!xname.empty());
1082  require(xi_size > 0);
1083  require(xj_size > 0);
1084  require(xlower.ct() >= 2);
1085  require(xupper.ct() >= 2);
1086  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
1087  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1088 
1089  // Body:
1090 
1091  field_vd* result =
1092  new_scalar_field_2d_unstructured(xns,
1093  xname,
1094  xi_size,
1095  xj_size,
1096  xuse_quads,
1097  xlower,
1098  xupper,
1099  property_dof_function(xfcn));
1100 
1101 
1102  // Postconditions:
1103 
1104  ensure(result != 0);
1105  ensure(result->state_is_not_read_accessible());
1106 
1107  // Exit:
1108 
1109  return result;
1110 }
1111 
1112 #ifdef HAVE_VTK
1113 
1117  const std::string& xname,
1118  size_type xpt_ct,
1119  block<sec_vd_value_type>& xlower,
1120  block<sec_vd_value_type>& xupper,
1121  const std::string& xfcn)
1122 {
1123 
1124 #ifdef DIAGNOSTIC_OUTPUT
1125  post_information_message("new_scalar_field_2d_unstructured:");
1126 #endif
1127 
1128  // Preconditions:
1129 
1130  require(xns.state_is_read_write_accessible());
1131  require(!xname.empty());
1132  require(xpt_ct > 0);
1133  require(xlower.ct() >= 2);
1134  require(xupper.ct() >= 2);
1135  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
1136  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1137 
1138  // Body:
1139 
1140  field_vd* result =
1141  new_scalar_field_2d_unstructured(xns,
1142  xname,
1143  xpt_ct,
1144  xlower,
1145  xupper,
1146  property_dof_function(xfcn));
1147 
1148  // Postconditions:
1149 
1150  ensure(result != 0);
1151  ensure(result->state_is_not_read_accessible());
1152 
1153  // Exit:
1154 
1155  return result;
1156 }
1157 
1158 #endif
1159 
1163  const std::string& xname,
1164  size_type xi_size,
1165  size_type xj_size,
1166  block<sec_vd_value_type>& xlower,
1167  block<sec_vd_value_type>& xupper,
1168  const std::string& xfcn)
1169 {
1170 
1171 #ifdef DIAGNOSTIC_OUTPUT
1172  post_information_message("new_scalar_field_2d_uniform:");
1173 #endif
1174 
1175  // Preconditions:
1176 
1177  require(xns.state_is_read_write_accessible());
1178  require(!xname.empty());
1179  require(xi_size > 0);
1180  require(xj_size > 0);
1181  require(xlower.ct() >= 2);
1182  require(xupper.ct() >= 2);
1183  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
1184  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1185 
1186  // Body:
1187 
1188  field_vd* result =
1189  new_scalar_field_2d_uniform(xns,
1190  xname,
1191  xi_size,
1192  xj_size,
1193  xlower,
1194  xupper,
1195  property_dof_function(xfcn));
1196 
1197  // Postconditions:
1198 
1199  ensure(result != 0);
1200  ensure(result->state_is_not_read_accessible());
1201 
1202  // Exit:
1203 
1204  return result;
1205 }
1206 
1207 
1211  const std::string& xname,
1212  size_type xi_size,
1213  size_type xj_size,
1214  size_type xk_size,
1215  bool xuse_hexs,
1216  block<sec_vd_value_type>& xlower,
1217  block<sec_vd_value_type>& xupper,
1218  const std::string& xfcn)
1219 {
1220 
1221 #ifdef DIAGNOSTIC_OUTPUT
1222  post_information_message("new_scalar_field_3d_unstructured:");
1223 #endif
1224 
1225  // Preconditions:
1226 
1227  require(xns.state_is_read_write_accessible());
1228  require(!xname.empty());
1229  require(xi_size > 0);
1230  require(xj_size > 0);
1231  require(xk_size > 0);
1232  require(xlower.ct() >= 3);
1233  require(xupper.ct() >= 3);
1234  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
1235  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1236 
1237  // Body:
1238 
1239  field_vd* result =
1240  new_scalar_field_3d_unstructured(xns,
1241  xname,
1242  xi_size,
1243  xj_size,
1244  xk_size,
1245  xuse_hexs,
1246  xlower,
1247  xupper,
1248  property_dof_function(xfcn));
1249 
1250  // Postconditions:
1251 
1252  ensure(result != 0);
1253  ensure(result->state_is_not_read_accessible());
1254 
1255  // Exit:
1256 
1257  return result;
1258 }
1259 
1260 #ifdef HAVE_VTK
1261 
1265  const std::string& xname,
1266  size_type xpt_ct,
1267  block<sec_vd_value_type>& xlower,
1268  block<sec_vd_value_type>& xupper,
1269  const std::string& xfcn)
1270 {
1271 
1272 #ifdef DIAGNOSTIC_OUTPUT
1273  post_information_message("new_scalar_field_2d_unstructured:");
1274 #endif
1275 
1276  // Preconditions:
1277 
1278  require(xns.state_is_read_write_accessible());
1279  require(!xname.empty());
1280  require(xpt_ct > 0);
1281  require(xlower.ct() >= 3);
1282  require(xupper.ct() >= 3);
1283  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
1284  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1285 
1286  // Body:
1287 
1288  field_vd* result =
1289  new_scalar_field_3d_unstructured(xns,
1290  xname,
1291  xpt_ct,
1292  xlower,
1293  xupper,
1294  property_dof_function(xfcn));
1295 
1296  // Postconditions:
1297 
1298  ensure(result != 0);
1299  ensure(result->state_is_not_read_accessible());
1300 
1301  // Exit:
1302 
1303  return result;
1304 }
1305 
1306 #endif
1307 
1311  const std::string& xname,
1312  size_type xi_size,
1313  size_type xj_size,
1314  size_type xk_size,
1315  block<sec_vd_value_type>& xlower,
1316  block<sec_vd_value_type>& xupper,
1317  const std::string& xfcn)
1318 {
1319 
1320 #ifdef DIAGNOSTIC_OUTPUT
1321  post_information_message("new_scalar_field_3d_uniform:");
1322 #endif
1323 
1324  // Preconditions:
1325 
1326  require(xns.state_is_read_write_accessible());
1327  require(!xname.empty());
1328  require(xi_size > 0);
1329  require(xj_size > 0);
1330  require(xk_size > 0);
1331  require(xlower.ct() >= 3);
1332  require(xupper.ct() >= 3);
1333  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
1334  require((xfcn == "linear_scalar_fcn") || (xfcn == "zero") || (xfcn == "property_dof_function_example") || (xfcn == "step_fcn"));
1335 
1336  // Body:
1337 
1338  field_vd* result =
1339  new_scalar_field_3d_uniform(xns,
1340  xname,
1341  xi_size,
1342  xj_size,
1343  xk_size,
1344  xlower,
1345  xupper,
1346  property_dof_function(xfcn));
1347 
1348  // Postconditions:
1349 
1350  ensure(result != 0);
1351  ensure(result->state_is_not_read_accessible());
1352 
1353  // Exit:
1354 
1355  return result;
1356 }
1357 
1358 
1359 void
1362  bool xdelete_coord_fiber,
1363  bool xdelete_prop_fiber)
1364 {
1365  // Preconditions:
1366 
1367 
1368  // Body:
1369 
1370  namespace_poset& lns = xfield->name_space();
1371  lns.begin_jim_edit_mode(true);
1372 
1373  // The prereq_id dofs define the outgoing adjacency links of the
1374  // member dependency graph. Build the incoming adjacency links.
1375 
1376  block< set<pod_index_type> > lin_links(lns.member_index_ub().pod());
1377 
1378  namespace_poset_member lmbr(lns.top());
1379 
1380  index_iterator lmbr_itr = lns.member_iterator();
1381  while(!lmbr_itr.is_done())
1382  {
1383  lmbr.attach_to_state(lmbr_itr.index());
1384 
1385  if(lmbr.is_jim(false))
1386  {
1387  for(int i=0; i<sheaf::PREREQ_IDS_UB; ++i)
1388  {
1389  pod_index_type lprereq_id = lmbr.poset_prereq_id(i);
1390 
1391  if(is_valid(lprereq_id))
1392  {
1393  lin_links[lprereq_id].insert(lmbr.index().pod());
1394  }
1395  }
1396  }
1397 
1398  lmbr_itr.next();
1399  }
1400  lmbr.detach_from_state();
1401 
1402  // Get the property and coordinate host indices, then delete the field.
1403 
1404  xfield->get_read_access();
1405 
1406  scoped_index lprop_host_index = xfield->property().host()->index();
1407  scoped_index lprop_schema_host_index = xfield->property().host()->schema().host()->index();
1408  scoped_index lprop_fiber_space_index = xfield->property().host()->schema().host()->fiber_space().index();
1409 
1410  scoped_index lcoord_host_index = xfield->coordinates().host()->index();
1411  scoped_index lcoord_schema_host_index = xfield->coordinates().host()->schema().host()->index();
1412  scoped_index lcoord_fiber_space_index = xfield->coordinates().host()->schema().host()->fiber_space().index();
1413 
1414  scoped_index lbase_host_index = xfield->base_space().host()->index();
1415 
1416  xfield->release_access();
1417 
1418  delete xfield;
1419 
1420  // Get the property schema host, remove the in link from the property
1421  // host to the property schema host, then delete the property host.
1422 
1423  lin_links[lprop_schema_host_index.hub_pod()].erase(lprop_host_index.hub_pod());
1424 
1425  lns.delete_poset(lprop_host_index, true);
1426 
1427  if(lin_links[lprop_schema_host_index.hub_pod()].empty())
1428  {
1429  // The prop schema host is no longer being used.
1430  // Get the fiber space, remove the proerty schema host
1431  // from the in links of the fiber space,
1432  // then delete the property schema host.
1433 
1434  lin_links[lprop_fiber_space_index.hub_pod()].erase(lprop_schema_host_index.hub_pod());
1435  lin_links[lbase_host_index.hub_pod()].erase(lprop_schema_host_index.hub_pod());
1436 
1437  lns.delete_poset(lprop_schema_host_index, true);
1438 
1439  if(lin_links[lprop_fiber_space_index.hub_pod()].empty() && xdelete_prop_fiber)
1440  {
1441  // The prop fiber space is no longer being used; delete it..
1442 
1443  lns.delete_poset(lprop_fiber_space_index, true);
1444  }
1445  }
1446 
1447  // Get the coord schema host, then delete the coord host.
1448 
1449  lin_links[lcoord_schema_host_index.hub_pod()].erase(lcoord_host_index.hub_pod());
1450 
1451  lns.delete_poset(lcoord_host_index, true);
1452 
1453  if(lin_links[lcoord_schema_host_index.hub_pod()].empty())
1454  {
1455  // The coord schema host is no longer being used,
1456  // delete it, but first get the fiber space.
1457 
1458  lin_links[lcoord_fiber_space_index.hub_pod()].erase(lcoord_schema_host_index.hub_pod());
1459  lin_links[lbase_host_index.hub_pod()].erase(lcoord_schema_host_index.hub_pod());
1460 
1461  lns.delete_poset(lcoord_schema_host_index, true);
1462 
1463  if(lin_links[lcoord_fiber_space_index.hub_pod()].empty() && xdelete_coord_fiber)
1464  {
1465  // The coord fiber space is no longer being used; delete it..
1466 
1467  lns.delete_poset(lcoord_fiber_space_index, true);
1468  }
1469  }
1470 
1471  if(lin_links[lbase_host_index.hub_pod()].empty())
1472  {
1473  // The base space is no longer being used; delete it.
1474 
1475  lns.delete_poset(lbase_host_index, true);
1476  }
1477 
1478  // The fiber space group in the namespace may now be empty.
1479  // If so, it must be deleted because it is incorrectly connected to top.
1480 
1481  pod_index_type lfiber_spaces_id = lns.member_id("fiber_spaces", false);
1482 
1483  if(is_valid(lfiber_spaces_id) && lns.cover_is_empty(LOWER, lfiber_spaces_id))
1484  {
1485  lns.delete_link(TOP_INDEX, lfiber_spaces_id);
1486  lns.delete_member(lfiber_spaces_id);
1487  }
1488 
1489 
1490  // The section space group in the namespace may now be empty.
1491  // If so, it must be deleted because it is incorrectly connected to top.
1492 
1493  pod_index_type lsection_spaces_id = lns.member_id("section_spaces", false);
1494 
1495  if(is_valid(lsection_spaces_id) && lns.cover_is_empty(LOWER, lsection_spaces_id))
1496  {
1497  lns.delete_link(TOP_INDEX, lsection_spaces_id);
1498  lns.delete_member(lsection_spaces_id);
1499  }
1500 
1501 
1502  lns.end_jim_edit_mode(true, true);
1503 
1504 
1505  // Postconditions:
1506 
1507 
1508  // Exit:
1509 
1510  return;
1511 }
1512 
1513 
1514 // ===========================================================
1515 // PROTECTED MEMBER FUNCTIONS FACET
1516 // ===========================================================
1517 
1518 
1521 new_0d_point_base_space(namespace_poset& xns, const std::string& xname, size_type xi_size)
1522 {
1523  // Preconditions:
1524 
1525  require(xns.state_is_read_write_accessible());
1526  require(!xname.empty());
1527  require(xi_size > 0);
1528 
1529  // Body:
1530 
1531  // Make the base space.
1532 
1533  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1534  string lbase_name(xname+"_base_space");
1535  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 0, false);
1536 
1537  lhost.get_read_write_access();
1538 
1539  string proto_member_name("point");
1540 
1541  poset_path lproto_path(base_space_member::prototypes_poset_name(),
1542  proto_member_name);
1543 
1544  // Compute the number of points;
1545  // xi_size is edge count for compatibility with other members.
1546 
1547  size_type lpt_ct = xi_size+1;
1548 
1549  // Construct an array of "client" ids.
1550 
1551  block<int> lclient_ids(lpt_ct);
1552  for(size_type i=0; i<lpt_ct; ++i)
1553  {
1554  lclient_ids.push_back(i);
1555  }
1556 
1557  // Create a block of points.
1558 
1559  unstructured_block* result =
1560  new unstructured_block(&lhost,
1561  lproto_path,
1562  lclient_ids.base(),
1563  lclient_ids.ct(),
1564  true);
1565 
1566  result->put_name(xname + "_unstructured_block", true, false);
1567 
1568 #ifdef DIAGNOSTIC_OUTPUT
1569  cout << lhost << endl;
1570 #endif
1571 
1572  // Clean up.
1573 
1574  lhost.release_access();
1575 
1576  // Postconditions:
1577 
1578  ensure(result != 0);
1579  ensure(result->state_is_not_read_accessible());
1580 
1581 
1582  // Exit:
1583 
1584  return result;
1585 }
1586 
1590  const std::string& xname,
1591  size_type xi_size,
1592  size_type xj_size)
1593 {
1594  // Preconditions:
1595 
1596  require(xns.state_is_read_write_accessible());
1597  require(!xname.empty());
1598  require(xi_size > 0);
1599  require(xj_size > 0);
1600 
1601  // Body:
1602 
1603  // Make the base space.
1604 
1605  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1606  string lbase_name(xname+"_base_space");
1607  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 0, false);
1608 
1609  lhost.get_read_write_access();
1610 
1611  string proto_member_name("point");
1612 
1613  poset_path lproto_path(base_space_member::prototypes_poset_name(),
1614  proto_member_name);
1615 
1616  // Compute the number of points;
1617  // xi_size, xj_size are edge counts for compatibility with other members.
1618 
1619  size_type lpt_ct = (xi_size+1)*(xj_size+1);
1620 
1621  // Construct an array of "client" ids.
1622 
1623  block<int> lclient_ids(lpt_ct);
1624  for(size_type i=0; i<lpt_ct; ++i)
1625  {
1626  lclient_ids.push_back(i);
1627  }
1628 
1629  // Create a block of points.
1630 
1631  unstructured_block* result =
1632  new unstructured_block(&lhost,
1633  lproto_path,
1634  lclient_ids.base(),
1635  lclient_ids.ct(),
1636  true);
1637 
1638  result->put_name(xname + "_unstructured_block", true, false);
1639 
1640 #ifdef DIAGNOSTIC_OUTPUT
1641  cout << lhost << endl;
1642 #endif
1643 
1644  // Clean up.
1645 
1646  lhost.release_access();
1647 
1648  // Postconditions:
1649 
1650  ensure(result != 0);
1651  ensure(result->state_is_not_read_accessible());
1652 
1653 
1654  // Exit:
1655 
1656  return result;
1657 }
1658 
1662  const std::string& xname,
1663  size_type xi_size,
1664  size_type xj_size,
1665  size_type xk_size)
1666 {
1667  // Preconditions:
1668 
1669  require(xns.state_is_read_write_accessible());
1670  require(!xname.empty());
1671  require(xi_size > 0);
1672  require(xj_size > 0);
1673  require(xk_size > 0);
1674 
1675  // Body:
1676 
1677  // Make the base space.
1678 
1679  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1680 // base_space_poset* lhost = &lns.new_base_space<unstructured_block>(xname+"_base_space",
1681 // "",
1682 // "",
1683 // 0,
1684 // true);
1685  string lbase_name(xname+"_base_space");
1686  unstructured_block::standard_host(lns, lbase_name, 0, false);
1687  base_space_poset& lhost = lns.member_poset<base_space_poset>(lbase_name, false);
1688 
1689  lhost.get_read_write_access();
1690 
1691  string proto_member_name("point");
1692 
1693  poset_path lproto_path(base_space_member::prototypes_poset_name(),
1694  proto_member_name);
1695 
1696  // Compute the number of points;
1697  // xi_size, xj_size are edge counts for compatibility with other members.
1698 
1699  size_type lpt_ct = (xi_size+1)*(xj_size+1)*(xk_size+1);
1700 
1701  // Construct an array of "client" ids.
1702 
1703  block<int> lclient_ids(lpt_ct);
1704  for(size_type i=0; i<lpt_ct; ++i)
1705  {
1706  lclient_ids.push_back(i);
1707  }
1708 
1709  // Create a block of points.
1710 
1711  unstructured_block* result =
1712  new unstructured_block(&lhost,
1713  lproto_path,
1714  lclient_ids.base(),
1715  lclient_ids.ct(),
1716  true);
1717 
1718  result->put_name(xname + "_unstructured_block", true, false);
1719 
1720 #ifdef DIAGNOSTIC_OUTPUT
1721  cout << lhost << endl;
1722 #endif
1723 
1724  // Clean up.
1725 
1726  lhost.release_access();
1727 
1728  // Postconditions:
1729 
1730  ensure(result != 0);
1731  ensure(result->state_is_not_read_accessible());
1732 
1733 
1734  // Exit:
1735 
1736  return result;
1737 }
1738 
1742  const std::string& xname,
1743  size_type xi_size)
1744 {
1745  // Preconditions:
1746 
1747  require(xns.state_is_read_write_accessible());
1748  require(!xname.empty());
1749  require(xi_size > 0);
1750 
1751  // Body:
1752 
1753  // Make the base space.
1754 
1755  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1756  base_space_poset& lhost = unstructured_block::standard_host(lns, xname, 1, false);
1757 
1758  lhost.get_read_write_access();
1759 
1760  string proto_member_name("segment_complex");
1761 
1762  poset_path lproto_path(base_space_member::prototypes_poset_name(),
1763  proto_member_name);
1764 
1765  unstructured_block* result =
1766  new unstructured_block(&lhost, lproto_path, xi_size);
1767  result->put_name(xname + "_unstructured_block", true, false);
1768 
1769 #ifdef DIAGNOSTIC_OUTPUT
1770  cout << lhost << endl;
1771 #endif
1772 
1773  // Clean up.
1774 
1775  lhost.release_access();
1776 
1777  // Postconditions:
1778 
1779  ensure(result != 0);
1780  ensure(result->state_is_not_read_accessible());
1781 
1782 
1783  // Exit:
1784 
1785  return result;
1786 }
1787 
1791  const std::string& xname,
1792  size_type xi_size,
1793  block<sec_vd_value_type>& xlower,
1794  block<sec_vd_value_type>& xupper,
1795  unstructured_block& xbase_space,
1796  const poset_path& xrep_path)
1797 {
1798  // Preconditions:
1799 
1800  require(xns.state_is_read_write_accessible());
1801  require(!xname.empty());
1802  require(xi_size > 0);
1803  require(xlower.ct() >= 1);
1804  require(xupper.ct() >= 1);
1805  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
1806  require(xns.contains_poset_member(xrep_path));
1807 
1808  // Body:
1809 
1810  // Make coordinate sec_rep_space.
1811 
1812  string lname = xname + "_coordinates_section_space";
1813 
1814  sec_rep_space& lhost =
1815  sec_e1::standard_host(xns, xbase_space.path(true), xrep_path, "", "", false);
1816 
1817  lhost.get_read_write_access();
1818 
1819  // Make the coordinates section.
1820 
1821  sec_e1* result = new sec_e1(&lhost);
1822  result->put_name(xname + "_coordinate_field", true, false);
1823 
1824  // Set the coordinates dofs.
1825 
1826  size_type i_ub = xi_size + 1;
1827 
1828  sec_vd_value_type ldelta0 = (xupper[0] - xlower[0])/xi_size;
1829 
1831 
1832  for(size_type i=0; i<i_ub; ++i)
1833  {
1834  lfiber[0] = xlower[0] + i*ldelta0;
1835 
1836  // Connectivity called from unstructured_block assigns vertex
1837  // client ids using standard array index calculation.
1838 
1839  result->put_fiber(i, lfiber);
1840  }
1841 
1842  // Clean up.
1843 
1844  lhost.release_access();
1845 
1846  // Postconditions:
1847 
1848  ensure(result != 0);
1849  ensure(result->state_is_not_read_accessible());
1850 
1851  // Exit:
1852 
1853  return result;
1854 }
1855 
1856 
1860  const std::string& xname,
1861  size_type xi_size)
1862 {
1863  // Preconditions:
1864 
1865  require(xns.state_is_read_write_accessible());
1866  require(!xname.empty());
1867  require(xi_size > 0);
1868 
1869  // Body:
1870 
1871  // Make the base space.
1872 
1873  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1874 
1875  base_space_poset& lhost = structured_block_1d::standard_host(lns, xname, false);
1876 
1877  lhost.get_read_write_access();
1878 
1879  structured_block_1d* result =
1880  new structured_block_1d(&lhost, xi_size, true);
1881  result->put_name(xname + "_structured_block_1d", true, false);
1882 
1883 #ifdef DIAGNOSTIC_OUTPUT
1884  cout << lhost << endl;
1885 #endif
1886 
1887  // Clean up.
1888 
1889  lhost.release_access();
1890 
1891  // Postconditions:
1892 
1893  ensure(result != 0);
1894  ensure(result->state_is_not_read_accessible());
1895 
1896  // Exit:
1897 
1898  return result;
1899 }
1900 
1904  const std::string& xname,
1905  size_type xi_size,
1906  block<sec_vd_value_type>& xlower,
1907  block<sec_vd_value_type>& xupper,
1908  structured_block_1d& xbase_space)
1909 {
1910  // Preconditions:
1911 
1912  require(xns.state_is_read_write_accessible());
1913  require(!xname.empty());
1914  require(xi_size > 0);
1915  require(xlower.ct() >= 1);
1916  require(xupper.ct() >= 1);
1917  require_for_all(i, 0, 1, xlower[i] < xupper[i]);
1918 
1919  // Body:
1920 
1921 #ifdef DIAGNOSTIC_OUTPUT
1922  cout << "xlower: ";
1923  for(int c=0; c<xlower.ub(); ++c)
1924  {
1925  cout << " " << xlower[c];
1926  }
1927  cout << endl;
1928 
1929  cout << "xupper: ";
1930  for(int c=0; c<xupper.ub(); ++c)
1931  {
1932  cout << " " << xupper[c];
1933  }
1934  cout << endl;
1935 #endif
1936 
1937 
1938  // Make coordinate sec_rep_space.
1939 
1940  string lname = xname + "_coordinates_section_space";
1941  poset_path lpath("sec_rep_descriptors", "vertex_block_uniform");
1942 
1943  sec_rep_space& lhost =
1944  sec_e1::standard_host(xns, xbase_space.path(true), lpath, "", "", false);
1945 
1946  lhost.get_read_write_access();
1947 
1948  // Make the coordinates section.
1949 
1950  sec_e1* result = new sec_e1(&lhost);
1951  result->put_name(xname + "_coordinate_field", true, false);
1952 
1953  // Set the coordinates dofs;
1954 
1955  put_1d_uniform_coord_dofs(xlower, xupper, result);
1956 
1957 #ifdef DIAGNOSTIC_OUTPUT
1958  cout << lhost << endl;
1959 #endif
1960 
1961  // Clean up.
1962 
1963  lhost.release_access();
1964 
1965  // Postconditions:
1966 
1967  ensure(result != 0);
1968  ensure(result->state_is_not_read_accessible());
1969 
1970  // Exit:
1971 
1972  return result;
1973 }
1974 
1978  const std::string& xname,
1979  size_type xi_size,
1980  size_type xj_size,
1981  bool xuse_quads)
1982 {
1983  // Preconditions:
1984 
1985  require(xns.state_is_read_write_accessible());
1986  require(!xname.empty());
1987  require(xi_size > 0);
1988  require(xj_size > 0);
1989 
1990  // Body:
1991 
1992  // Make the base space.
1993 
1994  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
1995 
1996  string lbase_name(xname+"_base_space");
1997  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 2, false);
1998 
1999  lhost.get_read_write_access();
2000 
2001  string proto_member_name(xuse_quads ? "quad_nodes" : "triangle_nodes");
2002 
2003  poset_path lproto_path(base_space_member::prototypes_poset_name(),
2004  proto_member_name);
2005 
2006  unstructured_block* result =
2007  new unstructured_block(&lhost, lproto_path, xi_size, xj_size);
2008  result->put_name(xname + "_unstructured_block", true, false);
2009 
2010 #ifdef DIAGNOSTIC_OUTPUT
2011  cout << lhost << endl;
2012 #endif
2013 
2014  // Clean up.
2015 
2016  lhost.release_access();
2017 
2018  // Postconditions:
2019 
2020  ensure(result != 0);
2021  ensure(result->state_is_not_read_accessible());
2022 
2023 
2024  // Exit:
2025 
2026  return result;
2027 }
2028 
2032  const std::string& xname,
2033  size_type xi_size,
2034  size_type xj_size,
2035  block<sec_vd_value_type>& xlower,
2036  block<sec_vd_value_type>& xupper,
2037  unstructured_block& xbase_space,
2038  const poset_path& xrep_path)
2039 {
2040  // Preconditions:
2041 
2042  require(xns.state_is_read_write_accessible());
2043  require(!xname.empty());
2044  require(xi_size > 0);
2045  require(xj_size > 0);
2046  require(xlower.ct() >= 2);
2047  require(xupper.ct() >= 2);
2048  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
2049  require(xns.contains_poset_member(xrep_path));
2050 
2051  // Body:
2052 
2053  // Make coordinate sec_rep_space.
2054 
2055  string lname = xname + "_coordinates_section_space";
2056 
2057  sec_rep_space& lhost =
2058  sec_e2::standard_host(xns, xbase_space.path(true), xrep_path, "", "", false);
2059 
2060  lhost.get_read_write_access();
2061 
2062  // Make the coordinates section.
2063 
2064  sec_e2* result = new sec_e2(&lhost);
2065  result->put_name(xname + "_coordinate_field", true, false);
2066 
2067  // Set the coordinates dofs.
2068 
2069  size_type i_ub = xi_size + 1;
2070  size_type j_ub = xj_size + 1;
2071 
2072  sec_vd_value_type ldelta0 = (xupper[0] - xlower[0])/xi_size;
2073  sec_vd_value_type ldelta1 = (xupper[1] - xlower[1])/xj_size;
2074 
2076 
2077  pod_index_type lclient_id;
2078 
2079  for(size_type i=0; i<i_ub; ++i)
2080  {
2081  lfiber[0] = xlower[0] + i*ldelta0;
2082  for(size_type j=0; j<j_ub; ++j)
2083  {
2084  lfiber[1] = xlower[1] + j*ldelta1;
2085 
2086  // Connectivity called from unstructured_block assigns vertex
2087  // client ids using standard array index calculation.
2088 
2089  lclient_id = i*j_ub + j;
2090 
2091  result->put_fiber(lclient_id, lfiber);
2092  }
2093  }
2094 
2095 #ifdef DIAGNOSTIC_OUTPUT
2096  cout << lhost << endl;
2097 #endif
2098 
2099  // Clean up.
2100 
2101  lhost.release_access();
2102 
2103  // Postconditions:
2104 
2105  ensure(result != 0);
2106  ensure(result->state_is_not_read_accessible());
2107 
2108  // Exit:
2109 
2110  return result;
2111 }
2112 
2113 #ifdef HAVE_VTK
2114 
2118  const std::string& xname,
2119  size_type xpt_ct,
2120  block<sec_vd_value_type>& xpt_coords)
2121 {
2122  // Preconditions:
2123 
2124  require(xns.state_is_read_write_accessible());
2125  require(!xname.empty());
2126  require(xpt_ct > 0);
2127 
2128  // Body:
2129 
2130  // Create xpt_ct random points within the unit circle centered at (0,0).
2131 
2132  vtkPoints* points = vtkPoints::New();
2133 
2134  int count = 0;
2135  while(count < xpt_ct)
2136  {
2137  double x = vtkMath::Random(-1.0, 1.0);
2138  double y = vtkMath::Random(-1.0, 1.0);
2139  double z = 0.0;
2140 
2141  double r2 = x*x + y*y;
2142  if(r2 <= 1.0)
2143  {
2144  points->InsertPoint(count, x, y, z);
2145  count++;
2146  }
2147  }
2148 
2149  // Triangulate the points by creating a VTK mesh object.
2150 
2151  vtkPolyData* profile = vtkPolyData::New();
2152  profile->SetPoints(points);
2153 
2154  vtkDelaunay2D* del = vtkDelaunay2D::New();
2155  del->SetInput(profile);
2156  del->SetTolerance(0.001);
2157 
2158  vtkConnectivityFilter* cf = vtkConnectivityFilter::New();
2159  cf->SetInput(del->GetOutput());
2160  cf->Update();
2161 
2162  vtkUnstructuredGrid* ugrid = cf->GetOutput();
2163 
2164  // Extract the point coordinates from the VTK mesh object.
2165 
2166  xpt_coords.reserve(2*xpt_ct);
2167  xpt_coords.set_ct(0);
2168  double lpt_coords[3];
2169  for(size_type i=0; i<xpt_ct; ++i)
2170  {
2171  ugrid->GetPoint(i, lpt_coords);
2172  xpt_coords.push_back(lpt_coords[0]);
2173  xpt_coords.push_back(lpt_coords[1]);
2174  }
2175 
2176  // Extract the triangle connectivity data from the VTK mesh object.
2177 
2178  size_type ltri_ct = ugrid->GetNumberOfCells();
2179  block<int> lconn(3*ltri_ct);
2180  lconn.set_ct(0);
2181 
2182  vtkIdType npts;
2183  vtkIdType* pts;
2184  for(size_type i=0; i<ltri_ct; ++i)
2185  {
2186  ugrid->GetCellPoints(i, npts, pts);
2187  lconn.push_back(pts[0]);
2188  lconn.push_back(pts[1]);
2189  lconn.push_back(pts[2]);
2190  }
2191 
2192  // Make the base space using the connectivy from the triangulation.
2193 
2194  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
2195 
2196  string lbase_name(xname+"_base_space");
2197  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 2, false);
2198 
2199  lhost.get_read_write_access();
2200 
2201  poset_path lproto_path(base_space_member::prototypes_poset_name(), "triangle_nodes");
2202 
2203  unstructured_block* result =
2204  new unstructured_block(&lhost, lproto_path, lconn.base(), lconn.ct(), true);
2205  result->put_name(xname + "_unstructured_block", true, false);
2206 
2207 #ifdef DIAGNOSTIC_OUTPUT
2208  cout << lhost << endl;
2209 #endif
2210 
2211  // Clean up.
2212 
2213  lhost.release_access();
2214 
2215  // Postconditions:
2216 
2217  ensure(result != 0);
2218  ensure(result->state_is_not_read_accessible());
2219 
2220 
2221  // Exit:
2222 
2223  return result;
2224 }
2225 
2226 #endif
2227 
2231  const std::string& xname,
2232  size_type xpt_ct,
2233  block<sec_vd_value_type>& xlower,
2234  block<sec_vd_value_type>& xupper,
2235  unstructured_block& xbase_space,
2236  const block<sec_vd_value_type>& xpt_coords)
2237 {
2238  // Preconditions:
2239 
2240  require(xns.state_is_read_write_accessible());
2241  require(!xname.empty());
2242  require(xpt_ct > 0);
2243  require(xlower.ct() >= 2);
2244  require(xupper.ct() >= 2);
2245  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
2246  require(xpt_coords.ct() >= 2*xpt_ct);
2247 
2248  // Body:
2249 
2250  // Make coordinate sec_rep_space.
2251 
2252  string lname = xname + "_coordinates_section_space";
2253  poset_path lpath("sec_rep_descriptors", "vertex_element_dlinear");
2254 
2255  sec_rep_space& lhost =
2256  sec_e2::standard_host(xns, xbase_space.path(true), lpath, "", "", false);
2257 
2258  lhost.get_read_write_access();
2259 
2260  // Make the coordinates section.
2261 
2262  sec_e2* result = new sec_e2(&lhost);
2263  result->put_name(xname + "_coordinate_field", true, false);
2264 
2265  // Set the coordinates dofs.
2266 
2268 
2269  sec_vd_value_type ldel0 = (xupper[0] - xlower[0])/2.0;
2270  sec_vd_value_type ldel1 = (xupper[1] - xlower[1])/2.0;
2271 
2272  for(size_type i=0; i<xpt_ct; ++i)
2273  {
2274  lfiber[0] = (xpt_coords[2*i ] + 1.0)*ldel0 + xlower[0];
2275  lfiber[1] = (xpt_coords[2*i+1] + 1.0)*ldel1 + xlower[1];
2276  result->put_fiber(i, lfiber);
2277  }
2278 
2279 #ifdef DIAGNOSTIC_OUTPUT
2280  cout << lhost << endl;
2281 #endif
2282 
2283  // Clean up.
2284 
2285  lhost.release_access();
2286 
2287  // Postconditions:
2288 
2289  ensure(result != 0);
2290  ensure(result->state_is_not_read_accessible());
2291 
2292  // Exit:
2293 
2294  return result;
2295 }
2296 
2297 
2301  const std::string& xname,
2302  size_type xi_size,
2303  size_type xj_size)
2304 {
2305  // Preconditions:
2306 
2307  require(xns.state_is_read_write_accessible());
2308  require(poset_path::is_valid_name(xname));
2309  require(!xns.contains_poset(xname, false));
2310  require(xi_size > 0);
2311  require(xj_size > 0);
2312 
2313  // Body:
2314 
2315  // Make the base space.
2316 
2317  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
2318 
2319  base_space_poset& lhost = structured_block_2d::standard_host(lns, xname, false);
2320 
2321  lhost.get_read_write_access();
2322 
2323  structured_block_2d* result =
2324  new structured_block_2d(&lhost, xi_size, xj_size, true);
2325  result->put_name(xname + "_structured_block_2d", true, false);
2326 
2327 #ifdef DIAGNOSTIC_OUTPUT
2328  cout << lhost << endl;
2329 #endif
2330 
2331  // Clean up.
2332 
2333  lhost.release_access();
2334 
2335  // Postconditions:
2336 
2337  ensure(result != 0);
2338  ensure(result->state_is_not_read_accessible());
2339 
2340  // Exit:
2341 
2342  return result;
2343 }
2344 
2348  const string& xname,
2349  size_type xi_size,
2350  size_type xj_size,
2351  block<sec_vd_value_type>& xlower,
2352  block<sec_vd_value_type>& xupper,
2353  structured_block_2d& xbase_space)
2354 {
2355  // Preconditions:
2356 
2357  require(xns.state_is_read_write_accessible());
2358  require(!xname.empty());
2359  require(xi_size > 0);
2360  require(xj_size > 0);
2361  require(xlower.ct() >= 2);
2362  require(xupper.ct() >= 2);
2363  require_for_all(i, 0, 2, xlower[i] < xupper[i]);
2364 
2365  // Body:
2366 
2367 #ifdef DIAGNOSTIC_OUTPUT
2368  cout << "xlower: ";
2369  for(int c=0; c<xlower.ub(); ++c)
2370  {
2371  cout << " " << xlower[c];
2372  }
2373  cout << endl;
2374 
2375  cout << "xupper: ";
2376  for(int c=0; c<xupper.ub(); ++c)
2377  {
2378  cout << " " << xupper[c];
2379  }
2380  cout << endl;
2381 #endif
2382 
2383 
2384  // Make coordinate sec_rep_space.
2385 
2386  string lname = xname + "_coordinates_section_space";
2387  poset_path lpath("sec_rep_descriptors", "vertex_block_uniform");
2388 
2389  sec_rep_space& lhost =
2390  sec_e2::standard_host(xns, xbase_space.path(true), lpath, "", "", false);
2391 
2392  lhost.get_read_write_access();
2393 
2394  // Make the coordinates section.
2395 
2396  sec_e2* result = new sec_e2(&lhost);
2397  result->put_name(xname + "_coordinate_field", true, false);
2398 
2399  // Set the coordinates dofs;
2400 
2401  put_2d_uniform_coord_dofs(xlower, xupper, result);
2402 
2403 #ifdef DIAGNOSTIC_OUTPUT
2404  cout << lhost << endl;
2405 #endif
2406 
2407  // Clean up.
2408 
2409  lhost.release_access();
2410 
2411  // Postconditions:
2412 
2413  ensure(result != 0);
2414  ensure(result->state_is_not_read_accessible());
2415 
2416  // Exit:
2417 
2418  return result;
2419 }
2420 
2424  const std::string& xname,
2425  size_type xi_size,
2426  size_type xj_size,
2427  size_type xk_size,
2428  bool xuse_hexs)
2429 {
2430  // Preconditions:
2431 
2432  require(xns.state_is_read_write_accessible());
2433  require(!xname.empty());
2434  require(xi_size > 0);
2435  require(xj_size > 0);
2436  require(xk_size > 0);
2437 
2438  // Body:
2439 
2440  // Make the base space.
2441 
2442  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
2443 
2444  string lbase_name(xname+"_base_space");
2445  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 3, false);
2446 
2447  lhost.get_read_write_access();
2448 
2449  string proto_member_name(xuse_hexs ? "hex_nodes" : "tetra_nodes");
2450 
2451  poset_path lproto_path(base_space_member::prototypes_poset_name(),
2452  proto_member_name);
2453 
2454  unstructured_block* result =
2455  new unstructured_block(&lhost, lproto_path, xi_size, xj_size, xk_size);
2456  result->put_name(xname + "_unstructured_block", true, false);
2457 
2458 #ifdef DIAGNOSTIC_OUTPUT
2459  cout << lhost << endl;
2460 #endif
2461 
2462  // Clean up.
2463 
2464  lhost.release_access();
2465 
2466  // Postconditions:
2467 
2468  ensure(result != 0);
2469  ensure(result->state_is_not_read_accessible());
2470 
2471 
2472  // Exit:
2473 
2474  return result;
2475 }
2476 
2480  const std::string& xname,
2481  size_type xi_size,
2482  size_type xj_size,
2483  size_type xk_size,
2484  block<sec_vd_value_type>& xlower,
2485  block<sec_vd_value_type>& xupper,
2486  unstructured_block& xbase_space,
2487  const poset_path& xrep_path)
2488 {
2489  // Preconditions:
2490 
2491  require(xns.state_is_read_write_accessible());
2492  require(!xname.empty());
2493  require(xi_size > 0);
2494  require(xj_size > 0);
2495  require(xk_size > 0);
2496  require(xlower.ct() >= 3);
2497  require(xupper.ct() >= 3);
2498  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
2499  require(xns.contains_poset_member(xrep_path));
2500 
2501  // Body:
2502 
2503  // Make coordinate sec_rep_space.
2504 
2505  string lname = xname + "_coordinates_section_space";
2506 
2507  sec_rep_space& lhost =
2508  sec_e3::standard_host(xns, xbase_space.path(true), xrep_path, "", "", false);
2509 
2510  lhost.get_read_write_access();
2511 
2512  // Make the coordinates section.
2513 
2514  sec_e3* result = new sec_e3(&lhost);
2515  result->put_name(xname + "_coordinate_field", true, false);
2516 
2517  // Set the coordinates dofs.
2518 
2519  size_type i_ub = xi_size + 1;
2520  size_type j_ub = xj_size + 1;
2521  size_type k_ub = xk_size + 1;
2522 
2523  sec_vd_value_type ldelta0 = (xupper[0] - xlower[0])/xi_size;
2524  sec_vd_value_type ldelta1 = (xupper[1] - xlower[1])/xj_size;
2525  sec_vd_value_type ldelta2 = (xupper[2] - xlower[2])/xk_size;
2526 
2528 
2529  pod_index_type lclient_id;
2530 
2531  for(size_type i=0; i<i_ub; ++i)
2532  {
2533  lfiber[0] = xlower[0] + i*ldelta0;
2534  for(size_type j=0; j<j_ub; ++j)
2535  {
2536  lfiber[1] = xlower[1] + j*ldelta1;
2537 
2538  for(size_type k=0; k<k_ub; ++k)
2539  {
2540  lfiber[2] = xlower[2] + k*ldelta2;
2541 
2542  // Connectivity called from unstructured_block assigns vertex
2543  // client ids using standard array index calculation.
2544 
2545  lclient_id = (i*j_ub + j)*k_ub + k;
2546 
2547  result->put_fiber(lclient_id, lfiber);
2548  }
2549  }
2550  }
2551 
2552 #ifdef DIAGNOSTIC_OUTPUT
2553  cout << lhost << endl;
2554 #endif
2555 
2556  // Clean up.
2557 
2558  lhost.release_access();
2559 
2560  // Postconditions:
2561 
2562  ensure(result != 0);
2563  ensure(result->state_is_not_read_accessible());
2564 
2565  // Exit:
2566 
2567  return result;
2568 }
2569 
2570 #ifdef HAVE_VTK
2571 
2575  const std::string& xname,
2576  size_type xpt_ct,
2577  block<sec_vd_value_type>& xpt_coords)
2578 {
2579  // Preconditions:
2580 
2581  require(xns.state_is_read_write_accessible());
2582  require(!xname.empty());
2583  require(xpt_ct > 0);
2584 
2585  // Body:
2586 
2587  // Create xpt_ct random points within the unit circle centered at (0,0).
2588 
2589  vtkPoints* points = vtkPoints::New();
2590 
2591  int count = 0;
2592  while(count < xpt_ct)
2593  {
2594  double x = vtkMath::Random(-1.0, 1.0);
2595  double y = vtkMath::Random(-1.0, 1.0);
2596  double z = vtkMath::Random(-1.0, 1.0);
2597 
2598  double r2 = x*x + y*y + z*z;
2599  if(r2 <= 1.0)
2600  {
2601  points->InsertPoint(count, x, y, z);
2602  count++;
2603  }
2604  }
2605 
2606  // Triangulate the points by creating a VTK mesh object.
2607 
2608  vtkPolyData* profile = vtkPolyData::New();
2609  profile->SetPoints(points);
2610 
2611  vtkDelaunay3D* del = vtkDelaunay3D::New();
2612  del->SetInput(profile);
2613  del->SetTolerance(0.001);
2614  del->Update();
2615 
2616  vtkUnstructuredGrid* ugrid = del->GetOutput();
2617 
2618  // Extract the point coordinates from the VTK mesh object.
2619 
2620  xpt_coords.reserve(3*xpt_ct);
2621  xpt_coords.set_ct(0);
2622  double lpt_coords[3];
2623  for(size_type i=0; i<xpt_ct; ++i)
2624  {
2625  ugrid->GetPoint(i, lpt_coords);
2626  xpt_coords.push_back(lpt_coords[0]);
2627  xpt_coords.push_back(lpt_coords[1]);
2628  xpt_coords.push_back(lpt_coords[2]);
2629  }
2630 
2631  // Extract the tet connectivity data from the VTK mesh object.
2632 
2633  size_type ltet_ct = ugrid->GetNumberOfCells();
2634  block<int> lconn(4*ltet_ct);
2635  lconn.set_ct(0);
2636 
2637  vtkIdType npts;
2638  vtkIdType* pts;
2639  for(size_type i=0; i<ltet_ct; ++i)
2640  {
2641  ugrid->GetCellPoints(i, npts, pts);
2642  lconn.push_back(pts[0]);
2643  lconn.push_back(pts[1]);
2644  lconn.push_back(pts[2]);
2645  lconn.push_back(pts[3]);
2646  }
2647 
2648  // Make the base space using the connectivy from the triangulation.
2649 
2650  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
2651 
2652  string lbase_name(xname+"_base_space");
2653  base_space_poset& lhost = unstructured_block::standard_host(lns, lbase_name, 3, false);
2654 
2655  lhost.get_read_write_access();
2656 
2657  poset_path lproto_path(base_space_member::prototypes_poset_name(), "tetra_nodes");
2658 
2659  unstructured_block* result =
2660  new unstructured_block(&lhost, lproto_path, lconn.base(), lconn.ct(), true);
2661 
2662  result->put_name(xname + "_unstructured_block", true, false);
2663 
2664 #ifdef DIAGNOSTIC_OUTPUT
2665  cout << lhost << endl;
2666 #endif
2667 
2668  // Clean up.
2669 
2670  lhost.release_access();
2671 
2672  // Postconditions:
2673 
2674  ensure(result != 0);
2675  ensure(result->state_is_not_read_accessible());
2676 
2677 
2678  // Exit:
2679 
2680  return result;
2681 }
2682 
2683 #endif
2684 
2688  const std::string& xname,
2689  size_type xpt_ct,
2690  block<sec_vd_value_type>& xlower,
2691  block<sec_vd_value_type>& xupper,
2692  unstructured_block& xbase_space,
2693  const block<sec_vd_value_type>& xpt_coords)
2694 {
2695  // Preconditions:
2696 
2697  require(xns.state_is_read_write_accessible());
2698  require(!xname.empty());
2699  require(xpt_ct > 0);
2700  require(xlower.ct() >= 3);
2701  require(xupper.ct() >= 3);
2702  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
2703  require(xpt_coords.ct() >= 3*xpt_ct);
2704 
2705  // Body:
2706 
2707  // Make coordinate sec_rep_space.
2708 
2709  string lname = xname + "_coordinates_section_space";
2710  poset_path lpath("sec_rep_descriptors", "vertex_element_dlinear");
2711 
2712  sec_rep_space& lhost =
2713  sec_e3::standard_host(xns, xbase_space.path(true), lpath, "", "", false);
2714 
2715  lhost.get_read_write_access();
2716 
2717  // Make the coordinates section.
2718 
2719  sec_e3* result = new sec_e3(&lhost);
2720  result->put_name(xname + "_coordinate_field", true, false);
2721 
2722  // Set the coordinates dofs.
2723 
2725 
2726  sec_vd_value_type ldel0 = (xupper[0] - xlower[0])/2.0;
2727  sec_vd_value_type ldel1 = (xupper[1] - xlower[1])/2.0;
2728  sec_vd_value_type ldel2 = (xupper[2] - xlower[2])/2.0;
2729 
2730  for(size_type i=0; i<xpt_ct; ++i)
2731  {
2732  lfiber[0] = (xpt_coords[3*i ] + 1.0)*ldel0 + xlower[0];
2733  lfiber[1] = (xpt_coords[3*i+1] + 1.0)*ldel1 + xlower[1];
2734  lfiber[2] = (xpt_coords[3*i+2] + 1.0)*ldel2 + xlower[2];
2735  result->put_fiber(i, lfiber);
2736  }
2737 
2738 #ifdef DIAGNOSTIC_OUTPUT
2739  cout << lhost << endl;
2740 #endif
2741 
2742  // Clean up.
2743 
2744  lhost.release_access();
2745 
2746  // Postconditions:
2747 
2748  ensure(result != 0);
2749  ensure(result->state_is_not_read_accessible());
2750 
2751  // Exit:
2752 
2753  return result;
2754 }
2755 
2759  const std::string& xname,
2760  size_type xi_size,
2761  size_type xj_size,
2762  size_type xk_size)
2763 {
2764  // Preconditions:
2765 
2766  require(xns.state_is_read_write_accessible());
2767  require(!xname.empty());
2768  require(xi_size > 0);
2769  require(xj_size > 0);
2770  require(xk_size > 0);
2771 
2772  // Body:
2773 
2774  // Make the base space.
2775 
2776  fiber_bundles_namespace& lns = dynamic_cast<fiber_bundles_namespace&>(xns);
2777 
2778  string lbase_name(xname+"_base_space");
2779  base_space_poset& lhost = structured_block_3d::standard_host(lns, lbase_name, false);
2780 
2781  lhost.get_read_write_access();
2782 
2783  structured_block_3d* result =
2784  new structured_block_3d(&lhost, xi_size, xj_size, xk_size, true);
2785  result->put_name(xname + "_structured_block_3d", true, false);
2786 
2787 #ifdef DIAGNOSTIC_OUTPUT
2788  cout << lhost << endl;
2789 #endif
2790 
2791  // Clean up.
2792 
2793  lhost.release_access();
2794 
2795  // Postconditions:
2796 
2797  ensure(result != 0);
2798  ensure(result->state_is_not_read_accessible());
2799 
2800  // Exit:
2801 
2802  return result;
2803 }
2804 
2808  const std::string& xname,
2809  size_type xi_size,
2810  size_type xj_size,
2811  size_type xk_size,
2812  block<sec_vd_value_type>& xlower,
2813  block<sec_vd_value_type>& xupper,
2814  structured_block_3d& xbase_space)
2815 {
2816  // Preconditions:
2817 
2818  require(xns.state_is_read_write_accessible());
2819  require(!xname.empty());
2820  require(xi_size > 0);
2821  require(xj_size > 0);
2822  require(xk_size > 0);
2823  require(xlower.ct() >= 3);
2824  require(xupper.ct() >= 3);
2825  require_for_all(i, 0, 3, xlower[i] < xupper[i]);
2826 
2827  // Body:
2828 
2829 #ifdef DIAGNOSTIC_OUTPUT
2830  cout << "xlower: ";
2831  for(int c=0; c<xlower.ub(); ++c)
2832  {
2833  cout << " " << xlower[c];
2834  }
2835  cout << endl;
2836 
2837  cout << "xupper: ";
2838  for(int c=0; c<xupper.ub(); ++c)
2839  {
2840  cout << " " << xupper[c];
2841  }
2842  cout << endl;
2843 #endif
2844 
2845 
2846  // Make coordinate sec_rep_space.
2847 
2848  string lname = xname + "_coordinates_section_space";
2849  poset_path lpath("sec_rep_descriptors", "vertex_block_uniform");
2850 
2851  sec_rep_space& lhost =
2852  sec_e3::standard_host(xns, xbase_space.path(true), lpath, "", "", false);
2853 
2854  lhost.get_read_write_access();
2855 
2856  // Make the coordinates section.
2857 
2858  sec_e3* result = new sec_e3(&lhost);
2859  result->put_name(xname + "_coordinate_field", true, false);
2860 
2861  // Set the coordinates dofs;
2862 
2863  put_3d_uniform_coord_dofs(xlower, xupper, result);
2864 
2865 
2866 #ifdef DIAGNOSTIC_OUTPUT
2867  cout << lhost << endl;
2868 #endif
2869 
2870  // Clean up.
2871 
2872  lhost.release_access();
2873 
2874  // Postconditions:
2875 
2876  ensure(result != 0);
2877  ensure(result->state_is_not_read_accessible());
2878 
2879  // Exit:
2880 
2881  return result;
2882 }
2883 
2887  const std::string& xname,
2888  base_space_member& xbase_space,
2889  const poset_path& xrep_path)
2890 {
2891  // Preconditions:
2892 
2893  require(xns.state_is_read_write_accessible());
2894  require(xns.contains_poset(xrep_path));
2895  require(!xname.empty());
2896 
2897  // Body:
2898 
2899  // Create the property sec_rep_space.
2900 
2901  string lname = xname + "_property_section_space";
2902 
2903  sec_rep_space& lhost =
2904  sec_at0::standard_host(xns, xbase_space.path(true), xrep_path, "", "", false);
2905 
2906  lhost.get_read_write_access();
2907 
2908  // Create the property section;
2909  // dofs will be set in main.
2910 
2911  sec_at0* result = new sec_at0(&lhost);
2912  result->put_name(xname+"_scalar_property", true, false);
2913 
2914 
2915  // Clean up.
2916 
2917  lhost.release_access();
2918 
2919  // Postconditions:
2920 
2921  ensure(result != 0);
2922  ensure(result->state_is_not_read_accessible());
2923 
2924  // Exit:
2925 
2926  return result;
2927 }
2928 
2929 void
2932  block<sec_vd_dof_type>& xproperty_dofs)
2933 {
2934  // Preconditions:
2935 
2936  require(xglobal_coords.ct() >= 1);
2937  require(xproperty_dofs.ct() == 1);
2938 
2939  // Body:
2940 
2941  // Not exactly a step, really a ramp.
2942  // Test case centers coarse mesh zone on
2943  // origin of coordinates, so make sure
2944  // test function not symmetric (or antisymmetric).
2945  // Otherwise, the error at the center may
2946  // be unexpectedly small.
2947 
2948  sec_vd_value_type x = xglobal_coords[0];
2949 
2950  if(x < -0.5)
2951  {
2952  xproperty_dofs[0] = -1.0;
2953  }
2954  else if(x > 0.0)
2955  {
2956  xproperty_dofs[0] = 1.0;
2957  }
2958  else
2959  {
2960  xproperty_dofs[0] = 4.0*x + 1.0;
2961  }
2962 
2963 
2964  // Postconditions:
2965 
2966  // Exit:
2967 
2968  return;
2969 }
2970 
2971 void
2974  block<sec_vd_dof_type>& xproperty_dofs)
2975 {
2976  // Preconditions:
2977 
2978  require(xglobal_coords.ct() > 0);
2979  require(xproperty_dofs.ct() == 1);
2980 
2981  // Body:
2982 
2983  sec_vd_dof_type lprop_dof = 20.0;
2984 
2985  int ldc = xglobal_coords.ct();
2986  for(int i=0; i<ldc; ++i)
2987  {
2988  lprop_dof += (i+1)*xglobal_coords[i];
2989  }
2990 
2991  xproperty_dofs[0] = lprop_dof;
2992 
2993 
2994  // Postconditions:
2995 
2996  // Exit:
2997 
2998  return;
2999 }
3000 
3001 void
3003 zero(block<sec_vd_value_type>& xglobal_coords, block<sec_vd_dof_type>& xproperty_dofs)
3004 {
3005  // Preconditions:
3006 
3007  // Body:
3008 
3009  xproperty_dofs.assign(0.0);
3010 
3011  // Postconditions:
3012 
3013  ensure_for_all(i, 0, xproperty_dofs.ct(), xproperty_dofs[i] == 0.0);
3014 
3015  // Exit:
3016 
3017  return;
3018 }
3019 
3020 
3024  const std::string& xbase_space_name,
3025  const block<int>& xindex_ubs)
3026 {
3027  base_space_member* result;
3028 
3029  // Preconditions:
3030 
3031 
3032  // Body:
3033 
3034  switch(xindex_ubs.ct())
3035  {
3036  case 1:
3037  result = field_factory::new_1d_structured_base_space(xns,
3038  xbase_space_name,
3039  xindex_ubs[0]);
3040  break;
3041  case 2:
3042  result = field_factory::new_2d_structured_base_space(xns,
3043  xbase_space_name,
3044  xindex_ubs[0],
3045  xindex_ubs[1]);
3046  break;
3047  case 3:
3048  result = field_factory::new_3d_structured_base_space(xns,
3049  xbase_space_name,
3050  xindex_ubs[0],
3051  xindex_ubs[1],
3052  xindex_ubs[2]);
3053  break;
3054  }
3055 
3056  // Postconditions:
3057 
3058 
3059  // Exit:
3060 
3061  return result;
3062 }
3063 
3064 
3068 {
3069  sec_ed* result;
3070 
3071  // Preconditions:
3072 
3073  require( (1 <= xdc) && (xdc <= 3) );
3074 
3075  // Body:
3076 
3077  switch(xdc)
3078  {
3079  case 1:
3080  result = new sec_e1();
3081  break;
3082  case 2:
3083  result = new sec_e2();
3084  break;
3085  case 3:
3086  result = new sec_e3();
3087  break;
3088  }
3089 
3090  // Postconditions:
3091 
3092  ensure(result != 0);
3093 
3094  // Exit:
3095 
3096  return result;
3097 }
3098 
3099 
3100 void
3103  const block<sec_vd_dof_type>& xupper,
3104  sec_ed* xcoords)
3105 {
3106  // Preconditions:
3107 
3108 
3109  // Body:
3110 
3112 
3113  // Structured_block_1d ctor sets client ids to match the order
3114  // for a normal seqment.
3115 
3116  // xmin; client id 0.
3117 
3118  lfiber[0] = xlower[0];
3119  xcoords->put_fiber(0, lfiber);
3120 
3121  // xmax; client id 1:
3122 
3123  lfiber[0] = xupper[0];
3124  xcoords->put_fiber(1, lfiber);
3125 
3126  // Postconditions:
3127 
3128 
3129  // Exit:
3130 
3131  return;
3132 }
3133 
3134 
3135 void
3138  const block<sec_vd_dof_type>& xupper,
3139  sec_ed* xcoords)
3140 {
3141  // Preconditions:
3142 
3143 
3144  // Body:
3145 
3146  // Set the coordinates dofs;
3147  // uniform coordinates have only 8 dofs in 2d,
3148  // the x,y coordinates at the corners of the domain.
3149  // (Even these aren't all independent).
3150 
3152 
3153  // Structured_block_2d ctor sets client ids to match the order
3154  // for a normal quad.
3155 
3156  // xmin, ymin; client id 0.
3157 
3158  lfiber[0] = xlower[0];
3159  lfiber[1] = xlower[1];
3160  xcoords->put_fiber(0, lfiber);
3161 
3162  // xmax, ymin; client id 1:
3163 
3164  lfiber[0] = xupper[0];
3165  lfiber[1] = xlower[1];
3166  xcoords->put_fiber(1, lfiber);
3167 
3168  // xmax, ymax; client id 2.
3169 
3170  lfiber[0] = xupper[0];
3171  lfiber[1] = xupper[1];
3172  xcoords->put_fiber(2, lfiber);
3173 
3174  // xmin, ymax; client id 3.
3175 
3176  lfiber[0] = xlower[0];
3177  lfiber[1] = xupper[1];
3178  xcoords->put_fiber(3, lfiber);
3179 
3180  // Postconditions:
3181 
3182 
3183  // Exit:
3184 
3185  return;
3186 }
3187 
3188 
3189 void
3192  const block<sec_vd_dof_type>& xupper,
3193  sec_ed* xcoords)
3194 {
3195  // Preconditions:
3196 
3197 
3198  // Body:
3199 
3200  // Set the coordinates dofs;
3201  // uniform coordinates have only 8 dofs in 2d,
3202  // the x,y coordinates at the corners of the domain.
3203  // (Even these aren't all independent).
3204 
3206 
3207  // Structured _block_3d ctor sets client ids to match the order
3208  // for a normal hex.
3209 
3210  // xmin, ymin, zmin; client id 0.
3211 
3212  lfiber[0] = xlower[0];
3213  lfiber[1] = xlower[1];
3214  lfiber[2] = xlower[2];
3215  xcoords->put_fiber(0, lfiber);
3216 
3217  // xmax, ymin, zmin; client id 1:
3218 
3219  lfiber[0] = xupper[0];
3220  lfiber[1] = xlower[1];
3221  lfiber[2] = xlower[2];
3222  xcoords->put_fiber(1, lfiber);
3223 
3224  // xmax, ymax, zmin; client id 2.
3225 
3226  lfiber[0] = xupper[0];
3227  lfiber[1] = xupper[1];
3228  lfiber[2] = xlower[2];
3229  xcoords->put_fiber(2, lfiber);
3230 
3231  // xmin, ymax, zmin; client id 3.
3232 
3233  lfiber[0] = xlower[0];
3234  lfiber[1] = xupper[1];
3235  lfiber[2] = xlower[2];
3236  xcoords->put_fiber(3, lfiber);
3237 
3238  // xmin, ymin, zmax; client id 4.
3239 
3240  lfiber[0] = xlower[0];
3241  lfiber[1] = xlower[1];
3242  lfiber[2] = xupper[2];
3243  xcoords->put_fiber(4, lfiber);
3244 
3245  // xmax, ymin, zmax; client id 5:
3246 
3247  lfiber[0] = xupper[0];
3248  lfiber[1] = xlower[1];
3249  lfiber[2] = xupper[2];
3250  xcoords->put_fiber(5, lfiber);
3251 
3252  // xmax, ymax, zmax; client id 6.
3253 
3254  lfiber[0] = xupper[0];
3255  lfiber[1] = xupper[1];
3256  lfiber[2] = xupper[2];
3257  xcoords->put_fiber(6, lfiber);
3258 
3259  // xmin, ymax, zmax; client id 7.
3260 
3261  lfiber[0] = xlower[0];
3262  lfiber[1] = xupper[1];
3263  lfiber[2] = xupper[2];
3264  xcoords->put_fiber(7, lfiber);
3265 
3266  // Postconditions:
3267 
3268 
3269  // Exit:
3270 
3271  return;
3272 }
3273 
3274 void
3277  const block<sec_vd_dof_type>& xlower,
3278  const block<sec_vd_dof_type>& xupper,
3279  sec_ed* xcoords)
3280 {
3281  // Preconditions:
3282 
3283 
3284  // Body:
3285 
3286  xcoords->get_read_write_access();
3287 
3288  switch(xdc)
3289  {
3290  case 1:
3291  put_1d_uniform_coord_dofs(xlower, xupper, xcoords);
3292  break;
3293  case 2:
3294  put_2d_uniform_coord_dofs(xlower, xupper, xcoords);
3295  break;
3296  case 3:
3297  put_3d_uniform_coord_dofs(xlower, xupper, xcoords);
3298  break;
3299  }
3300 
3301  xcoords->release_access();
3302 
3303  // Postconditions:
3304 
3305 
3306  // Exit:
3307 
3308  return;
3309 }
3310 
3311 
3314 property_dof_function(const std::string& xname)
3315 {
3317 
3318  // Preconditions:
3319 
3320  require((xname == "linear_scalar_fcn") || (xname == "zero") || (xname == "property_dof_function_example") || (xname == "step_fcn"));
3321 
3322  // Body:
3323 
3324  if(xname == "linear_scalar_fcn")
3325  {
3326  result = linear_scalar_fcn;
3327  }
3328  else if (xname == "step_fcn")
3329  {
3330  result = step_fcn;
3331  }
3332  else if (xname == "zero")
3333  {
3334  result = zero;
3335  }
3336  else if(xname == "property_dof_function_example")
3337  {
3338  result = field_vd::property_dof_function_example;
3339  }
3340 
3341  else
3342  {
3343  post_fatal_error_message("Unsuppported property dof function name.");
3344  }
3345 
3346  // Postconditions:
3347 
3348  ensure(result != 0);
3349 
3350  // Exit:
3351 
3352  return result;
3353 }
3354 
static field_vd * new_scalar_field_3d_uniform(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 3D uniform mesh xi_size by xj_size by ...
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...
static field_vd * new_scalar_field_1d_points(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_vertex_constant")
Creates a scalar field with name xname+"_scalar_property" on a point mesh with coordinates which loca...
static void put_2d_uniform_coord_dofs(const block< sec_vd_dof_type > &xlower, const block< sec_vd_dof_type > &xupper, sec_ed *xcoords)
Sets the dofs for 2D uniform coordinate section xcoords to the bounds specified by xlower and xupper...
virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser)
Delete the cover link between hub id xgreater and hub id xlesser.
static field_vd * new_scalar_field_1d_uniform(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 1D uniform mesh of size xi_size with c...
static field_vd * new_scalar_field_1d_unstructured(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 1D mesh of size xi_size, with cooordinate bounds xlower and xupper, and with property values given by xfcn. If xfcn == 0, then field_vd::property_value_function_example is used.
host_type * host() const
The poset this is a member of.
Definition: sec_vd.cc:1353
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
Definition: scoped_index.h:672
A homogeneous collection of connected quads arranged in an i_size() x j_size() array.
const scoped_index & index() const
The member index of this poset within the namespace host()
namespace_poset & name_space() const
The namespace this resides in.
Definition: field_vd.cc:331
poset_path path(bool xauto_access=true) const
A path to this component.
static sec_e2 * new_2d_unstructured_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, unstructured_block &xbase_space, const poset_path &xrep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates 2D cooordinates with bounds xlower and xupper.
Namespace for fields component of sheaf system.
The default name space; a poset which contains other posets as members.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
virtual void get_read_access() const
Get read access to the state associated with this.
Definition: field_vd.cc:1516
static sec_e2 * new_2d_uniform_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, structured_block_2d &xbase_space)
Creates 2D uniform coordinates with bounds xlower and xupper.
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
Definition: at1.h:44
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...
static sec_ed * new_coord_section_handle(int xdc)
Creates a new unattached instance of sec_e<xdc>.
static field_vd * new_scalar_field_3d_unstructured(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, bool xuse_hexs, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 3D mesh with general connectivity...
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 void step_fcn(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
Step property dof function. Not exactly a step, really a ramp. Test case centers coarse mesh zone on ...
STL namespace.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
host_type * host() const
The poset this is a member of.
Definition: sec_at1.cc:525
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.
OBSOLETE: use zone_nodes_block or point_block_*d. A client handle for a base space member which repre...
static sec_e1 * new_1d_uniform_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, structured_block_1d &xbase_space)
Creates 1D uniform coordinates with bounds xlower and xupper.
A homogeneous collection of connected segments arranged in an i_size() array.
static structured_block_2d * new_2d_structured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size, size_type xj_size)
Creates a 2D structured mesh with xi_size by xj_size.
A client handle for a member of a base space poset.
A client handle for a member of a namespace poset.
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...
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
Definition: sec_ed.h:47
static void put_1d_uniform_coord_dofs(const block< sec_vd_dof_type > &xlower, const block< sec_vd_dof_type > &xupper, sec_ed *xcoords)
Sets the dofs for 1D uniform coordinate section xcoords to the bounds specified by xlower and xupper...
poset & fiber_space()
The fiber space for section spaces on this schema.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
static unstructured_block * new_0d_point_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size)
Creates a 0D mesh of (xi_size+1) points, without any higher dimensional cells. Intended to be given c...
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
namespace_poset_member & top()
The top member of the poset (mutable version)
void assign(const_reference_type xitem)
Sets the values of all items to xitem.
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
poset * host() const
The poset which this is a handle to a member of.
pointer_type base() const
The underlying storage array.
static field_vd * new_scalar_field_2d_uniform(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 2D uniform mesh xi_size by xj_size wit...
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
static structured_block_1d * new_1d_structured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size)
Creates a 1D structured mesh with xi_size.
static base_space_member * new_structured_base_space(namespace_poset &xns, const std::string &xbase_space_name, const block< int > &xindex_ubs)
Constructs a structured base space in namespace xns, with name xbase_space_name, and index bounds xin...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
A vd-valued property as a function of global coordinates.
Definition: field_vd.h:69
bool cover_is_empty(bool xlower, pod_index_type xmbr_hub_id) const
True if and only if the lower (xlower true) or upper (xlower false) cover set of the member with hub ...
sec_vd & property() const
The dependent variable of this field.
Definition: field_vd.cc:357
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...
Definition: field_vd.cc:1594
static unstructured_block * new_1d_unstructured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size)
Creates a 1D mesh of size xi_size.
static sec_e3 * new_3d_unstructured_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, unstructured_block &xbase_space, const poset_path &xrep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates 3D cooordinates with bounds xlower and xupper.
static unstructured_block * new_2d_unstructured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size, size_type xj_size, bool xuse_quads)
Creates a 2D mesh with general connectivity, but arranged in an xi_size by xj_size rectangular array ...
static field_vd * new_scalar_field_3d_points(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_vertex_constant")
Creates a scalar field with name xname+"_scalar_property" on a point mesh with coordinates which loca...
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.
void(* property_dof_function_type)(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
The type of the function for computing the property dofs at given global coordinates.
Definition: fields.h:64
static field_vd * new_scalar_field_2d_unstructured(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, bool xuse_quads, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates a scalar field with name xname+"_scalar_property" on a 2D mesh with general connectivity...
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...
static sec_e3 * new_3d_uniform_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, structured_block_3d &xbase_space)
Creates 3D uniform coordinates with bounds xlower and xupper.
void delete_poset(pod_index_type xhub_id, bool xauto_access)
Delete the poset with hub id xhub_id.
A section of a fiber bundle with a 3-dimensional Euclidean vector space fiber.
Definition: sec_e3.h:47
base_space_member & base_space() const
The base space of this field.
Definition: field_vd.cc:373
static sec_at0 * new_property(fiber_bundles_namespace &xns, const std::string &xname, base_space_member &xbase_space, const poset_path &xrep_path)
Creates a property section with values given by xfcn. If xfcn == 0, then field_vd::property_value_fun...
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
A homogeneous collection of connected hexahedra arranged in an i_size() x j_size() x k_size() array...
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
prevent editing of jims and jim order relation
Iterates over the subset of Zn defined by the characteristic function host().
void detach_from_state()
Detaches field from state it is currently attached to.
Definition: sec_tuple.cc:603
const bool LOWER
Selector for lower cover.
Definition: sheaf.h:67
virtual void detach_from_state()
Detach this handle from its state, if any.
void put_property_dofs(property_dof_function_type xproperty_dofs_fcn, bool xauto_access)
Sets the dofs of property() to values computed by xproperty_dofs_fcn.
Definition: field_vd.cc:454
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...
static void delete_field_spaces(field_vd *xfield, bool xdelete_coord_fiber, bool xdelete_prop_fiber)
Deletes field xfield and all associated section spaces, section schema spaces, and base space...
bool state_is_not_read_accessible() const
True if this is attached and if the coordinates and property are not accessible for read or access co...
Definition: field_vd.cc:1403
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
Definition: sec_vd.cc:1144
static void zero(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
Property dof function with value 0.0.
static field_vd * new_scalar_field_2d_points(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, size_type xj_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, property_dof_function_type xfcn=0, const poset_path &xproperty_rep_path="sec_rep_descriptors/vertex_vertex_constant")
Creates a scalar field with name xname+"_scalar_property" on a point mesh with coordinates which loca...
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
A section of a fiber bundle with a 1-dimensional Euclidean vector space fiber.
Definition: sec_e1.h:47
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
static void linear_scalar_fcn(block< sec_vd_value_type > &xglobal_coords, block< sec_vd_dof_type > &xproperty_dofs)
Scalar property dof function, linear so it can be fit exactly by both linear and multilinear elements...
static void put_3d_uniform_coord_dofs(const block< sec_vd_dof_type > &xlower, const block< sec_vd_dof_type > &xupper, sec_ed *xcoords)
Sets the dofs for 3D uniform coordinate section xcoords to the bounds specified by xlower and xupper...
static void put_uniform_coord_dofs(int xdc, const block< sec_vd_dof_type > &xlower, const block< sec_vd_dof_type > &xupper, sec_ed *xcoords)
Sets the dofs for dimension xdc uniform coordinate section xcoords to the bounds specified by xlower ...
sec_ed_invertible & coordinates() const
The independent variable of this field.
Definition: field_vd.cc:339
virtual void delete_member(pod_index_type xmbr_hub_id)
Delete the member with hub id xmbr_hub_id. Warning: this routine does not delete links; it will leave...
index_iterator member_iterator() const
double sec_vd_dof_type
The type of degree of freedom in the section space.
Definition: fiber_bundle.h:78
static property_dof_function_type property_dof_function(const std::string &xname)
The property dof function with name xname. Intended to enable passing property_dof_function pointers ...
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Definition: pod_types.cc:37
static structured_block_3d * new_3d_structured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size)
Creates a 3D structured mesh with xi_size by xj_size by xk_size.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
Definition: fiber_bundle.h:73
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
Definition: sec_at0.h:51
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...
static sec_e1 * new_1d_unstructured_coordinates(fiber_bundles_namespace &xns, const std::string &xname, size_type xi_size, block< sec_vd_value_type > &xlower, block< sec_vd_value_type > &xupper, unstructured_block &xbase_space, const poset_path &xrep_path="sec_rep_descriptors/vertex_element_dlinear")
Creates 1D cooordinates with bounds xlower and xupper.
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
static unstructured_block * new_3d_unstructured_base_space(namespace_poset &xns, const std::string &xname, size_type xi_size, size_type xj_size, size_type xk_size, bool xuse_hexs)
Creates a 3D mesh with general connectivity, but arranged in an xi_size by xj_size by xk_size cubic a...
const int PREREQ_IDS_UB
Number of prerequisites ids. Must be consistent with PREREQ_ID_*_INDEX below.
virtual const scoped_index & member_id(bool xauto_access) const
An id in the member hub id space; intended for copying to initialize ids to the member id space...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710
A section of a fiber bundle with a 2-dimensional Euclidean vector space fiber.
Definition: sec_e2.h:48
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61