mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Clean-up after latest Foundation integrations
This commit is contained in:
@ -42,9 +42,18 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile(const IOobject& io)
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
const fileName fName(io.filePath());
|
||||
const fileName fName
|
||||
(
|
||||
isGlobal
|
||||
? io.globalFilePath()
|
||||
: io.localFilePath()
|
||||
);
|
||||
if (fName.empty())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -59,7 +68,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile(const IOobject& io)
|
||||
Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
{
|
||||
fileName fName;
|
||||
@ -79,7 +89,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
|
||||
}
|
||||
else
|
||||
{
|
||||
fName = io.filePath();
|
||||
fName = (isGlobal ? io.globalFilePath() : io.localFilePath());
|
||||
|
||||
if (!exists(fName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -240,7 +251,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface(checkFile(static_cast<const searchableSurface&>(*this))),
|
||||
triSurface(checkFile(static_cast<const searchableSurface&>(*this), true)),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
@ -273,7 +284,10 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface(checkFile(static_cast<const searchableSurface&>(*this), dict)),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), dict, true)
|
||||
),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
@ -307,6 +321,97 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
||||
}
|
||||
|
||||
|
||||
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
|
||||
:
|
||||
// Find instance for triSurfaceMesh
|
||||
searchableSurface(io),
|
||||
// Reused found instance in objectRegistry
|
||||
objectRegistry
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
searchableSurface::instance(),
|
||||
io.local(),
|
||||
io.db(),
|
||||
io.readOpt(),
|
||||
io.writeOpt(),
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), isGlobal)
|
||||
),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
outsideVolType_(volumeType::UNKNOWN)
|
||||
{
|
||||
const pointField& pts = triSurface::points();
|
||||
|
||||
bounds() = boundBox(pts, isGlobal);
|
||||
}
|
||||
|
||||
|
||||
Foam::triSurfaceMesh::triSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
)
|
||||
:
|
||||
searchableSurface(io),
|
||||
// Reused found instance in objectRegistry
|
||||
objectRegistry
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
searchableSurface::instance(),
|
||||
io.local(),
|
||||
io.db(),
|
||||
io.readOpt(),
|
||||
io.writeOpt(),
|
||||
false // searchableSurface already registered under name
|
||||
)
|
||||
),
|
||||
triSurface
|
||||
(
|
||||
checkFile(static_cast<const searchableSurface&>(*this), dict, isGlobal)
|
||||
),
|
||||
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
|
||||
minQuality_(-1),
|
||||
surfaceClosed_(-1),
|
||||
outsideVolType_(volumeType::UNKNOWN)
|
||||
{
|
||||
// Reading from supplied file name instead of objectPath/filePath
|
||||
dict.readIfPresent("file", fName_, false, false);
|
||||
|
||||
scalar scaleFactor = 0;
|
||||
|
||||
// Allow rescaling of the surface points
|
||||
// eg, CAD geometries are often done in millimeters
|
||||
if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
|
||||
{
|
||||
Info<< searchableSurface::name() << " : using scale " << scaleFactor
|
||||
<< endl;
|
||||
triSurface::scalePoints(scaleFactor);
|
||||
}
|
||||
|
||||
const pointField& pts = triSurface::points();
|
||||
|
||||
bounds() = boundBox(pts, isGlobal);
|
||||
|
||||
// Have optional minimum quality for normal calculation
|
||||
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
|
||||
{
|
||||
Info<< searchableSurface::name()
|
||||
<< " : ignoring triangles with quality < "
|
||||
<< minQuality_ << " for normals calculation." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::triSurfaceMesh::~triSurfaceMesh()
|
||||
|
||||
@ -93,10 +93,15 @@ class triSurfaceMesh
|
||||
// Private Member Functions
|
||||
|
||||
//- Return fileName to load IOobject from
|
||||
static fileName checkFile(const IOobject& io);
|
||||
static fileName checkFile(const IOobject& io, const bool isGlobal);
|
||||
|
||||
//- Return fileName to load IOobject from. Optional override of fileName
|
||||
static fileName checkFile(const IOobject&, const dictionary&);
|
||||
static fileName checkFile
|
||||
(
|
||||
const IOobject&,
|
||||
const dictionary&,
|
||||
const bool isGlobal
|
||||
);
|
||||
|
||||
//- Helper function for isSurfaceClosed
|
||||
static bool addFaceToEdge
|
||||
@ -141,7 +146,7 @@ public:
|
||||
//- Construct from triSurface
|
||||
triSurfaceMesh(const IOobject&, const triSurface&);
|
||||
|
||||
//- Construct read.
|
||||
//- Construct read
|
||||
triSurfaceMesh(const IOobject& io);
|
||||
|
||||
//- Construct from IO and dictionary (used by searchableSurface).
|
||||
@ -153,6 +158,19 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Special constructors for use by distributedTriSurface. File search
|
||||
// status (local/global) supplied.
|
||||
|
||||
triSurfaceMesh(const IOobject& io, const bool isGlobal);
|
||||
|
||||
triSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict,
|
||||
const bool isGlobal
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~triSurfaceMesh();
|
||||
|
||||
@ -285,9 +303,30 @@ public:
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
) const;
|
||||
|
||||
//- Is object global
|
||||
virtual bool global() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return complete path + object name if the file exists
|
||||
// either in the case/processor or case otherwise null
|
||||
virtual fileName filePath() const
|
||||
{
|
||||
return searchableSurface::globalFilePath();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//- Template function for obtaining global status
|
||||
template<>
|
||||
inline bool typeGlobal<triSurfaceMesh>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user