SheafSystem  0.0.0.0
vtk_unstructured_grid_builder.cc
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Implementation for class vtk_unstructured_grid_builder
19 
20 #include "SheafSystem/vtk_unstructured_grid_builder.h"
21 
22 #include "SheafSystem/assert_contract.h"
23 #include "SheafSystem/base_space_member.h"
24 #include "SheafSystem/biorder_iterator.h"
25 #include "SheafSystem/block.impl.h"
26 #include "SheafSystem/error_message.h"
27 #include "SheafSystem/eval_iterator.h"
28 #include "SheafSystem/namespace_poset.h"
29 #include "SheafSystem/postorder_iterator.h"
30 #include "SheafSystem/preorder_iterator.h"
31 #include "SheafSystem/sec_rep_descriptor.h"
32 #include "SheafSystem/sec_vd_space.h"
33 #include "SheafSystem/section_space_schema_poset.h"
34 #include "SheafSystem/visualization_iterator.h"
35 
36 #include "vtkUnstructuredGrid.h"
37 #include "vtkUnstructuredGridWriter.h"
38 #include "vtkDoubleArray.h"
39 #include "vtkFieldData.h"
40 #include "vtkIdTypeArray.h"
41 #include "vtkIntArray.h"
42 #include "vtkPoints.h"
43 #include "vtkCellArray.h"
44 #include "vtkCellData.h"
45 #include "vtkPointData.h"
46 
47 //#undefine DIAGNOSTIC_OUTPUT
48 //#define DIAGNOSTIC_OUTPUT
49 
50 // Workaround for MS Visual C++
51 using namespace tool;
52 using namespace std;
53 
54 // ============================================================================
55 // ANY FACET
56 // ============================================================================
57 
58 bool
60 is_ancestor_of(const any* other) const
61 {
62 
63  // Preconditions:
64 
65  require(other != 0);
66 
67  // Body:
68 
69  // True if other conforms to this
70 
71  bool result = dynamic_cast<const vtk_unstructured_grid_builder*>(other) != 0;
72 
73  // Postconditions:
74 
75  return result;
76 }
77 
80 clone() const
81 {
83 
84  // Preconditions:
85 
86  // Body:
87 
88  result = new vtk_unstructured_grid_builder();
89 
90  // Postconditions:
91 
92  ensure(result != 0);
93  ensure(is_same_type(result));
94 
95  // Exit:
96 
97  return result;
98 }
99 
103 {
104  // Preconditions:
105 
106  // Body:
107 
108  not_implemented();
109 
110  // Postconditions:
111 
112  ensure(invariant());
113 
114  // Exit
115 
116  return *this;
117 }
118 
122 {
123 
124  // Preconditions:
125 
126  require(is_ancestor_of(&xother));
127 
128  // Body:
129 
130  not_implemented();
131 
132  // Postconditions:
133 
134  ensure(invariant());
135 
136  // Exit:
137 
138  return *this;
139 }
140 
141 bool
143 invariant() const
144 {
145  bool result = true;
146 
147  if(invariant_check())
148  {
149  // Prevent recursive calls to invariant.
150 
151  disable_invariant_check();
152 
153  // Must satisfy base class invariant.
154 
156 
157  // Invariances for this class:
158 
162 
163  // Finished, turn invariant checking back on.
164 
165  enable_invariant_check();
166  }
167 
168  // Exit:
169 
170  return result;
171 }
172 
173 // ============================================================================
174 // VTK_DATA_SET_BUILDER FACET
175 // ============================================================================
176 
179 {
180  // Preconditions:
181 
182  // Body:
183 
184  _vtk_cell_types = new block<int>;
185  _vtk_cell_connectivity = new block<vtkIdType>;
186 
187  // Postconditions:
188 
189  // Exit:
190 
191  return;
192 }
193 
196 {
197  // Preconditions:
198 
199  // Body:
200 
201  not_implemented();
202 
203  // Postconditions:
204 
205  ensure(invariant());
206 
207  // Exit:
208 
209  return;
210 }
211 
214 {
215  // Preconditions:
216 
217  // Body:
218 
219  _vtk_cell_types = new block<int>;
220  _vtk_cell_connectivity = new block<vtkIdType>;
221 
222  set_name_space(xns);
223 
224  // Postconditions:
225 
226  ensure(invariant());
227 
228  // Exit:
229 
230  return;
231 }
232 
235 {
236  // Preconditions:
237 
238  // Body:
239 
240  delete _vtk_cell_types;
241  delete _vtk_cell_connectivity;
242 
243  // Postconditions:
244 
245  // Exit:
246 
247  return;
248 }
249 
250 void
253 {
254  // Preconditions:
255 
256  // Body:
257 
258  if(_name_space != &xns)
259  {
260  _name_space = &xns;
261 
262  // Initialize the mapping from sheaf cell types to vtk cell types.
263 
264  init_cell_type_map();
265  }
266 
267  // Postconditions:
268 
269  ensure(invariant());
270 
271  // Exit:
272 
273  return;
274 }
275 
276 vtkUnstructuredGrid*
278 build(const sec_vd& xcoords, const sec_vd& xproperty)
279 {
280  vtkUnstructuredGrid* result;
281 
282  // Preconditions:
283 
284  require(precondition_of(build_pa(xcoords, xproperty, result)));
285 
286  // Body:
287 
288  result = vtkUnstructuredGrid::New();
289 
290  build_pa(xcoords, xproperty, *result);
291 
292  // Postconditions:
293 
294  ensure(result != 0);
295  ensure(postcondition_of(build_pa(xcoords, xproperty, result)));
296 
297  // Exit:
298 
299  return result;
300 }
301 
302 vtkUnstructuredGrid*
304 build(const sec_vd& xcoords, const sec_vd& xproperty1, const sec_vd& xproperty2)
305 {
306  vtkUnstructuredGrid* result;
307 
308  // Preconditions:
309 
310  require(precondition_of(build_pa(xcoords, xproperty1, xproperty2, result)));
311 
312  // Body:
313 
314  result = vtkUnstructuredGrid::New();
315 
316  build_pa(xcoords, xproperty1, xproperty2, *result);
317 
318  // Postconditions:
319 
320  ensure(result != 0);
321  ensure(postcondition_of(build_pa(xcoords, xproperty1, xproperty2, result)));
322 
323  // Exit:
324 
325  return result;
326 }
327 
328 vtkUnstructuredGrid*
330 build(const sec_vd& xcoords)
331 {
332  vtkUnstructuredGrid* result;
333 
334  // Preconditions:
335 
336  require(precondition_of(build_pa(xcoords, result)));
337 
338  // Body:
339 
340  result = vtkUnstructuredGrid::New();
341 
342  build_pa(xcoords, *result);
343 
344  // Postconditions:
345 
346  ensure(result != 0);
347  ensure(postcondition_of(build_pa(xcoords, result)));
348 
349  // Exit:
350 
351  return result;
352 }
353 
354 vtkUnstructuredGrid*
356 build(const sec_vd& xcoords, const std::string& xpartition_name)
357 {
358  vtkUnstructuredGrid* result;
359 
360  // Preconditions:
361 
362  require(precondition_of(build_pa(xcoords, xparitition_name, result)));
363 
364  // Body:
365 
366  result = vtkUnstructuredGrid::New();
367 
368  build_pa(xcoords, xpartition_name, *result);
369 
370  // Postconditions:
371 
372  ensure(result != 0);
373  ensure(postcondition_of(build_pa(xcoords, xparitition_name, result)));
374 
375  // Exit:
376 
377  return result;
378 }
379 
380 vtkUnstructuredGrid*
382 build(const sec_vd& xcoords, const block<sec_vd*>& xproperties)
383 {
384  vtkUnstructuredGrid* result;
385 
386  // Preconditions:
387 
388  require(precondition_of(build_pa(xcoords, xproperties, result)));
389 
390  // Body:
391 
392  result = vtkUnstructuredGrid::New();
393 
394  build_pa(xcoords, xproperties, *result);
395 
396  // Postconditions:
397 
398  ensure(result != 0);
399  ensure(postcondition_of(build_pa(xcoords, xproperties, result)));
400 
401  // Exit:
402 
403  return result;
404 }
405 
406 void
408 build_pa(const sec_vd& xcoords,
409  const sec_vd& xproperty,
410  vtkUnstructuredGrid& xresult)
411 {
412 
413 #ifdef DIAGNOSTIC_OUTPUT
414  post_information_message("build_pa with property");
415 #endif
416 
417  // Preconditions:
418 
419  require(xcoords.state_is_read_accessible());
420  require(xcoords.schema().base_space().schema().\ conforms_to(base_space_member::standard_schema_path()));
421  require(xcoords.schema().df() <= 3);
422  require(!xcoords.name().empty());
423  require(xproperty.state_is_read_accessible());
424 
426 
427  require(xproperty.is_jim());
428 
433 
434  require(!xcoords.is_jim() ? xproperty.schema().same_base_space(xcoords.schema()) \
435  : true);
436 
437  // Body:
438 
439  // The vis iterators will iterate over the smaller of the coords or prop
440  // base space. So initialize the vtk mesh data with the smaller of the two.
441 
442  const sec_vd& lsmaller =
443  xcoords.schema().base_space().le(&xproperty.schema().base_space()) ?
444  xcoords : xproperty;
445 
446  initialize_vtk_mesh_data(lsmaller, xcoords.name());
447 
448  // Reset the property data
449 
450  _vtk_prop_dofs.set_ct(0);
451  _prop_is_pt_data.set_ct(0);
452  _prop_tensor_rank.set_ct(0);
453 
454  // Initialize property data.
455 
456  initialize_vtk_prop_data(&xproperty);
457 
458 
459  if(xcoords.is_jim())
460  {
461  // The coords are an ordinary section, not multi-section.
462  // Gather the point and cell data for the section.
463 
464  visualization_iterator* litr =
466 
467  litr->put_use_point_top_ids(_use_point_top_ids);
468  litr->put_use_cell_top_ids(_use_cell_top_ids);
469 
470  while(!litr->is_done())
471  {
472  litr->set_vtk_data(xcoords,
473  xproperty,
474  _vtk_coord_dofs,
475  _vtk_prop_dofs[0],
476  _prop_tensor_rank[0],
477  *_vtk_cell_types,
478  *_vtk_cell_connectivity,
479  _cell_type_map,
480  _vtk_pt_label_ids,
481  _vtk_cell_label_ids);
482  litr->next();
483  }
484 
485  delete litr;
486  }
487  else
488  {
489  // The coords are a multi-section.
490  // Gather the point and cell data separately for each branch.
491 
492  sec_rep_space* lhost = xcoords.host();
493 
494  visualization_iterator* litr =
496  xproperty.schema(),
497  false);
498 
499  litr->put_use_point_top_ids(_use_point_top_ids);
500  litr->put_use_cell_top_ids(_use_cell_top_ids);
501 
502  sec_vd lbranch;
503  preorder_iterator lbranch_itr(xcoords, "jims", DOWN, NOT_STRICT);
504  while(!lbranch_itr.is_done())
505  {
506  lbranch.attach_to_state(lhost, lbranch_itr.index());
507  section_space_schema_member& lbranch_schema =
508  lhost->member_dof_map(lbranch_itr.index()).schema();
509 
510  litr->put_anchor(lbranch_schema, xproperty.schema());
511  litr->reset();
512 
513  while(!litr->is_done())
514  {
515  litr->set_vtk_data(lbranch,
516  xproperty,
517  _vtk_coord_dofs,
518  _vtk_prop_dofs[0],
519  _prop_tensor_rank[0],
520  *_vtk_cell_types,
521  *_vtk_cell_connectivity,
522  _cell_type_map,
523  _vtk_pt_label_ids,
524  _vtk_cell_label_ids);
525  litr->next();
526  }
527  lbranch_itr.next();
528  }
529 
530  lbranch.detach_from_state();
531  delete litr;
532  }
533 
534  finalize_vtk_mesh_data(xresult);
535  finalize_vtk_prop_data(&xproperty,
536  _prop_is_pt_data[0],
537  _prop_tensor_rank[0],
538  _vtk_prop_dofs[0],
539  xresult);
540 
541  // Encourage vtk to reclaim memory.
542 
543  xresult.Squeeze();
544 
545 #ifdef DIAGNOSTIC_OUTPUT
546 
547  vtkIndent lindent;
548  xresult.PrintSelf(cout, lindent);
549 #endif
550 
551  // Postconditions:
552 
553 
554  // Exit:
555 
556  return;
557 }
558 
559 void
561 build_pa(const sec_vd& xcoords, const sec_vd& xproperty1, const sec_vd& xproperty2,
562  vtkUnstructuredGrid& xresult)
563 {
564 
565 #ifdef DIAGNOSTIC_OUTPUT
566  post_information_message("build_pa with properties");
567 #endif
568 
569  // Preconditions:
570 
571  require(xcoords.state_is_read_accessible());
572  require(xcoords.schema().base_space().schema().\ conforms_to(base_space_member::standard_schema_path()));
573  require(xcoords.schema().df() <= 3);
574  require(!xcoords.name().empty());
575  require(xproperty1.state_is_read_accessible());
576  require(xproperty2.state_is_read_accessible());
577 
579 
580  require(xproperty1.is_jim());
581  require(xproperty2.is_jim());
582 
587 
588  require(!xcoords.is_jim() ? xproperty1.schema().same_base_space(xcoords.schema()) : true);
589  require(!xcoords.is_jim() ? xproperty2.schema().same_base_space(xcoords.schema()) : true);
590 
591  // Body:
592 
593  // Construct a block for the properties
594 
595  block<sec_vd*> properties;
596  properties.push_back(const_cast<sec_vd*>(&xproperty1));
597  properties.push_back(const_cast<sec_vd*>(&xproperty2));
598 
599  // Call the block build function
600 
601  build_pa(xcoords, properties, xresult);
602 
603  // Postconditions:
604 
605 
606  // Exit:
607 
608  return;
609 }
610 
611 void
613 build_pa(const sec_vd& xcoords, vtkUnstructuredGrid& xresult)
614 {
616 #ifdef DIAGNOSTIC_OUTPUT
617  post_information_message("build_pa without property");
618 #endif
619 
620  // Preconditions:
621 
622  require(xcoords.state_is_read_accessible());
623  require(xcoords.schema().base_space().schema().\ conforms_to(base_space_member::standard_schema_path()));
624  require(xcoords.schema().df() <= 3);
625  require(!xcoords.name().empty());
626 
627  // Body:
628 
629  initialize_vtk_mesh_data(xcoords, xcoords.name());
630 
631  if(xcoords.is_jim())
632  {
633  // The coords are an ordinary section, not multi-section.
634  // Gather the point and cell data for the section.
635 
636  visualization_iterator* litr =
638  const_cast<sec_vd&>(xcoords).schema());
639 
640  litr->put_use_point_top_ids(_use_point_top_ids);
641  litr->put_use_cell_top_ids(_use_cell_top_ids);
642 
643  while(!litr->is_done())
644  {
645  litr->set_vtk_data(const_cast<sec_vd&>(xcoords),
646  _vtk_coord_dofs,
647  *_vtk_cell_types,
648  *_vtk_cell_connectivity,
649  _cell_type_map,
650  _vtk_pt_label_ids,
651  _vtk_cell_label_ids);
652  litr->next();
653  }
654 
655  delete litr;
656  }
657  else
658  {
659  // The coords are a multi-section.
660  // Gather the point and cell data separately for each branch.
661 
662  sec_rep_space* lhost = xcoords.host();
663 
664  visualization_iterator* litr =
666  const_cast<sec_vd&>(xcoords).schema(), false);
667 
668  litr->put_use_point_top_ids(_use_point_top_ids);
669  litr->put_use_cell_top_ids(_use_cell_top_ids);
670 
671  sec_vd lbranch;
672  preorder_iterator lbranch_itr(xcoords, "jims", DOWN, NOT_STRICT);
673  while(!lbranch_itr.is_done())
674  {
675  lbranch.attach_to_state(lhost, lbranch_itr.index());
676  section_space_schema_member& lbranch_schema =
677  lhost->member_dof_map(lbranch_itr.index()).schema();
678 
679  litr->put_anchor(lbranch_schema);
680  litr->reset();
681 
682  while(!litr->is_done())
683  {
684  litr->set_vtk_data(lbranch,
685  _vtk_coord_dofs,
686  *_vtk_cell_types,
687  *_vtk_cell_connectivity,
688  _cell_type_map,
689  _vtk_pt_label_ids,
690  _vtk_cell_label_ids);
691  litr->next();
692  }
693  lbranch_itr.next();
694  }
695 
696  lbranch.detach_from_state();
697  delete litr;
698  }
699 
700  finalize_vtk_mesh_data(xresult);
701 
702  // Encourage vtk to reclaim memory.
703 
704  xresult.Squeeze();
705 
706 #ifdef DIAGNOSTIC_OUTPUT
707  vtkIndent lindent;
708  xresult.PrintSelf(cout, lindent);
709 #endif
710 
711  // Postconditions:
712 
713 
714  // Exit:
715 
716  return;
717 }
718 
719 void
721 build_pa(const sec_vd& xcoords,
722  const std::string& xpartition_name,
723  vtkUnstructuredGrid& xresult)
724 {
725 
726 #ifdef DIAGNOSTIC_OUTPUT
727  post_information_message("build_pa with partition");
728 #endif
729 
730  // Preconditions:
731 
732  require(xcoords.state_is_read_accessible());
734  require(xcoords.schema().df() <= 3);
735  require(!xpartition_name.empty());
736  require(xcoords.schema().base_space().host()->member_id_spaces(true).contains(xpartition_name));
737 
738  // Body:
739 
740  build_pa(xcoords, xresult);
741  set_cell_data(const_cast<sec_vd&>(xcoords).schema().base_space(), xpartition_name, xresult);
742 
743  // Exit:
744 
745  return;
746 }
747 
748 void
750 build_pa(const sec_vd& xcoords,
751  const block<sec_vd*>& xproperties,
752  vtkUnstructuredGrid& xresult)
753 {
754 
755 #ifdef DIAGNOSTIC_OUTPUT
756  post_information_message("build_pa with multiple properties");
757 #endif
758 
759  // Preconditions:
760 
761  require(xcoords.state_is_read_accessible());
762  require(xcoords.schema().base_space().schema().\ conforms_to(base_space_member::standard_schema_path()));
763  require(xcoords.schema().df() <= 3);
764  require(!xcoords.name().empty());
765  require(xproperties.ct() > 0);
766  require_for_all(i, 0, xproperties.ct(), xproperties[i]->state_is_read_accessible());
767 
769 
770  require_for_all(i, 0, xproperties.ct(), xproperties[i]->is_jim());
771 
776 
777  require_for_all(i, 0, xproperties.ct(), !xcoords.is_jim() ?
778  xproperties[i]->schema().same_base_space(xcoords.schema()) : true);
779 
780  // Body:
781 
782  // The vis iterators will iterate over the smaller of the coords or prop
783  // base space. So initialize the vtk mesh data with the smaller of the two.
784 
785  const sec_vd* lsmaller = &xcoords;
786  for(int i=0; i<xproperties.ct(); ++i)
787  {
788  if(xproperties[i]->schema().base_space().le(&lsmaller->schema().base_space()))
789  {
790  lsmaller = xproperties[i];
791  }
792  }
793 
794  initialize_vtk_mesh_data(*lsmaller, xcoords.name());
795 
796  // Reset the property data.
797 
798  _vtk_prop_dofs.set_ct(0);
799  _prop_is_pt_data.set_ct(0);
800  _prop_tensor_rank.set_ct(0);
801 
802  // Initialize property data.
803 
804  for(int i=0; i<xproperties.ct(); ++i)
805  {
806  initialize_vtk_prop_data(xproperties[i]);
807  }
808 
809 
811 
812  // Tranfer the coordinates and the first property to vtk.
813 
814  if(xcoords.is_jim())
815  {
816  // The coords are an ordinary section, not multi-section.
817  // Gather the point and cell data for the section.
818 
819  litr =
821  xproperties[0]->schema());
822 
823  litr->put_use_point_top_ids(_use_point_top_ids);
824  litr->put_use_cell_top_ids(_use_cell_top_ids);
825 
826  while(!litr->is_done())
827  {
828  litr->set_vtk_data(xcoords,
829  *xproperties[0],
830  _vtk_coord_dofs,
831  _vtk_prop_dofs[0],
832  _prop_tensor_rank[0],
833  *_vtk_cell_types,
834  *_vtk_cell_connectivity,
835  _cell_type_map,
836  _vtk_pt_label_ids,
837  _vtk_cell_label_ids);
838  litr->next();
839  }
840  delete litr;
841  }
842  else
843  {
844  // The coords are a multi-section.
845  // Gather the point and cell data separately for each branch.
846 
847  sec_rep_space* lhost = xcoords.host();
848 
849  litr =
851  xproperties[0]->schema(),
852  false);
853 
854  litr->put_use_point_top_ids(_use_point_top_ids);
855  litr->put_use_cell_top_ids(_use_cell_top_ids);
856 
857  sec_vd lbranch;
858  preorder_iterator lbranch_itr(xcoords, "jims", DOWN, NOT_STRICT);
859  while(!lbranch_itr.is_done())
860  {
861  lbranch.attach_to_state(lhost, lbranch_itr.index());
862  section_space_schema_member& lbranch_schema =
863  lhost->member_dof_map(lbranch_itr.index()).schema();
864 
865  litr->put_anchor(lbranch_schema, xproperties[0]->schema());
866  litr->reset();
867 
868  while(!litr->is_done())
869  {
870  litr->set_vtk_data(lbranch,
871  *xproperties[0],
872  _vtk_coord_dofs,
873  _vtk_prop_dofs[0],
874  _prop_tensor_rank[0],
875  *_vtk_cell_types,
876  *_vtk_cell_connectivity,
877  _cell_type_map,
878  _vtk_pt_label_ids,
879  _vtk_cell_label_ids);
880  litr->next();
881  }
882  lbranch_itr.next();
883  }
884 
885  lbranch.detach_from_state();
886  delete litr;
887  }
888 
889  // Transfer the remaining properties to vtk.
890 
891  for(int i=1; i<xproperties.ct(); ++i)
892  {
895 
896  litr =
898  xproperties[i]->schema());
899 
900  litr->put_use_point_top_ids(_use_point_top_ids);
901  litr->put_use_cell_top_ids(_use_cell_top_ids);
902 
903  while(!litr->is_done())
904  {
905  litr->set_vtk_data(*xproperties[i], _vtk_prop_dofs[i], _prop_tensor_rank[i]);
906  litr->next();
907  }
908 
909  delete litr;
910  }
911 
912  // Finalize vtk data.
913 
914  finalize_vtk_mesh_data(xresult);
915 
916  for(int i=0; i<xproperties.ct(); ++i)
917  {
918  finalize_vtk_prop_data(xproperties[i],
919  _prop_is_pt_data[i],
920  _prop_tensor_rank[i],
921  _vtk_prop_dofs[i],
922  xresult);
923  }
924 
925  // Encourage vtk to reclaim memory.
926 
927  xresult.Squeeze();
928 
929 #ifdef DIAGNOSTIC_OUTPUT
930  vtkIndent lindent;
931  xresult.PrintSelf(cout, lindent);
932 #endif
933 
934  // Postconditions:
935 
936  // Exit:
937 
938  return;
939 }
940 
941 
942 // ============================================================================
943 // PRIVATE MEMBER FUNCTIONS
944 // ============================================================================
945 
947 tool::vtk_unstructured_grid_builder::
948 name_space() const
949 {
950  return *_name_space;
951 }
952 
953 void
954 tool::vtk_unstructured_grid_builder::
955 init_cell_type_map()
956 {
957  // Preconditions:
958 
959  require(name_space().state_is_read_accessible());
960 
961  // Body:
962 
963  poset* lprototypes =
964  &name_space().member_poset<poset>(base_space_member::prototypes_poset_name(),
965  false);
966  lprototypes->get_read_access();
967 
968  _cell_type_map.reserve(lprototypes->member_index_ub().pod());
969 
970  _cell_type_map.set_ct(_cell_type_map.ub());
971  _cell_type_map.assign(0);
972 
973  base_space_member lmbr;
974  lmbr.attach_to_state(lprototypes, "point");
975  _cell_type_map.set_item(lmbr.type_id(), 1);
976 
977  lmbr.attach_to_state(lprototypes, "segment");
978  _cell_type_map.set_item(lmbr.type_id(), 3);
979 
980  lmbr.attach_to_state(lprototypes, "segment_complex");
981  _cell_type_map.set_item(lmbr.type_id(), 3);
982 
983  lmbr.attach_to_state(lprototypes, "triangle");
984  _cell_type_map.set_item(lmbr.type_id(), 5);
985 
986  lmbr.attach_to_state(lprototypes, "triangle_nodes");
987  _cell_type_map.set_item(lmbr.type_id(), 5);
988 
989  lmbr.attach_to_state(lprototypes, "triangle_complex");
990  _cell_type_map.set_item(lmbr.type_id(), 5);
991 
992  lmbr.attach_to_state(lprototypes, "quad");
993  _cell_type_map.set_item(lmbr.type_id(), 9);
994 
995  lmbr.attach_to_state(lprototypes, "quad_nodes");
996  _cell_type_map.set_item(lmbr.type_id(), 9);
997 
998  lmbr.attach_to_state(lprototypes, "quad_complex");
999  _cell_type_map.set_item(lmbr.type_id(), 9);
1000 
1001  lmbr.attach_to_state(lprototypes, "hex");
1002  _cell_type_map.set_item(lmbr.type_id(), 12);
1003 
1004  lmbr.attach_to_state(lprototypes, "hex_nodes");
1005  _cell_type_map.set_item(lmbr.type_id(), 12);
1006 
1007  lmbr.attach_to_state(lprototypes, "hex_complex");
1008  _cell_type_map.set_item(lmbr.type_id(), 12);
1009 
1010  lmbr.attach_to_state(lprototypes, "tetra");
1011  _cell_type_map.set_item(lmbr.type_id(), 10);
1012 
1013  lmbr.attach_to_state(lprototypes, "tetra_nodes");
1014  _cell_type_map.set_item(lmbr.type_id(), 10);
1015 
1016  lmbr.attach_to_state(lprototypes, "tetra_complex");
1017  _cell_type_map.set_item(lmbr.type_id(), 10);
1018 
1019  lmbr.detach_from_state();
1020  lprototypes->release_access();
1021 
1022  // Postconditions:
1023 
1024  // Exit:
1025 
1026  return;
1027 }
1028 
1029 void
1030 tool::vtk_unstructured_grid_builder::
1031 set_cell_data(abstract_poset_member& xbase,
1032  const std::string& xpartition_name,
1033  vtkUnstructuredGrid& xresult)
1034 {
1035  // Preconditions:
1036 
1037  require(!xpartition_name.empty());
1038  require(xbase.host()->member_id_spaces(true).contains(xpartition_name));
1039 
1040  // Body:
1041 
1042  // Create the paritition coloring data
1043 
1044  vtkDoubleArray* lvtk_part_ids = vtkDoubleArray::New();
1045  string lpart_ids_name(xpartition_name + "_mbr_ids");
1046  lvtk_part_ids->SetName(lpart_ids_name.c_str());
1047  lvtk_part_ids->SetNumberOfComponents(1);
1048  lvtk_part_ids->SetNumberOfTuples(_cell_ct);
1049 
1050 #ifdef DIAGNOSTIC_OUTPUT
1051  cout << xbase << endl;
1052 #endif
1053 
1054  subposet lparts(xbase.host(), xpartition_name);
1055 
1056  const index_space_handle& lpart_space = lparts.id_space();
1057  double lpart_id = 0.0;
1058 
1059  subposet lzones(xbase.host(), "__elements");
1060  int lzone_id = 0;
1061  bool ltruncate = false;
1062 
1063  biorder_iterator lpart_itr(xbase, DOWN, NOT_STRICT);
1064  while(!lpart_itr.is_done())
1065  {
1066  scoped_index lmbr_id = lpart_itr.index();
1067  switch(lpart_itr.action())
1068  {
1069  case biorder_iterator::PREVISIT_ACTION:
1070 
1071  if(lparts.contains_member(lmbr_id))
1072  {
1073  // This member is one of the parts;
1074  // set the current part id and continue descent
1075 
1076  lpart_id = static_cast<double>(lpart_space.pod(lmbr_id) + 1);
1077 
1078 #ifdef DIAGNOSTIC_OUTPUT
1079  cout << "entering part with mbr_id: " << lmbr_id
1080  << " and with part id: " << lpart_id
1081  << endl;
1082 #endif
1083 
1084  ltruncate = false;
1085  }
1086  else if(lzones.contains_member(lmbr_id))
1087  {
1088  // This member is a zone;
1089  // store the current part id as cell data.
1090  // No need to go deeper.
1091 
1092 
1093 #ifdef DIAGNOSTIC_OUTPUT
1094  cout << "mbr_id: " << lmbr_id
1095  << " is a zone with seq id: " << lzone_id
1096  << " and with part id: " << lpart_id
1097  << endl;
1098 #endif
1099 
1100  lvtk_part_ids->SetTuple(lzone_id++, &lpart_id);
1101  ltruncate = true;
1102  }
1103  else
1104  {
1105  // This member is neither a part nor a zone;
1106  // just continue descent.
1107 
1108  ltruncate = false;
1109  }
1110 
1111  break;
1112  case biorder_iterator::POSTVISIT_ACTION:
1113 
1114  if(lparts.contains_member(lmbr_id))
1115  {
1116  // This member is one of the parts and we're leaving it;
1117  // set the current part id back to -1.
1118 
1119 #ifdef DIAGNOSTIC_OUTPUT
1120  cout << "leaving part with mbr_id: " << lmbr_id
1121  << " and with part id: " << lpart_id
1122  << endl;
1123 #endif
1124 
1125  lpart_id = 0.0;
1126  ltruncate = false;
1127  }
1128 
1129  break;
1130  default:
1131  post_fatal_error_message("Unrecognized iterator action");
1132  break;
1133  }
1134  lpart_itr.next(ltruncate);
1135  }
1136 
1137  // Set the partition data into the result.
1138 
1139  xresult.GetCellData()->SetScalars(lvtk_part_ids);
1140 
1141  // Clean up.
1142 
1143  lzones.detach_from_state();
1144  lparts.detach_from_state();
1145  lvtk_part_ids->Delete();
1146 
1147  // Postconditions:
1148 
1149  // Exit:
1150 
1151  return;
1152 }
1153 
1155 void
1157 build_file(const sec_vd& xcoords, const sec_vd& xproperty, const std::string& xvtk_file_name, bool xis_ascii)
1158 {
1159  // Preconditions:
1160 
1161  require(xcoords.state_is_read_accessible());
1163  require(xcoords.schema().df() <= 3);
1164  require(xproperty.state_is_read_accessible());
1165  require(xproperty.schema().base_space().is_same_state(&xcoords.schema().base_space()));
1166  require(xproperty.schema().evaluation().is_same_state(&xcoords.schema().evaluation()));
1167  require(!xvtk_file_name.empty());
1168 
1169  // Body:
1170 
1171 
1172  // Create a vtk data object.
1173 
1174  vtkUnstructuredGrid* lug = build(xcoords, xproperty);
1175 
1176  // Create a vtk data object writer and set it to write
1177  // either ascii or binary.
1178 
1179  vtkUnstructuredGridWriter* writer = vtkUnstructuredGridWriter::New();
1180  writer->SetInputData(lug);
1181  writer->SetFileName(xvtk_file_name.c_str());
1182 
1183  if(xis_ascii)
1184  writer->SetFileTypeToASCII();
1185  else
1186  writer->SetFileTypeToBinary();
1187 
1188  // Actually write the file.
1189 
1190  writer->Write();
1191 
1192  // Cleanup.
1193 
1194  writer->Delete();
1195  lug->Delete();
1196 
1197 
1198  // Postconditions:
1199 
1200 
1201  // Exit:
1202 
1203  return;
1204 
1205 }
1206 
1207 bool
1209 is_scalar(const sec_vd* xsec) const
1210 {
1211  // Preconditions:
1212 
1213  require(xsec->state_is_read_accessible());
1214 
1215  // Body:
1216 
1217  static const int num_paths = 2;
1218 
1219  static const string schema_paths[num_paths] =
1220  {
1221  "fiber_space_schema/at0_schema",
1222  "fiber_space_schema/e1_schema"
1223  };
1224 
1225  bool result = false;
1226 
1227  const schema_poset_member& fiber_schema = xsec->schema().fiber_schema();
1228 
1229  for(int i=0; i<num_paths; ++i)
1230  {
1231  result = fiber_schema.conforms_to(schema_paths[i]);
1232  if(result)
1233  break;
1234  }
1235 
1236  // Postconditions:
1237 
1238  // Exit:
1239 
1240  return result;
1241 }
1242 
1243 bool
1245 is_vector(const sec_vd* xsec) const
1246 {
1247  // Preconditions:
1248 
1249  require(xsec->state_is_read_accessible());
1250 
1251  // Body:
1252 
1253  static const int num_paths = 2;
1254 
1255  static const string schema_paths[num_paths] =
1256  {
1257  "fiber_space_schema/e2_schema",
1258  "fiber_space_schema/e3_schema"
1259  };
1260 
1261  bool result = false;
1262 
1263  const schema_poset_member& fiber_schema = xsec->schema().fiber_schema();
1264 
1265  for(int i=0; i<num_paths; ++i)
1266  {
1267  result = fiber_schema.conforms_to(schema_paths[i]);
1268  if(result)
1269  break;
1270  }
1271 
1272  // Postconditions:
1273 
1274  // Exit:
1275 
1276  return result;
1277 }
1278 
1279 bool
1281 is_tensor(const sec_vd* xsec) const
1282 {
1283  // Preconditions:
1284 
1285  require(xsec->state_is_read_accessible());
1286 
1287  // Body:
1288 
1290 
1291  static const int num_paths = 7;
1292 
1293  static const string schema_paths[num_paths] =
1294  {
1295  // VTK only supports rank 2 symmetric tensors
1296  // "fiber_space_schema/at2_e2_schema",
1297  // "fiber_space_schema/at2_e3_schema",
1298  // "fiber_space_schema/t02_e2_schema",
1299  // "fiber_space_schema/t02_e3_schema",
1300  // "fiber_space_schema/t03_e3_schema",
1301  "fiber_space_schema/st2_e2_schema",
1302  "fiber_space_schema/st2_e3_schema"
1303  };
1304 
1305  bool result = false;
1306 
1307  const schema_poset_member& fiber_schema = xsec->schema().fiber_schema();
1308 
1309  for(int i=0; i<num_paths; ++i)
1310  {
1311  result = fiber_schema.conforms_to(schema_paths[i]);
1312  if(result)
1313  break;
1314  }
1315 
1316  // Postconditions:
1317 
1318  // Exit:
1319 
1320  return result;
1321 }
1322 
1323 void
1324 tool::vtk_unstructured_grid_builder::
1325 initialize_vtk_mesh_data(const sec_vd& xsec, std::string xcoords_name)
1326 {
1327  // Preconditions:
1328 
1329  require(xsec.state_is_read_accessible());
1330 
1333 
1334  require(!xsec.is_jim() ?
1335  (xsec.schema().rep().name() == "vertex_element_dlinear" ||
1336  xsec.schema().rep().name() == "vertex_vertex_constant") :
1337  true);
1338 
1339  // Body:
1340 
1341  const section_space_schema_member& lschema = xsec.schema();
1342  int ldb = lschema.db();
1343  base_space_poset& lbase_host = lschema.host()->base_space();
1344  _is_point_mesh = (lbase_host.max_db() == 0);
1345 
1346  // Calculate the vertex and cell counts.
1347 
1348  _pt_ct = 0;
1349  postorder_iterator litr(xsec.base(), lbase_host.d_cells(0), DOWN, NOT_STRICT);
1350  while(!litr.is_done())
1351  {
1352  _pt_ct++;
1353  litr.next();
1354  }
1355 
1356  _cell_ct = 0;
1357  postorder_iterator litr2(xsec.base(), lbase_host.d_cells(ldb), DOWN, NOT_STRICT);
1358  while(!litr2.is_done())
1359  {
1360  _cell_ct++;
1361  litr2.next();
1362  }
1363 
1364  // Allocate the vtk coord data arrays.
1365  // Parameter xcoords_name passed by value because .c_str() modifies state.
1366 
1367  _vtk_coord_dofs = vtkDoubleArray::New();
1368  _vtk_coord_dofs->SetName(xcoords_name.c_str());
1369  _vtk_coord_dofs->SetNumberOfComponents(3); // Must be 3 for vtkPoints (coordinates)
1370  _vtk_coord_dofs->SetNumberOfTuples(_pt_ct);
1371 
1372  // Allocate space in the vtk cell type and connectivity arrays;
1373  // blocks will resize but we want to avoid many small reallocations.
1374 
1375  _vtk_cell_types->reserve(_cell_ct);
1376  _vtk_cell_types->set_ct(0);
1377 
1378  _vtk_cell_connectivity->reserve(_cell_ct*9);
1379  _vtk_cell_connectivity->set_ct(0);
1380 
1381 
1382  _vtk_pt_label_ids = vtkIdTypeArray::New();
1383  _vtk_pt_label_ids->SetName("point_label_ids");
1384  _vtk_pt_label_ids->SetNumberOfComponents(1);
1385 
1386  // Will use SetValue in vis itr set_vtk_data,
1387  // so have to set number of values.
1388 
1389  _vtk_pt_label_ids->SetNumberOfValues(_pt_ct);
1390 
1391  _vtk_cell_label_ids = vtkIdTypeArray::New();
1392  _vtk_cell_label_ids->SetName("cell_label_ids");
1393  _vtk_cell_label_ids->SetNumberOfComponents(1);
1394 
1395  // Will use InsertNextTuple in vis itr set_vtk_data,
1396  // so must not set number of values.
1397 
1398  // _vtk_cell_label_ids->SetNumberOfTuples(_cell_ct);
1399 
1400  // Postconditions:
1401 
1402 #ifdef DIAGNOSTIC_OUTPUT
1403  cout << "in initialize_vtk_mesh_data: pt ct: " << _pt_ct
1404  << " cell ct: " << _cell_ct << endl;
1405 #endif
1406 
1407  // Exit:
1408 
1409  return;
1410 }
1411 
1412 void
1413 tool::vtk_unstructured_grid_builder::
1414 finalize_vtk_mesh_data(vtkUnstructuredGrid& xresult)
1415 {
1416  // Preconditions:
1417 
1418  // Body:
1419 
1420  // Construct the vtk point object.
1421 
1422  vtkPoints* lvtk_points = vtkPoints::New();
1423  lvtk_points->SetNumberOfPoints(_pt_ct);
1424  lvtk_points->SetData(_vtk_coord_dofs);
1425  lvtk_points->SetDataTypeToDouble();
1426  xresult.SetPoints(lvtk_points);
1427 
1428  // Set the cell data in the result.
1429 
1430  vtkCellArray* lvtk_cells = vtkCellArray::New();
1431  lvtk_cells->Allocate(_cell_ct);
1432 
1433  vtkIdTypeArray* lvtk_connectivity = vtkIdTypeArray::New();
1434  lvtk_connectivity->SetNumberOfComponents(1);
1435  lvtk_connectivity->SetArray(_vtk_cell_connectivity->base(),
1436  _vtk_cell_connectivity->ct(),
1437  1);
1438 
1439  lvtk_cells->SetCells(_cell_ct, lvtk_connectivity);
1440 
1441  xresult.SetCells(_vtk_cell_types->base(), lvtk_cells);
1442 
1443  vtkPointData* lpt_data = xresult.GetPointData();
1444  lpt_data->AddArray(_vtk_pt_label_ids);
1445 
1446  vtkCellData* lcell_data = xresult.GetCellData();
1447  lcell_data->AddArray(_vtk_cell_label_ids);
1448 
1449  // Clean up.
1450 
1451  lvtk_points->Delete();
1452  _vtk_coord_dofs->Delete();
1453  lvtk_cells->Delete();
1454  lvtk_connectivity->Delete();
1455  _vtk_pt_label_ids->Delete();
1456  _vtk_cell_label_ids->Delete();
1457 
1458  // Postconditions:
1459 
1460  // Exit:
1461 
1462  return;
1463 }
1464 
1465 void
1466 tool::vtk_unstructured_grid_builder::
1467 initialize_vtk_prop_data(const sec_vd* xprop)
1468 {
1469  // Preconditions:
1470 
1471  require(xprop->state_is_read_accessible());
1472 
1473  // Body:
1474 
1475  define_old_variable(int old_vtk_prop_dofs_ct = _vtk_prop_dofs.ct());
1476 
1477  const section_space_schema_member& lschema = xprop->schema();
1478  string lprop_name = xprop->name();
1479 
1482 
1483  bool lprop_is_pt_data = _is_point_mesh || lschema.rep().eval_is_above_disc();
1484  _prop_is_pt_data.push_back(lprop_is_pt_data);
1485 
1486  int ltensor_rank;
1487  if(is_scalar(xprop))
1488  {
1489  ltensor_rank = 0;
1490  }
1491  else if(is_vector(xprop))
1492  {
1493  ltensor_rank = 1;
1494  }
1495  else if(is_tensor(xprop))
1496  {
1497  ltensor_rank = 2;
1498  }
1499  else
1500  {
1501  // Must be an abstract vector;
1502  // vtk doesn't exactly know what to do
1503  // with it, so lie.
1504 
1505  int ldf = xprop->schema().df();
1506  if(ldf == 1)
1507  {
1508  ltensor_rank = 0;
1509  }
1510  else if(ldf <= 3)
1511  {
1512  ltensor_rank = 1;
1513  }
1514  else
1515  {
1516  ltensor_rank = -1; // Not supported
1517  }
1518  }
1519  _prop_tensor_rank.push_back(ltensor_rank);
1520 
1521  vtkDoubleArray* lvtk_prop_dofs = vtkDoubleArray::New();
1522  lvtk_prop_dofs->SetName(lprop_name.c_str());
1523  lvtk_prop_dofs->SetNumberOfComponents(ltensor_rank == 2 ? 9 : lschema.df());
1524  lvtk_prop_dofs->SetNumberOfTuples(lprop_is_pt_data ? _pt_ct : _cell_ct);
1525 
1526  _vtk_prop_dofs.push_back(lvtk_prop_dofs);
1527 
1528  // Postconditions:
1529 
1530  ensure(_vtk_prop_dofs.ct() == old_vtk_prop_dofs_ct + 1);
1531  ensure(_prop_is_pt_data.ct() == _vtk_prop_dofs.ct());
1532  ensure(_prop_tensor_rank.ct() == _vtk_prop_dofs.ct());
1533 
1534  // Exit:
1535 
1536  return;
1537 }
1538 
1539 void
1540 tool::vtk_unstructured_grid_builder::
1541 finalize_vtk_prop_data(const sec_vd* xprop,
1542  bool xprop_is_pt_data,
1543  int xprop_tensor_rank,
1544  vtkDoubleArray* xvtk_prop_dofs,
1545  vtkUnstructuredGrid& xresult)
1546 {
1547  // Preconditions:
1548 
1549 
1550  // Body:
1551 
1552  // Put the prop data into the result.
1553 
1554  vtkDataSetAttributes* latt;
1555  if(xprop_is_pt_data)
1556  {
1557  latt = xresult.GetPointData();
1558  }
1559  else
1560  {
1561  latt = xresult.GetCellData();
1562  }
1563 
1564  latt->DebugOn();
1565 
1566  switch(xprop_tensor_rank)
1567  {
1568  case 0:
1569  latt->SetScalars(xvtk_prop_dofs);
1570  break;
1571  case 1:
1572  latt->SetVectors(xvtk_prop_dofs);
1573  break;
1574  case 2:
1575  latt->SetTensors(xvtk_prop_dofs);
1576  break;
1577  default:
1578  post_warning_message("Algebraic type of property section not supported");
1579  break;
1580  }
1581 
1582  latt->DebugOff();
1583 
1584  // Clean up.
1585 
1586  xvtk_prop_dofs->Delete();
1587 
1588  // Postconditions:
1589 
1590 
1591  // Exit:
1592 
1593  return;
1594 }
1595 
1596 
1597 // ============================================================================
1598 // NON-MEMBER FUNCTIONS
1599 // ============================================================================
1600 
1601 
vtkUnstructuredGrid * build(const sec_vd &xcoords, const sec_vd &xproperty)
Builds a vtkUnstructuredGrid from xcoords and xproperty, auto_allocated.
poset_state_handle * host() const
The poset which this is a handle to a component of.
virtual bool is_jim(bool xin_current_version=true) const
True if this member is join irreducible in the current version of the host (xin_current_version == tr...
A client handle for a subposet.
Definition: subposet.h:86
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.
void put_use_point_top_ids(bool xvalue)
Sets use_point_top_ids() to xvalue.
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
bool is_scalar(const sec_vd *xsec) const
True if the fiber of xsec is a scalar type.
const scoped_index & index() const
The member index of this poset within the namespace host()
schema_poset_member & fiber_schema()
The fiber schema component of this (mutable version).
void build_pa(const sec_vd &xcoords, const sec_vd &xproperty, vtkUnstructuredGrid &xresult)
Builds a vtkUnstructuredGrid from xcoords and xproperty, pre-allocated.
action_type action() const
The type of action the client should take when the iterator returns control to the client...
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
subposet & d_cells(int xd)
The subposet containing the cells of dimension xd (mutable version).
subposet & evaluation()
The evaluation subposet for section spaces on this schema (mutable version).
const index_space_family & member_id_spaces(bool xauto_access) const
Collection of member id spaces for this (const version).
abstract_poset_member & base()
The restricted base of this section space member (mutable version)
virtual bool invariant() const
Class invariant.
STL namespace.
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
bool is_tensor(const sec_vd *xsec) const
True if the fiber of xsec is a tensor type.
const pod_index_type & type_id() const
The cell type id of this. The id of the prototype of this in the "cell_types" id space of the prototy...
std::string name() const
A name for this.
Dperecated. Use postorder_itr. Specialization of the filtered depth-first iterator which exposes the ...
static const std::string & prototypes_poset_name()
The name of the prototypes poset.
Abstract class for creating a vtkUnstructuredGrid from sheaf field objects.
A client handle for a member of a base space poset.
Namespace for the tools component of the sheaf system.
Abstract base class with useful features for all objects.
Definition: any.h:39
void set_name_space(namespace_poset &xns)
If this instance&#39;s namespace is not equal to xns, this instance is initialized to have namespace xns...
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
const bool NOT_STRICT
Iteration strictness control.
Definition: sheaf.h:102
virtual vtk_unstructured_grid_builder * clone() const
Virtual constructor, makes a new instance of the same type as this.
const bool DOWN
Iteration directions.
Definition: sheaf.h:77
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
section_dof_map & member_dof_map(pod_index_type xmbr_index, bool xrequire_write_access=false)
The dof map associated with the member identified by xmbr_id (mutable version).
bool same_base_space(const section_space_schema_member &xother) const
True if this has the same base as xother.
Creates a vtkUnstructuredGrid from sheaf field objects.
A client handle for a mutable partially ordered set.
Definition: poset.h:40
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
static visualization_iterator * new_visualization_iterator(const section_space_schema_member &xcoords_schema, const section_space_schema_member &xprop_schema, bool xinitialize=true)
Creates an iterator appropriate for xcoords and xprop.
Specialization of the filtered depth-first iterator which exposes the PREVISIT_ACTION and the POSTVIS...
void put_use_cell_top_ids(bool xvalue)
Sets use_cell_top_ids() to xvalue.
bool le(pod_index_type xother_index) const
True if this is less than or equal to the member with index xother_index.
void next()
Makes this the next member of the subset.
bool is_vector(const sec_vd *xsec) const
True if the fiber of xsec is a vector type.
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 vector space fiber.
Definition: sec_vd.h:54
bool is_done() const
True if iteration finished.
virtual vtk_unstructured_grid_builder & operator=(const vtk_abstract_grid_builder &xother)
Assignment operator.
void detach_from_state()
Detaches field from state it is currently attached to.
Definition: sec_tuple.cc:603
static const poset_path & standard_schema_path()
The path of the schema required by this class.
virtual void detach_from_state()
Detach this handle from its state, if any.
Abstract iterator over the schema of both the coordinates and property sections of a visualization...
virtual void put_anchor(const section_space_schema_member &xcoords_schema, const section_space_schema_member &xprop_schema)
Reinitializes anchor() to iterate over xcoord_schema and xprop_schema.
virtual bool invariant() const
Class invariant.
total_poset_member & base_space()
The base space component of this (mutable version).
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
A client handle for a poset member which has been prepared for use as a schema for a section space...
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
int db() const
The dimension of the base space component.
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
int df() const
The dimension of the fiber space component.
virtual void set_vtk_data(const sec_vd &xcoords, const sec_vd &xprop, vtkDoubleArray *xvtk_pt_coords, vtkDoubleArray *xvtk_prop, int xprop_tensor_rank, block< int > &xvtk_cell_types, block< vtkIdType > &xvtk_cell_connectivity, block< int > &xvtk_cell_type_map, vtkIdTypeArray *xvtk_pt_label_ids, vtkIdTypeArray *xvtk_cell_label_ids)
Transfers coordinate and property data to vtk data structures.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
virtual void get_read_access() const
Get read access to the state associated with this.
int max_db() const
The maximum dimension of the members of this base space.
An abstract client handle for a member of a poset.
sec_rep_descriptor & rep()
The representation for section spaces on this schema (mutable version).
virtual schema_poset_member & schema()
The schema for this member (mutable version).
void build_file(const sec_vd &xcoords, const sec_vd &xproperty, const std::string &xvtk_file_name, bool xis_ascii=true)
Builds a vtk file representation of a vtkPolyData from xcoords and xproperty with file name xvtk_file...
A client handle for a poset member which has been prepared for use as a schema.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
base_space_poset & base_space()
The base space for section spaces on this schema.
const scoped_index & index() const
The index of the current member of the iteration.
A handle for a poset whose members are numerical representations of sections of a fiber bundle...
Definition: sec_rep_space.h:61