diff --git a/applications/test/fileOperation1/Make/files b/applications/test/fileOperation1/Make/files index 3f4a231f16..8f7d27ee23 100644 --- a/applications/test/fileOperation1/Make/files +++ b/applications/test/fileOperation1/Make/files @@ -1,3 +1,3 @@ -Test-fileOperation1.C +Test-fileOperation1.cxx EXE = $(FOAM_USER_APPBIN)/Test-fileOperation1 diff --git a/applications/test/fileOperation1/Test-fileOperation1.C b/applications/test/fileOperation1/Test-fileOperation1.cxx similarity index 96% rename from applications/test/fileOperation1/Test-fileOperation1.C rename to applications/test/fileOperation1/Test-fileOperation1.cxx index e395ea292d..78f3d24e5e 100644 --- a/applications/test/fileOperation1/Test-fileOperation1.C +++ b/applications/test/fileOperation1/Test-fileOperation1.cxx @@ -27,7 +27,7 @@ Application Test-fileOperation1 Description - Test string parsing and other bits for fileOperation + Test string parsing and other bits for fileOperation \*---------------------------------------------------------------------------*/ @@ -42,7 +42,8 @@ Description using namespace Foam; -word toString(const fileOperation::procRangeType& group) +template +word toString(const IntRange& group) { if (group.empty()) { diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index 3e94d450da..5a6359add1 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2015-2024 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,11 +78,9 @@ bool Foam::checkFileExistence(const fileName& fName) for (const fileName& dirN : dirEntries) { // Analyse directory name - fileName rp, rd, rl; - label rNum; + label rNum(-1); const label readProci = - fileOperation::splitProcessorPath - (dirN, rp, rd, rl, group, rNum); + fileOperation::detectProcessorPath(dirN, group, &rNum); if (proci == readProci) { @@ -211,18 +209,8 @@ Foam::boolList Foam::haveMeshFile // Collect local block number label myBlockNumber = -1; { - fileName path, pDir, local; procRangeType group; - label numProcs; - label proci = fileOperation::splitProcessorPath - ( - fName, - path, - pDir, - local, - group, - numProcs - ); + label proci = fileOperation::detectProcessorPath(fName, group); if (proci == -1 && group.empty()) { diff --git a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C index a9dda1fcb7..0b262f41f1 100644 --- a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017-2018 OpenFOAM Foundation - Copyright (C) 2020-2023 OpenCFD Ltd. + Copyright (C) 2020-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -154,7 +154,7 @@ bool Foam::fileOperations::collatedFileOperation::appendObject { // Append to processorsNN/ file - const label proci = detectProcessorPath(io.objectPath()); + const label proci = fileOperation::detectProcessorPath(io.objectPath()); if (debug) { @@ -544,7 +544,7 @@ Foam::word Foam::fileOperations::collatedFileOperation::processorsDir { if (UPstream::parRun()) { - const List& procs(UPstream::procID(comm_)); + const auto& procs = UPstream::procID(comm_); word procDir(processorsBaseDir+Foam::name(nProcs_)); @@ -565,7 +565,7 @@ Foam::word Foam::fileOperations::collatedFileOperation::processorsDir if (ioRanks_.size()) { // Detect current processor number - label proci = detectProcessorPath(fName); + label proci = fileOperation::detectProcessorPath(fName); if (proci != -1) { diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index 2d7f0839d5..3ad19e15cf 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017-2018 OpenFOAM Foundation - Copyright (C) 2019-2024 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -524,12 +524,11 @@ Foam::fileOperation::lookupAndCacheProcessorsPath for (const fileName& dirN : dirEntries) { // Analyse directory name - fileName rp, rd, rl; - label rNum; + label rNum(-1); const label readProci = - splitProcessorPath(dirN, rp, rd, rl, group, rNum); + fileOperation::detectProcessorPath(dirN, group, &rNum); - nProcs = max(nProcs, readProci+1); + nProcs = Foam::max(nProcs, readProci+1); Tuple2 pathTypeIdx(pathType::NOTFOUND, 0); @@ -554,7 +553,7 @@ Foam::fileOperation::lookupAndCacheProcessorsPath } // "processorsNN" or "processorsNN_start-end" - nProcs = max(nProcs, rNum); + nProcs = Foam::max(nProcs, rNum); if (group.empty()) { @@ -581,7 +580,7 @@ Foam::fileOperation::lookupAndCacheProcessorsPath if (pathTypeIdx.first() != pathType::NOTFOUND) { - procDirs.append(dirIndex(dirN, pathTypeIdx)); + procDirs.emplace_back(dirN, pathTypeIdx); } } @@ -621,7 +620,7 @@ Foam::fileOperation::lookupAndCacheProcessorsPath int flavour(pathType::PROCUNCOLLATED); for (const dirIndex& pDir : procDirs) { - flavour = max(flavour, int(pDir.second().first())); + flavour = Foam::max(flavour, int(pDir.second().first())); } reduce(nProcs, maxOp