diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index c68438c0e4..7a8e25a5b6 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -478,6 +478,7 @@ int main(int argc, char *argv[]) if ( name == "positions" + || name == "coordinates" || name == "origProcId" || name == "origId" ) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 8a2c513fa0..004af363fb 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -745,12 +745,12 @@ int main(int argc, char *argv[]) false ); - IOobject* positionsPtr = sprayObjs.lookup - ( - word("positions") - ); + // Note: looking up "positions" for backwards compatibility + IOobject* positionsPtr = + sprayObjs.lookup(word("positions")); + IOobject* coordsPtr = sprayObjs.lookup(word("coordinates")); - if (positionsPtr) + if (positionsPtr || coordsPtr) { // Read lagrangian particles // ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 716f8522ab..131598746a 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -586,8 +586,10 @@ int main(int argc, char *argv[]) IOobject* positionsPtr = sprayObjs.lookup(word("positions")); + IOobject* coordsPtr = + sprayObjs.lookup(word("coordinates")); - if (positionsPtr) + if (coordsPtr || positionsPtr) { cloudObjects.insert(cloudDirs[i], sprayObjs); } diff --git a/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C b/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C index 9052b8df0b..73cfda6582 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C +++ b/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C @@ -96,9 +96,14 @@ void Foam::parLagrangianRedistributor::findClouds cloud::prefix/localCloudDirs[i] ); - if (sprayObjs.lookup(word("positions"))) + if + ( + sprayObjs.lookup(word("coordinates")) + || sprayObjs.lookup(word("positions")) + ) { - // One of the objects is positions so must be valid cloud + // One of the objects is coordinates/positions so must be valid + // cloud label cloudI = findIndex(cloudNames, localCloudDirs[i]); @@ -107,7 +112,7 @@ void Foam::parLagrangianRedistributor::findClouds forAllConstIter(IOobjectList, sprayObjs, iter) { const word& name = iter.key(); - if (name != "positions") + if (name != "coordinates" && name != "positions") { objectNames[cloudI][objectI++] = name; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H index 89e1084abc..650258ef1f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H @@ -35,8 +35,8 @@ if (timeDirs.size() && !noLagrangian) cloudPrefix/cloudName ); - // Clouds always have "positions" - if (cloudObjs.found("positions")) + // Clouds always have "positions" (v1706 and lower) or "coordinates" + if (cloudObjs.found("positions") || cloudObjs.found("coordinates")) { // Save the cloud fields on a per cloud basis auto fieldsPerCloud = cloudFields(cloudName); @@ -52,9 +52,10 @@ if (timeDirs.size() && !noLagrangian) } } - // Prune out "positions" again since it gets treated specially + // Prune out geometry again since it gets treated specially forAllIters(cloudFields, cloudIter) { + cloudIter().erase("coordinates"); cloudIter().erase("positions"); } @@ -74,4 +75,5 @@ if (cloudNames.size()) cloudNames.writeList(Info) << endl; } + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloud.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloud.C index 5cc4a45f5c..db87438e46 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloud.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputSerialCloud.C @@ -65,7 +65,7 @@ void Foam::ensightSerialCloud::writePositions forAllConstIter(Cloud, cloudPtr(), elmnt) { - const vector& p = elmnt().position(); + const vector p(elmnt().position()); os.write(p.x()); os.write(p.y()); @@ -79,7 +79,7 @@ void Foam::ensightSerialCloud::writePositions label parcelId = 0; forAllConstIter(Cloud, cloudPtr(), elmnt) { - const vector& p = elmnt().position(); + const vector p(elmnt().position()); os.write(++parcelId, 8); // unusual width os.write(p.x()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H index 66e0616aba..9ac1c56808 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H @@ -60,16 +60,16 @@ if (timeDirs.size()) cloudPrefix/cloudName ); - bool hasPositions = false; + bool hasCoordinates = false; forAllConstIter(IOobjectList, objs, fieldIter) { const IOobject obj = *fieldIter(); const word& fieldName = obj.name(); const word& fieldType = obj.headerClassName(); - if (fieldName == "positions") + if (fieldName == "positions" || fieldName == "coordinates") { - hasPositions = true; + hasCoordinates = true; } else if (cloudFieldTypes.found(fieldType)) { @@ -79,7 +79,7 @@ if (timeDirs.size()) } // drop this cloud if it has no positions or is otherwise empty - if (!hasPositions || cloudIter().empty()) + if (!hasCoordinates || cloudIter().empty()) { Info<< "removing cloud " << cloudName << endl; cloudFields.erase(cloudIter); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 3aa9ea5855..bac5a91a44 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -381,8 +381,13 @@ int main(int argc, char *argv[]) cloudPrefix/cloudName ); - // Check that the positions field is present for this time - if (!cloudObjs.found("positions")) + // Check that the positions/coordinates field is present for this + // time + if + ( + !cloudObjs.found("positions") + || !cloudObjs.found("coordinates") + ) { continue; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H index 03a76e5856..a51474d4be 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -62,7 +62,7 @@ for (label i=0; i < nTypes; i++) if (fieldTypes[i] == cloud::prefix) { - IOobject lagrangianHeader + IOobject positionsHeader ( "positions", runTime.timeName(), @@ -71,9 +71,22 @@ for (label i=0; i < nTypes; i++) IOobject::NO_READ ); + IOobject coordinatesHeader + ( + "coordinates", + runTime.timeName(), + cloud::prefix, + mesh, + IOobject::NO_READ + ); + if ( - lagrangianHeader.typeHeaderOk>> + positionsHeader.typeHeaderOk>> + ( + false + ) + || coordinatesHeader.typeHeaderOk>> ( false ) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C index 763fbd4f9d..98f14db918 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C @@ -1168,8 +1168,9 @@ int main(int argc, char *argv[]) ); IOobject* positionsPtr = sprayObjs.lookup("positions"); + IOobject* coordinatesPtr = sprayObjs.lookup("coordinates"); - if (positionsPtr) + if (positionsPtr || coordinatesPtr) { mkDir(fvPath/cloud::prefix/cloudDirs[cloudI]); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H index 5637f22498..115c4b3d3b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H @@ -23,10 +23,8 @@ if (timeDirs.size() && !noLagrangian) fileName::DIRECTORY ); - forAll(cloudDirs, cloudI) + for (const word& cloudName : cloudDirs) { - const word& cloudName = cloudDirs[cloudI]; - IOobjectList cloudObjs ( mesh, @@ -34,8 +32,8 @@ if (timeDirs.size() && !noLagrangian) cloudPrefix/cloudName ); - // clouds always require "positions" - if (cloudObjs.found("positions")) + // Clouds always require "positions"/"coordinates" + if (cloudObjs.found("positions") || cloudObjs.found("coordinates")) { if (allCloudDirs.insert(cloudName)) { @@ -60,9 +58,9 @@ if (cloudNames.size()) { // complete the echo information Info<< "("; - forAll(cloudNames, cloudNo) + for (const word& cloudName : cloudNames) { - Info<< ' ' << cloudNames[cloudNo]; + Info<< ' ' << cloudName; } Info<< " ) " << endl; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 9575b36373..e84e12f118 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -1344,7 +1344,7 @@ int main(int argc, char *argv[]) cloud::prefix/cloudName ); - if (sprayObjs.found("positions")) + if (sprayObjs.found("positions") || sprayObjs.found("coordinates")) { wordList labelNames(sprayObjs.names(labelIOField::typeName)); Info<< " labels :"; diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamMeshLagrangian.C index c08e17559c..f7be26d4be 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamMeshLagrangian.C @@ -64,7 +64,8 @@ vtkSmartPointer Foam::vtkPVFoam::lagrangianVTKMesh ); IOobject* positionsPtr = sprayObjs.lookup(word("positions")); - if (positionsPtr) + IOobject* coordinatesPtr = sprayObjs.lookup(word("coordinates")); + if (positionsPtr || coordinatesPtr) { Cloud parcels(mesh, cloudName, false); diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index ea12f0aef7..a5d8986a75 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -160,7 +160,7 @@ int USERD_set_filenames } } - IOobject sprayHeader + IOobject positionsHeader ( "positions", runTime.timeName(), @@ -171,7 +171,22 @@ int USERD_set_filenames false ); - if (sprayHeader.typeHeaderOk>(false)) + IOobject coordinatesHeader + ( + "coordinates", + runTime.timeName(), + cloud::prefix, + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ); + + if + ( + positionsHeader.typeHeaderOk>(false) + || coordinatesHeader.typeHeaderOk>(false) + ) { Info<< "[Found lagrangian]" << endl; @@ -181,10 +196,8 @@ int USERD_set_filenames IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix); - lagrangianScalarNames = - objects.names(sprayScalarFieldName); - lagrangianVectorNames = - objects.names(sprayVectorFieldName); + lagrangianScalarNames = objects.names(sprayScalarFieldName); + lagrangianVectorNames = objects.names(sprayVectorFieldName); isSpray[fieldNames.size()] = true; diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index d450795f47..ebc89520af 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -120,8 +120,9 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp) ); IOobject* positionsPtr = objects.lookup("positions"); + IOobject* coordinatesPtr = objects.lookup("coordinates"); - if (positionsPtr) + if (positionsPtr || coordinatesPtr) { Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl; diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C b/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C index 2fe1df15ec..56cf1a83ef 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C @@ -111,7 +111,10 @@ void mapLagrangian(const meshToMesh& interp) bool foundPositions = returnReduce(objects.found("positions"), orOp());; - if (foundPositions) + bool foundCoordinates = + returnReduce(objects.found("coordinates"), orOp());; + + if (foundPositions || foundCoordinates) { Info<< nl << " processing cloud " << cloudDirs[cloudI] << endl; diff --git a/etc/controlDict b/etc/controlDict index 0377378758..77a630c3fb 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -44,6 +44,9 @@ InfoSwitches writeDictionaries 0; writeOptionalEntries 0; + // Write lagrangian "positions" file in v1706 format (at earlier) + writeLagrangianPositions 0; + // Report list of slaves/pids used (parallel) writeSlaves 1; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C index 7fa09a835d..f2389857d9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C @@ -63,7 +63,7 @@ Foam::label Foam::polyMeshTetDecomposition::findSharedBasePoint const point& tetBasePt = pPts[f[faceBasePtI]]; - for (label tetPtI = 1; tetPtI < f.size() - 1; tetPtI++) + for (label tetPtI = 1; tetPtI < f.size() - 1; ++tetPtI) { label facePtI = (tetPtI + faceBasePtI) % f.size(); label otherFacePtI = f.fcIndex(facePtI); @@ -158,7 +158,7 @@ Foam::label Foam::polyMeshTetDecomposition::findBasePoint const point& tetBasePt = pPts[f[faceBasePtI]]; - for (label tetPtI = 1; tetPtI < f.size() - 1; tetPtI++) + for (label tetPtI = 1; tetPtI < f.size() - 1; ++tetPtI) { label facePtI = (tetPtI + faceBasePtI) % f.size(); label otherFacePtI = f.fcIndex(facePtI); @@ -219,17 +219,16 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts label nInternalFaces = mesh.nInternalFaces(); - for (label fI = 0; fI < nInternalFaces; fI++) + for (label fI = 0; fI < nInternalFaces; ++fI) { tetBasePtIs[fI] = findSharedBasePoint(mesh, fI, tol, report); } pointField neighbourCellCentres(mesh.nFaces() - nInternalFaces); - for(label facei = nInternalFaces; facei < mesh.nFaces(); facei++) + for (label facei = nInternalFaces; facei < mesh.nFaces(); ++facei) { - neighbourCellCentres[facei - nInternalFaces] = - pC[pOwner[facei]]; + neighbourCellCentres[facei - nInternalFaces] = pC[pOwner[facei]]; } syncTools::swapBoundaryFacePositions(mesh, neighbourCellCentres); @@ -250,8 +249,7 @@ Foam::labelList Foam::polyMeshTetDecomposition::findFaceBasePts fI++, bFI++ ) { - label patchi = - mesh.boundaryMesh().patchID()[bFI]; + label patchi = mesh.boundaryMesh().patchID()[bFI]; if (patches[patchi].coupled()) { @@ -381,7 +379,7 @@ bool Foam::polyMeshTetDecomposition::checkFaceTets // Calculate coupled cell centre pointField neiCc(mesh.nFaces() - mesh.nInternalFaces()); - for (label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++) + for (label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); ++facei) { neiCc[facei - mesh.nInternalFaces()] = cc[own[facei]]; } @@ -526,21 +524,21 @@ bool Foam::polyMeshTetDecomposition::checkFaceTets Foam::List Foam::polyMeshTetDecomposition::faceTetIndices ( const polyMesh& mesh, - label fI, - label cI + label facei, + label celli ) { const faceList& pFaces = mesh.faces(); - const face& f = pFaces[fI]; + const face& f = pFaces[facei]; label nTets = f.size() - 2; List faceTets(nTets); - for (label tetPtI = 1; tetPtI < f.size() - 1; tetPtI ++) + for (label tetPti = 1; tetPti < f.size() - 1; ++tetPti) { - faceTets[tetPtI - 1] = tetIndices(cI, fI, tetPtI); + faceTets[tetPti - 1] = tetIndices(celli, facei, tetPti); } return faceTets; @@ -550,28 +548,26 @@ Foam::List Foam::polyMeshTetDecomposition::faceTetIndices Foam::List Foam::polyMeshTetDecomposition::cellTetIndices ( const polyMesh& mesh, - label cI + label celli ) { const faceList& pFaces = mesh.faces(); const cellList& pCells = mesh.cells(); - const cell& thisCell = pCells[cI]; + const cell& thisCell = pCells[celli]; label nTets = 0; - forAll(thisCell, cFI) + for (const label facei : thisCell) { - nTets += pFaces[thisCell[cFI]].size() - 2; + nTets += pFaces[facei].size() - 2; } DynamicList cellTets(nTets); - forAll(thisCell, cFI) + for (const label facei : thisCell) { - label fI = thisCell[cFI]; - - cellTets.append(faceTetIndices(mesh, fI, cI)); + cellTets.append(faceTetIndices(mesh, facei, celli)); } return cellTets; @@ -581,27 +577,26 @@ Foam::List Foam::polyMeshTetDecomposition::cellTetIndices Foam::tetIndices Foam::polyMeshTetDecomposition::findTet ( const polyMesh& mesh, - label cI, + label celli, const point& pt ) { const faceList& pFaces = mesh.faces(); const cellList& pCells = mesh.cells(); - const cell& thisCell = pCells[cI]; + const cell& thisCell = pCells[celli]; tetIndices tetContainingPt; - forAll(thisCell, cFI) + for (const label facei : thisCell) { - label fI = thisCell[cFI]; - const face& f = pFaces[fI]; + const face& f = pFaces[facei]; - for (label tetPtI = 1; tetPtI < f.size() - 1; tetPtI++) + for (label tetPti = 1; tetPti < f.size() - 1; ++tetPti) { // Get tetIndices of face triangle - tetIndices faceTetIs(cI, fI, tetPtI); + tetIndices faceTetIs(celli, facei, tetPti); // Check if inside if (faceTetIs.tet(mesh).inside(pt)) diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index 7c0bd7f7c9..ade118370f 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -65,10 +65,11 @@ Foam::findCellParticle::findCellParticle ( const polyMesh& mesh, Istream& is, - bool readFields + bool readFields, + bool newFormat ) : - particle(mesh, is, readFields) + particle(mesh, is, readFields, newFormat) { if (readFields) { diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index 077335b2fe..6b7343e500 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -146,7 +146,8 @@ public: ( const polyMesh& mesh, Istream& is, - bool readFields = true + bool readFields = true, + bool newFormat = true ); //- Construct and return a clone diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C index 02d8722560..6996e1500c 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C @@ -480,10 +480,11 @@ Foam::wallBoundedParticle::wallBoundedParticle ( const polyMesh& mesh, Istream& is, - bool readFields + bool readFields, + bool newFormat ) : - particle(mesh, is, readFields) + particle(mesh, is, readFields, newFormat) { if (readFields) { diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H index 654ee8ae57..c648fc5c3c 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H @@ -249,7 +249,8 @@ public: ( const polyMesh& c, Istream& is, - bool readFields = true + bool readFields = true, + bool newFormat = true ); //- Construct copy diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C index ef914b5b32..250e4a21b1 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C @@ -161,10 +161,11 @@ Foam::wallBoundedStreamLineParticle::wallBoundedStreamLineParticle ( const polyMesh& mesh, Istream& is, - bool readFields + bool readFields, + bool newFormat ) : - wallBoundedParticle(mesh, is, readFields) + wallBoundedParticle(mesh, is, readFields, newFormat) { if (readFields) { diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H index 62d6a83940..09b0b21229 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H @@ -181,7 +181,8 @@ public: ( const polyMesh& c, Istream& is, - bool readFields = true + bool readFields = true, + bool newFormat = true ); //- Construct copy diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H index 3e1cad4338..482da35719 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H @@ -186,7 +186,8 @@ public: ( const polyMesh& mesh, Istream& is, - bool readFields = true + bool readFields = true, + bool newFormat = true ); //- Construct and return a clone diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C index dcc6e5ecc6..944b40f798 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C @@ -44,10 +44,11 @@ Foam::DSMCParcel::DSMCParcel ( const polyMesh& mesh, Istream& is, - bool readFields + bool readFields, + bool newFormat ) : - ParcelType(mesh, is, readFields), + ParcelType(mesh, is, readFields, newFormat), U_(Zero), Ei_(0.0), typeId_(-1) diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 05d1b58aed..4eba7f4cf7 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -40,12 +40,12 @@ void Foam::Cloud::checkPatches() const { const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh(); bool ok = true; - forAll(pbm, patchi) + for (const polyPatch& pp : pbm) { - if (isA(pbm[patchi])) + if (isA(pp)) { const cyclicAMIPolyPatch& cami = - refCast(pbm[patchi]); + refCast(pp); if (cami.owner()) { @@ -76,6 +76,7 @@ Foam::Cloud::Cloud : cloud(pMesh, cloudName), IDLList(), + geometryType_(IOPosition>::geometryType::COORDINATES), polyMesh_(pMesh), labels_(), globalPositionsPtr_() @@ -113,7 +114,7 @@ void Foam::Cloud::deleteParticle(ParticleType& p) template void Foam::Cloud::deleteLostParticles() { - forAllIter(typename Cloud, *this, pIter) + forAllIters(*this, pIter) { ParticleType& p = pIter(); @@ -170,7 +171,7 @@ void Foam::Cloud::move } // Initialise the stepFraction moved for the particles - forAllIter(typename Cloud, *this, pIter) + forAllIters(*this, pIter) { pIter().stepFraction() = 0; } @@ -205,7 +206,7 @@ void Foam::Cloud::move } // Loop over all particles - forAllIter(typename Cloud, *this, pIter) + forAllIters(*this, pIter) { ParticleType& p = pIter(); @@ -293,9 +294,9 @@ void Foam::Cloud::move bool transfered = false; - forAll(allNTrans, i) + for (const label n : allNTrans) { - if (allNTrans[i]) + if (n) { transfered = true; break; @@ -309,10 +310,8 @@ void Foam::Cloud::move } // Retrieve from receive buffers - forAll(neighbourProcs, i) + for (const label neighbProci : neighbourProcs) { - label neighbProci = neighbourProcs[i]; - label nRec = allNTrans[neighbProci]; if (nRec) @@ -329,7 +328,7 @@ void Foam::Cloud::move label pI = 0; - forAllIter(typename Cloud, newParticles, newpIter) + forAllIters(newParticles, newpIter) { ParticleType& newp = newpIter(); @@ -368,10 +367,10 @@ void Foam::Cloud::autoMap(const mapPolyMesh& mapper) const vectorField& positions = globalPositionsPtr_(); label i = 0; - forAllIter(typename Cloud, *this, iter) + forAllIters(*this, iter) { iter().autoMap(positions[i], mapper); - ++ i; + ++i; } } @@ -384,11 +383,12 @@ void Foam::Cloud::writePositions() const this->db().time().path()/this->name() + "_positions.obj" ); - forAllConstIter(typename Cloud, *this, pIter) + forAllConstIters(*this, pIter) { const ParticleType& p = pIter(); - pObj<< "v " << p.position().x() << " " << p.position().y() << " " - << p.position().z() << nl; + const point position(p.position()); + pObj<< "v " << position.x() << " " << position.y() << " " + << position.z() << nl; } pObj.flush(); @@ -408,10 +408,10 @@ void Foam::Cloud::storeGlobalPositions() const vectorField& positions = globalPositionsPtr_(); label i = 0; - forAllConstIter(typename Cloud, *this, iter) + forAllConstIters(*this, iter) { positions[i] = iter().position(); - ++ i; + ++i; } } diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index ec92e831fe..a49247d0d6 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -75,6 +75,10 @@ class Cloud { // Private data + //- Geometry type + typename IOPosition>::geometryType geometryType_; + + //- Reference to the mesh database const polyMesh& polyMesh_; //- Temporary storage for addressing. Used in findTris. diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index c530f1f940..8678c5bde6 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -54,6 +54,16 @@ void Foam::Cloud::readCloudUniformProperties() { const IOdictionary uniformPropsDict(dictObj); + // Fall back to positions mode if the entry is not present for + // backwards compatibility + geometryType_ = + IOPosition>::geometryTypeNames_.lookupOrDefault + ( + "geometry", + uniformPropsDict, + IOPosition>::geometryType::POSITIONS + ); + const word procName("processor" + Foam::name(Pstream::myProcNo())); if (uniformPropsDict.found(procName)) { @@ -91,6 +101,12 @@ void Foam::Cloud::writeCloudUniformProperties() const Pstream::listCombineGather(np, maxEqOp