------------------------------------------------------------------------------
| 5836 | |
| 5837 | //------------------------------------------------------------------------------ |
| 5838 | void 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 |
no test coverage detected