98 void simpleMarkFeatures
102 const scalar featureAngle,
103 const bool concaveMultiCells,
104 const bool doNotPreserveFaceZones,
133 label meshEdgeI = meshEdges[edgeI];
134 featureEdgeSet.
insert(meshEdgeI);
135 singleCellFeaturePointSet.
insert(mesh.
edges()[meshEdgeI][0]);
136 singleCellFeaturePointSet.
insert(mesh.
edges()[meshEdgeI][1]);
165 const labelList& meshPoints = allBoundary.meshPoints();
169 const labelList& eFaces = edgeFaces[edgeI];
171 if (eFaces.
size() > 2)
173 const edge&
e = allBoundary.edges()[edgeI];
180 singleCellFeaturePointSet.
insert(meshPoints[e[0]]);
181 singleCellFeaturePointSet.
insert(meshPoints[e[1]]);
188 const labelList& eFaces = edgeFaces[edgeI];
190 if (eFaces.
size() == 2)
192 label f0 = eFaces[0];
193 label f1 = eFaces[1];
196 const vector& n0 = allBoundary.faceNormals()[f0];
197 const vector& n1 = allBoundary.faceNormals()[f1];
199 if ((n0 & n1) < minCos)
201 const edge& e = allBoundary.edges()[edgeI];
202 label v0 = meshPoints[e[0]];
203 label
v1 = meshPoints[e[1]];
206 featureEdgeSet.
insert(meshEdgeI);
212 allBoundary[f1].centre(allBoundary.points())
213 - allBoundary[f0].centre(allBoundary.points())
216 if (concaveMultiCells && (c1c0 & n0) > SMALL)
219 Info<<
"Detected concave feature edge:" << edgeI
220 <<
" cos:" << (c1c0 & n0)
222 << allBoundary.points()[v0]
223 << allBoundary.points()[
v1]
226 singleCellFeaturePointSet.
erase(v0);
227 multiCellFeaturePointSet.
insert(v0);
228 singleCellFeaturePointSet.
erase(v1);
229 multiCellFeaturePointSet.
insert(v1);
234 if (!multiCellFeaturePointSet.
found(v0))
236 singleCellFeaturePointSet.
insert(v0);
238 if (!multiCellFeaturePointSet.
found(v1))
240 singleCellFeaturePointSet.
insert(v1);
256 featureFaceSet.
insert(faceI);
262 if (doNotPreserveFaceZones)
264 if (faceZones.
size() > 0)
267 <<
"Detected " << faceZones.
size()
268 <<
" faceZones. These will not be preserved."
274 if (faceZones.
size() > 0)
276 Info<<
"Detected " << faceZones.
size()
277 <<
" faceZones. Preserving these by marking their"
278 <<
" points, edges and faces as features." <<
endl;
283 const faceZone& fz = faceZones[zoneI];
285 Info<<
"Inserting all faces in faceZone " << fz.
name()
286 <<
" as features." <<
endl;
294 featureFaceSet.insert(faceI);
299 singleCellFeaturePointSet.
erase(f[fp]);
300 multiCellFeaturePointSet.
insert(f[fp]);
303 featureEdgeSet.
insert(fEdges[fp]);
310 featureFaces = featureFaceSet.toc();
311 featureEdges = featureEdgeSet.
toc();
312 singleCellFeaturePoints = singleCellFeaturePointSet.
toc();
313 multiCellFeaturePoints = multiCellFeaturePointSet.
toc();
323 const labelList& singleCellFeaturePoints,
329 Info<<
"Dumping centres of featureFaces to obj file " << str.name()
338 Info<<
"Dumping featureEdges to obj file " << str.name() <<
endl;
343 const edge& e = mesh.
edges()[featureEdges[i]];
348 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
352 OFstream str(
"singleCellFeaturePoints.obj");
353 Info<<
"Dumping featurePoints that become a single cell to obj file "
354 << str.name() <<
endl;
355 forAll(singleCellFeaturePoints, i)
361 OFstream str(
"multiCellFeaturePoints.obj");
362 Info<<
"Dumping featurePoints that become multiple cells to obj file "
363 << str.name() <<
endl;
364 forAll(multiCellFeaturePoints, i)
372 int main(
int argc,
char *argv[])
402 isBoundaryEdge.
set(fEdges[i], 1);
410 Info<<
"Feature:" << featureAngle <<
endl
411 <<
"minCos :" << minCos <<
endl
418 Info<<
"Splitting all internal faces to create multiple faces"
419 <<
" between two cells." <<
nl
426 "doNotPreserveFaceZones"
429 if (concaveMultiCells)
431 Info<<
"Generating multiple cells for points on concave feature edges."
452 doNotPreserveFaceZones,
456 singleCellFeaturePoints,
457 multiCellFeaturePoints
476 singleCellFeaturePoints,
477 multiCellFeaturePoints
526 dualMaker.setRefinement
531 singleCellFeaturePoints,
532 multiCellFeaturePoints,
543 if (map().hasMotionPoints())
557 Info<<
"Writing dual mesh to " << runTime.timeName() <<
endl;