mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide canRead, canWrite tests for triSurface
- for symmetry with MeshedSurface etc.
This commit is contained in:
@ -32,6 +32,7 @@ License
|
||||
#include "SortableList.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "surfZoneList.H"
|
||||
#include "surfaceFormatsCore.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -41,6 +42,69 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// Note that these lists are a stop-gap measure until the read/write handling
|
||||
// gets properly updated
|
||||
const Foam::wordHashSet Foam::triSurface::readTypes_
|
||||
{
|
||||
"ftr", "stl", "stlb", "gts", "obj", "off", "tri", "ac", "nas", "vtk"
|
||||
};
|
||||
|
||||
|
||||
const Foam::wordHashSet Foam::triSurface::writeTypes_
|
||||
{
|
||||
"ftr", "stl", "stlb", "gts", "obj", "off", "tri", "ac", "smesh", "vtk"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::triSurface::canReadType(const word& ext, const bool verbose)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::checkSupport
|
||||
(
|
||||
readTypes(),
|
||||
ext,
|
||||
verbose,
|
||||
"reading"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::triSurface::canWriteType(const word& ext, const bool verbose)
|
||||
{
|
||||
return fileFormats::surfaceFormatsCore::checkSupport
|
||||
(
|
||||
writeTypes(),
|
||||
ext,
|
||||
verbose,
|
||||
"writing"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::triSurface::canRead(const fileName& name, const bool verbose)
|
||||
{
|
||||
word ext = name.ext();
|
||||
if (ext == "gz")
|
||||
{
|
||||
ext = name.lessExt().ext();
|
||||
}
|
||||
return canReadType(ext, verbose);
|
||||
}
|
||||
|
||||
|
||||
const Foam::wordHashSet& Foam::triSurface::readTypes()
|
||||
{
|
||||
return readTypes_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::wordHashSet& Foam::triSurface::writeTypes()
|
||||
{
|
||||
return writeTypes_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
|
||||
|
||||
@ -90,6 +90,9 @@ class triSurface
|
||||
// during reading and writing)
|
||||
geometricSurfacePatchList patches_;
|
||||
|
||||
static const wordHashSet readTypes_;
|
||||
static const wordHashSet writeTypes_;
|
||||
|
||||
|
||||
// Demand driven private data.
|
||||
|
||||
@ -240,6 +243,18 @@ public:
|
||||
//- Name of triSurface directory to use.
|
||||
static fileName triSurfInstance(const Time&);
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canRead(const fileName& name, const bool verbose=false);
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canReadType(const word& ext, const bool verbose=false);
|
||||
|
||||
//- Can we write this file format?
|
||||
static bool canWriteType(const word& ext, const bool verbose=false);
|
||||
|
||||
static const wordHashSet& readTypes();
|
||||
static const wordHashSet& writeTypes();
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user