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

Method GetNodeSet

IO/IOSS/vtkIOSSCellGridReaderInternal.cxx:325–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325std::vector<vtkSmartPointer<vtkCellGrid>> vtkIOSSCellGridReaderInternal::GetNodeSet(
326 const std::string& blockName, vtkIOSSReader::EntityType vtk_entity_type,
327 const DatabaseHandle& handle, int timestep, vtkIOSSCellGridReader* self)
328{
329 (void)self;
330 (void)vtk_entity_type;
331 auto region = this->GetRegion(handle);
332 auto group_entity = region->get_entity(blockName, Ioss::EntityType::NODESET);
333 if (!group_entity)
334 {
335 vtkErrorWithObjectMacro(self, "No group entity for node-set \"" << blockName << "\".");
336 return {};
337 }
338 auto grid = vtkSmartPointer<vtkCellGrid>::New();
339 auto meta = vtkCellMetadata::NewInstance("vtkDGVert"_token, grid);
340 auto* dg = vtkDGCell::SafeDownCast(meta);
341 if (!meta || !dg)
342 {
343 vtkErrorWithObjectMacro(
344 self, "Could not create metadata for node-set \"" << blockName << "\".");
345 return {};
346 }
347 if (!grid->AddCellMetadata(meta))
348 {
349 vtkErrorWithObjectMacro(
350 self, "Could not add metadata for node-set \"" << blockName << "\" to grid.");
351 return {};
352 }
353 // Fetch the IDs of the file-global points included in the node-set,
354 // offsetting by -1 so they are 0-indexed:
355 auto transform = Ioss::TransformFactory::create("offset");
356 transform->set_property("offset", -1);
357 auto ids_raw = vtkIOSSUtilities::GetData(group_entity, "ids_raw", transform);
358 ids_raw->SetNumberOfComponents(1);
359
360 // Add the ID array to a vtkDataSetAttributes instance corresponding to
361 // the number of cells of the node-set. Since a separate cell-grid holds
362 // each node-set, we use the name of the cell type ("vtkDGVert") for the
363 // array group:
364 auto* cellGroup = grid->GetAttributes(dg->GetClassName());
365 cellGroup->AddArray(ids_raw);
366 dg->GetCellSpec().Connectivity = ids_raw;
367 dg->GetCellSpec().SourceShape = vtkDGCell::Shape::Vertex;
368 dg->GetCellSpec().Blanked = false;
369
370 // From the shape of cells in the block, the connectivity size, and the order,
371 // we need to infer vtkDGCell::CellTypeInfo data (FunctionSpace, Basis, Order).
372 vtkCellAttribute::CellTypeInfo cellShapeInfo;
373 cellShapeInfo.FunctionSpace = "constant"_token;
374 cellShapeInfo.Basis = "C"_token;
375 cellShapeInfo.Order = 0;
376
377 // Read node coordinates as the shape attribute.
378 // This must always be a "CG" (continuous) attribute.
379 vtkIOSSCellGridUtilities::GetShape(
380 region, group_entity, cellShapeInfo, timestep, dg, grid, &this->Cache);
381 // Apply displacements before reading other cell-attributes as
382 // computing the range of HDIV/HCURL attributes **must** use

Callers 1

GetCellGridsMethod · 0.95

Calls 14

ApplyDisplacementsMethod · 0.95
GetNodalAttributesMethod · 0.95
createFunction · 0.85
AddCellMetadataMethod · 0.80
GetApplyDisplacementsMethod · 0.80
GetDataFunction · 0.70
GetShapeFunction · 0.70
NewFunction · 0.50
NewInstanceFunction · 0.50
GetRegionMethod · 0.45
SetNumberOfComponentsMethod · 0.45
GetAttributesMethod · 0.45

Tested by

no test coverage detected