Go to the documentation of this file.
97 Pout<<
"Created patch " << patchName <<
" at " << patchi <<
endl;
101 Pout<<
"Reusing patch " << patchName <<
" at " << patchi <<
endl;
119 bool changed =
false;
123 if (nearest[bFacei] != -1)
126 label bMeshPatchID =
bMesh.whichPatch(nearest[bFacei]);
128 label
patchID = surfToMeshPatch[bMeshPatchID];
136 bool zoneFlip =
false;
173 int main(
int argc,
char *argv[])
177 "Reads surface and applies surface regioning to a mesh"
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;
242 bMesh.readTriSurface(surfName);
252 patchMap[i] = addPatch(
mesh, bPatches[i].
name());
262 faceSet unmatchedFaces(
mesh,
"unmatchedFaces", nearest.size()/100);
266 if (nearest[bFacei] == -1)
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))
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;
void addPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Add boundary patches.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
label nInternalFaces() const
Number of internal faces.
label nFaces() const
Number of mesh faces.
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Class describing modification of a face.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
virtual const fileName & name() const
Return the name of the stream.
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points)
virtual const labelList & faceOwner() const
Return face owner.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const labelIOList & zoneID
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
label start() const
Return start label of this patch in the polyMesh face list.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
void removeBoundary()
Remove boundary patches.
const boundBox & bounds() const
Return mesh bounding box.
virtual const faceList & faces() const
Return raw faces.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const dimensionedScalar e
Elementary charge.
const polyBoundaryMesh & patches
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....
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.
Foam::argList args(argc, argv)
const boolList & flipMap() const
Return face flip map.
A list of faces which address into the list of points.