103 Pout<<
"Created patch " << patchName <<
" at " << patchi <<
endl;
107 Pout<<
"Reusing patch " << patchName <<
" at " << patchi <<
endl;
125 bool changed =
false;
129 if (nearest[bFacei] != -1)
132 label bMeshPatchID =
bMesh.whichPatch(nearest[bFacei]);
134 label
patchID = surfToMeshPatch[bMeshPatchID];
142 bool zoneFlip =
false;
179 int 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;
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;
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;
248 bMesh.readTriSurface(surfName);
258 patchMap[i] = addPatch(
mesh, bPatches[i].
name());
272 if (nearest[bFacei] == -1)
278 Pout<<
"Writing all " << unmatchedFaces.size()
279 <<
" unmatched faces to faceSet " 280 << unmatchedFaces.
name()
283 unmatchedFaces.
write();
294 Info<<
"Read " << faceLabels.size() <<
" faces to repatch ..." <<
endl;
296 for (
const label facei : faceLabels)
298 if (repatchFace(
mesh,
bMesh, nearest, patchMap, facei, meshMod))
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;
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
const Type & value() const noexcept
Return const reference to value.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
Class describing modification of a face.
const word & name() const noexcept
Return the object name.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
constexpr char nl
The newline '\n' character (0x0a)
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 void noParallel()
Remove the parallel options.
A bounding box defined in terms of min/max extrema points.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
label nFaces() const noexcept
Number of mesh faces.
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.
#define forAll(list, i)
Loop across all elements in list.
A list of faces which address into the list of points.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of elements in the list.
virtual const labelList & faceOwner() const
Return face owner.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label nInternalFaces() const noexcept
Number of internal faces.
virtual const faceList & faces() const
Return raw faces.
virtual autoPtr< polyPatch > clone(const labelList &faceCells) const
Construct and return a clone, setting faceCells.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
void removeBoundary()
Remove boundary patches.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const boundBox & bounds() const
Return mesh bounding box.
T get(const label index) const
Get a value from the argument at index.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Direct mesh changes based on v1.3 polyTopoChange syntax.
label whichPatch(const label faceIndex) const
Return patch index for a given mesh face index.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
const boolList & flipMap() const noexcept
Return face flip map.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
A patch is a list of labels that address the faces in the global face list.
void addPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches.
Foam::argList args(argc, argv)
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.
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.