55 label patchi =
mesh.boundaryMesh().findPatchID(patchName);
100 mesh.removeBoundary();
101 mesh.addPatches(newPatches);
103 Pout<<
"Created patch " << patchName <<
" at " << patchi <<
endl;
107 Pout<<
"Reusing patch " << patchName <<
" at " << patchi <<
endl;
125 bool changed =
false;
127 label bFacei = facei -
mesh.nInternalFaces();
129 if (nearest[bFacei] != -1)
132 label bMeshPatchID =
bMesh.whichPatch(nearest[bFacei]);
134 label
patchID = surfToMeshPatch[bMeshPatchID];
136 if (
patchID !=
mesh.boundaryMesh().whichPatch(facei))
138 label own =
mesh.faceOwner()[facei];
140 label zoneID =
mesh.faceZones().whichZone(facei);
142 bool zoneFlip =
false;
179int main(
int argc,
char *argv[])
183 "Reads surface and applies surface regioning to a mesh"
192 "Only repatch the faces in specified faceSet"
198 "Search tolerance as fraction of mesh size (default 1e-3)"
207 Info<<
"Reading surface from " << surfName <<
" ..." <<
endl;
210 const bool readSet =
args.readIfPresent(
"faceSet", setName);
214 Info<<
"Repatching only the faces in faceSet " << setName
215 <<
" according to nearest surface triangle ..." <<
endl;
219 Info<<
"Patching all boundary faces according to nearest surface"
220 <<
" triangle ..." <<
endl;
223 const scalar searchTol =
args.getOrDefault<scalar>(
"tol", 1
e-3);
229 Info<<
"All boundary faces further away than " << searchTol
230 <<
" of mesh bounding box " <<
meshBb
231 <<
" will keep their patch label ..." <<
endl;
234 Info<<
"Before patching:" <<
nl
235 <<
" patch\tsize" <<
endl;
239 Info<<
" " <<
mesh.boundaryMesh()[patchi].name() <<
'\t'
240 <<
mesh.boundaryMesh()[patchi].size() <<
nl;
248 bMesh.readTriSurface(surfName);
258 patchMap[i] = addPatch(
mesh, bPatches[i].
name());
272 if (nearest[bFacei] == -1)
274 unmatchedFaces.insert(
mesh.nInternalFaces() + bFacei);
278 Pout<<
"Writing all " << unmatchedFaces.size()
279 <<
" unmatched faces to faceSet "
280 << unmatchedFaces.name()
283 unmatchedFaces.write();
298 if (repatchFace(
mesh,
bMesh, nearest, patchMap, facei, meshMod))
308 const label facei =
mesh.nInternalFaces() + bFacei;
310 if (repatchFace(
mesh,
bMesh, nearest, patchMap, facei, meshMod))
317 Pout<<
"Changed " << nChanged <<
" boundary faces." <<
nl <<
endl;
323 Info<<
"After patching:" <<
nl
324 <<
" patch\tsize" <<
endl;
328 Info<<
" " <<
mesh.boundaryMesh()[patchi].name() <<
'\t'
329 <<
mesh.boundaryMesh()[patchi].size() <<
endl;
labelList faceLabels(nFaceLabels)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void noParallel()
Remove the parallel options.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A bounding box defined in terms of min/max extrema points.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A subset of mesh faces organised as a primitive patch.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A class for handling file names.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
constexpr char nl
The newline '\n' character (0x0a).
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.