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

Function GetShape

IO/IOSS/vtkIOSSCellGridUtilities.cxx:369–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369bool GetShape(Ioss::Region* region, const Ioss::GroupingEntity* group_entity,
370 vtkCellAttribute::CellTypeInfo& cellShapeInfo, int timestep, vtkDGCell* meta, vtkCellGrid* grid,
371 vtkIOSSUtilities::Cache* cache)
372{
373 (void)timestep;
374 (void)group_entity; // TODO: If we ever squeeze points on a per-block basis, we must cache
375 // the nodal coords on group_entity (not nodeblock_entity) and
376 // use the vtkDGCell's cellSpec.Connectivity to subset points when
377 // generating the cache entry.
378
379 auto nodeblock_entity = region->get_entity("nodeblock_1", Ioss::EntityType::NODEBLOCK);
380 if (!nodeblock_entity)
381 {
382 return false;
383 }
384 vtkSmartPointer<vtkDataArray> cached = (cache
385 ? vtkDataArray::SafeDownCast(cache->Find(nodeblock_entity, "__vtk_mesh_model_coordinates__"))
386 : nullptr);
387 if (cached)
388 {
389 vtkLogF(TRACE, "using cached mesh_model_coordinates");
390 }
391 else
392 {
393 cached = vtkIOSSUtilities::GetData(nodeblock_entity, "mesh_model_coordinates");
394 cached = ChangeComponents(cached, 3);
395
396 if (cache)
397 {
398 cache->Insert(group_entity, "__vtk_mesh_model_coordinates__", cached.GetPointer());
399 }
400 }
401
402 grid->GetAttributes("coordinates")->AddArray(cached);
403
404 vtkNew<vtkCellAttribute> attribute;
405 attribute->Initialize("shape", "ℝ³", 3);
406 cellShapeInfo.DOFSharing = "coordinates"_token; // Required for the shape attribute.
407 cellShapeInfo.FunctionSpace = meta->GetCellSpec().SourceShape == vtkDGCell::Shape::Vertex
408 ? "constant"_token
409 : "HGRAD"_token; // Required for the shape attribute.
410 cellShapeInfo.ArraysByRole["connectivity"] = meta->GetCellSpec().Connectivity;
411 cellShapeInfo.ArraysByRole["values"] = cached;
412 attribute->SetCellTypeInfo(meta->GetClassName(), cellShapeInfo);
413 grid->AddCellAttribute(attribute);
414 grid->SetShapeAttribute(attribute);
415 return true;
416}
417
418VTK_ABI_NAMESPACE_END
419} // namespace vtkIOSSCellGridUtilities

Callers 4

GetElementBlockMethod · 0.70
GetNodeSetMethod · 0.70
InitMethod · 0.50
GetSelectionMethod · 0.50

Calls 12

SetCellTypeInfoMethod · 0.80
AddCellAttributeMethod · 0.80
SetShapeAttributeMethod · 0.80
GetDataFunction · 0.70
ChangeComponentsFunction · 0.70
FindMethod · 0.45
InsertMethod · 0.45
GetPointerMethod · 0.45
AddArrayMethod · 0.45
GetAttributesMethod · 0.45
InitializeMethod · 0.45
GetClassNameMethod · 0.45

Tested by

no test coverage detected