MCPcopy Create free account
hub / github.com/Kitware/VTK / CreateMesh

Function CreateMesh

IO/CatalystConduit/vtkConduitToDataObject.cxx:684–728  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

682
683//----------------------------------------------------------------------------
684vtkSmartPointer<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//----------------------------------------------------------------------------
731vtkSmartPointer<vtkImageData> CreateImageData(const conduit_cpp::Node& coordset)

Callers 1

FillPartitionedDataSetFunction · 0.85

Calls 9

as_stringMethod · 0.80
CreateImageDataFunction · 0.70
CreateRectilinearGridFunction · 0.70
CreateStructuredGridFunction · 0.70
CreatePointsFunction · 0.70
NewFunction · 0.50
SetPointsMethod · 0.45

Tested by

no test coverage detected