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

Method SortFieldFiles

IO/Geometry/vtkOpenFOAMReader.cxx:5838–5866  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

5836
5837//------------------------------------------------------------------------------
5838void vtkOpenFOAMReaderPrivate::SortFieldFiles(vtkStringArray* selections, vtkStringArray* files)
5839{
5840 // The object (field) name in the FoamFile header should always correspond
5841 // to the filename (without any trailing .gz etc)
5842
5843 const vtkIdType nFiles = files->GetNumberOfValues();
5844
5845 vtkNew<vtkStringArray> names;
5846 names->SetNumberOfValues(nFiles);
5847
5848 for (vtkIdType i = 0; i < nFiles; ++i)
5849 {
5850 std::string name(files->GetValue(i));
5851 const auto ending = name.rfind(".gz");
5852 if (ending != std::string::npos)
5853 {
5854 name.erase(ending);
5855 }
5856 names->SetValue(i, name);
5857 }
5858
5859 names->Squeeze();
5860 files->Squeeze();
5861 vtkSortDataArray::Sort(names, files);
5862 for (vtkIdType i = 0; i < nFiles; ++i)
5863 {
5864 selections->InsertNextValue(names->GetValue(i));
5865 }
5866}
5867
5868//------------------------------------------------------------------------------
5869// Set contents from dictionary information read from the polyMesh/boundary file

Callers 1

Calls 8

SortFunction · 0.50
GetNumberOfValuesMethod · 0.45
SetNumberOfValuesMethod · 0.45
GetValueMethod · 0.45
eraseMethod · 0.45
SetValueMethod · 0.45
SqueezeMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected