83 void simpleMarkFeatures
87 const scalar featureAngle,
88 const bool concaveMultiCells,
89 const bool doNotPreserveFaceZones,
118 label meshEdgeI = meshEdges[edgeI];
119 featureEdgeSet.
insert(meshEdgeI);
120 singleCellFeaturePointSet.
insert(mesh.
edges()[meshEdgeI][0]);
121 singleCellFeaturePointSet.
insert(mesh.
edges()[meshEdgeI][1]);
146 allBoundary.checkPointManifold(
false, &singleCellFeaturePointSet);
150 const labelList& meshPoints = allBoundary.meshPoints();
154 const labelList& eFaces = edgeFaces[edgeI];
156 if (eFaces.
size() > 2)
158 const edge&
e = allBoundary.edges()[edgeI];
165 singleCellFeaturePointSet.
insert(meshPoints[
e[0]]);
166 singleCellFeaturePointSet.
insert(meshPoints[
e[1]]);
173 const labelList& eFaces = edgeFaces[edgeI];
175 if (eFaces.
size() == 2)
177 label f0 = eFaces[0];
178 label f1 = eFaces[1];
181 const vector& n0 = allBoundary.faceNormals()[f0];
182 const vector& n1 = allBoundary.faceNormals()[f1];
184 if ((n0 & n1) < minCos)
186 const edge&
e = allBoundary.edges()[edgeI];
187 label v0 = meshPoints[
e[0]];
188 label v1 = meshPoints[
e[1]];
191 featureEdgeSet.
insert(meshEdgeI);
197 allBoundary[f1].centre(allBoundary.points())
198 - allBoundary[f0].centre(allBoundary.points())
201 if (concaveMultiCells && (c1c0 & n0) > small)
204 Info<<
"Detected concave feature edge:" << edgeI
205 <<
" cos:" << (c1c0 & n0)
207 << allBoundary.points()[v0]
208 << allBoundary.points()[v1]
211 singleCellFeaturePointSet.
erase(v0);
212 multiCellFeaturePointSet.
insert(v0);
213 singleCellFeaturePointSet.
erase(v1);
214 multiCellFeaturePointSet.
insert(v1);
219 if (!multiCellFeaturePointSet.
found(v0))
221 singleCellFeaturePointSet.
insert(v0);
223 if (!multiCellFeaturePointSet.
found(v1))
225 singleCellFeaturePointSet.
insert(v1);
241 featureFaceSet.insert(facei);
247 if (doNotPreserveFaceZones)
249 if (faceZones.
size() > 0)
252 <<
"Detected " << faceZones.
size()
253 <<
" faceZones. These will not be preserved."
259 if (faceZones.
size() > 0)
261 Info<<
"Detected " << faceZones.
size()
262 <<
" faceZones. Preserving these by marking their"
263 <<
" points, edges and faces as features." <<
endl;
268 const faceZone& fz = faceZones[zoneI];
270 Info<<
"Inserting all faces in faceZone " << fz.
name()
271 <<
" as features." <<
endl;
279 featureFaceSet.insert(facei);
284 singleCellFeaturePointSet.
erase(
f[fp]);
285 multiCellFeaturePointSet.
insert(
f[fp]);
288 featureEdgeSet.
insert(fEdges[fp]);
295 featureFaces = featureFaceSet.toc();
296 featureEdges = featureEdgeSet.
toc();
297 singleCellFeaturePoints = singleCellFeaturePointSet.
toc();
298 multiCellFeaturePoints = multiCellFeaturePointSet.
toc();
308 const labelList& singleCellFeaturePoints,
314 Info<<
"Dumping centres of featureFaces to obj file " << str.name()
323 Info<<
"Dumping featureEdges to obj file " << str.name() <<
endl;
328 const edge&
e = mesh.
edges()[featureEdges[i]];
333 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
337 OFstream str(
"singleCellFeaturePoints.obj");
338 Info<<
"Dumping featurePoints that become a single cell to obj file "
339 << str.name() <<
endl;
340 forAll(singleCellFeaturePoints, i)
346 OFstream str(
"multiCellFeaturePoints.obj");
347 Info<<
"Dumping featurePoints that become multiple cells to obj file "
348 << str.name() <<
endl;
349 forAll(multiCellFeaturePoints, i)
357 int main(
int argc,
char *argv[])
366 "have multiple faces in between cells"
371 "split cells on concave boundary edges into multiple cells"
375 "doNotPreserveFaceZones",
376 "disable the default behaviour of preserving faceZones by having"
377 " multiple faces in between cells"
382 "do not update fields"
401 isBoundaryEdge.
set(fEdges[i], 1);
405 const scalar featureAngle =
args.
argRead<scalar>(1);
408 Info<<
"Feature:" << featureAngle <<
endl
409 <<
"minCos :" << minCos <<
endl
416 Info<<
"Splitting all internal faces to create multiple faces"
417 <<
" between two cells." <<
nl
424 "doNotPreserveFaceZones"
427 if (concaveMultiCells)
429 Info<<
"Generating multiple cells for points on concave feature edges."
451 doNotPreserveFaceZones,
455 singleCellFeaturePoints,
456 multiCellFeaturePoints
475 singleCellFeaturePoints,
476 multiCellFeaturePoints
501 dualMaker.setRefinement
506 singleCellFeaturePoints,
507 multiCellFeaturePoints,
518 if (map().hasMotionPoints())
532 Info<<
"Writing dual mesh to " << runTime.name() <<
endl;
Field reading functions for post-processing utilities.
#define forAll(list, i)
Loop across all elements in list.
bool insert(const Key &key)
Insert a new entry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
List< Key > toc() const
Return the table of contents.
bool found(const Key &) const
Return true if hashedEntry is found in table.
List of IOobjects with searching and retrieving facilities.
void size(const label)
Override size to be inconsistent with allocated storage.
void set(const PackedList< 1 > &)
Set specified bits.
A list of faces which address into the list of points.
label nEdges() const
Return number of edges in patch.
label nInternalEdges() const
Number of internal edges.
A List obtained as a section of another List.
label size() const
Return the number of elements in the UPtrList.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
static void noParallel()
Remove the parallel options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Read a value from the argument at index.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
Creates dual of polyMesh. Every point becomes a cell (or multiple cells for feature points),...
Mesh consisting of general polyhedral cells.
const meshFaceZones & faceZones() const
Return face zones.
virtual const faceList & faces() const
Return raw faces.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
const fileName & pointsInstance() const
Return the current instance directory for points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
void setInstance(const fileName &)
Set the instance for mesh files.
virtual void setPoints(const pointField &)
Reset the points.
A patch is a list of labels that address the faces in the global face list.
const labelList & meshEdges() const
Return global edge index for local edges.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
label nInternalFaces() const
const labelListList & faceEdges() const
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for handling words, derived from string.
const word & name() const
Return name.
int main(int argc, char *argv[])
const fvPatchList & patches
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#define WarningInFunction
Report a warning using Foam::Warning.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
dimensionedScalar cos(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Foam::argList args(argc, argv)
Unit conversion functions.