50 const Switch& geometricTestOnly
58 Info<< nl <<
"Reading existing feature edges from file " 59 << featureEdgeFile << nl
60 <<
"Selecting edges purely based on geometric tests: " 80 const Switch& geometricTestOnly,
81 const scalar includedAngle
85 <<
"Constructing feature set from included angle " 86 << includedAngle << nl
87 <<
"Selecting edges purely based on geometric tests: " 109 const scalar includedAngle
118 if (dict.
found(
"files"))
122 if (fileNames.found(surfaceFileName))
124 return extractFromFile
126 fileNames[surfaceFileName],
133 return extractFromSurface
143 return extractFromSurface
162 Info<<
"Surface : " << surfaceFileName << nl <<
endl;
173 const Switch featureProximity =
179 Info<< nl <<
"Feature line extraction is only valid on closed manifold " 180 <<
"surfaces." <<
endl;
212 if (dict.
isDict(
"trimFeatures"))
222 if (minElem > 0 || minLen > 0)
224 Info<<
"Removing features of length < " 226 Info<<
"Removing features with number of edges < " 229 set().trimFeatures(minLen, minElem, includedAngle);
240 if (dict.
isDict(
"subsetFeatures"))
247 if (subsetDict.
found(
"insideBox"))
251 Info<<
"Selecting edges inside bb " << bb;
254 Info <<
" see insideBox.obj";
255 bb.writeOBJ(
"insideBox.obj");
261 else if (subsetDict.
found(
"outsideBox"))
265 Info<<
"Removing all edges inside bb " << bb;
268 Info<<
" see outsideBox.obj" <<
endl;
269 bb.writeOBJ(
"outsideBox.obj");
276 const Switch nonManifoldEdges =
279 if (!nonManifoldEdges)
281 Info<<
"Removing all non-manifold edges" 282 <<
" (edges with > 2 connected faces) unless they" 283 <<
" cross multiple regions" <<
endl;
293 Info<<
"Removing all open edges" 294 <<
" (edges with 1 connected face)" <<
endl;
305 if (subsetDict.
found(
"plane"))
307 const plane cutPlane(subsetDict.
lookup(
"plane")());
311 Info<<
"Only edges that intersect the plane with normal " 313 <<
" and base point " << cutPlane.refPoint()
314 <<
" will be included as feature edges."<<
endl;
320 newSet.setFromStatus(edgeStat, includedAngle);
323 <<
"Initial feature set:" << nl
324 <<
" feature points : " << newSet.featurePoints().size() << nl
325 <<
" feature edges : " << newSet.featureEdges().size() << nl
327 <<
" region edges : " << newSet.nRegionEdges() << nl
328 <<
" external edges : " << newSet.nExternalEdges() << nl
329 <<
" internal edges : " << newSet.nInternalEdges() << nl
341 if (
findIndex(surfBaffleNames, name) != -1)
343 Info<<
"Adding baffle region " << name <<
endl;
344 surfBaffleRegions[pI] =
true;
353 sFeatFileName +
".extendedFeatureEdgeMesh",
358 if (dict.
isDict(
"addFeatures"))
360 const word addFeName = dict.
subDict(
"addFeatures")[
"name"];
361 Info<<
"Adding (without merging) features from " << addFeName
370 "extendedFeatureEdgeMesh",
376 Info<<
"Read " << addFeMesh.name() <<
nl;
377 addFeMesh.writeStats(
Info);
379 feMesh.add(addFeMesh);
384 <<
"Final feature set:" <<
nl;
385 feMesh.writeStats(
Info);
387 Info<< nl <<
"Writing extendedFeatureEdgeMesh to " 388 << feMesh.objectPath() <<
endl;
390 mkDir(feMesh.path());
420 Info<< nl <<
"Writing featureEdgeMesh to " 421 << bfeMesh.objectPath() <<
endl;
423 bfeMesh.regIOobject::write();
429 Info<< nl <<
"Extracting internal and external closeness of " 430 <<
"surface." <<
endl;
437 sFeatFileName +
".closeness",
448 searchSurf.extractCloseness()
451 closenessFields.
first()->write();
452 closenessFields.second()->write();
456 const faceList faces(searchSurf.faces());
461 searchSurf.objectRegistry::name(),
465 closenessFields.first(),
473 searchSurf.objectRegistry::name(),
477 closenessFields.second(),
487 searchSurf.extractPointCloseness()
490 closenessFields.
first()->write();
491 closenessFields.second()->write();
495 const faceList faces(searchSurf.faces());
496 const Map<label>& meshPointMap = searchSurf.meshPointMap();
499 internalClosenessPointField = closenessFields.
first();
502 externalClosenessPointField = closenessFields.second();
504 scalarField internalCloseness(searchSurf.nPoints(), great);
505 scalarField externalCloseness(searchSurf.nPoints(), great);
509 internalCloseness[
pi] =
510 internalClosenessPointField[meshPointMap[
pi]];
512 externalCloseness[
pi] =
513 externalClosenessPointField[meshPointMap[
pi]];
519 searchSurf.objectRegistry::name(),
522 "internalPointCloseness",
531 searchSurf.objectRegistry::name(),
534 "externalPointCloseness",
546 Info<< nl <<
"Extracting curvature of surface at the points." 553 sFeatFileName +
".curvature",
582 if (featureProximity)
584 Info<< nl <<
"Extracting proximity of close feature points and " 585 <<
"edges to the surface" <<
endl;
587 const scalar searchDistance =
597 const scalar radiusSqr =
min 605 feMesh.allNearestFeatureEdges(triCentre, radiusSqr, hitList);
606 featureProximity[fi] =
min 608 feMesh.minDisconnectedDist(hitList),
612 feMesh.allNearestFeaturePoints(triCentre, radiusSqr, hitList);
613 featureProximity[fi] =
min 624 sFeatFileName +
".featureProximity",
636 featureProximityField.write();
665 forAll(surfaceFileNames, i)
667 extractFeatures(surfaceFileNames[i], runTime, dict);
675 int main(
int argc,
char *argv[])
679 "extract and write surface features to file" 695 if (dict.
found(
"surfaces"))
708 if (!iter().isDict())
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
A triangle primitive used to calculate face areas and swept volumes.
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 class for handling file names.
A list of keyword definitions, which are a keyword followed by any number of values (e...
void selectCutEdges(const triSurface &surf, const plane &cutPlane, List< surfaceFeatures::edgeStatus > &edgeStat)
Select edges that are intersected by the given plane.
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
tmp< scalarField > curvature() const
Return the curvature of surface at the points.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
static void noParallel()
Remove the parallel options.
void selectBox(const triSurface &surf, const boundBox &bb, const bool removeInside, List< surfaceFeatures::edgeStatus > &edgeStat)
Select edges inside or outside bounding box.
label k
Boltzmann constant.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
fileName constantPath() const
Return constant path.
T & first()
Return the first element of the list.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
scalar minDist(const List< pointIndexHit > &hitList)
bool isDict(const word &) const
Check if entry is a sub-dictionary.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
IOoject and searching on triSurface.
void selectManifoldEdges(const triSurface &surf, const scalar tol, const scalar includedAngle, List< surfaceFeatures::edgeStatus > &edgeStat)
Select manifold edges.
stressControl lookup("compactNormalStress") >> compactNormalStress
An ordered pair of two objects of type <T> with first() and second() elements.
void writeStats(Ostream &) const
Write some statistics.
A class for handling words, derived from string.
const word & constant() const
Return constant name.
word name() const
Return file name (part beyond last /)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const Field< PointType > & points() const
Return reference to global points.
const labelListList & edgeFaces() const
Return edge-face addressing.
const word dictName("particleTrackDict")
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
scalar circumRadius() const
Return circum-radius.
An STL-conforming hash table.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
const Time & time() const
Return time.
Points connected by edges.
const char * asText() const
Return a text representation of the Switch.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
const geometricSurfacePatchList & patches() const
Point circumCentre() const
Return circum-centre.
time_t elapsedClockTime() const
Returns wall-clock time from clock instantiation.
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
A surfaceWriter for VTK legacy format.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
fileName lessExt() const
Return file name without extension (part before last .)
Standard boundBox + extra functionality for use in octree.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
faceList faces() const
Return the list of triangles as a faceList.
const doubleScalar e
Elementary charge.
static void addNote(const string &)
Add extra notes for the usage information.
Triangulated surface description with patch information.
List< fileName > fileNameList
A List of fileNames.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const Type & first() const
Return first.
Holds feature edges/points of surface.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.