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

Method PopulateMeshTimeIndices

IO/Geometry/vtkOpenFOAMReader.cxx:6627–6683  ·  view source on GitHub ↗

------------------------------------------------------------------------------ create a Lookup Table containing the location of the points and faces files for each time steps mesh

Source from the content-addressed store, hash-verified

6625// create a Lookup Table containing the location of the points
6626// and faces files for each time steps mesh
6627void vtkOpenFOAMReaderPrivate::PopulateMeshTimeIndices(const bool skipComputingMetaData)
6628{
6629 auto& faces = this->PolyMeshTimeIndexFaces;
6630 auto& points = this->PolyMeshTimeIndexPoints;
6631
6632 // Ensure consistent sizing
6633 const vtkIdType nTimes = this->TimeValues->GetNumberOfTuples();
6634 if (!skipComputingMetaData)
6635 {
6636 this->PopulateMeshIndicesFileChecks->SetNumberOfComponents(3);
6637 this->PopulateMeshIndicesFileChecks->SetNumberOfTuples(nTimes);
6638 this->PopulateMeshIndicesFileChecks->SetName("PopulateMeshIndicesFileChecks");
6639 }
6640
6641 faces.resize(nTimes, TIMEINDEX_UNVISITED);
6642 points.resize(nTimes, TIMEINDEX_UNVISITED);
6643
6644#if VTK_OPENFOAM_TIME_PROFILING
6645 auto start = std::chrono::high_resolution_clock::now();
6646#endif
6647 for (vtkIdType timeIter = 0; timeIter < nTimes; ++timeIter)
6648 {
6649 // The mesh directory for this timestep
6650 const std::string meshDir(this->TimeRegionPath(timeIter) + "/polyMesh/");
6651 bool hasMeshDir;
6652 bool topoChanged;
6653 bool pointsMoved;
6654 if (!skipComputingMetaData)
6655 {
6656 hasMeshDir = vtksys::SystemTools::FileIsDirectory(meshDir);
6657 topoChanged = hasMeshDir && vtkFoamFile::IsFile(meshDir + "faces", true);
6658 pointsMoved = hasMeshDir && vtkFoamFile::IsFile(meshDir + "points", true);
6659 this->PopulateMeshIndicesFileChecks->SetValue(3 * timeIter, hasMeshDir);
6660 this->PopulateMeshIndicesFileChecks->SetValue(3 * timeIter + 1, topoChanged);
6661 this->PopulateMeshIndicesFileChecks->SetValue(3 * timeIter + 2, pointsMoved);
6662 }
6663 else
6664 {
6665 hasMeshDir = this->PopulateMeshIndicesFileChecks->GetValue(3 * timeIter);
6666 topoChanged = this->PopulateMeshIndicesFileChecks->GetValue(3 * timeIter + 1);
6667 pointsMoved = this->PopulateMeshIndicesFileChecks->GetValue(3 * timeIter + 2);
6668 }
6669
6670 UpdateTimeInstance(faces, timeIter, topoChanged);
6671 UpdateTimeInstance(points, timeIter, pointsMoved);
6672 }
6673#if VTK_OPENFOAM_TIME_PROFILING
6674 auto end = std::chrono::high_resolution_clock::now();
6675 this->RequestInformationTimeInMicroseconds +=
6676 std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
6677#endif
6678
6679#if VTK_FOAMFILE_DEBUG
6680 PrintMeshTimes("faces", faces);
6681 PrintMeshTimes("points", points);
6682#endif
6683}
6684

Callers 2

MakeInformationVectorMethod · 0.95
SetupInformationMethod · 0.95

Calls 10

TimeRegionPathMethod · 0.95
UpdateTimeInstanceFunction · 0.85
GetNumberOfTuplesMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
SetNameMethod · 0.45
resizeMethod · 0.45
SetValueMethod · 0.45
GetValueMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected