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 =
177 Info<< nl <<
"Feature line extraction is only valid on closed manifold " 178 <<
"surfaces." <<
endl;
194 const scalar includedAngle = dict.
lookup<scalar>(
"includedAngle");
210 if (dict.
isDict(
"trimFeatures"))
220 if (minElem > 0 || minLen > 0)
222 Info<<
"Removing features of length < " 224 Info<<
"Removing features with number of edges < " 227 set().trimFeatures(minLen, minElem, includedAngle);
238 if (dict.
isDict(
"subsetFeatures"))
245 if (subsetDict.
found(
"insideBox"))
249 Info<<
"Selecting edges inside bb " << bb;
252 Info <<
" see insideBox.obj";
253 bb.writeOBJ(
"insideBox.obj");
259 else if (subsetDict.
found(
"outsideBox"))
263 Info<<
"Removing all edges inside bb " << bb;
266 Info<<
" see outsideBox.obj" <<
endl;
267 bb.writeOBJ(
"outsideBox.obj");
274 const Switch nonManifoldEdges =
277 if (!nonManifoldEdges)
279 Info<<
"Removing all non-manifold edges" 280 <<
" (edges with > 2 connected faces) unless they" 281 <<
" cross multiple regions" <<
endl;
291 Info<<
"Removing all open edges" 292 <<
" (edges with 1 connected face)" <<
endl;
303 if (subsetDict.
found(
"plane"))
305 const plane cutPlane(subsetDict.
lookup(
"plane")());
309 Info<<
"Only edges that intersect the plane with normal " 311 <<
" and base point " << cutPlane.refPoint()
312 <<
" will be included as feature edges."<<
endl;
318 newSet.setFromStatus(edgeStat, includedAngle);
321 <<
"Initial feature set:" << nl
322 <<
" feature points : " << newSet.featurePoints().size() << nl
323 <<
" feature edges : " << newSet.featureEdges().size() << nl
325 <<
" region edges : " << newSet.nRegionEdges() << nl
326 <<
" external edges : " << newSet.nExternalEdges() << nl
327 <<
" internal edges : " << newSet.nInternalEdges() << nl
339 if (
findIndex(surfBaffleNames, name) != -1)
341 Info<<
"Adding baffle region " << name <<
endl;
342 surfBaffleRegions[pI] =
true;
351 sFeatFileName +
".extendedFeatureEdgeMesh",
356 if (dict.
isDict(
"addFeatures"))
358 const word addFeName = dict.
subDict(
"addFeatures")[
"name"];
359 Info<<
"Adding (without merging) features from " << addFeName
368 "extendedFeatureEdgeMesh",
374 Info<<
"Read " << addFeMesh.name() <<
nl;
375 addFeMesh.writeStats(
Info);
377 feMesh.add(addFeMesh);
382 <<
"Final feature set:" <<
nl;
383 feMesh.writeStats(
Info);
385 Info<< nl <<
"Writing extendedFeatureEdgeMesh to " 386 << feMesh.localObjectPath() <<
endl;
388 mkDir(feMesh.path());
418 Info<< nl <<
"Writing featureEdgeMesh to " 419 << bfeMesh.localObjectPath() <<
endl;
421 bfeMesh.regIOobject::write();
425 if (dict.
isDict(
"closeness"))
427 Info<< nl <<
"Extracting internal and external closeness of " 428 <<
"surface." <<
endl;
432 const Switch faceCloseness =
434 const Switch pointCloseness =
437 const scalar internalAngleTolerance
441 "internalAngleTolerance", 80
445 const scalar externalAngleTolerance
449 "externalAngleTolerance", 80
458 sFeatFileName +
".closeness",
470 searchSurf.extractCloseness
472 internalAngleTolerance,
473 externalAngleTolerance
478 << closenessFields.first()->name() <<
endl;
479 closenessFields.first()->
write();
482 << closenessFields.second()->name() <<
endl;
483 closenessFields.second()->
write();
487 const faceList faces(searchSurf.faces());
492 searchSurf.objectRegistry::name(),
496 closenessFields.first(),
503 searchSurf.objectRegistry::name(),
507 closenessFields.second(),
517 searchSurf.extractPointCloseness
519 internalAngleTolerance,
520 externalAngleTolerance
525 << closenessFields.first()->name() <<
endl;
526 closenessFields.first()->
write();
529 << closenessFields.second()->name() <<
endl;
530 closenessFields.second()->
write();
534 const faceList faces(searchSurf.faces());
535 const Map<label>& meshPointMap = searchSurf.meshPointMap();
538 internalClosenessPointField = closenessFields.
first();
541 externalClosenessPointField = closenessFields.second();
543 scalarField internalCloseness(searchSurf.nPoints(), great);
544 scalarField externalCloseness(searchSurf.nPoints(), great);
548 internalCloseness[
pi] =
549 internalClosenessPointField[meshPointMap[
pi]];
551 externalCloseness[
pi] =
552 externalClosenessPointField[meshPointMap[
pi]];
558 searchSurf.objectRegistry::name(),
561 "internalPointCloseness",
569 searchSurf.objectRegistry::name(),
572 "externalPointCloseness",
583 Info<< nl <<
"Extracting curvature of surface at the points." 590 sFeatFileName +
".curvature",
618 if (featureProximity)
620 Info<< nl <<
"Extracting proximity of close feature points and " 621 <<
"edges to the surface" <<
endl;
623 const scalar searchDistance =
624 dict.
lookup<scalar>(
"maxFeatureProximity");
633 const scalar radiusSqr =
min 641 feMesh.allNearestFeatureEdges(triCentre, radiusSqr, hitList);
642 featureProximity[fi] =
min 644 feMesh.minDisconnectedDist(hitList),
648 feMesh.allNearestFeaturePoints(triCentre, radiusSqr, hitList);
649 featureProximity[fi] =
min 660 sFeatFileName +
".featureProximity",
672 featureProximityField.write();
700 forAll(surfaceFileNames, i)
702 extractFeatures(surfaceFileNames[i], runTime, dict);
710 int main(
int argc,
char *argv[])
714 "extract and write surface features to file" 730 if (dict.
found(
"surfaces"))
743 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.
virtual Ostream & write(const char)=0
Write character.
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.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const labelListList & edgeFaces() const
Return edge-face addressing.
const word dictName("particleTrackDict")
scalar circumRadius() const
Return circum-radius.
An STL-conforming hash table.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
IOstream::streamFormat writeFormat() const
Default write format.
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 with support for writing ASCII or binary.
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...
Holds feature edges/points of surface.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.