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:
@ -47,46 +47,27 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByType
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByTypeNames
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::fieldVisualisationBase::colourByType,
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"colour",
|
||||
"field"
|
||||
};
|
||||
{ colourByType::cbColour, "colour" },
|
||||
{ colourByType::cbField, "field" },
|
||||
};
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::fieldVisualisationBase::colourMapType,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"rainbow",
|
||||
"blueWhiteRed",
|
||||
"fire",
|
||||
"greyscale"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByType,
|
||||
2
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourByTypeNames;
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapType,
|
||||
4
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames;
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapType
|
||||
>
|
||||
Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames
|
||||
{
|
||||
{ colourMapType::cmRainbow, "rainbow" },
|
||||
{ colourMapType::cmBlueWhiteRed, "blueWhiteRed" },
|
||||
{ colourMapType::cmFire, "fire" },
|
||||
{ colourMapType::cmGreyscale, "greyscale" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -508,7 +489,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||
colourMap_(cmRainbow),
|
||||
range_()
|
||||
{
|
||||
colourBy_ = colourByTypeNames.read(dict.lookup("colourBy"));
|
||||
colourBy_ = colourByTypeNames.lookup("colourBy", dict);
|
||||
|
||||
switch (colourBy_)
|
||||
{
|
||||
@ -523,7 +504,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
||||
|
||||
if (dict.found("colourMap"))
|
||||
{
|
||||
colourMap_ = colourMapTypeNames.read(dict.lookup("colourMap"));
|
||||
colourMap_ = colourMapTypeNames.lookup("colourMap", dict);
|
||||
}
|
||||
|
||||
const dictionary& sbarDict = dict.subDict("scalarBar");
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "Tuple2.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
#include "vector.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "Function1.H"
|
||||
@ -78,7 +78,7 @@ public:
|
||||
cbField
|
||||
};
|
||||
|
||||
static const NamedEnum<colourByType, 2> colourByTypeNames;
|
||||
static const Enum<colourByType> colourByTypeNames;
|
||||
|
||||
enum colourMapType
|
||||
{
|
||||
@ -88,7 +88,7 @@ public:
|
||||
cmGreyscale
|
||||
};
|
||||
|
||||
static const NamedEnum<colourMapType, 4> colourMapTypeNames;
|
||||
static const Enum<colourMapType> colourMapTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -32,27 +32,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::runTimePostPro::geometryBase::renderModeType,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"flat",
|
||||
"gouraud",
|
||||
"phong"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::runTimePostPro::geometryBase::renderModeType,
|
||||
3
|
||||
Foam::functionObjects::runTimePostPro::geometryBase::renderModeType
|
||||
>
|
||||
Foam::functionObjects::runTimePostPro::geometryBase::renderModeTypeNames;
|
||||
Foam::functionObjects::runTimePostPro::geometryBase::renderModeTypeNames
|
||||
{
|
||||
{ renderModeType::rmFlat, "flat" },
|
||||
{ renderModeType::rmGouraud, "gouraud" },
|
||||
{ renderModeType::rmPhong, "phong" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -104,7 +93,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
||||
{
|
||||
if (dict.found("renderMode"))
|
||||
{
|
||||
renderMode_ = renderModeTypeNames.read(dict.lookup("renderMode"));
|
||||
renderMode_ = renderModeTypeNames.lookup("renderMode", dict);
|
||||
}
|
||||
|
||||
if (dict.found("opacity"))
|
||||
|
||||
@ -39,7 +39,7 @@ SourceFiles
|
||||
#include "vector.H"
|
||||
#include "Function1.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
rmPhong //!< Phong shading
|
||||
};
|
||||
|
||||
static const NamedEnum<renderModeType, 3> renderModeTypeNames;
|
||||
static const Enum<renderModeType> renderModeTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -48,27 +48,19 @@ namespace runTimePostPro
|
||||
defineRunTimeSelectionTable(pathline, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::runTimePostPro::pathline::representationType,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
"line",
|
||||
"tube",
|
||||
"vector"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::runTimePostPro::pathline::representationType,
|
||||
4
|
||||
Foam::functionObjects::runTimePostPro::pathline::representationType
|
||||
>
|
||||
Foam::functionObjects::runTimePostPro::pathline::representationTypeNames;
|
||||
Foam::functionObjects::runTimePostPro::pathline::representationTypeNames
|
||||
{
|
||||
{ representationType::rtNone, "none" },
|
||||
{ representationType::rtLine, "line" },
|
||||
{ representationType::rtTube, "tube" },
|
||||
{ representationType::rtVector, "vector" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -137,7 +129,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
||||
geometryBase(parent, dict, colours),
|
||||
representation_
|
||||
(
|
||||
representationTypeNames.read(dict.lookup("representation"))
|
||||
representationTypeNames.lookup("representation", dict)
|
||||
),
|
||||
tubeRadius_(0.0),
|
||||
lineColour_(nullptr)
|
||||
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#define functionObjects_runTimePostPro_pathline_H
|
||||
|
||||
#include "geometryBase.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -71,7 +71,7 @@ public:
|
||||
rtVector
|
||||
};
|
||||
|
||||
static const NamedEnum<representationType, 4> representationTypeNames;
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -48,24 +48,17 @@ namespace runTimePostPro
|
||||
defineRunTimeSelectionTable(pointData, dictionary);
|
||||
}
|
||||
}
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::runTimePostPro::pointData::representationType,
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"sphere",
|
||||
"vector"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::runTimePostPro::pointData::representationType,
|
||||
2
|
||||
Foam::functionObjects::runTimePostPro::pointData::representationType
|
||||
>
|
||||
Foam::functionObjects::runTimePostPro::pointData::representationTypeNames;
|
||||
Foam::functionObjects::runTimePostPro::pointData::representationTypeNames
|
||||
{
|
||||
{ representationType::rtSphere, "sphere" },
|
||||
{ representationType::rtVector, "vector" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -106,7 +99,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
||||
geometryBase(parent, dict, colours),
|
||||
representation_
|
||||
(
|
||||
representationTypeNames.read(dict.lookup("representation"))
|
||||
representationTypeNames.lookup("representation", dict)
|
||||
),
|
||||
maxGlyphLength_(readScalar(dict.lookup("maxGlyphLength"))),
|
||||
pointColour_(nullptr)
|
||||
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#define functionObjects_runTimePostPro_pointData_H
|
||||
|
||||
#include "geometryBase.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -69,7 +69,7 @@ public:
|
||||
rtVector //!< Vector
|
||||
};
|
||||
|
||||
static const NamedEnum<representationType, 2> representationTypeNames;
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -62,7 +62,7 @@ SourceFiles
|
||||
#include "vector.H"
|
||||
#include "point.H"
|
||||
#include "boundBox.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "vector.H"
|
||||
|
||||
|
||||
@ -48,27 +48,21 @@ namespace runTimePostPro
|
||||
defineRunTimeSelectionTable(surface, dictionary);
|
||||
}
|
||||
}
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
functionObjects::runTimePostPro::surface::representationType,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
"wireframe",
|
||||
"surface",
|
||||
"surfaceWithEdges",
|
||||
"glyph"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::functionObjects::runTimePostPro::surface::representationType,
|
||||
5
|
||||
Foam::functionObjects::runTimePostPro::surface::representationType
|
||||
>
|
||||
Foam::functionObjects::runTimePostPro::surface::representationTypeNames;
|
||||
Foam::functionObjects::runTimePostPro::surface::representationTypeNames
|
||||
{
|
||||
{ representationType::rtNone, "none" },
|
||||
{ representationType::rtWireframe, "wireframe" },
|
||||
{ representationType::rtSurface, "surface" },
|
||||
{ representationType::rtSurfaceWithEdges, "surfaceWithEdges" },
|
||||
{ representationType::rtGlyph, "glyph" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -155,7 +149,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
||||
geometryBase(parent, dict, colours),
|
||||
representation_
|
||||
(
|
||||
representationTypeNames.read(dict.lookup("representation"))
|
||||
representationTypeNames.lookup("representation", dict)
|
||||
),
|
||||
featureEdges_(false),
|
||||
surfaceColour_(nullptr),
|
||||
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#define functionObjects_runTimePostPro_surface_H
|
||||
|
||||
#include "geometryBase.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
#include "vtkSmartPointer.h"
|
||||
@ -74,7 +74,7 @@ public:
|
||||
rtGlyph
|
||||
};
|
||||
|
||||
static const NamedEnum<representationType, 5> representationTypeNames;
|
||||
static const Enum<representationType> representationTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user