Go to the documentation of this file.
81 void simpleMarkFeatures
85 const scalar featureAngle,
86 const bool concaveMultiCells,
87 const bool doNotPreserveFaceZones,
116 label meshEdgeI = meshEdges[edgeI];
117 featureEdgeSet.
insert(meshEdgeI);
144 allBoundary.checkPointManifold(
false, &singleCellFeaturePointSet);
148 const labelList& meshPoints = allBoundary.meshPoints();
152 const labelList& eFaces = edgeFaces[edgeI];
154 if (eFaces.
size() > 2)
156 const edge&
e = allBoundary.edges()[edgeI];
163 singleCellFeaturePointSet.
insert(meshPoints[
e[0]]);
164 singleCellFeaturePointSet.
insert(meshPoints[
e[1]]);
171 const labelList& eFaces = edgeFaces[edgeI];
173 if (eFaces.
size() == 2)
175 label f0 = eFaces[0];
179 const vector& n0 = allBoundary.faceNormals()[f0];
180 const vector& n1 = allBoundary.faceNormals()[
f1];
182 if ((n0 & n1) < minCos)
184 const edge&
e = allBoundary.edges()[edgeI];
185 label v0 = meshPoints[
e[0]];
186 label v1 = meshPoints[
e[1]];
189 featureEdgeSet.
insert(meshEdgeI);
195 allBoundary[
f1].centre(allBoundary.points())
196 - allBoundary[f0].centre(allBoundary.points())
199 if (concaveMultiCells && (c1c0 & n0) > SMALL)
202 Info<<
"Detected concave feature edge:" << edgeI
203 <<
" cos:" << (c1c0 & n0)
205 << allBoundary.points()[v0]
206 << allBoundary.points()[v1]
209 singleCellFeaturePointSet.
erase(v0);
210 multiCellFeaturePointSet.
insert(v0);
211 singleCellFeaturePointSet.
erase(v1);
212 multiCellFeaturePointSet.
insert(v1);
217 if (!multiCellFeaturePointSet.
found(v0))
219 singleCellFeaturePointSet.
insert(v0);
221 if (!multiCellFeaturePointSet.
found(v1))
223 singleCellFeaturePointSet.
insert(v1);
239 featureFaceSet.insert(faceI);
245 if (doNotPreserveFaceZones)
247 if (faceZones.size() > 0)
250 <<
"Detected " << faceZones.size()
251 <<
" faceZones. These will not be preserved."
257 if (faceZones.size() > 0)
259 Info<<
"Detected " << faceZones.size()
260 <<
" faceZones. Preserving these by marking their"
261 <<
" points, edges and faces as features." <<
endl;
266 const faceZone& fz = faceZones[zoneI];
268 Info<<
"Inserting all faces in faceZone " << fz.
name()
269 <<
" as features." <<
endl;
277 featureFaceSet.insert(faceI);
282 singleCellFeaturePointSet.
erase(
f[fp]);
283 multiCellFeaturePointSet.
insert(
f[fp]);
286 featureEdgeSet.
insert(fEdges[fp]);
293 featureFaces = featureFaceSet.toc();
294 featureEdges = featureEdgeSet.
toc();
295 singleCellFeaturePoints = singleCellFeaturePointSet.
toc();
296 multiCellFeaturePoints = multiCellFeaturePointSet.
toc();
306 const labelList& singleCellFeaturePoints,
312 Info<<
"Dumping centres of featureFaces to obj file " << str.name()
321 Info<<
"Dumping featureEdges to obj file " << str.name() <<
endl;
331 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
335 OFstream str(
"singleCellFeaturePoints.obj");
336 Info<<
"Dumping featurePoints that become a single cell to obj file "
337 << str.name() <<
endl;
338 forAll(singleCellFeaturePoints, i)
344 OFstream str(
"multiCellFeaturePoints.obj");
345 Info<<
"Dumping featurePoints that become multiple cells to obj file "
346 << str.name() <<
endl;
347 forAll(multiCellFeaturePoints, i)
355 int main(
int argc,
char *argv[])
364 "have multiple faces inbetween cells"
369 "split cells on concave boundary edges into multiple cells"
373 "doNotPreserveFaceZones",
374 "disable the default behaviour of preserving faceZones by having"
375 " multiple faces inbetween cells"
394 isBoundaryEdge.
set(fEdges[i], 1);
398 const scalar featureAngle =
args.
argRead<scalar>(1);
401 Info<<
"Feature:" << featureAngle <<
endl
402 <<
"minCos :" << minCos <<
endl
409 Info<<
"Splitting all internal faces to create multiple faces"
410 <<
" between two cells." <<
nl
417 "doNotPreserveFaceZones"
420 if (concaveMultiCells)
422 Info<<
"Generating multiple cells for points on concave feature edges."
443 doNotPreserveFaceZones,
447 singleCellFeaturePoints,
448 multiCellFeaturePoints
467 singleCellFeaturePoints,
468 multiCellFeaturePoints
517 dualMaker.setRefinement
522 singleCellFeaturePoints,
523 multiCellFeaturePoints,
534 if (map().hasMotionPoints())
548 Info<<
"Writing dual mesh to " << runTime.timeName() <<
endl;
static SLList< string > validArgs
A list of valid (mandatory) arguments.
virtual const pointField & points() const
Return raw points.
A class for handling words, derived from string.
List< Key > toc() const
Return the table of contents.
#define forAll(list, i)
Loop across all elements in list.
A List obtained as a section of another List.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, const bool syncPar=true, const bool readOldTime=false)
Helper routine to read Geometric fields.
void set(const PackedList< 1 > &)
Set specified bits.
label nEdges() const
Return number of edges in patch.
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Unit conversion functions.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const
Return face zone mesh.
virtual bool write() const
Write mesh using IO settings from time.
const fileName & pointsInstance() const
Return the current instance directory for points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A subset of mesh faces organised as a primitive patch.
A patch is a list of labels that address the faces in the global face list.
const labelListList & faceEdges() const
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
int main(int argc, char *argv[])
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label nInternalFaces() const
bool found(const Key &) const
Return true if hashedEntry is found in table.
const word & name() const
Return name.
const double e
Elementary charge.
List of IOobjects with searching and retrieving facilities.
label nInternalEdges() const
Number of internal edges.
void setInstance(const fileName &)
Set the instance for mesh files.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual const faceList & faces() const
Return raw faces.
Helper routine to read fields.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const vectorField & faceCentres() const
label size() const
Return the number of elements in the PtrList.
bool insert(const Key &key)
Insert a new entry.
bool optionFound(const word &opt) const
Return true if the named option is found.
T argRead(const label index) const
Read a value from the argument at index.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
static void noParallel()
Remove the parallel options.
const labelList & meshEdges() const
Return global edge index for local edges.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
Creates dual of polyMesh. Every point becomes a cell (or multiple cells for feature points),...
A list of faces which address into the list of points.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)