Skip to content
Snippets Groups Projects
Commit 8060792b authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: provide canRead, canWrite tests for triSurface

- for symmetry with MeshedSurface etc.
parent 7d3eb76f
Branches
Tags
No related merge requests found
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment