66int main(
int argc,
char *argv[])
70 "Write surface mesh regions to separate files"
72 argList::noParallel();
77 "Specify single patch or multiple patches to extract\n"
78 "Eg, 'top' or '( front \".*back\" )'"
84 "Exclude single or multiple patches (name or regex) from extracting.\n"
85 "Eg, 'outlet' or '( inlet \".*Wall\" )'"
88 argList::addArgument(
"input",
"The input surface file");
94 const fileName surfBase(surfName.lessExt());
96 const word extension(surfName.ext());
100 <<
"Read surface from " << surfName <<
" ..." <<
nl <<
endl;
106 Info<<
" " << surf.size() <<
" faces with "
107 << zones.
size() <<
" zones" <<
nl <<
nl;
110 wordRes includePatches, excludePatches;
126 stringListOps::findMatching
136 Info<<
"Writing regions to "
137 << zoneIndices.size() <<
" separate files ..." <<
nl <<
endl;
141 bitSet includeMap(surf.size());
143 for (
const label zonei : zoneIndices)
152 if (patchName.empty())
155 patchName = geometricSurfacePatch::defaultName(zonei);
158 fileName outFile(surfBase +
'_' + patchName +
'.' + extension);
160 Info<<
" Zone " << zonei <<
" (" << zn.
size() <<
" faces) "
162 <<
" to file " << outFile <<
nl;
165 surf.subsetMesh(includeMap).write(outFile);
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
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.
bool readListIfPresent(const word &optName, List< T > &list) const
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A class for handling file names.
const word & name() const
The patch/zone name.
A surface zone on a MeshedSurface.
label size() const
The size of this zone in the face list.
labelRange range() const
The start/size range of this zone.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
Operations on lists of strings.
Extract name (as a word) from an object, typically using its name() method.