diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index 5c4c321850d5af41642a3917a3335d2bfed50986..3268db210812a2ae543023e0c3c10e618aaf2ac3 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -702,6 +702,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); Info<< "Writing polyMesh" << endl; + pShapeMesh.removeFiles(); pShapeMesh.write(); Info<< nl << "end" << endl; diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C index 45477dd4fba6121338c04f1687237e4c79f62592..ee5b4f073b8f26fc042568bef1809063a6aa7a57 100644 --- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C +++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C @@ -753,6 +753,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); Info<< "Writing polyMesh" << endl; + pShapeMesh.removeFiles(); pShapeMesh.write(); Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index 5a0ebc94aa2dfb9b085172c940b9a55704b9de3f..fbb98236c8567c8c85a15f359509532cf153b99f 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -1177,6 +1177,9 @@ int main(int argc, char *argv[]) patchPhysicalTypes ); + // Remove files now, to ensure all mesh files written are consistent. + pShapeMesh.removeFiles(); + //dont write mesh yet, otherwise preservePatchTypes will be broken //and zones wont be written //checkmesh done after patch addition as well diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index f9ce3c3423f7b61339b16fd94ae27c4a840da864..ff3ae5737ed1c82f273fd9295ba6ea8fe51113c3 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -865,6 +865,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); Info<< "Writing polyMesh" << endl; + pShapeMesh.removeFiles(); pShapeMesh.write(); Info<< "\nEnd\n" << endl; diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index a1d4f55668a28b8e6627f55c18d346b5964ac00f..f6c84fbb1a1c6710377afed14d1ddb1af58670b4 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -942,6 +942,9 @@ int main(int argc, char *argv[]) boundaryPatchPhysicalTypes ); + // Remove files now, to ensure all mesh files written are consistent. + mesh.removeFiles(); + repatchPolyTopoChanger repatcher(mesh); // Now use the patchFaces to patch up the outside faces of the mesh. diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 6c3c2451e02bf2179e2ebbfcfbdc490c7fa50685..e4c9fb7bf9fc509546a70c0cb4e7813b330a65e1 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -1158,8 +1158,6 @@ int main(int argc, char *argv[]) Info<< endl; - - // Construct mesh polyMesh mesh ( @@ -1179,8 +1177,10 @@ int main(int argc, char *argv[]) wordList(0) // boundaryPatchPhysicalTypes ); + // Remove files now, to ensure all mesh files written are consistent. + mesh.removeFiles(); - if (faceZones.size() > 0 || cellZones.size() > 0) + if (faceZones.size() || cellZones.size()) { Info << "Adding cell and face zones" << endl; @@ -1188,7 +1188,7 @@ int main(int argc, char *argv[]) List<faceZone*> fZones(faceZones.size()); List<cellZone*> cZones(cellZones.size()); - if (cellZones.size() > 0) + if (cellZones.size()) { forAll(cellZones.toc(), cnt) { @@ -1205,7 +1205,7 @@ int main(int argc, char *argv[]) ); } } - if (faceZones.size() > 0) + if (faceZones.size()) { const labelList& own = mesh.faceOwner(); const labelList& nei = mesh.faceNeighbour(); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index 994f0c57a776496ad9d4989c5e1204a1de81aa17..d291b8313962e180afbacd589e67919ee5e297f2 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -575,6 +575,7 @@ polyMesh pShapeMesh ); Info << "Writing polyMesh" << endl; +pShapeMesh.removeFiles(); pShapeMesh.write(); fileName czPath diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C index 28e99a7a1d62dad6a50276649b95f1f2d4baeddb..2bc7e4fd7e59cb01241467386f83eda0957f841c 100644 --- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C +++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C @@ -156,9 +156,9 @@ int main(int argc, char *argv[]) Info<< "Writing mesh ..." << endl; + mesh.removeFiles(); mesh.write(); - Info<< "End\n" << endl; return 0; diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index d953cc9782a28bb5b7cb52e63f72adf540c0d450..c7f8d86a200e11511ff7feb69db73216900a20d2 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -313,11 +313,10 @@ int main(int argc, char *argv[]) patchPhysicalTypes ); - Info<< "Writing mesh to " << runTime.constant() << endl << endl; - + Info<< "Writing mesh ..." << endl; + mesh.removeFiles(); mesh.write(); - Info<< "End\n" << endl; return 0; diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C index ac629373671aa1c6bd5c0e52a9816c0a17fc1f75..1a24ab8623d3b8571350acaf23b221206b93799e 100644 --- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C +++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C @@ -262,6 +262,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); Info<< "Writing polyMesh" << endl; + pShapeMesh.removeFiles(); pShapeMesh.write(); Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 39d8ff5a7690c9d0e884513238d9ca297bc98b35..b7b80d576c1be37b775fc37a9d8c3bbae98e1403 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -342,7 +342,6 @@ int main(int argc, char *argv[]) const polyMesh& mesh = meshPtr; - if (readFaceFile) { label nPatches = 0; @@ -474,7 +473,7 @@ int main(int argc, char *argv[]) boundaryPatch.setSize(facei); - // Print region to patch mapping + // Print region to patch mapping Info<< "Regions:" << endl; forAllConstIter(Map<label>, regionToPatch, iter) @@ -548,6 +547,7 @@ int main(int argc, char *argv[]) Info<< "Writing mesh to " << runTime.constant() << endl << endl; + meshPtr().removeFiles(); meshPtr().write(); Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C index 507d8575e7b8544fdd7aad00506005d6b97f2a35..a338b390b5ff5be76429cbc720bdedf9cf509f26 100644 --- a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C +++ b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C @@ -80,9 +80,9 @@ int main(int argc, char *argv[]) Info<< "Writing mesh ..." << endl; + mesh.removeFiles(); mesh.write(); - Info<< "End\n" << endl; return 0; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C index f7a6b8d2d34d767a54c40f4686fa278c083e0237..ee160048be8d0b8c34f8c21f4e85cfc340f27081 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C @@ -530,9 +530,6 @@ Foam::polyMesh::polyMesh Info<<"Constructing polyMesh from cell and boundary shapes." << endl; } - // Remove all of the old mesh files if they exist - removeFiles(instance()); - // Calculate faces and cells labelList patchSizes; labelList patchStarts; @@ -814,9 +811,6 @@ Foam::polyMesh::polyMesh Info<<"Constructing polyMesh from cell and boundary shapes." << endl; } - // Remove all of the old mesh files if they exist - removeFiles(instance()); - // Calculate faces and cells labelList patchSizes; labelList patchStarts;