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"
92 argList::noFunctionObjects();
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);
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 "
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);
264 topoSet::removeFiles(
mesh);
265 processorMeshes::removeFiles(
mesh);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void transfer(List< T > &list)
const labelList & meshPoints() const
Return labelList of mesh points in patch.
T get(const label index) const
Get a value from the argument at index.
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
List< T > getList(const label index) const
Get a List of values from the argument at index.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Description of cuts across cells.
A collection of cell labels.
An edge is a list of two point labels. The functionality it provides supports the discretisation 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.
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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)