----------------------------------------------------------------------------
| 682 | |
| 683 | //---------------------------------------------------------------------------- |
| 684 | vtkSmartPointer<vtkDataSet> CreateMesh( |
| 685 | const conduit_cpp::Node& topology, const conduit_cpp::Node& coordsets) |
| 686 | { |
| 687 | // get the coordset for this topology element. |
| 688 | auto coords = coordsets[topology["coordset"].as_string()]; |
| 689 | if (topology["type"].as_string() == "uniform" && coords["type"].as_string() == "uniform") |
| 690 | { |
| 691 | return CreateImageData(coords); |
| 692 | } |
| 693 | |
| 694 | if (topology["type"].as_string() == "rectilinear" && coords["type"].as_string() == "rectilinear") |
| 695 | { |
| 696 | return CreateRectilinearGrid(coords); |
| 697 | } |
| 698 | |
| 699 | if (topology["type"].as_string() == "structured" && coords["type"].as_string() == "explicit") |
| 700 | { |
| 701 | return CreateStructuredGrid(topology, coords); |
| 702 | } |
| 703 | |
| 704 | if (coords["type"].as_string() == "explicit" && topology["type"].as_string() == "unstructured" && |
| 705 | topology.has_path("elements/shape")) |
| 706 | { |
| 707 | std::string shape = topology["elements/shape"].as_string(); |
| 708 | if (shape != "mixed") |
| 709 | { |
| 710 | return CreateMonoShapedUnstructuredGrid(topology, coords); |
| 711 | } |
| 712 | else if (topology.has_path("elements/shape_map") && topology.has_path("elements/shapes")) |
| 713 | { |
| 714 | return CreateMixedUnstructuredGrid(topology, coords); |
| 715 | } |
| 716 | // if there are no cells in the Conduit mesh, return an empty ug |
| 717 | return vtkSmartPointer<vtkUnstructuredGrid>::New(); |
| 718 | } |
| 719 | |
| 720 | if (coords["type"].as_string() == "explicit" && topology["type"].as_string() == "points") |
| 721 | { |
| 722 | auto pointset = vtkSmartPointer<vtkPointSet>::New(); |
| 723 | pointset->SetPoints(CreatePoints(coords)); |
| 724 | return pointset; |
| 725 | } |
| 726 | |
| 727 | throw std::runtime_error("unsupported topology or coordset"); |
| 728 | } |
| 729 | |
| 730 | //---------------------------------------------------------------------------- |
| 731 | vtkSmartPointer<vtkImageData> CreateImageData(const conduit_cpp::Node& coordset) |
no test coverage detected