From 8f15184be96be6e5c01e6276e3489d6d74fb1ac6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 3 Dec 2010 12:04:43 +0000 Subject: [PATCH] ENH: redistributeMeshPar : make it work with master-reading of dictionaries --- .../redistributeMeshPar/redistributeMeshPar.C | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C index 985349019f..18ecebece9 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C @@ -86,33 +86,55 @@ autoPtr createMesh if (!haveMesh) { // Create dummy mesh. Only used on procs that don't have mesh. - // WIP: how to avoid parallel comms when loading IOdictionaries? - // For now just give error message. - if - ( - regIOobject::fileModificationChecking - == regIOobject::timeStampMaster - || regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ) + + // Switch timeStamp checking to one which does not do any + // parallel sync + regIOobject::fileCheckTypes oldCheckType = + regIOobject::fileModificationChecking; + regIOobject::fileModificationChecking = regIOobject::timeStamp; + { - FatalErrorIn("createMesh(..)") - << "Cannot use 'fileModificationChecking' mode " - << regIOobject::fileCheckTypesNames - [ - regIOobject::fileModificationChecking - ] - << " since this uses parallel communication." - << exit(FatalError); + IOdictionary fvSolution + ( + IOobject + ( + "fvSolution", + runTime.system(), + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ); + Pout<< "Writing dummy " << fvSolution.objectPath() << endl; + fvSolution.regIOobject::write(); + } + { + IOdictionary fvSchemes + ( + IOobject + ( + "fvSchemes", + runTime.system(), + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ); + fvSchemes.add("divSchemes", dictionary()); + fvSchemes.add("gradSchemes", dictionary()); + fvSchemes.add("laplacianSchemes", dictionary()); + Pout<< "Writing dummy " << fvSchemes.objectPath() << endl; + fvSchemes.regIOobject::write(); } + Pout<< "Creating dummy mesh from " << io.objectPath() << endl; fvMesh dummyMesh ( IOobject ( - regionName, - instDir, - runTime, + io.name(), + io.instance(), + io.db(), IOobject::NO_READ ), xferCopy(pointField()), @@ -124,6 +146,8 @@ autoPtr createMesh Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath() << endl; dummyMesh.write(); + + regIOobject::fileModificationChecking = oldCheckType; } Pout<< "Reading mesh from " << io.objectPath() << endl;