1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 \*---------------------------------------------------------------------------*/
31 #include "mergePolyMesh.H"
35 void getRootCase(fileName& casePath)
39 if (casePath.empty() || casePath == ".")
41 // handle degenerate form and '.'
44 else if (casePath[0] != '/' && casePath.name() == "..")
46 // avoid relative cases ending in '..' - makes for very ugly names
47 casePath = cwd()/casePath;
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 int main(int argc, char *argv[])
63 argList::noParallel();
64 argList::validArgs.append("masterCase");
69 "specify alternative mesh region for the master mesh"
72 argList::validArgs.append("addCase");
77 "specify alternative mesh region for the additional mesh"
80 argList args(argc, argv);
86 fileName masterCase = args[1];
87 word masterRegion = polyMesh::defaultRegion;
88 args.optionReadIfPresent("masterRegion", masterRegion);
90 fileName addCase = args[2];
91 word addRegion = polyMesh::defaultRegion;
92 args.optionReadIfPresent("addRegion", addRegion);
94 getRootCase(masterCase);
97 Info<< "Master: " << masterCase << " region " << masterRegion << nl
98 << "mesh to add: " << addCase << " region " << addRegion << endl;
100 #include "createTimes.H"
102 Info<< "Reading master mesh for time = " << runTimeMaster.timeName() << nl;
104 Info<< "Create mesh\n" << endl;
105 mergePolyMesh masterMesh
110 runTimeMaster.timeName(),
116 Info<< "Reading mesh to add for time = " << runTimeToAdd.timeName() << nl;
118 Info<< "Create mesh\n" << endl;
124 runTimeToAdd.timeName(),
131 Info<< "Writing combined mesh to " << runTimeMaster.timeName() << endl;
133 masterMesh.addMesh(meshToAdd);
135 masterMesh.polyMesh::write();
137 Info<< "\nEnd\n" << endl;
143 // ************************************************************************* //