48int main(
int argc,
char *argv[])
52 "Strips any baffle parts of a surface.\n"
53 "A baffle region is one which is reached by walking from an open edge,"
54 " and stopping when a multiply connected edge is reached."
57 argList::noParallel();
58 argList::validOptions.clear();
59 argList::addArgument(
"input",
"The input surface file");
60 argList::addArgument(
"output",
"The output surface file");
64 Info<<
"Reading surface from " << surfFileName <<
endl;
68 const word outExtension = outFileName.
ext();
73 bool anyZoneRemoved =
false;
75 label iterationNo = 0;
76 label iterationLimit = 10;
78 Info<<
"Splitting off baffle parts " <<
endl;
82 anyZoneRemoved =
false;
93 if (edFaces[i].size() > 2)
95 multipleEdges[i] =
true;
112 for (label z = 0; z <
nZones; z++)
114 bool keepZone =
true;
122 if (edFaces[faceEds[
f][fe]].size() < 2)
126 anyZoneRemoved =
true;
143 nonBaffle[
f] = keepZone;
144 baffle[
f] = !keepZone;
149 Info<<
" Iteration " << iterationNo <<
endl;
153 if (baffleSurf.
size())
159 +
"." + outExtension;
161 Info<<
" Writing baffle part to " << bafflePartFileName <<
endl;
163 baffleSurf.
write(bafflePartFileName);
166 surf = surf.subsetMesh(nonBaffle, pointMap, faceMap);
168 if (iterationNo == iterationLimit)
171 <<
"Iteration limit of " << iterationLimit <<
"reached" <<
endl;
176 }
while (anyZoneRemoved && iterationNo < iterationLimit);
178 Info<<
"Writing new surface to " << outFileName <<
endl;
180 surf.
write(outFileName);
190 if (edFaces[i].size() > 2)
192 multipleEdges[i] =
true;
198 Info<<
"Splitting remaining multiply connected parts" <<
endl;
200 for (label z = 0; z <
nZones; z++)
218 +
"." + outExtension;
220 Info<<
" Writing multiple part "
221 << z <<
" to " << remainingPartFileName <<
endl;
223 zoneSurf.
write(remainingPartFileName);
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
void size(const label n)
Older name for setAddressableSize.
Extract command arguments and options from the supplied argc and argv parameters.
T get(const label index) const
Get a value from the argument at index.
A subset of mesh faces organised as a primitive patch.
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .)
Triangulated surface description with patch information.
triSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .)
#define WarningInFunction
Report a warning using Foam::Warning.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.