mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: upgrade from NamedEnum to Enum (issue #515)
This commit is contained in:
@ -69,18 +69,12 @@ enum ExtrudeMode
|
||||
SURFACE
|
||||
};
|
||||
|
||||
namespace Foam
|
||||
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<ExtrudeMode, 3>::names[] =
|
||||
{
|
||||
"mesh",
|
||||
"patch",
|
||||
"surface"
|
||||
};
|
||||
}
|
||||
|
||||
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
|
||||
{ ExtrudeMode::MESH, "mesh" },
|
||||
{ ExtrudeMode::PATCH, "patch" },
|
||||
{ ExtrudeMode::SURFACE, "surface" },
|
||||
};
|
||||
|
||||
|
||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
@ -305,9 +299,10 @@ int main(int argc, char *argv[])
|
||||
const Switch flipNormals(dict.lookup("flipNormals"));
|
||||
|
||||
// What to extrude
|
||||
const ExtrudeMode mode = ExtrudeModeNames.read
|
||||
const ExtrudeMode mode = ExtrudeModeNames.lookup
|
||||
(
|
||||
dict.lookup("constructFrom")
|
||||
"constructFrom",
|
||||
dict
|
||||
);
|
||||
|
||||
// Any merging of small edges
|
||||
|
||||
@ -60,17 +60,11 @@ enum ExtrudeMode
|
||||
MESHEDSURFACE
|
||||
};
|
||||
|
||||
namespace Foam
|
||||
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<ExtrudeMode, 2>::names[] =
|
||||
{
|
||||
"polyMesh2D",
|
||||
"MeshedSurface"
|
||||
};
|
||||
}
|
||||
|
||||
static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
|
||||
{ ExtrudeMode::POLYMESH2D, "polyMesh2D" },
|
||||
{ ExtrudeMode::MESHEDSURFACE, "MeshedSurface" },
|
||||
};
|
||||
|
||||
|
||||
//pointField moveInitialPoints
|
||||
|
||||
@ -42,24 +42,20 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
conformalVoronoiMesh::dualMeshPointType,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"internal",
|
||||
"surface",
|
||||
"featureEdge",
|
||||
"featurePoint",
|
||||
"constrained"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::conformalVoronoiMesh::dualMeshPointType, 5>
|
||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_;
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::conformalVoronoiMesh::dualMeshPointType
|
||||
>
|
||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_
|
||||
{
|
||||
{ dualMeshPointType::internal, "internal" },
|
||||
{ dualMeshPointType::surface, "surface" },
|
||||
{ dualMeshPointType::featureEdge, "featureEdge" },
|
||||
{ dualMeshPointType::featurePoint, "featurePoint" },
|
||||
{ dualMeshPointType::constrained, "constrained" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
constrained = 4
|
||||
};
|
||||
|
||||
static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_;
|
||||
static const Enum<dualMeshPointType> dualMeshPointTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -27,20 +27,19 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedCellEnum::cellTypes
|
||||
>
|
||||
Foam::indexedCellEnum::cellTypesNames_
|
||||
{
|
||||
"Unassigned",
|
||||
"Internal",
|
||||
"Surface",
|
||||
"FeatureEdge",
|
||||
"FeaturePoint",
|
||||
"Far"
|
||||
{ cellTypes::ctUnassigned, "Unassigned" },
|
||||
{ cellTypes::ctFar, "Far" },
|
||||
{ cellTypes::ctInternal, "Internal" },
|
||||
{ cellTypes::ctSurface, "Surface" },
|
||||
{ cellTypes::ctFeatureEdge, "FeatureEdge" },
|
||||
{ cellTypes::ctFeaturePoint,"FeaturePoint" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>
|
||||
cellTypesNames_;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -34,7 +34,7 @@ SourceFiles
|
||||
#ifndef indexedCellEnum_H
|
||||
#define indexedCellEnum_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,7 +47,6 @@ class indexedCellEnum
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
enum cellTypes
|
||||
{
|
||||
ctUnassigned = INT_MIN,
|
||||
@ -58,7 +57,7 @@ public:
|
||||
ctFeaturePoint = INT_MIN + 5
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<cellTypes, 6> cellTypesNames_;
|
||||
static const Enum<cellTypes> cellTypesNames_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -28,42 +28,42 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedVertexEnum::vertexType
|
||||
>
|
||||
Foam::indexedVertexEnum::vertexTypeNames_
|
||||
{
|
||||
"Unassigned",
|
||||
"Internal",
|
||||
"InternalNearBoundary",
|
||||
"InternalSurface",
|
||||
"InternalSurfaceBaffle",
|
||||
"ExternalSurfaceBaffle",
|
||||
"InternalFeatureEdge",
|
||||
"InternalFeatureEdgeBaffle",
|
||||
"ExternalFeatureEdgeBaffle",
|
||||
"InternalFeaturePoint",
|
||||
"ExternalSurface",
|
||||
"ExternalFeatureEdge",
|
||||
"ExternalFeaturePoint",
|
||||
"Far",
|
||||
"Constrained"
|
||||
{ vertexType::vtUnassigned, "Unassigned" },
|
||||
{ vertexType::vtInternal, "Internal" },
|
||||
{ vertexType::vtInternalNearBoundary, "InternalNearBoundary" },
|
||||
{ vertexType::vtInternalSurface, "InternalSurface" },
|
||||
{ vertexType::vtInternalSurfaceBaffle, "InternalSurfaceBaffle" },
|
||||
{ vertexType::vtExternalSurfaceBaffle, "ExternalSurfaceBaffle" },
|
||||
{ vertexType::vtInternalFeatureEdge, "InternalFeatureEdge" },
|
||||
{ vertexType::vtInternalFeatureEdgeBaffle, "InternalFeatureEdgeBaffle" },
|
||||
{ vertexType::vtExternalFeatureEdgeBaffle, "ExternalFeatureEdgeBaffle" },
|
||||
{ vertexType::vtInternalFeaturePoint, "InternalFeaturePoint" },
|
||||
{ vertexType::vtExternalSurface, "ExternalSurface" },
|
||||
{ vertexType::vtExternalFeatureEdge, "ExternalFeatureEdge" },
|
||||
{ vertexType::vtExternalFeaturePoint, "ExternalFeaturePoint" },
|
||||
{ vertexType::vtFar, "Far" },
|
||||
{ vertexType::vtConstrained, "Constrained" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>
|
||||
Foam::indexedVertexEnum::vertexTypeNames_;
|
||||
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedVertexEnum::vertexMotion
|
||||
>
|
||||
Foam::indexedVertexEnum::vertexMotionNames_
|
||||
{
|
||||
"fixed",
|
||||
"movable"
|
||||
{ vertexMotion::fixed, "fixed" },
|
||||
{ vertexMotion::movable, "movable" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>
|
||||
vertexMotionNames_;
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
|
||||
@ -34,7 +34,7 @@ SourceFiles
|
||||
#ifndef indexedVertexEnum_H
|
||||
#define indexedVertexEnum_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,9 +72,9 @@ public:
|
||||
movable = 1
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<vertexType, 15> vertexTypeNames_;
|
||||
static const Enum<vertexType> vertexTypeNames_;
|
||||
|
||||
static const Foam::NamedEnum<vertexMotion, 2> vertexMotionNames_;
|
||||
static const Enum<vertexMotion> vertexMotionNames_;
|
||||
|
||||
friend Ostream& operator<<(Foam::Ostream&, const vertexType&);
|
||||
|
||||
|
||||
@ -848,7 +848,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
meshRefinement::readFlags
|
||||
(
|
||||
meshRefinement::IOdebugTypeNames,
|
||||
meshRefinement::debugTypeNames,
|
||||
flags
|
||||
)
|
||||
);
|
||||
@ -873,7 +873,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
meshRefinement::readFlags
|
||||
(
|
||||
meshRefinement::IOwriteTypeNames,
|
||||
meshRefinement::writeTypeNames,
|
||||
flags
|
||||
)
|
||||
)
|
||||
@ -892,7 +892,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
meshRefinement::readFlags
|
||||
(
|
||||
meshRefinement::IOoutputTypeNames,
|
||||
meshRefinement::outputTypeNames,
|
||||
flags
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user