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
A class for handling file names.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
bool processorCase() const noexcept
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)
static bool master(const label communicator=worldComm)
bool readListIfPresent(const word &optName, List< T > &list) const
const polyBoundaryMesh & boundaryMesh() const
Ostream & endl(Ostream &os)
const Type & value() const
T get(const label index) const
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Identifies a surface patch/zone by name and index, with optional geometric type.
void setCapacity(const label len)
labelList indices(const wordRe &matcher, const bool useGroups=true) const
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
virtual readUpdateState readUpdate()
static void addArgument(const string &argName, const string &usage="")
Generic templated field type.
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...
A patch is a list of labels that address the faces in the global face list.
DynamicList< T, SizeMin > & append(const T &val)
const faceZoneMesh & faceZones() const noexcept
static void setAdvanced(const word &optName, bool advanced=true)
labelList findMatching(const StringListType &input, const wordRes &allow, const wordRes &deny=wordRes(), AccessOp aop=noOp())
virtual bool write(const token &tok)=0
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
label index() const noexcept
label findZoneID(const word &zoneName) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
label index() const noexcept
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual const faceList & faces() const
#define FatalErrorInFunction
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
const label nNonProcessor
static int myProcNo(const label communicator=worldComm)
forAllConstIters(mixture.phases(), phase)
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
const word & name() const noexcept
unsigned int count(const UList< bool > &bools, const bool val=true)
static void addOptions(const bool constant=true, const bool withZero=false)
static bool & parRun() noexcept
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual void setTime(const Time &t)
labelList identity(const label len, label start=0)
A List of wordRe with additional matching capabilities.
const polyBoundaryMesh & patches
List< T > getList(const label index) const
fileName globalPath() const
word name(const expressions::valueTypeCode typeCode)
A List with indirect addressing.
const word & name() const noexcept
const globalMeshData & globalData() const
static instantList select0(Time &runTime, const argList &args)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
static bool isAbsolute(const std::string &str)
static label nProcs(const label communicator=worldComm)
bool found(const word &optName) const
A list of faces which address into the list of points.