Commit 6e154d84 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: use Enum instead of NamedEnum in fileFormats

parent 0af1e0b7
......@@ -281,22 +281,22 @@ bool Foam::fileFormats::FIREMeshWriter::write(const fileName& meshName) const
if (FIRECore::file3dExtensions.hasEnum(ext))
{
FIRECore::fileExt3d fireFileType = FIRECore::file3dExtensions[ext];
if (fireFileType == FIRECore::POLY_ASCII)
if (fireFileType == FIRECore::fileExt3d::POLY_ASCII)
{
useBinary = false;
useCompress = false;
}
else if (fireFileType == FIRECore::POLY_BINARY)
else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY)
{
useBinary = true;
useCompress = false;
}
else if (fireFileType == FIRECore::POLY_ASCII_COMPRESSED)
else if (fireFileType == FIRECore::fileExt3d::POLY_ASCII_Z)
{
useBinary = false;
useCompress = true;
}
else if (fireFileType == FIRECore::POLY_BINARY_COMPRESSED)
else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY_Z)
{
useBinary = true;
useCompress = true;
......
......@@ -27,26 +27,15 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::coordSet::coordFormat,
5
>::names[] =
const Foam::Enum<Foam::coordSet::coordFormat>
Foam::coordSet::coordFormatNames_
{
"xyz",
"x",
"y",
"z",
"distance"
{ coordFormat::XYZ, "xyz" },
{ coordFormat::X, "x" },
{ coordFormat::Y, "y" },
{ coordFormat::Z, "z" },
{ coordFormat::DISTANCE, "distance" }
};
}
const Foam::NamedEnum<Foam::coordSet::coordFormat, 5>
Foam::coordSet::coordFormatNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......
......@@ -37,6 +37,7 @@ SourceFiles
#include "pointField.H"
#include "word.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -70,7 +71,7 @@ public:
private:
//- String representation of coordFormat enums
static const NamedEnum<coordFormat, 5> coordFormatNames_;
static const Enum<coordFormat> coordFormatNames_;
protected:
......
......@@ -27,24 +27,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NamedEnum<Foam::fileFormats::FIRECore::fileExt3d, 4>
Foam::fileFormats::FIRECore::file3dExtensions;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::FIRECore::fileExt3d,
4
>::names[] =
const Foam::Enum<Foam::fileFormats::FIRECore::fileExt3d>
Foam::fileFormats::FIRECore::file3dExtensions
{
"fpma",
"fpmb",
"fpmaz",
"fpmbz"
{ fileExt3d::POLY_ASCII, "fpma" },
{ fileExt3d::POLY_BINARY, "fpmb" },
{ fileExt3d::POLY_ASCII_Z, "fpmaz" },
{ fileExt3d::POLY_BINARY_Z, "fpmbz" }
};
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......
......@@ -40,7 +40,7 @@ SourceFiles
#include "labelList.H"
#include "pointField.H"
#include "IOstreams.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -86,8 +86,8 @@ public:
{
POLY_ASCII,
POLY_BINARY,
POLY_ASCII_COMPRESSED,
POLY_BINARY_COMPRESSED
POLY_ASCII_Z,
POLY_BINARY_Z
};
......@@ -97,11 +97,12 @@ public:
//- Float type (binary format)
typedef double fireReal_t;
protected:
// Protected Data
static const NamedEnum<fileExt3d, 4> file3dExtensions;
static const Enum<fileExt3d> file3dExtensions;
// Protected Member Functions
......
......@@ -33,40 +33,22 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NamedEnum<Foam::fileFormats::STARCDCore::fileHeader, 3>
Foam::fileFormats::STARCDCore::fileHeaders_;
const Foam::NamedEnum<Foam::fileFormats::STARCDCore::fileExt, 4>
Foam::fileFormats::STARCDCore::fileExtensions_;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::STARCDCore::fileHeader,
3
>::names[] =
const Foam::Enum<Foam::fileFormats::STARCDCore::fileHeader>
Foam::fileFormats::STARCDCore::fileHeaders_
{
"PROSTAR_CELL",
"PROSTAR_VERTEX",
"PROSTAR_BOUNDARY"
{ fileHeader::HEADER_CEL, "PROSTAR_CELL" },
{ fileHeader::HEADER_VRT, "PROSTAR_VERTEX" },
{ fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" }
};
template<>
const char* Foam::NamedEnum
<
Foam::fileFormats::STARCDCore::fileExt,
4
>::names[] =
const Foam::Enum<Foam::fileFormats::STARCDCore::fileExt>
Foam::fileFormats::STARCDCore::fileExtensions_
{
"cel",
"vrt",
"bnd",
"inp"
{ fileExt::CEL_FILE, "cel" },
{ fileExt::VRT_FILE, "vrt" },
{ fileExt::BND_FILE, "bnd" },
{ fileExt::INP_FILE, "inp" }
};
}
const char* const Foam::fileFormats::STARCDCore::defaultBoundaryName =
"Default_Boundary_Region";
......
......@@ -36,7 +36,7 @@ SourceFiles
#define STARCDCore_H
#include "IFstream.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "pointField.H"
#include "Map.H"
#include "FixedList.H"
......@@ -113,8 +113,8 @@ private:
// Private Data
static const NamedEnum<fileHeader, 3> fileHeaders_;
static const NamedEnum<fileExt, 4> fileExtensions_;
static const Enum<fileHeader> fileHeaders_;
static const Enum<fileExt> fileExtensions_;
protected:
......
......@@ -35,49 +35,38 @@ License
namespace Foam
{
defineTypeNameAndDebug(vtkUnstructuredReader, 1);
}
template<>
const char*
NamedEnum<vtkUnstructuredReader::vtkDataType, 8>::names[] =
const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataType>
Foam::vtkUnstructuredReader::vtkDataTypeNames
{
"int",
"unsigned_int",
"long",
"unsigned_long",
"float",
"double",
"string",
"vtkIdType"
{ vtkDataType::VTK_INT, "int" },
{ vtkDataType::VTK_UINT, "unsigned_int" },
{ vtkDataType::VTK_LONG, "long" },
{ vtkDataType::VTK_ULONG, "unsigned_long" },
{ vtkDataType::VTK_FLOAT, "float" },
{ vtkDataType::VTK_DOUBLE, "double" },
{ vtkDataType::VTK_STRING, "string" },
{ vtkDataType::VTK_ID, "vtkIdType" }
};
const NamedEnum<vtkUnstructuredReader::vtkDataType, 8>
vtkUnstructuredReader::vtkDataTypeNames;
template<>
const char*
NamedEnum<vtkUnstructuredReader::vtkDataSetType, 3>::names[] =
const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataSetType>
Foam::vtkUnstructuredReader::vtkDataSetTypeNames
{
"FIELD",
"SCALARS",
"VECTORS"
{ vtkDataSetType::VTK_FIELD, "FIELD" },
{ vtkDataSetType::VTK_SCALARS, "SCALARS" },
{ vtkDataSetType::VTK_VECTORS, "VECTORS" }
};
const NamedEnum<vtkUnstructuredReader::vtkDataSetType, 3>
vtkUnstructuredReader::vtkDataSetTypeNames;
template<>
const char*
NamedEnum<vtkUnstructuredReader::parseMode, 5>::names[] =
const Foam::Enum<Foam::vtkUnstructuredReader::parseMode>
Foam::vtkUnstructuredReader::parseModeNames
{
"NOMODE",
"UNSTRUCTURED_GRID",
"POLYDATA",
"CELL_DATA",
"POINT_DATA"
{ parseMode::NOMODE, "NOMODE" },
{ parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" },
{ parseMode::POLYDATA, "POLYDATA" },
{ parseMode::CELL_DATA, "CELL_DATA" },
{ parseMode::POINT_DATA, "POINT_DATA" }
};
const NamedEnum<vtkUnstructuredReader::parseMode, 5>
vtkUnstructuredReader::parseModeNames;
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......
......@@ -51,7 +51,7 @@ SourceFiles
#include "objectRegistry.H"
#include "cellShapeList.H"
#include "HashSet.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -83,7 +83,7 @@ public:
VTK_ID
};
static const NamedEnum<vtkDataType, 8> vtkDataTypeNames;
static const Enum<vtkDataType> vtkDataTypeNames;
//- Enumeration defining the vtk dataset types
......@@ -94,11 +94,10 @@ public:
VTK_VECTORS
};
static const NamedEnum<vtkDataSetType, 3> vtkDataSetTypeNames;
static const Enum<vtkDataSetType> vtkDataSetTypeNames;
//- Enumeration defining the parse mode - what type of data is being
// read
//- Enumeration defining the parse mode - type of data being read
enum parseMode
{
NOMODE,
......@@ -108,7 +107,7 @@ public:
POINT_DATA
};
static const NamedEnum<parseMode, 5> parseModeNames;
static const Enum<parseMode> parseModeNames;
private:
......
......@@ -222,7 +222,7 @@ void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
// Set the precision of the points data to 10
os.precision(10);
Info<< "points: " << pointLst.size() << endl;
Info<< nl << "points: " << pointLst.size() << endl;
putFireLabel(os, pointLst.size());
newline(os);
......
Supports Markdown
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