Go to the documentation of this file.
71 Info<<
"Adding exposed internal faces to "
72 << (
patchId == -1 ?
"new" :
"existing")
73 <<
" patch \"" << patchName <<
"\"" <<
nl <<
endl;
85 for (
const label patchi : patchIDs)
87 nFaces += pbm[patchi].size();
98 for (
const label patchi : patchIDs)
104 patchFaces[nFaces] = pp.
start()+i;
125 bool haveWarned =
false;
128 if (!faceData[faceI].valid(deltaCalc.data()))
133 <<
"Did not visit some faces, e.g. face " << faceI
135 <<
"Using patch " << patchIDs[0] <<
" as nearest"
139 nearest[faceI] = patchIDs[0];
143 nearest[faceI] = faceData[faceI].data();
155 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
164 const word fieldType = FieldType::typeName;
176 Info<<
"Subsetting " << fieldType <<
" (";
200 subFields[nFields].rename(fieldName);
213 void subsetPointFields
222 const word fieldType = FieldType::typeName;
234 Info<<
"Subsetting " << fieldType <<
" (";
258 subFields[nFields].rename(fieldName);
271 void subsetDimensionedFields
279 const word fieldType = FieldType::typeName;
291 Info<<
"Subsetting " << fieldType <<
" (";
315 subFields[nFields].rename(fieldName);
327 template<
class TopoSet>
339 ReadFields<TopoSet>(objects, sets);
344 const TopoSet&
set = sets[seti];
352 if (
set.found(map[i]))
374 int main(
int argc,
char *argv[])
378 "Create a mesh subset for a particular region of interest based on a"
379 " cellSet or cellZone(s) specified as the first command argument.\n"
380 "See setSet/topoSet utilities on how to select cells based on"
389 "The cellSet name, but with the -zone option this is interpreted"
390 " to be a cellZone selection by name(s) or regex.\n"
391 "Eg 'mixer' or '( mixer \"moving.*\" )'"
398 "Add exposed internal faces to specified patch"
399 " instead of \"oldInternalFaces\""
405 "Add exposed internal faces to closest of specified patches"
406 " instead of \"oldInternalFaces\""
411 "Subset with cellZone(s) instead of cellSet."
412 " The command argument may be a list of words or regexs"
418 "Specify a time for the resulting mesh"
434 const bool useCellZone =
args.
found(
"zone");
435 const bool overwrite =
args.
found(
"overwrite");
441 if (specifiedInstance)
444 meshInstance = fieldsInstance;
457 exposedPatchIDs.first() =
465 Info<<
"Adding exposed internal faces to nearest of patches "
468 if (exposedPatchIDs.empty())
471 <<
nl <<
"No patches matched. Patches: "
479 exposedPatchIDs.first() =
484 Info<<
"Adding exposed internal faces to patch \""
486 <<
"\" (created if necessary)" <<
nl
514 Info<<
"Using cellSet " << selectionName <<
nl <<
endl;
528 :
mesh.cellZones().selection(zoneNames)
531 if (exposedPatchIDs.size() == 1)
537 exposedPatchIDs.first(),
544 labelList nearestExposedPatch(nearestPatch(
mesh, exposedPatchIDs));
564 <<
" cells" <<
nl <<
nl;
576 subsetFields(subsetter, availableFields, vScalarFlds);
579 subsetFields(subsetter, availableFields, vVectorFlds);
582 subsetFields(subsetter, availableFields, vSphTensorFlds);
585 subsetFields(subsetter, availableFields, vSymmTensorFlds);
588 subsetFields(subsetter, availableFields, vTensorFlds);
595 subsetFields(subsetter, availableFields, sScalarFlds);
598 subsetFields(subsetter, availableFields, sVectorFlds);
601 subsetFields(subsetter, availableFields, sSphTensorFlds);
604 subsetFields(subsetter, availableFields, sSymmTensorFlds);
607 subsetFields(subsetter, availableFields, sTensorFlds);
616 subsetPointFields(subsetter, pMesh, availableFields, pScalarFlds);
619 subsetPointFields(subsetter, pMesh, availableFields, pVectorFlds);
622 subsetPointFields(subsetter, pMesh, availableFields, pSphTensorFlds);
625 subsetPointFields(subsetter, pMesh, availableFields, pSymmTensorFlds);
628 subsetPointFields(subsetter, pMesh, availableFields, pTensorFlds);
635 subsetDimensionedFields(subsetter, availableFields, dScalarFlds);
638 subsetDimensionedFields(subsetter, availableFields, dVectorFlds);
641 subsetDimensionedFields(subsetter, availableFields, dSphTensorFlds);
644 subsetDimensionedFields(subsetter, availableFields, dSymmTensorFlds);
647 subsetDimensionedFields(subsetter, availableFields, dTensorFlds);
661 objects.
remove(*cellSetPtr);
693 if (overwrite || specifiedInstance)
714 for (
const auto&
fld : vScalarFlds) {
fld.write(); }
715 for (
const auto&
fld : vVectorFlds) {
fld.write(); }
716 for (
const auto&
fld : vSphTensorFlds) {
fld.write(); }
717 for (
const auto&
fld : vSymmTensorFlds) {
fld.write(); }
718 for (
const auto&
fld : vTensorFlds) {
fld.write(); }
721 for (
const auto&
fld : sScalarFlds) {
fld.write(); }
722 for (
const auto&
fld : sVectorFlds) {
fld.write(); }
723 for (
const auto&
fld : sSphTensorFlds) {
fld.write(); }
724 for (
const auto&
fld : sSymmTensorFlds) {
fld.write(); }
725 for (
const auto&
fld : sTensorFlds) {
fld.write(); }
728 for (
const auto&
fld : pScalarFlds) {
fld.write(); }
729 for (
const auto&
fld : pVectorFlds) {
fld.write(); }
730 for (
const auto&
fld : pSphTensorFlds) {
fld.write(); }
731 for (
const auto&
fld : pSymmTensorFlds) {
fld.write(); }
732 for (
const auto&
fld : pTensorFlds) {
fld.write(); }
735 for (
const auto&
fld : dScalarFlds) {
fld.write(); }
736 for (
const auto&
fld : dVectorFlds) {
fld.write(); }
737 for (
const auto&
fld : dSphTensorFlds) {
fld.write(); }
738 for (
const auto&
fld : dSymmTensorFlds) {
fld.write(); }
739 for (
const auto&
fld : dTensorFlds) {
fld.write(); }
static autoPtr< T > New(Args &&... args)
bitSet create(const label n, const labelHashSet &locations, const bool on=true)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static void setInstance(const fileName &instance, Container &)
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
void set(List< bool > &bools, const labelRange &range)
A class for handling words, derived from Foam::string.
label findIndex(const wordRe &key) const
virtual bool write(const bool valid=true) const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const labelList & cellMap() const
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const labelList & pointMap() const
Given the original mesh and the list of selected cells, it creates the mesh consisting only of the de...
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
static word timeName(const scalar t, const int precision=precision_)
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
static word exposedPatchName
static void addNote(const string ¬e)
const fileName & facesInstance() const
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
void setCellSubset(const bitSet &selectedCells, const label patchID=-1, const bool syncPar=true)
const polyBoundaryMesh & boundaryMesh() const
Ostream & endl(Ostream &os)
const T * set(const label i) const
A HashTable with keys but without contents that is similar to std::unordered_set.
T get(const label index) const
bool readIfPresent(const word &optName, T &val) const
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
label min(const labelHashSet &set, label minValue=labelMax)
Mesh consisting of general polyhedral cells.
static void addArgument(const string &argName, const string &usage="")
const fileName & pointsInstance() const
static void noFunctionObjects(bool addWithOption=false)
label nCells() const noexcept
A patch is a list of labels that address the faces in the global face list.
const cellZoneMesh & cellZones() const noexcept
HashTable< wordHashSet > classes() const
bool remove(const IOobject &io)
void transfer(List< T > &list)
void setSize(const label newLen)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
wordList patchNames(nPatches)
label findPatchID(const word &patchName, const bool allowNotFound=true) const
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Mesh data needed to do the Finite Volume discretisation.
Mesh representing a set of points created from polyMesh.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
List< Key > sortedToc() const
const fvMesh & baseMesh() const noexcept
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A HashTable similar to std::unordered_map.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const fvMesh &sMesh, const labelUList &patchMap, const labelUList &cellMap, const labelUList &faceMap, const bool allowUnmapped=false)
#define FatalErrorInFunction
Field reading functions for post-processing utilities.
labelList getExposedFaces(const bitSet &selectedCells, const bool syncCouples=true) const
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)
const vectorField & faceCentres() const
static void removeFiles(const polyMesh &mesh)
A List of wordRe with additional matching capabilities.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
List< T > getList(const label index) const
const fvMesh & subMesh() const
const labelList & faceMap() const
const Time & time() const
label nTotalCells() const noexcept
label nFaces() const noexcept
An instant of time. Contains the time value and name.
const globalMeshData & globalData() const
Generic GeometricField class.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
#define WarningInFunction
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
bool found(const word &optName) const
UIndirectList< label > labelUIndList
UIndirectList of labels.