mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -102,6 +102,8 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
argList::noCheckProcessorDirectories();
|
||||||
|
|
||||||
#include "addDictOption.H"
|
#include "addDictOption.H"
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Run-time selectable surface feature extraction.
|
Run-time selectable surface feature extraction.
|
||||||
|
|
||||||
|
Selectable as "extractFromFile".
|
||||||
Mandatory dictionary entries: "featureEdgeFile".
|
Mandatory dictionary entries: "featureEdgeFile".
|
||||||
Optional dictionary entries: "geometricTestOnly".
|
Optional dictionary entries: "geometricTestOnly".
|
||||||
|
|
||||||
@ -60,17 +61,13 @@ class extractFromFile
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
extractFromFile(const dictionary& dict);
|
extractFromFile(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~extractFromFile();
|
virtual ~extractFromFile();
|
||||||
|
|
||||||
|
//- Features loaded (extracted) from featureEdgeFile
|
||||||
//- Extracted features from surface
|
|
||||||
virtual autoPtr<surfaceFeatures> features
|
virtual autoPtr<surfaceFeatures> features
|
||||||
(
|
(
|
||||||
const triSurface& surf
|
const triSurface& surf
|
||||||
|
|||||||
@ -52,10 +52,10 @@ Foam::surfaceFeaturesExtraction::extractFromNone::extractFromNone
|
|||||||
:
|
:
|
||||||
method()
|
method()
|
||||||
{
|
{
|
||||||
const dictionary& coeffDict = dict.optionalSubDict("noneCoeffs");
|
// A "noneCoeffs" sub-dictionary doesn't make much sense.
|
||||||
|
|
||||||
coeffDict.readIfPresent("includedAngle", includedAngle_);
|
dict.readIfPresent("includedAngle", includedAngle_);
|
||||||
coeffDict.readIfPresent("geometricTestOnly", geometricTestOnly_);
|
dict.readIfPresent("geometricTestOnly", geometricTestOnly_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +67,6 @@ Foam::surfaceFeaturesExtraction::extractFromNone::~extractFromNone()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::surfaceFeatures>
|
Foam::autoPtr<Foam::surfaceFeatures>
|
||||||
Foam::surfaceFeaturesExtraction::extractFromNone::features
|
Foam::surfaceFeaturesExtraction::extractFromNone::features
|
||||||
(
|
(
|
||||||
|
|||||||
@ -28,6 +28,7 @@ Description
|
|||||||
Run-time selectable surface feature extraction - no extraction.
|
Run-time selectable surface feature extraction - no extraction.
|
||||||
Primarily useful with self-intersection methods.
|
Primarily useful with self-intersection methods.
|
||||||
|
|
||||||
|
Selectable as "none".
|
||||||
Optional dictionary entries: "includedAngle", "geometricTestOnly".
|
Optional dictionary entries: "includedAngle", "geometricTestOnly".
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -58,16 +59,12 @@ class extractFromNone
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
extractFromNone(const dictionary& dict);
|
extractFromNone(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~extractFromNone();
|
virtual ~extractFromNone();
|
||||||
|
|
||||||
|
|
||||||
//- Extracted features from surface (no-op)
|
//- Extracted features from surface (no-op)
|
||||||
virtual autoPtr<surfaceFeatures> features
|
virtual autoPtr<surfaceFeatures> features
|
||||||
(
|
(
|
||||||
|
|||||||
@ -27,6 +27,8 @@ Class
|
|||||||
Description
|
Description
|
||||||
Run-time selectable surface feature extraction - extract from surface.
|
Run-time selectable surface feature extraction - extract from surface.
|
||||||
|
|
||||||
|
Selectable as "extractFromSurface".
|
||||||
|
|
||||||
Mandatory dictionary entries: "includedAngle".
|
Mandatory dictionary entries: "includedAngle".
|
||||||
Optional dictionary entries: "geometricTestOnly".
|
Optional dictionary entries: "geometricTestOnly".
|
||||||
|
|
||||||
@ -57,23 +59,18 @@ class extractFromSurface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
extractFromSurface(const dictionary& dict);
|
extractFromSurface(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~extractFromSurface();
|
virtual ~extractFromSurface();
|
||||||
|
|
||||||
|
//- Features extracted from surface
|
||||||
//- Extracted features from surface
|
|
||||||
virtual autoPtr<surfaceFeatures> features
|
virtual autoPtr<surfaceFeatures> features
|
||||||
(
|
(
|
||||||
const triSurface& surf
|
const triSurface& surf
|
||||||
) const override;
|
) const override;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -70,22 +70,20 @@ Foam::surfaceFeaturesExtraction::method::New
|
|||||||
{
|
{
|
||||||
const word methodName = dict.lookup("extractionMethod");
|
const word methodName = dict.lookup("extractionMethod");
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodName);
|
||||||
dictionaryConstructorTablePtr_->find(methodName);
|
|
||||||
|
|
||||||
if (!cstrIter.found())
|
if (!cstrIter.found())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction
|
||||||
(
|
(
|
||||||
dict
|
dict
|
||||||
) << "Unknown extractionMethod "
|
) << "Unknown extractionMethod " << methodName << nl << nl
|
||||||
<< methodName << nl << nl
|
<< "Valid extraction methods:" << nl
|
||||||
<< "Valid extraction methods: :" << nl
|
|
||||||
<< flatOutput(dictionaryConstructorTablePtr_->sortedToc())
|
<< flatOutput(dictionaryConstructorTablePtr_->sortedToc())
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<method>(cstrIter()(dict));
|
return autoPtr<method>(cstrIter.object()(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,11 +21,17 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
Foam::surfaceFeaturesExtraction
|
||||||
|
|
||||||
|
Description
|
||||||
|
Namespace for run-time selectable surface feature extraction methods.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::surfaceFeaturesExtraction::method
|
Foam::surfaceFeaturesExtraction::method
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Run-time selectable surface feature extraction methods.
|
Abstract base for run-time selectable surface feature extraction methods.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfaceFeaturesExtraction.C
|
surfaceFeaturesExtraction.C
|
||||||
@ -123,7 +129,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace surfaceFeaturesExtraction
|
} // End namespace surfaceFeaturesExtraction
|
||||||
|
|||||||
@ -31,6 +31,153 @@ Description
|
|||||||
Extracts and writes surface features to file. All but the basic feature
|
Extracts and writes surface features to file. All but the basic feature
|
||||||
extraction is a work-in-progress.
|
extraction is a work-in-progress.
|
||||||
|
|
||||||
|
The extraction process is driven by the \a system/surfaceFeatureExtractDict
|
||||||
|
dictionary, but the \a -dict option can be used to define an alternative
|
||||||
|
location.
|
||||||
|
|
||||||
|
The \a system/surfaceFeatureExtractDict dictionary contains entries
|
||||||
|
for each extraction process.
|
||||||
|
The name of the individual dictionary is used to load the input surface
|
||||||
|
(found under \a constant/triSurface) and also as the basename for the
|
||||||
|
output.
|
||||||
|
|
||||||
|
If the \c surfaces entry is present in a sub-dictionary, it has absolute
|
||||||
|
precedence over a surface name deduced from the dictionary name.
|
||||||
|
If the dictionary name itself does not have an extension, the \c surfaces
|
||||||
|
entry becomes mandatory since in this case the dictionary name cannot
|
||||||
|
represent an input surface file (ie, there is no file extension).
|
||||||
|
The \c surfaces entry is a wordRe list, which allows loading and
|
||||||
|
combining of multiple surfaces. Any exactly specified surface names must
|
||||||
|
exist, but surfaces selected via regular expressions need not exist.
|
||||||
|
The selection mechanism preserves order and is without duplicates.
|
||||||
|
For example,
|
||||||
|
\verbatim
|
||||||
|
dictName
|
||||||
|
{
|
||||||
|
surfaces (surface1.stl "other.*" othersurf.obj);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
When loading surfaces, the points/faces/regions of each surface are
|
||||||
|
normally offset to create an aggregated surface. No merging of points
|
||||||
|
or faces is done. The optional entry \c loadingOption can be used to
|
||||||
|
adjust the treatment of the regions when loading single or multiple files,
|
||||||
|
with selections according to the Foam::triSurfaceLoader::loadingOption
|
||||||
|
enumeration.
|
||||||
|
\verbatim
|
||||||
|
dictName
|
||||||
|
{
|
||||||
|
// Optional treatment of surface regions when loading
|
||||||
|
// (single, file, offset, merge)
|
||||||
|
loadingOption file;
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
The \c loadingOption is primarily used in combination with the
|
||||||
|
\c intersectionMethod (specifically its \c region option).
|
||||||
|
The default \c loadingOption is normally \c offset,
|
||||||
|
but this changes to \c file if the \c intersectionMethod
|
||||||
|
\c region is being used.
|
||||||
|
|
||||||
|
Once surfaces have been loaded, the first stage is to extract
|
||||||
|
features according to the specified \c extractionMethod with values
|
||||||
|
as per the following table:
|
||||||
|
\table
|
||||||
|
extractionMethod | Description
|
||||||
|
none | No feature extraction
|
||||||
|
extractFromFile | Load features from the file named in featureEdgeFile
|
||||||
|
extractFromSurface | Extract features from surface geometry
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
There are a few entries that influence the extraction behaviour:
|
||||||
|
\verbatim
|
||||||
|
// File to use for extractFromFile input
|
||||||
|
featureEdgeFile "FileName"
|
||||||
|
|
||||||
|
// Mark edges whose adjacent surface normals are at an angle less
|
||||||
|
// than includedAngle as features
|
||||||
|
// - 0 : selects no edges
|
||||||
|
// - 180: selects all edges
|
||||||
|
includedAngle 120;
|
||||||
|
|
||||||
|
// Do not mark region edges
|
||||||
|
geometricTestOnly yes;
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
This initial set of edges can be trimmed:
|
||||||
|
\verbatim
|
||||||
|
trimFeatures
|
||||||
|
{
|
||||||
|
// Remove features with fewer than the specified number of edges
|
||||||
|
minElem 0;
|
||||||
|
|
||||||
|
// Remove features shorter than the specified cumulative length
|
||||||
|
minLen 0.0;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
and subsetted
|
||||||
|
\verbatim
|
||||||
|
subsetFeatures
|
||||||
|
{
|
||||||
|
// Use a plane to select feature edges (normal)(basePoint)
|
||||||
|
// Only keep edges that intersect the plane
|
||||||
|
plane (1 0 0)(0 0 0);
|
||||||
|
|
||||||
|
// Select feature edges using a box // (minPt)(maxPt)
|
||||||
|
// Only keep edges inside the box:
|
||||||
|
insideBox (0 0 0)(1 1 1);
|
||||||
|
|
||||||
|
// Only keep edges outside the box:
|
||||||
|
outsideBox (0 0 0)(1 1 1);
|
||||||
|
|
||||||
|
// Keep nonManifold edges (edges with >2 connected faces where
|
||||||
|
// the faces form more than two different normal planes)
|
||||||
|
nonManifoldEdges yes;
|
||||||
|
|
||||||
|
// Keep open edges (edges with 1 connected face)
|
||||||
|
openEdges yes;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Subsequently, additional features can be added from another file:
|
||||||
|
\verbatim
|
||||||
|
addFeatures
|
||||||
|
{
|
||||||
|
// Add (without merging) another extendedFeatureEdgeMesh
|
||||||
|
name axZ.extendedFeatureEdgeMesh;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
The intersectionMethod provides a final means of adding additional
|
||||||
|
features. These are loosely termed "self-intersection", since it
|
||||||
|
detects the face/face intersections of the loaded surface or surfaces.
|
||||||
|
|
||||||
|
\table
|
||||||
|
intersectionMethod | Description
|
||||||
|
none | Do nothing
|
||||||
|
self | All face/face intersections
|
||||||
|
region | Limit face/face intersections to those between different regions.
|
||||||
|
\endtable
|
||||||
|
The optional \c tolerance tuning parameter is available for handling
|
||||||
|
the face/face intersections, but should normally not be touched.
|
||||||
|
|
||||||
|
As well as the normal extendedFeatureEdgeMesh written,
|
||||||
|
other items can be selected with boolean switches:
|
||||||
|
|
||||||
|
\table
|
||||||
|
Output option | Description
|
||||||
|
closeness | Output the closeness of surface elements to other surface elements.
|
||||||
|
curvature | Output surface curvature
|
||||||
|
featureProximity | Output the proximity of feature points and edges to another
|
||||||
|
writeObj | Write features to OBJ format for postprocessing
|
||||||
|
writeVTK | Write closeness/curvature/proximity fields as VTK for postprocessing
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Although surfaceFeatureExtract can do many things, there are still a fair
|
||||||
|
number of corner cases where it may not produce the desired result.
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
@ -60,16 +207,26 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
"extract and write surface features to file"
|
"Extract and write surface features to file"
|
||||||
);
|
);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::noFunctionObjects();
|
argList::noFunctionObjects();
|
||||||
|
|
||||||
#include "addDictOption.H"
|
argList::addOption
|
||||||
|
(
|
||||||
|
"dict",
|
||||||
|
"file",
|
||||||
|
"read surfaceFeatureExtractDict from specified location"
|
||||||
|
);
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< "Note: "
|
||||||
|
<< "Feature line extraction only valid on closed manifold surfaces"
|
||||||
|
<< nl << nl;
|
||||||
|
|
||||||
const word dictName("surfaceFeatureExtractDict");
|
const word dictName("surfaceFeatureExtractDict");
|
||||||
#include "setSystemRunTimeDictionaryIO.H"
|
#include "setSystemRunTimeDictionaryIO.H"
|
||||||
|
|
||||||
@ -82,44 +239,58 @@ int main(int argc, char *argv[])
|
|||||||
// Where to write VTK output files
|
// Where to write VTK output files
|
||||||
const fileName vtkOutputDir = runTime.constantPath()/"triSurface";
|
const fileName vtkOutputDir = runTime.constantPath()/"triSurface";
|
||||||
|
|
||||||
forAllConstIter(dictionary, dict, iter)
|
forAllConstIters(dict, iter)
|
||||||
{
|
{
|
||||||
const word& dictName = iter().keyword();
|
if (!iter().isDict() || iter().keyword().isPattern())
|
||||||
|
|
||||||
if (!iter().isDict())
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dictionary& surfaceDict = iter().dict();
|
const dictionary& surfaceDict = iter().dict();
|
||||||
|
|
||||||
if (!surfaceDict.found("extractionMethod"))
|
if (!surfaceDict.found("extractionMethod"))
|
||||||
{
|
{
|
||||||
|
// Insist on an extractionMethod
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The output name based in dictionary name (without extensions)
|
||||||
|
const word& dictName = iter().keyword();
|
||||||
|
const word outputName = dictName.lessExt();
|
||||||
|
|
||||||
autoPtr<surfaceFeaturesExtraction::method> extractor =
|
autoPtr<surfaceFeaturesExtraction::method> extractor =
|
||||||
surfaceFeaturesExtraction::method::New
|
surfaceFeaturesExtraction::method::New
|
||||||
(
|
(
|
||||||
surfaceDict
|
surfaceDict
|
||||||
);
|
);
|
||||||
|
|
||||||
// The output name, cleansed of extensions
|
// We don't needs the intersectionMethod yet, but can use it
|
||||||
// Optional "output" entry, or the dictionary name.
|
// for setting a reasonable loading option
|
||||||
const word outputName =
|
const surfaceIntersection::intersectionType selfIntersect =
|
||||||
fileName
|
surfaceIntersection::selfIntersectionNames.lookupOrDefault
|
||||||
(
|
(
|
||||||
surfaceDict.lookupOrDefault<word>("output", dictName)
|
"intersectionMethod",
|
||||||
).lessExt();
|
surfaceDict,
|
||||||
|
surfaceIntersection::NONE
|
||||||
|
);
|
||||||
|
|
||||||
// The "surfaces" entry is normally optional, but if the sub-dictionary
|
const Switch writeObj = surfaceDict.lookupOrDefault<Switch>
|
||||||
// is itself called "surfaces", then this becomes mandatory.
|
|
||||||
// This provides a simple means of handling both situations without an
|
|
||||||
// additional switch.
|
|
||||||
if
|
|
||||||
(
|
(
|
||||||
dictName == "surfaces" // mandatory
|
"writeObj",
|
||||||
|| surfaceDict.found("surfaces") // or optional
|
Switch::OFF
|
||||||
)
|
);
|
||||||
|
const Switch writeVTK = surfaceDict.lookupOrDefault<Switch>
|
||||||
|
(
|
||||||
|
"writeVTK",
|
||||||
|
Switch::OFF
|
||||||
|
);
|
||||||
|
|
||||||
|
// The "surfaces" entry is normally optional, but make it mandatory
|
||||||
|
// if the dictionary name doesn't have an extension
|
||||||
|
// (ie, probably not a surface filename at all).
|
||||||
|
// If it is missing, this will fail nicely with an appropriate error
|
||||||
|
// message.
|
||||||
|
if (surfaceDict.found("surfaces") || !dictName.hasExt())
|
||||||
{
|
{
|
||||||
loader.select(wordReList(surfaceDict.lookup("surfaces")));
|
loader.select(wordReList(surfaceDict.lookup("surfaces")));
|
||||||
}
|
}
|
||||||
@ -128,20 +299,20 @@ int main(int argc, char *argv[])
|
|||||||
loader.select(dictName);
|
loader.select(dictName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DebugVar(loader.available());
|
||||||
|
// DebugVar(outputName);
|
||||||
|
|
||||||
if (loader.selected().empty())
|
if (loader.selected().empty())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "No surfaces specified/found for entry: "
|
<< "No surfaces specified/found for entry: "
|
||||||
<< dictName << exit(FatalError);
|
<< dictName << exit(FatalError);
|
||||||
}
|
}
|
||||||
// DebugVar(loader.available());
|
|
||||||
// DebugVar(outputName);
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "Surfaces : ";
|
Info<< "Surfaces : ";
|
||||||
if (loader.selected().size() == 1)
|
if (loader.selected().size() == 1)
|
||||||
{
|
{
|
||||||
Info<< loader.selected()[0] << nl;
|
Info<< loader.selected().first() << nl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,18 +320,24 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Info<< "Output : " << outputName << nl;
|
Info<< "Output : " << outputName << nl;
|
||||||
|
|
||||||
|
// Loading option - default depends on context
|
||||||
triSurfaceLoader::loadingOption loadingOption =
|
triSurfaceLoader::loadingOption loadingOption =
|
||||||
triSurfaceLoader::loadingOptionNames.lookupOrDefault
|
triSurfaceLoader::loadingOptionNames.lookupOrDefault
|
||||||
(
|
(
|
||||||
"loadingOption",
|
"loadingOption",
|
||||||
surfaceDict,
|
surfaceDict,
|
||||||
triSurfaceLoader::loadingOption::OFFSET_REGION
|
(
|
||||||
|
selfIntersect == surfaceIntersection::SELF_REGION
|
||||||
|
? triSurfaceLoader::FILE_REGION
|
||||||
|
: triSurfaceLoader::OFFSET_REGION
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<<"loading with "
|
Info<<"Load options : "
|
||||||
<< triSurfaceLoader::loadingOptionNames[loadingOption]
|
<< triSurfaceLoader::loadingOptionNames[loadingOption] << nl
|
||||||
<< endl;
|
<< "Write options:"
|
||||||
|
<< " writeObj=" << writeObj
|
||||||
|
<< " writeVTK=" << writeVTK << nl;
|
||||||
|
|
||||||
// Load a single file, or load and combine multiple selected files
|
// Load a single file, or load and combine multiple selected files
|
||||||
autoPtr<triSurface> surfPtr = loader.load(loadingOption);
|
autoPtr<triSurface> surfPtr = loader.load(loadingOption);
|
||||||
@ -173,25 +350,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
triSurface surf = surfPtr();
|
triSurface surf = surfPtr();
|
||||||
|
|
||||||
const Switch writeVTK = surfaceDict.lookupOrDefault<Switch>
|
Info<< "NB: Feature line extraction is only valid on closed manifold "
|
||||||
(
|
|
||||||
"writeVTK",
|
|
||||||
Switch::OFF
|
|
||||||
);
|
|
||||||
const Switch writeObj = surfaceDict.lookupOrDefault<Switch>
|
|
||||||
(
|
|
||||||
"writeObj",
|
|
||||||
Switch::OFF
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "write VTK: " << writeVTK << nl;
|
|
||||||
|
|
||||||
Info<< "Feature line extraction is only valid on closed manifold "
|
|
||||||
<< "surfaces." << nl;
|
<< "surfaces." << nl;
|
||||||
|
|
||||||
Info<< nl << "Statistics:" << nl;
|
Info<< nl
|
||||||
|
<< "Statistics:" << nl;
|
||||||
surf.writeStats(Info);
|
surf.writeStats(Info);
|
||||||
Info<< nl;
|
|
||||||
|
|
||||||
// Need a copy as plain faces if outputting VTK format
|
// Need a copy as plain faces if outputting VTK format
|
||||||
faceList faces;
|
faceList faces;
|
||||||
@ -403,14 +567,6 @@ int main(int argc, char *argv[])
|
|||||||
feMesh.add(addFeMesh);
|
feMesh.add(addFeMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
const surfaceIntersection::intersectionType selfIntersect =
|
|
||||||
surfaceIntersection::selfIntersectionNames.lookupOrDefault
|
|
||||||
(
|
|
||||||
"intersectionMethod",
|
|
||||||
surfaceDict,
|
|
||||||
surfaceIntersection::NONE
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selfIntersect != surfaceIntersection::NONE)
|
if (selfIntersect != surfaceIntersection::NONE)
|
||||||
{
|
{
|
||||||
triSurfaceSearch query(surf);
|
triSurfaceSearch query(surf);
|
||||||
@ -461,7 +617,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
feMesh.write();
|
feMesh.write();
|
||||||
|
|
||||||
// Write a featureEdgeMesh for backwards compatibility
|
// Write a featureEdgeMesh (.eMesh) for backwards compatibility
|
||||||
|
// Used by snappyHexMesh (JUN-2017)
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
featureEdgeMesh bfeMesh
|
featureEdgeMesh bfeMesh
|
||||||
|
|||||||
@ -16,7 +16,7 @@ FoamFile
|
|||||||
|
|
||||||
surface1.stl
|
surface1.stl
|
||||||
{
|
{
|
||||||
// How to obtain raw features (none | extractFromFile | extractFromSurface)
|
// Extract raw features (none | extractFromFile | extractFromSurface)
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
// Mark edges whose adjacent surface normals are at an angle less
|
// Mark edges whose adjacent surface normals are at an angle less
|
||||||
@ -28,37 +28,48 @@ surface1.stl
|
|||||||
// Do not mark region edges
|
// Do not mark region edges
|
||||||
geometricTestOnly yes;
|
geometricTestOnly yes;
|
||||||
|
|
||||||
/* alternative specification as coeff dictionary
|
|
||||||
extractFromSurfaceCoeffs
|
|
||||||
{
|
|
||||||
includedAngle 120;
|
|
||||||
|
|
||||||
geometricTestOnly yes;
|
|
||||||
} */
|
|
||||||
|
|
||||||
// Generate additional intersection features (none | self | region)
|
// Generate additional intersection features (none | self | region)
|
||||||
intersectionMethod none;
|
intersectionMethod none;
|
||||||
|
|
||||||
// Tolerance for surface intersections
|
// Tolerance for surface intersections
|
||||||
tolerance 1e-3;
|
// tolerance 1e-3;
|
||||||
|
|
||||||
// Write options
|
// Output options:
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
// Write features to obj format for postprocessing
|
||||||
writeObj yes;
|
writeObj yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Self intersection (single or multiple surfaces).
|
||||||
|
// - Use 'surfaces' entry (a wordRe list) if it exists.
|
||||||
|
// - If the dictionary name does not have an extension, 'surfaces' is mandatory.
|
||||||
|
outputName1
|
||||||
|
{
|
||||||
|
extractionMethod none;
|
||||||
|
|
||||||
|
surfaces (surface1.stl surface2.nas);
|
||||||
|
|
||||||
|
// Generate additional intersection features (none | self | region)
|
||||||
|
intersectionMethod self;
|
||||||
|
|
||||||
|
// Tolerance for surface intersections
|
||||||
|
// tolerance 1e-3;
|
||||||
|
|
||||||
|
// Output options:
|
||||||
|
|
||||||
|
// Write features to OBJ format for postprocessing
|
||||||
|
writeObj yes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
surface2.nas
|
surface2.nas
|
||||||
{
|
{
|
||||||
// How to obtain raw features (none | extractFromFile | extractFromSurface)
|
// Extract raw features (none | extractFromFile | extractFromSurface)
|
||||||
extractionMethod extractFromFile;
|
extractionMethod extractFromFile;
|
||||||
|
|
||||||
extractFromFileCoeffs
|
|
||||||
{
|
|
||||||
// Load from an existing feature edge file
|
// Load from an existing feature edge file
|
||||||
featureEdgeFile "constant/triSurface/featureEdges.nas";
|
featureEdgeFile "constant/triSurface/featureEdges.nas";
|
||||||
}
|
|
||||||
|
|
||||||
trimFeatures
|
trimFeatures
|
||||||
{
|
{
|
||||||
@ -71,16 +82,15 @@ surface2.nas
|
|||||||
|
|
||||||
subsetFeatures
|
subsetFeatures
|
||||||
{
|
{
|
||||||
// Use a plane to select feature edges
|
// Use a plane to select feature edges (normal)(basePoint)
|
||||||
// (normal)(basePoint)
|
// Only keep edges that intersect the plane
|
||||||
// Keep only edges that intersect the plane will be included
|
|
||||||
plane (1 0 0)(0 0 0);
|
plane (1 0 0)(0 0 0);
|
||||||
|
|
||||||
// Select feature edges using a box
|
// Select feature edges using a box // (minPt)(maxPt)
|
||||||
// (minPt)(maxPt)
|
// Only keep edges inside the box:
|
||||||
// Keep edges inside the box:
|
|
||||||
insideBox (0 0 0)(1 1 1);
|
insideBox (0 0 0)(1 1 1);
|
||||||
// Keep edges outside the box:
|
|
||||||
|
// Only keep edges outside the box:
|
||||||
outsideBox (0 0 0)(1 1 1);
|
outsideBox (0 0 0)(1 1 1);
|
||||||
|
|
||||||
// Keep nonManifold edges (edges with >2 connected faces where
|
// Keep nonManifold edges (edges with >2 connected faces where
|
||||||
@ -95,110 +105,35 @@ surface2.nas
|
|||||||
{
|
{
|
||||||
// Add (without merging) another extendedFeatureEdgeMesh
|
// Add (without merging) another extendedFeatureEdgeMesh
|
||||||
name axZ.extendedFeatureEdgeMesh;
|
name axZ.extendedFeatureEdgeMesh;
|
||||||
|
|
||||||
// Optionally flip features (invert all normals, making
|
|
||||||
// convex<->concave etc)
|
|
||||||
//flip false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output the curvature of the surface
|
|
||||||
curvature no;
|
|
||||||
|
|
||||||
// Output the proximity of feature points and edges to each other
|
|
||||||
featureProximity no;
|
|
||||||
|
|
||||||
// The maximum search distance to use when looking for other feature
|
|
||||||
// points and edges
|
|
||||||
maxFeatureProximity 1;
|
|
||||||
|
|
||||||
// Out put the closeness of surface elements to other surface elements.
|
|
||||||
closeness no;
|
|
||||||
|
|
||||||
// Generate additional intersection features (none | self | region)
|
// Generate additional intersection features (none | self | region)
|
||||||
intersectionMethod none;
|
intersectionMethod none;
|
||||||
|
|
||||||
// Tolerance for surface intersections
|
// Tolerance for surface intersections
|
||||||
tolerance 1e-3;
|
// tolerance 1e-3;
|
||||||
|
|
||||||
// Write options
|
// Output options:
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
// Output the closeness of surface elements to other surface elements.
|
||||||
writeObj yes;
|
closeness no;
|
||||||
|
|
||||||
// Write surface proximity and curvature fields to vtk format
|
// Output surface curvature
|
||||||
// for postprocessing
|
curvature no;
|
||||||
|
|
||||||
|
// Output the proximity of feature points and edges to another
|
||||||
|
featureProximity no;
|
||||||
|
|
||||||
|
// The maximum search distance when checking feature proximity
|
||||||
|
maxFeatureProximity 1;
|
||||||
|
|
||||||
|
// Write features to OBJ format for postprocessing
|
||||||
|
writeObj no;
|
||||||
|
|
||||||
|
// Write closeness/curvature/proximity fields as VTK for postprocessing
|
||||||
writeVTK no;
|
writeVTK no;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle single or multiple surfaces
|
|
||||||
//
|
|
||||||
// - If the dictionary is named 'surfaces', it must also contain a 'surfaces'
|
|
||||||
// entry (wordRe list).
|
|
||||||
//
|
|
||||||
// - If other dictionaries contain a 'surfaces' entry,
|
|
||||||
// it will be taken for the input.
|
|
||||||
//
|
|
||||||
dummyName
|
|
||||||
{
|
|
||||||
extractionMethod extractFromSurface;
|
|
||||||
|
|
||||||
surfaces (surface1.stl surface2.nas);
|
|
||||||
|
|
||||||
// Base output name (optional)
|
|
||||||
// output surfaces;
|
|
||||||
|
|
||||||
// Generate additional intersection features (none | self | region)
|
|
||||||
intersectionMethod self;
|
|
||||||
|
|
||||||
// Tolerance for surface intersections
|
|
||||||
tolerance 1e-3;
|
|
||||||
|
|
||||||
includedAngle 120;
|
|
||||||
|
|
||||||
// Do not mark region edges
|
|
||||||
geometricTestOnly yes;
|
|
||||||
|
|
||||||
// Write options
|
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
|
||||||
writeObj yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Handle single or multiple surfaces
|
|
||||||
//
|
|
||||||
// - If the dictionary is named 'surfaces', it must also contain a 'surfaces'
|
|
||||||
// entry (wordRe list).
|
|
||||||
//
|
|
||||||
// - If other dictionaries contain a 'surfaces' entry,
|
|
||||||
// it will be taken for the input.
|
|
||||||
//
|
|
||||||
surfaces
|
|
||||||
{
|
|
||||||
extractionMethod none;
|
|
||||||
|
|
||||||
surfaces (surface1.stl surface2.nas);
|
|
||||||
|
|
||||||
// Base output name (optional)
|
|
||||||
// output surfaces;
|
|
||||||
|
|
||||||
// Generate additional intersection features (none | self | region)
|
|
||||||
intersectionMethod self;
|
|
||||||
|
|
||||||
// Tolerance for surface intersections
|
|
||||||
tolerance 1e-3;
|
|
||||||
|
|
||||||
/* alternative specification as coeff dictionary
|
|
||||||
noneCoeffs
|
|
||||||
{
|
|
||||||
includedAngle 0;
|
|
||||||
} */
|
|
||||||
|
|
||||||
// Write options
|
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
|
||||||
writeObj yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -43,6 +43,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::argList::bannerEnabled_ = true;
|
bool Foam::argList::bannerEnabled_ = true;
|
||||||
|
bool Foam::argList::checkProcessorDirectories_ = true;
|
||||||
Foam::SLList<Foam::string> Foam::argList::validArgs;
|
Foam::SLList<Foam::string> Foam::argList::validArgs;
|
||||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||||
@ -194,6 +195,12 @@ void Foam::argList::noParallel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::argList::noCheckProcessorDirectories()
|
||||||
|
{
|
||||||
|
checkProcessorDirectories_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::argList::printOptionUsage
|
void Foam::argList::printOptionUsage
|
||||||
(
|
(
|
||||||
const label location,
|
const label location,
|
||||||
@ -759,7 +766,7 @@ void Foam::argList::parse
|
|||||||
// - normal running : nProcs = dictNProcs = nProcDirs
|
// - normal running : nProcs = dictNProcs = nProcDirs
|
||||||
// - decomposition to more processors : nProcs = dictNProcs
|
// - decomposition to more processors : nProcs = dictNProcs
|
||||||
// - decomposition to fewer processors : nProcs = nProcDirs
|
// - decomposition to fewer processors : nProcs = nProcDirs
|
||||||
if (dictNProcs > Pstream::nProcs())
|
if (checkProcessorDirectories_ && dictNProcs > Pstream::nProcs())
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< source
|
<< source
|
||||||
@ -814,7 +821,11 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
// Possibly going to fewer processors.
|
// Possibly going to fewer processors.
|
||||||
// Check if all procDirs are there.
|
// Check if all procDirs are there.
|
||||||
if (dictNProcs < Pstream::nProcs())
|
if
|
||||||
|
(
|
||||||
|
checkProcessorDirectories_
|
||||||
|
&& dictNProcs < Pstream::nProcs()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
label nProcDirs = 0;
|
label nProcDirs = 0;
|
||||||
while
|
while
|
||||||
@ -1337,9 +1348,11 @@ bool Foam::argList::checkRootCase() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master() && !isDir(path()))
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Allow slaves on non-existing processor directories, created later
|
if (Pstream::master() && (checkProcessorDirectories_ && !isDir(path())))
|
||||||
|
{
|
||||||
|
// Allow slaves on non-existing processor directories created later
|
||||||
FatalError
|
FatalError
|
||||||
<< executable_
|
<< executable_
|
||||||
<< ": cannot open case directory " << path()
|
<< ": cannot open case directory " << path()
|
||||||
@ -1347,6 +1360,19 @@ bool Foam::argList::checkRootCase() const
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!isDir(path()))
|
||||||
|
{
|
||||||
|
FatalError
|
||||||
|
<< executable_
|
||||||
|
<< ": cannot open case directory " << path()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,6 +119,9 @@ class argList
|
|||||||
//- Track enabled/disabled banner state
|
//- Track enabled/disabled banner state
|
||||||
static bool bannerEnabled_;
|
static bool bannerEnabled_;
|
||||||
|
|
||||||
|
//- Track enabled/disabled checking of processor directories state
|
||||||
|
static bool checkProcessorDirectories_;
|
||||||
|
|
||||||
//- Switch on/off parallel mode. Has to be first to be constructed
|
//- Switch on/off parallel mode. Has to be first to be constructed
|
||||||
// so destructor is done last.
|
// so destructor is done last.
|
||||||
ParRunControl parRunControl_;
|
ParRunControl parRunControl_;
|
||||||
@ -387,6 +390,9 @@ public:
|
|||||||
//- Remove the parallel options
|
//- Remove the parallel options
|
||||||
static void noParallel();
|
static void noParallel();
|
||||||
|
|
||||||
|
//- Remove checking of processor directories
|
||||||
|
static void noCheckProcessorDirectories();
|
||||||
|
|
||||||
//- Return true if the post-processing option is specified
|
//- Return true if the post-processing option is specified
|
||||||
static bool postProcess(int argc, char *argv[]);
|
static bool postProcess(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|||||||
@ -83,6 +83,7 @@ Foam::functionObjects::volRegion::volRegion
|
|||||||
? regionTypeNames_.read(dict.lookup("regionType"))
|
? regionTypeNames_.read(dict.lookup("regionType"))
|
||||||
: vrtAll
|
: vrtAll
|
||||||
),
|
),
|
||||||
|
regionName_(polyMesh::defaultRegion),
|
||||||
regionID_(-1)
|
regionID_(-1)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|||||||
@ -217,12 +217,17 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
word outName = fieldName + '_' + regionTypeNames_[regionType_];
|
||||||
|
if (this->volRegion::regionName_ != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
outName = outName + '-' + this->volRegion::regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
IOField<Type>
|
IOField<Type>
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName + '_' + regionTypeNames_[regionType_]
|
outName,
|
||||||
+ '-' + volRegion::regionName_,
|
|
||||||
obr_.time().timeName(),
|
obr_.time().timeName(),
|
||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -241,13 +246,17 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
|
|||||||
file()<< tab << result;
|
file()<< tab << result;
|
||||||
|
|
||||||
Log << " " << operationTypeNames_[operation_]
|
Log << " " << operationTypeNames_[operation_]
|
||||||
<< "(" << volRegion::regionName_ << ") of " << fieldName
|
<< "(" << this->volRegion::regionName_ << ") of " << fieldName
|
||||||
<< " = " << result << endl;
|
<< " = " << result << endl;
|
||||||
|
|
||||||
// Write state/results information
|
// Write state/results information
|
||||||
const word& opName = operationTypeNames_[operation_];
|
const word& opName = operationTypeNames_[operation_];
|
||||||
word resultName =
|
word outName = fieldName;
|
||||||
opName + '(' + volRegion::regionName_ + ',' + fieldName + ')';
|
if (this->volRegion::regionName_ != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
outName = this->volRegion::regionName_ + ',' + outName;
|
||||||
|
}
|
||||||
|
word resultName = opName + '(' + outName + ')';
|
||||||
this->setResult(resultName, result);
|
this->setResult(resultName, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ void Foam::meshTools::writeOBJ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os << 'l';
|
os << 'f';
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
os << ' ' << foamToObj[f[fp]]+1;
|
os << ' ' << foamToObj[f[fp]]+1;
|
||||||
|
|||||||
@ -92,6 +92,28 @@ Foam::scalar Foam::noiseModel::checkUniformTimeStep
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::noiseModel::validateBounds(const scalarList& p) const
|
||||||
|
{
|
||||||
|
forAll(p, i)
|
||||||
|
{
|
||||||
|
if ((p[i] < minPressure_) || (p[i] > maxPressure_))
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Pressure data at position " << i
|
||||||
|
<< " is outside of permitted bounds:" << nl
|
||||||
|
<< " pressure: " << p[i] << nl
|
||||||
|
<< " minimum pressure: " << minPressure_ << nl
|
||||||
|
<< " maximum pressure: " << maxPressure_ << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::noiseModel::findStartTimeIndex
|
Foam::label Foam::noiseModel::findStartTimeIndex
|
||||||
(
|
(
|
||||||
const instantList& allTimes,
|
const instantList& allTimes,
|
||||||
@ -141,6 +163,8 @@ Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
|
|||||||
startTime_(0),
|
startTime_(0),
|
||||||
windowModelPtr_(),
|
windowModelPtr_(),
|
||||||
graphFormat_("raw"),
|
graphFormat_("raw"),
|
||||||
|
minPressure_(-0.5*VGREAT),
|
||||||
|
maxPressure_(0.5*VGREAT),
|
||||||
outputPrefix_(),
|
outputPrefix_(),
|
||||||
writePrmsf_(true),
|
writePrmsf_(true),
|
||||||
writeSPL_(true),
|
writeSPL_(true),
|
||||||
@ -178,6 +202,8 @@ bool Foam::noiseModel::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
dict.readIfPresent("startTime", startTime_);
|
dict.readIfPresent("startTime", startTime_);
|
||||||
dict.readIfPresent("graphFormat", graphFormat_);
|
dict.readIfPresent("graphFormat", graphFormat_);
|
||||||
|
dict.readIfPresent("minPressure", minPressure_);
|
||||||
|
dict.readIfPresent("maxPressure", maxPressure_);
|
||||||
dict.readIfPresent("outputPrefix", outputPrefix_);
|
dict.readIfPresent("outputPrefix", outputPrefix_);
|
||||||
|
|
||||||
// Check number of samples - must be a power of 2 for our FFT
|
// Check number of samples - must be a power of 2 for our FFT
|
||||||
@ -225,6 +251,8 @@ bool Foam::noiseModel::read(const dictionary& dict)
|
|||||||
|
|
||||||
windowModelPtr_ = windowModel::New(dict, nSamples_);
|
windowModelPtr_ = windowModel::New(dict, nSamples_);
|
||||||
|
|
||||||
|
Info<< nl << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ protected:
|
|||||||
//- Upper frequency limit, default = 10kHz
|
//- Upper frequency limit, default = 10kHz
|
||||||
scalar fUpper_;
|
scalar fUpper_;
|
||||||
|
|
||||||
//- Flag to indicate that custom frequenct bounds are being used
|
//- Flag to indicate that custom frequency bounds are being used
|
||||||
bool customBounds_;
|
bool customBounds_;
|
||||||
|
|
||||||
//- Start time, default = 0s
|
//- Start time, default = 0s
|
||||||
@ -139,6 +139,15 @@ protected:
|
|||||||
word graphFormat_;
|
word graphFormat_;
|
||||||
|
|
||||||
|
|
||||||
|
// Data validation
|
||||||
|
|
||||||
|
//- Min pressure value
|
||||||
|
scalar minPressure_;
|
||||||
|
|
||||||
|
//- Min pressure value
|
||||||
|
scalar maxPressure_;
|
||||||
|
|
||||||
|
|
||||||
// Write options
|
// Write options
|
||||||
|
|
||||||
//- Output file prefix, default = ''
|
//- Output file prefix, default = ''
|
||||||
@ -176,6 +185,9 @@ protected:
|
|||||||
const scalarList& times
|
const scalarList& times
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return true if all pressure data is within min/max bounds
|
||||||
|
bool validateBounds(const scalarList& p) const;
|
||||||
|
|
||||||
//- Find and return start time index
|
//- Find and return start time index
|
||||||
label findStartTimeIndex
|
label findStartTimeIndex
|
||||||
(
|
(
|
||||||
|
|||||||
@ -84,8 +84,16 @@ void pointNoise::processData
|
|||||||
Info<< " read " << t.size() << " values" << nl << endl;
|
Info<< " read " << t.size() << " values" << nl << endl;
|
||||||
|
|
||||||
Info<< "Creating noise FFT" << endl;
|
Info<< "Creating noise FFT" << endl;
|
||||||
|
|
||||||
const scalar deltaT = checkUniformTimeStep(t);
|
const scalar deltaT = checkUniformTimeStep(t);
|
||||||
|
|
||||||
|
if (!validateBounds(p))
|
||||||
|
{
|
||||||
|
Info<< "No noise data generated" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Determine the windowing
|
// Determine the windowing
|
||||||
windowModelPtr_->validate(t.size());
|
windowModelPtr_->validate(t.size());
|
||||||
const windowModel& win = windowModelPtr_();
|
const windowModel& win = windowModelPtr_();
|
||||||
|
|||||||
Reference in New Issue
Block a user