65 int 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" 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 114 label nPatchFaces = 0;
115 label nPatchEdges = 0;
117 for (
const label patchi : patchSet)
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" 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())
251 cutter.updateMesh(morphMap());
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelListList & pointEdges() const
labelHashSet patchSet(const UList< wordRe > &select, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
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.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
List< T > getList(const label index) const
Get a List of values from the argument at index.
Description of cuts across cells.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
const dimensionedScalar e
Elementary charge.
const fileName & pointsInstance() const
Return the current instance directory for points.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
wordList names() const
Return a list of patch names.
label size() const noexcept
The number of entries in the list.
A List of wordRe with additional matching capabilities.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
const labelListList & pointCells() const
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
T get(const label index) const
Get a value from the argument at index.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A collection of cell labels.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyBoundaryMesh & patches
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
Foam::argList args(argc, argv)
bool found(const word &optName) const
Return true if the named option is found.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())