/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Application reconstructPar Description Reconstructs fields of a case that is decomposed for parallel execution of OpenFOAM. \*---------------------------------------------------------------------------*/ #include "argList.H" #include "timeSelector.H" #include "fvCFD.H" #include "IOobjectList.H" #include "processorMeshes.H" #include "regionProperties.H" #include "fvFieldReconstructor.H" #include "pointFieldReconstructor.H" #include "reconstructLagrangian.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // bool haveAllTimes ( const HashSet& masterTimeDirSet, const instantList& timeDirs ) { // Loop over all times forAll(timeDirs, timeI) { if (!masterTimeDirSet.found(timeDirs[timeI].name())) { return false; } } return true; } int main(int argc, char *argv[]) { argList::addNote ( "Reconstruct fields of a parallel case" ); // enable -constant ... if someone really wants it // enable -zeroTime to prevent accidentally trashing the initial fields timeSelector::addOptions(true, true); argList::noParallel(); #include "addRegionOption.H" argList::addBoolOption ( "allRegions", "operate on all regions in regionProperties" ); argList::addOption ( "fields", "list", "specify a list of fields to be reconstructed. Eg, '(U T p)' - " "regular expressions not currently supported" ); argList::addOption ( "lagrangianFields", "list", "specify a list of lagrangian fields to be reconstructed. Eg, '(U d)' -" "regular expressions not currently supported, " "positions always included." ); argList::addBoolOption ( "noLagrangian", "skip reconstructing lagrangian positions and fields" ); argList::addBoolOption ( "sets", "reconstruct cellSets, faceSets, pointSets" ); argList::addBoolOption ( "newTimes", "only reconstruct new times (i.e. that do not exist already)" ); #include "setRootCase.H" #include "createTime.H" HashSet selectedFields; if (args.optionFound("fields")) { args.optionLookup("fields")() >> selectedFields; } const bool reconstructSets = args.optionFound("sets"); const bool noLagrangian = args.optionFound("noLagrangian"); HashSet selectedLagrangianFields; if (args.optionFound("lagrangianFields")) { if (noLagrangian) { FatalErrorIn(args.executable()) << "Cannot specify noLagrangian and lagrangianFields " << "options together." << exit(FatalError); } args.optionLookup("lagrangianFields")() >> selectedLagrangianFields; } const bool newTimes = args.optionFound("newTimes"); const bool allRegions = args.optionFound("allRegions"); // determine the processor count directly label nProcs = 0; while (isDir(args.path()/(word("processor") + name(nProcs)))) { ++nProcs; } if (!nProcs) { FatalErrorIn(args.executable()) << "No processor* directories found" << exit(FatalError); } // Create the processor databases PtrList