Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
applications
utilities
mesh
manipulation
insideCells
insideCells.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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.
15
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
19
for more details.
20
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/>.
23
24
Application
25
insideCells
26
27
Description
28
Picks up cells with cell centre 'inside' of surface.
29
30
Requires surface to be closed and singly connected.
31
32
Usage
33
34
- insideCells [OPTIONS] <Foam surface file> <cellSet name>
35
36
@param <Foam surface file> \n
37
@todo Detailed description of argument.
38
39
@param <cellSet name> \n
40
@todo Detailed description of argument.
41
42
@param -case <dir>\n
43
Case directory.
44
45
@param -help \n
46
Display help message.
47
48
@param -doc \n
49
Display Doxygen API documentation page for this application.
50
51
@param -srcDoc \n
52
Display Doxygen source documentation page for this application.
53
54
\*---------------------------------------------------------------------------*/
55
56
#include <
OpenFOAM/argList.H
>
57
#include <
OpenFOAM/Time.H
>
58
#include <
OpenFOAM/polyMesh.H
>
59
#include <
triSurface/triSurface.H
>
60
#include <
meshTools/triSurfaceSearch.H
>
61
#include <
meshTools/cellSet.H
>
62
63
using namespace
Foam;
64
65
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66
67
// Main program:
68
69
int
main
(
int
argc,
char
*argv[])
70
{
71
Foam::argList::noParallel
();
72
Foam::argList::validArgs
.
append
(
"surface file"
);
73
Foam::argList::validArgs
.
append
(
"destination cellSet"
);
74
75
# include <
OpenFOAM/setRootCase.H
>
76
# include <
OpenFOAM/createTime.H
>
77
# include <
OpenFOAM/createPolyMesh.H
>
78
79
fileName
surfName(
args
.
additionalArgs
()[0]);
80
81
fileName
setName(
args
.
additionalArgs
()[1]);
82
83
84
// Read surface
85
Info
<<
"Reading surface from "
<< surfName <<
endl
;
86
triSurface
surf(surfName);
87
88
// Destination cellSet.
89
cellSet
insideCells(
mesh
, setName,
IOobject::NO_READ
);
90
91
92
// Construct search engine on surface
93
triSurfaceSearch
querySurf(surf);
94
95
boolList
inside(querySurf.calcInside(
mesh
.
cellCentres
()));
96
97
forAll
(inside, cellI)
98
{
99
if
(inside[cellI])
100
{
101
insideCells.insert(cellI);
102
}
103
}
104
105
106
Info
<<
"Selected "
<< insideCells.size()
107
<<
" cells out of "
<<
mesh
.
nCells
() << endl
108
<< endl
109
<<
"Writing selected cells to cellSet "
<< insideCells.name()
110
<< endl << endl
111
<<
"Use this cellSet e.g. with subsetMesh : "
<< endl << endl
112
<<
" subsetMesh <root> <case> "
<< insideCells.name()
113
<< endl <<
endl
;
114
115
insideCells.
write
();
116
117
Info
<<
"End\n"
<<
endl
;
118
119
return
0;
120
}
121
122
123
// ************************ vim: set sw=4 sts=4 et: ************************ //