48 int 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." 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;
99 label nZones = surf.markZones(multipleEdges,
faceZone);
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;
196 label nZones = surf.markZones(multipleEdges,
faceZone);
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);
triSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void noParallel()
Remove the parallel options.
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
#define forAll(list, i)
Loop across all elements in list.
word ext() const
Return file name extension (part after last .)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Extract command arguments and options from the supplied argc and argv parameters. ...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
T get(const label index) const
Get a value from the argument at index.
#define WarningInFunction
Report a warning using Foam::Warning.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
fileName lessExt() const
Return file name without extension (part before last .)
messageStream Info
Information stream (stdout output on master, null elsewhere)
A subset of mesh faces organised as a primitive patch.
Triangulated surface description with patch information.
Foam::argList args(argc, argv)
static HashTable< string > validOptions
A list of valid options.