55 label patchi =
mesh.boundaryMesh().findPatchID(patchName);
94 mesh.removeBoundary();
95 mesh.addPatches(newPatches);
97 Pout<<
"Created patch " << patchName <<
" at " << patchi <<
endl;
101 Pout<<
"Reusing patch " << patchName <<
" at " << patchi <<
endl;
119 bool changed =
false;
121 label bFacei = facei -
mesh.nInternalFaces();
123 if (nearest[bFacei] != -1)
126 label bMeshPatchID =
bMesh.whichPatch(nearest[bFacei]);
128 label
patchID = surfToMeshPatch[bMeshPatchID];
130 if (
patchID !=
mesh.boundaryMesh().whichPatch(facei))
132 label own =
mesh.faceOwner()[facei];
134 label
zoneID =
mesh.faceZones().whichZone(facei);
136 bool zoneFlip =
false;
173int main(
int argc,
char *argv[])
177 "Reads surface and applies surface regioning to a mesh"
180 argList::noParallel();
181 argList::addArgument(
"surfaceFile");
186 "Only repatch the faces in specified faceSet"
192 "Search tolerance as fraction of mesh size (default 1e-3)"
201 Info<<
"Reading surface from " << surfName <<
" ..." <<
endl;
208 Info<<
"Repatching only the faces in faceSet " << setName
209 <<
" according to nearest surface triangle ..." <<
endl;
213 Info<<
"Patching all boundary faces according to nearest surface"
214 <<
" triangle ..." <<
endl;
223 Info<<
"All boundary faces further away than " << searchTol
224 <<
" of mesh bounding box " <<
meshBb
225 <<
" will keep their patch label ..." <<
endl;
228 Info<<
"Before patching:" <<
nl
229 <<
" patch\tsize" <<
endl;
233 Info<<
" " <<
mesh.boundaryMesh()[patchi].name() <<
'\t'
234 <<
mesh.boundaryMesh()[patchi].size() <<
nl;
242 bMesh.readTriSurface(surfName);
252 patchMap[i] = addPatch(
mesh, bPatches[i].
name());
266 if (nearest[bFacei] == -1)
268 unmatchedFaces.insert(
mesh.nInternalFaces() + bFacei);
272 Pout<<
"Writing all " << unmatchedFaces.size()
273 <<
" unmatched faces to faceSet "
274 << unmatchedFaces.
name()
277 unmatchedFaces.
write();
288 Info<<
"Read " << faceLabels.size() <<
" faces to repatch ..." <<
endl;
290 for (
const label facei : faceLabels)
292 if (repatchFace(
mesh,
bMesh, nearest, patchMap, facei, meshMod))
302 const label facei =
mesh.nInternalFaces() + bFacei;
304 if (repatchFace(
mesh,
bMesh, nearest, patchMap, facei, meshMod))
311 Pout<<
"Changed " << nChanged <<
" boundary faces." <<
nl <<
endl;
317 Info<<
"After patching:" <<
nl
318 <<
" patch\tsize" <<
endl;
322 Info<<
" " <<
mesh.boundaryMesh()[patchi].name() <<
'\t'
323 <<
mesh.boundaryMesh()[patchi].size() <<
endl;
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual const fileName & name() const
Get the name of the stream.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
A list of faces which address into the list of 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 elements in the list.
T get(const label index) const
Get a value from the argument at index.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
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 globalCellID) const
Helper function to re-direct to zone::localID(...)
const boolList & flipMap() const noexcept
Return face flip map.
A class for handling file names.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
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.
virtual autoPtr< polyPatch > clone(const labelList &faceCells) const
Construct and return a clone, setting faceCells.
label start() const
Return start label of this patch in the polyMesh 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
const labelIOList & zoneID
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
constexpr char nl
The newline '\n' character (0x0a)
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.