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\" )'" 95 const fileName surfBase(surfName.lessExt());
97 const word extension(surfName.ext());
101 <<
"Read surface from " << surfName <<
" ..." <<
nl <<
endl;
107 Info<<
" " << surf.size() <<
" faces with " 108 << zones.
size() <<
" zones" <<
nl <<
nl;
111 wordRes includePatches, excludePatches;
137 Info<<
"Writing regions to " 138 << zoneIndices.size() <<
" separate files ..." <<
nl <<
endl;
142 bitSet includeMap(surf.size());
144 for (
const label zonei : zoneIndices)
153 if (patchName.empty())
159 fileName outFile(surfBase +
'_' + patchName +
'.' + extension);
161 Info<<
" Zone " << zonei <<
" (" << zn.
size() <<
" faces) " 163 <<
" to file " << outFile <<
nl;
166 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.
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.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
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...
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
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)
const word & name() const noexcept
The patch/zone name.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.