1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Picks up cells with cell centre 'inside' of surface. Requires surface
26 to be closed and singly connected.
28 \*---------------------------------------------------------------------------*/
31 #include "objectRegistry.H"
34 #include "triSurface.H"
35 #include "triSurfaceSearch.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 int main(int argc, char *argv[])
46 Foam::argList::noParallel();
47 Foam::argList::validArgs.append("surface file");
48 Foam::argList::validArgs.append("destination cellSet");
50 # include "setRootCase.H"
51 # include "createTime.H"
52 # include "createPolyMesh.H"
54 fileName surfName(args.additionalArgs()[0]);
56 fileName setName(args.additionalArgs()[1]);
60 Info<< "Reading surface from " << surfName << endl;
61 triSurface surf(surfName);
63 // Destination cellSet.
64 cellSet insideCells(mesh, setName, IOobject::NO_READ);
67 // Construct search engine on surface
68 triSurfaceSearch querySurf(surf);
70 boolList inside(querySurf.calcInside(mesh.cellCentres()));
76 insideCells.insert(cellI);
81 Info<< "Selected " << insideCells.size()
82 << " cells out of " << mesh.nCells() << endl
84 << "Writing selected cells to cellSet " << insideCells.name()
86 << "Use this cellSet e.g. with subsetMesh : " << endl << endl
87 << " subsetMesh <root> <case> " << insideCells.name()
92 Info << "End\n" << endl;
98 // ************************************************************************* //