65int main(
int argc,
char *argv[])
69 "Refine cells next to specified patches."
76 "The list of patch names or regex - Eg, '(top \"Wall.\")'"
81 "The size of the refined cells as a fraction of the edge-length"
82 " on a (0,1) interval"
89 "Restrict cells to refine based on specified cellSet name"
98 const word oldInstance =
mesh.pointsInstance();
102 const scalar weight =
args.get<scalar>(2);
103 const bool overwrite =
args.found(
"overwrite");
106 if (!patchSet.size())
109 <<
"Cannot find any patches in set " <<
patches <<
endl
110 <<
"Valid patches are " <<
mesh.boundaryMesh().names()
114 label nPatchFaces = 0;
115 label nPatchEdges = 0;
117 for (
const label patchi : patchSet)
119 nPatchFaces +=
mesh.boundaryMesh()[patchi].size();
120 nPatchEdges +=
mesh.boundaryMesh()[patchi].nEdges();
131 for (
const label patchi : patchSet)
136 for (
const label meshPointi : meshPoints)
140 cutCells.insert(pCells);
146 if (
args.readIfPresent(
"useSet", setName))
148 Info<<
"Subsetting cells to cut based on cellSet"
153 Info<<
"Read " <<
cells.size() <<
" cells from cellSet "
158 cutCells.retain(
cells);
160 Info<<
"Removed from cells to cut all the ones not in set "
165 bitSet vertOnPatch(
mesh.nPoints());
167 for (
const label patchi : patchSet)
172 vertOnPatch.set(meshPoints);
175 for (
const label patchi : patchSet)
180 for (
const label meshPointi : meshPoints)
184 for (
const label edgei : pEdges)
188 label otherPointi =
e.otherVertex(meshPointi);
190 if (!vertOnPatch.test(otherPointi))
192 allCutEdges.append(edgei);
194 if (
e.start() == meshPointi)
196 allCutEdgeWeights.append(weight);
200 allCutEdgeWeights.append(1 - weight);
207 allCutEdges.shrink();
208 allCutEdgeWeights.shrink();
211 <<
" cells:" << cutCells.size() <<
nl
212 <<
" edges:" << allCutEdges.size() <<
endl;
216 cutEdgeWeights.
transfer(allCutEdgeWeights);
217 allCutEdgeWeights.clear();
236 cutter.setRefinement(cuts, meshMod);
245 if (morphMap().hasMotionPoints())
247 mesh.movePoints(morphMap().preMotionPoints());
251 cutter.updateMesh(morphMap());
257 mesh.setInstance(oldInstance);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
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.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Description of cuts across cells.
A collection of cell labels.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
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.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)