66 label meshEdgeI =
bMesh.featureToEdge()[featEdgeI];
68 markedEdges[markedI++] = meshEdgeI;
76int main(
int argc,
char *argv[])
80 "Divides external faces into patches based on feature angle"
85 argList::noParallel();
86 argList::noFunctionObjects();
88 argList::addArgument(
"featureAngle",
"in degrees [0-180]");
94 const word oldInstance =
mesh.pointsInstance();
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();
143 label unsetFacei = patchIDs.find(-1);
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);
179 patchIDs[facei] = newPatchi;
183 Info<<
"Assigned " << nVisited <<
" faces to patch " << patchName
203 newPatchPtrList[newPatchi] =
216 for (label patchi = newPatchi; patchi <
patches.size(); patchi++)
220 newPatchPtrList[newPatchi] = polyPatch::New
241 polyMeshRepatcher.changePatches(newPatchPtrList);
252 label meshFacei = meshFace[facei];
254 polyMeshRepatcher.changePatchID(meshFacei, patchIDs[facei]);
257 polyMeshRepatcher.repatch();
262 mesh.setInstance(oldInstance);
266 IOstream::defaultPrecision(
max(10u, IOstream::defaultPrecision()));
Various functions to operate on Lists.
void setSize(const label n)
Alias for resize()
An ordered pair of two objects of type <T> with first() and second() elements.
A list of faces which address into the list of points.
label nEdges() const
Number of edges in patch.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
T get(const label index) const
Get a value from the argument at index.
bool found(const word &optName) const
Return true if the named option is found.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Like polyPatch but without reference to mesh. Used in boundaryMesh to hold data on patches....
const word & name() const noexcept
The patch name.
A patch is a list of labels that address the faces in the global face list.
A mesh which allows changes in the patch distribution of the boundary faces. The change in patching i...
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
dimensionedScalar cos(const dimensionedScalar &ds)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.