66 int main(
int argc,
char *argv[])
70 "Write surface mesh regions to separate files" 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\" )'" 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;
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())
158 fileName outFile(surfBase +
'_' + patchName +
'.' + extension);
160 Info<<
" Zone " << zonei <<
" (" << zn.
size() <<
" faces) " 162 <<
" to file " << outFile <<
nl;
165 surf.subsetMesh(includeMap).write(outFile);
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.
const word & name() const
The patch/zone name.
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.
A surface zone on a MeshedSurface.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
The size of this zone in the face list.
static void noParallel()
Remove the parallel options.
Operations on lists of strings.
Extract name (as a word) from an object, typically using its name() method.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
A class for handling words, derived from Foam::string.
Extract command arguments and options from the supplied argc and argv parameters. ...
labelList findMatching(const StringListType &input, const wordRes::filter &pred, AccessOp aop=identityOp())
Return ids for items with matching names.
A List of wordRe with additional matching capabilities.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
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...
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1...
T get(const label index) const
Get a value from the argument at index.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::argList args(argc, argv)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.