66 label meshEdgeI =
bMesh.featureToEdge()[featEdgeI];
68 markedEdges[markedI++] = meshEdgeI;
76 int main(
int argc,
char *argv[])
80 "Divides external faces into patches based on feature angle" 96 Info<<
"Mesh read in = " 101 const scalar featureAngle =
args.
get<scalar>(1);
102 const bool overwrite =
args.
found(
"overwrite");
106 Info<<
"Feature:" << featureAngle <<
endl 107 <<
"minCos :" << minCos <<
endl 118 bMesh.setFeatureEdges(minCos);
123 collectFeatureEdges(
bMesh, markedEdges);
136 label newPatchi =
bMesh.patches().size();
145 if (unsetFacei == -1)
155 patchName =
"auto" +
name(suffix++);
157 while (
bMesh.findPatchID(patchName) != -1);
159 bMesh.addPatch(patchName);
161 bMesh.changePatchType(patchName,
"patch");
167 bMesh.markFaces(markedEdges, unsetFacei, visited);
183 Info<<
"Assigned " << nVisited <<
" faces to patch " << patchName
219 for (label patchi = newPatchi; patchi <
patches.
size(); patchi++)
248 polyMeshRepatcher.changePatches(newPatches);
259 label meshFacei = meshFace[facei];
261 polyMeshRepatcher.changePatchID(meshFacei,
patchIDs[facei]);
264 polyMeshRepatcher.repatch();
const labelList patchIDs(pbm.indices(polyPatchNames, true))
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const word & name() const noexcept
Return the object name.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void noParallel()
Remove the parallel options.
label nFaces() const noexcept
Number of mesh faces.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
A list of faces which address into the list of points.
const fileName & pointsInstance() const
Return the current instance directory for points.
void setSize(const label n)
Alias for resize()
dimensionedScalar cos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A mesh which allows changes in the patch distribution of the boundary faces. The change in patching i...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
label find(const T &val) const
Find index of the first occurrence of the value.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
label nEdges() const
Number of edges in patch.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
T get(const label index) const
Get a value from the argument at index.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
const polyBoundaryMesh & patches
const std::string patch
OpenFOAM patch number as a std::string.
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)
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
A patch is a list of labels that address the faces in the global face list.
Foam::argList args(argc, argv)
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points) ...
bool found(const word &optName) const
Return true if the named option is found.