Go to the documentation of this file.
86 for (
const label patchi : indices)
90 if (isType<emptyPolyPatch>(pp))
99 indices[
count] = patchi;
103 indices.resize(
count);
111 int main(
int argc,
char *argv[])
115 "Extract patch or faceZone surfaces from a polyMesh."
116 " The name is historical, it only triangulates faces"
117 " when the output format requires it."
130 "excludeProcPatches",
131 "Exclude processor patches"
137 "Specify single or multiple faceZones to extract\n"
138 "Eg, 'cells' or '( slice \"mfp-.*\" )'"
144 "Specify single patch or multiple patches to extract.\n"
145 "Eg, 'top' or '( front \".*back\" )'"
151 "Specify single patch or multiple patches to exclude from writing."
152 " Eg, 'outlet' or '( inlet \".*Wall\" )'",
161 if (!userOutFileName.hasExt())
164 <<
"Missing extension on output name " << userOutFileName
168 Info<<
"Extracting surface from boundaryMesh ..." <<
nl <<
nl;
170 const bool includeProcPatches =
176 if (includeProcPatches)
178 Info<<
"Including all processor patches." <<
nl <<
endl;
182 Info<<
"Excluding all processor patches." <<
nl <<
endl;
185 wordRes includePatches, excludePatches;
199 if (selectedFaceZones.size())
218 if (timeDirs.size() == 1)
220 outFileName = userOutFileName;
227 Info<<
" ... no mesh change." <<
nl;
234 const auto dot = userOutFileName.rfind(
'.');
237 userOutFileName.substr(0,
dot) +
"_"
239 + userOutFileName.
ext();
256 (includePatches.size() || excludePatches.size())
257 ? getSelectedPatches(
bMesh, includePatches, excludePatches)
267 if (selectedFaceZones.size())
269 faceZoneIds = fzm.
indices(selectedFaceZones);
271 Info<<
"Additionally extracting faceZones "
272 << fzm.
names(selectedFaceZones) <<
nl;
290 patchSize.insert(pp.
name(), pp.size());
295 for (
const label zonei : faceZoneIds)
298 zoneSize.insert(pp.
name(), pp.size());
310 compactZoneID.insert(iter.key(), compactZoneID.size());
315 compactZoneID.insert(iter.key(), compactZoneID.size());
327 label patchi =
bMesh.findPatchID(iter.key());
330 patchToCompactZone[patchi] = iter.val();
335 faceZoneToCompactZone[zoneI] = iter.val();
350 compactZones.
append(patchToCompactZone[pp.
index()]);
354 for (
const label zonei : faceZoneIds)
360 compactZones.
append(faceZoneToCompactZone[pp.
index()]);
379 allBoundary.meshPoints(),
380 allBoundary.meshPointMap(),
420 gatheredPoints.clear();
422 faceList allFaces = ListListOps::combine<faceList>
427 gatheredFaces.clear();
429 labelList allZones = ListListOps::combine<labelList>
434 gatheredZones.clear();
442 Info<<
"surfZone " << *iter
443 <<
" : " << surfZones[*iter].name()
469 Info<<
"Writing merged surface to " << globalCasePath <<
endl;
471 sortedFace.
write(globalCasePath);
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
A class for handling file names.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
static word timeName(const scalar t, const int precision=precision_)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
static void addNote(const string ¬e)
Add extra notes for the usage information.
bool readListIfPresent(const word &optName, List< T > &list) const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
word ext() const
Return file name extension (part after last .)
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Identifies a surface patch/zone by name, patch index and geometricType.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
A subset of mesh faces organised as a primitive patch.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Extract name (as a word) from an object, typically using its name() method.
labelList findMatching(const StringListType &input, const wordRes &whitelist, const wordRes &blacklist=wordRes(), AccessOp aop=noOp())
Return ids for items with matching names.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const word & name() const
Return name.
label findZoneID(const word &zoneName) const
Find zone index given a name, return -1 if not found.
label start() const
Return start label of this patch in the polyMesh face list.
wordList names() const
A list of the zone names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setCapacity(const label nElem)
Alter the size of the underlying storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
readUpdateState
Enumeration defining the state of the mesh after a read update.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
fileName path() const
Return path.
forAllConstIters(mixture.phases(), phase)
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
A List of wordRe with additional matching capabilities.
const polyBoundaryMesh & patches
List< T > getList(const label index) const
Get a List of values from the argument at index.
fileName globalPath() const
Return global path for the case.
A List with indirect addressing.
const globalMeshData & globalData() const
Return parallel info.
bool processorCase() const
Return true if this is a processor case.
static instantList select0(Time &runTime, const argList &args)
labelList indices(const keyType &key) const
Return zone indices for all matches.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
label index() const
Return the index of this zone in zone list.
const word & name() const
The patch name.
label index() const
The index of this patch in the boundaryMesh.
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.
bool found(const word &optName) const
Return true if the named option is found.
A list of faces which address into the list of points.