ENH: upgrade from NamedEnum to Enum (issue #515)

This commit is contained in:
Mark Olesen 2017-07-03 21:43:33 +02:00
parent 575073890f
commit f55c568f13
179 changed files with 1595 additions and 2035 deletions

View File

@ -43,26 +43,17 @@ using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::compressible::
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType,
2
>::names[] =
{
"vapor",
"liquid"
};
const Foam::NamedEnum
<
Foam::compressible::
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType,
2
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType
>
Foam::compressible::
alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_;
alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_
{
{ phaseType::vaporPhase, "vapor" },
{ phaseType::liquidPhase, "liquid" },
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -111,7 +102,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField
)
:
alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict),
phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))),
phaseType_(phaseTypeNames_.lookup("phaseType", dict)),
relax_(dict.lookupOrDefault<scalar>("relax", 0.5)),
AbyV_(p.size(), 0),
alphatConv_(p.size(), 0),

View File

@ -164,7 +164,7 @@ private:
// Private data
//- Heat source type names
static const NamedEnum<phaseType, 2> phaseTypeNames_;
static const Enum<phaseType> phaseTypeNames_;
//- Heat source type
phaseType phaseType_;

View File

@ -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

View File

@ -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

View File

@ -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 * * * * * * * * * * * * //

View File

@ -122,7 +122,7 @@ public:
constrained = 4
};
static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_;
static const Enum<dualMeshPointType> dualMeshPointTypeNames_;
private:

View File

@ -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_;
// ************************************************************************* //

View File

@ -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_;
};

View File

@ -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<<
(

View File

@ -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&);

View File

@ -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
)
)

View File

@ -33,23 +33,14 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::vector::components,
3
>::names[] =
{
"x",
"y",
"z"
};
}
const Foam::NamedEnum<Foam::vector::components, 3>
Foam::channelIndex::vectorComponentsNames_;
const Foam::Enum
<
Foam::vector::components
>
Foam::channelIndex::vectorComponentsNames_
(
Foam::vector::components::X, { "x", "y", "z" }
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -233,7 +224,7 @@ Foam::channelIndex::channelIndex
)
:
symmetric_(readBool(dict.lookup("symmetric"))),
dir_(vectorComponentsNames_.read(dict.lookup("component")))
dir_(vectorComponentsNames_.lookup("component", dict))
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();

View File

@ -55,7 +55,7 @@ class channelIndex
// Private data
static const NamedEnum<vector::components, 3> vectorComponentsNames_;
static const Enum<vector::components> vectorComponentsNames_;
//- Is mesh symmetric
const bool symmetric_;

View File

@ -29,24 +29,19 @@ License
#include "polyMesh.H"
#include "regionProperties.H"
using namespace Foam;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::solverTemplate::solverType
>
Foam::solverTemplate::solverTypeNames_
{
template<>
const char* Foam::NamedEnum<Foam::solverTemplate::solverType, 4>::names[] =
{
"compressible",
"incompressible",
"buoyant",
"unknown"
};
}
const Foam::NamedEnum<Foam::solverTemplate::solverType, 4>
Foam::solverTemplate::solverTypeNames_;
{ solverType::stCompressible, "compressible" },
{ solverType::stIncompressible, "incompressible" },
{ solverType::stBuoyant, "buoyant" },
{ solverType::stUnknown, "unknown" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -261,7 +256,7 @@ Foam::solverTemplate::solverTemplate
Info<< "Selecting " << solverName << ": ";
solverType_ = solverTypeNames_.read(solverDict.lookup("solverType"));
solverType_ = solverTypeNames_.lookup("solverType", solverDict);
Info<< solverTypeNames_[solverType_];
multiRegion_ = readBool(solverDict.lookup("multiRegion"));
@ -366,7 +361,7 @@ bool Foam::solverTemplate::multiRegion() const
}
label Foam::solverTemplate::nRegion() const
Foam::label Foam::solverTemplate::nRegion() const
{
return regionTypes_.size();
}

View File

@ -36,7 +36,7 @@ Description
#include "wordList.H"
#include "dimensionSet.H"
#include "IOobject.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +65,7 @@ public:
};
//- Solver type names
static const NamedEnum<solverType, 4> solverTypeNames_;
static const Enum<solverType> solverTypeNames_;
private:

View File

@ -59,7 +59,12 @@ class shapeSelector
static const Foam::Enum<shapeType> shapeTypeNames;
};
const Foam::Enum<shapeSelector::shapeType> shapeSelector::shapeTypeNames
const Foam::Enum
<
shapeSelector::shapeType
>
shapeSelector::shapeTypeNames
{
{ shapeSelector::shapeType::PLANE, "plane" },
{ shapeSelector::shapeType::SPHERE, "sphere" },

View File

@ -41,22 +41,16 @@ namespace Foam
dictionary
);
}
template<>
const char* Foam::NamedEnum
<
Foam::tabulatedWallFunctions::general::interpolationType,
1
>::names[] =
{
"linear"
};
}
const
Foam::NamedEnum<Foam::tabulatedWallFunctions::general::interpolationType, 1>
Foam::tabulatedWallFunctions::general::interpolationTypeNames_;
const Foam::Enum
<
Foam::tabulatedWallFunctions::general::interpolationType
>
Foam::tabulatedWallFunctions::general::interpolationTypeNames_
{
{ interpolationType::itLinear, "linear" },
};
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -138,7 +132,7 @@ Foam::tabulatedWallFunctions::general::general
)
:
tabulatedWallFunction(dict, mesh, typeName),
interpType_(interpolationTypeNames_[coeffDict_.lookup("interpType")]),
interpType_(interpolationTypeNames_.lookup("interpType", coeffDict_)),
yPlus_(),
uPlus_(),
log10YPlus_(coeffDict_.lookup("log10YPlus")),

View File

@ -63,7 +63,7 @@ SourceFiles
#define general_H
#include "tabulatedWallFunction.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -91,7 +91,7 @@ public:
itLinear
};
static const NamedEnum<interpolationType, 1> interpolationTypeNames_;
static const Enum<interpolationType> interpolationTypeNames_;
protected:

View File

@ -45,25 +45,22 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
Foam::fileMonitor::fileStateNames_;
const Foam::Enum
<
Foam::fileMonitor::fileState
>
Foam::fileMonitor::fileStateNames_
{
{ fileState::UNMODIFIED, "unmodified" },
{ fileState::MODIFIED, "modified" },
{ fileState::DELETED, "deleted" },
};
namespace Foam
{
defineTypeNameAndDebug(fileMonitor, 0);
template<>
const char* Foam::NamedEnum
<
Foam::fileMonitor::fileState,
3
>::names[] =
{
"unmodified",
"modified",
"deleted"
};
//- Reduction operator for PackedList of fileState
class reduceFileStates
{

View File

@ -43,7 +43,7 @@ SourceFiles
#define fileMonitor_H
#include <sys/types.h>
#include "NamedEnum.H"
#include "Enum.H"
#include "className.H"
#include "DynamicList.H"
@ -74,7 +74,7 @@ public:
DELETED = 2
};
static const NamedEnum<fileState, 3> fileStateNames_;
static const Enum<fileState> fileStateNames_;
private:
// Private data

View File

@ -27,23 +27,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::volumeType
>
Foam::volumeType::names
{
template<>
const char* Foam::NamedEnum
<
Foam::volumeType,
4
>::names[] =
{
"unknown",
"mixed",
"inside",
"outside"
};
}
const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names;
{ type::UNKNOWN, "unknown" },
{ type::MIXED, "mixed" },
{ type::INSIDE, "inside" },
{ type::OUTSIDE, "outside" },
};
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //

View File

@ -34,7 +34,7 @@ SourceFiles
#ifndef volumeType_H
#define volumeType_H
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,8 +44,8 @@ namespace Foam
// Forward declaration of friend functions and operators
class volumeType;
Istream& operator>>(Istream& is, volumeType&);
Ostream& operator<<(Ostream& os, const volumeType& C);
Istream& operator>>(Istream& is, volumeType& vt);
Ostream& operator<<(Ostream& os, const volumeType& vt);
/*---------------------------------------------------------------------------*\
@ -65,6 +65,9 @@ public:
OUTSIDE = 3
};
// Static data
static const Enum<volumeType> names;
private:
@ -76,11 +79,6 @@ private:
public:
// Static data
static const NamedEnum<volumeType, 4> names;
// Constructors
//- Construct null

View File

@ -32,37 +32,32 @@ License
namespace Foam
{
defineTypeNameAndDebug(IOobject, 0);
template<>
const char* NamedEnum
<
IOobject::fileCheckTypes,
4
>::names[] =
{
"timeStamp",
"timeStampMaster",
"inotify",
"inotifyMaster"
};
}
const Foam::Enum
<
Foam::IOobject::fileCheckTypes
>
Foam::IOobject::fileCheckTypesNames
{
{ fileCheckTypes::timeStamp, "timeStamp" },
{ fileCheckTypes::timeStampMaster, "timeStampMaster" },
{ fileCheckTypes::inotify, "inotify" },
{ fileCheckTypes::inotifyMaster, "inotifyMaster" },
};
const Foam::NamedEnum<Foam::IOobject::fileCheckTypes, 4>
Foam::IOobject::fileCheckTypesNames;
// Default fileCheck type
Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking
(
fileCheckTypesNames.read
fileCheckTypesNames.lookup
(
debug::optimisationSwitches().lookup
(
"fileModificationChecking"
)
"fileModificationChecking",
debug::optimisationSwitches()
)
);
namespace Foam
{
// Register re-reader

View File

@ -76,7 +76,7 @@ SourceFiles
#include "typeInfo.H"
#include "autoPtr.H"
#include "InfoProxy.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -129,7 +129,7 @@ public:
inotifyMaster
};
static const NamedEnum<fileCheckTypes, 4> fileCheckTypesNames;
static const Enum<fileCheckTypes> fileCheckTypesNames;
private:

View File

@ -34,23 +34,18 @@ License
namespace Foam
{
defineTypeNameAndDebug(UPstream, 0);
template<>
const char* Foam::NamedEnum
<
Foam::UPstream::commsTypes,
3
>::names[] =
{
"blocking",
"scheduled",
"nonBlocking"
};
}
const Foam::NamedEnum<Foam::UPstream::commsTypes, 3>
Foam::UPstream::commsTypeNames;
const Foam::Enum
<
Foam::UPstream::commsTypes
>
Foam::UPstream::commsTypeNames
{
{ commsTypes::blocking, "blocking" },
{ commsTypes::scheduled, "scheduled" },
{ commsTypes::nonBlocking, "nonBlocking" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -411,7 +406,11 @@ registerOptSwitch
Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
(
commsTypeNames.read(Foam::debug::optimisationSwitches().lookup("commsType"))
commsTypeNames.lookup
(
"commsType",
Foam::debug::optimisationSwitches()
)
);
namespace Foam

View File

@ -43,7 +43,7 @@ SourceFiles
#include "DynamicList.H"
#include "HashTable.H"
#include "string.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "ListOps.H"
#include "LIFOStack.H"
@ -69,7 +69,7 @@ public:
nonBlocking
};
static const NamedEnum<commsTypes, 3> commsTypeNames;
static const Enum<commsTypes> commsTypeNames;
// Public classes

View File

@ -37,40 +37,34 @@ License
namespace Foam
{
defineTypeNameAndDebug(Time, 0);
template<>
const char* Foam::NamedEnum
<
Foam::Time::stopAtControls,
4
>::names[] =
{
"endTime",
"noWriteNow",
"writeNow",
"nextWrite"
};
template<>
const char* Foam::NamedEnum
<
Foam::Time::writeControls,
5
>::names[] =
{
"timeStep",
"runTime",
"adjustableRunTime",
"clockTime",
"cpuTime"
};
}
const Foam::NamedEnum<Foam::Time::stopAtControls, 4>
Foam::Time::stopAtControlNames_;
const Foam::Enum
<
Foam::Time::stopAtControls
>
Foam::Time::stopAtControlNames_
{
{ stopAtControls::saEndTime, "endTime" },
{ stopAtControls::saNoWriteNow, "noWriteNow" },
{ stopAtControls::saWriteNow, "writeNow" },
{ stopAtControls::saNextWrite, "nextWrite" },
};
const Foam::Enum
<
Foam::Time::writeControls
>
Foam::Time::writeControlNames_
{
{ writeControls::wcTimeStep, "timeStep" },
{ writeControls::wcRunTime, "runTime" },
{ writeControls::wcAdjustableRunTime, "adjustableRunTime" },
{ writeControls::wcClockTime, "clockTime" },
{ writeControls::wcCpuTime, "cpuTime" },
};
const Foam::NamedEnum<Foam::Time::writeControls, 5>
Foam::Time::writeControlNames_;
Foam::Time::fmtflags Foam::Time::format_(Foam::Time::general);

View File

@ -47,7 +47,7 @@ SourceFiles
#include "TimeState.H"
#include "Switch.H"
#include "instantList.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "typeInfo.H"
#include "dlLibraryTable.H"
#include "functionObjectList.H"
@ -130,10 +130,10 @@ protected:
scalar startTime_;
mutable scalar endTime_;
static const NamedEnum<stopAtControls, 4> stopAtControlNames_;
static const Enum<stopAtControls> stopAtControlNames_;
mutable stopAtControls stopAt_;
static const NamedEnum<writeControls, 5> writeControlNames_;
static const Enum<writeControls> writeControlNames_;
writeControls writeControl_;
scalar writeInterval_;

View File

@ -201,9 +201,10 @@ void Foam::Time::readDict()
if (controlDict_.found("writeControl"))
{
writeControl_ = writeControlNames_.read
writeControl_ = writeControlNames_.lookup
(
controlDict_.lookup("writeControl")
"writeControl",
controlDict_
);
}
@ -288,7 +289,7 @@ void Foam::Time::readDict()
// if nothing is specified, the endTime is zero
if (controlDict_.found("stopAt"))
{
stopAt_ = stopAtControlNames_.read(controlDict_.lookup("stopAt"));
stopAt_ = stopAtControlNames_.lookup("stopAt", controlDict_);
if (stopAt_ == saEndTime)
{

View File

@ -28,27 +28,22 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::timeControl::timeControls
>
Foam::timeControl::timeControlNames_
{
template<>
const char* NamedEnum<timeControl::timeControls, 9>::
names[] =
{
"timeStep",
"writeTime",
"outputTime",
"adjustableRunTime",
"runTime",
"clockTime",
"cpuTime",
"onEnd",
"none"
};
}
const Foam::NamedEnum<Foam::timeControl::timeControls, 9>
Foam::timeControl::timeControlNames_;
{ timeControl::ocTimeStep, "timeStep" },
{ timeControl::ocWriteTime, "writeTime" },
{ timeControl::ocOutputTime, "outputTime" },
{ timeControl::ocAdjustableRunTime, "adjustableRunTime" },
{ timeControl::ocRunTime, "runTime" },
{ timeControl::ocClockTime, "clockTime" },
{ timeControl::ocCpuTime, "cpuTime" },
{ timeControl::ocOnEnd, "onEnd" },
{ timeControl::ocNone, "none" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -117,7 +112,7 @@ void Foam::timeControl::read(const dictionary& dict)
if (dict.found(controlName))
{
timeControl_ = timeControlNames_.read(dict.lookup(controlName));
timeControl_ = timeControlNames_.lookup(controlName, dict);
}
else
{

View File

@ -77,7 +77,7 @@ private:
const word prefix_;
//- String representation of timeControls enums
static const NamedEnum<timeControls, 9> timeControlNames_;
static const Enum<timeControls> timeControlNames_;
//- Type of time control
timeControls timeControl_;

View File

@ -35,22 +35,23 @@ namespace Foam
defineTypeNameAndDebug(coupledPolyPatch, 0);
const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4;
template<>
const char* NamedEnum<coupledPolyPatch::transformType, 5>::names[] =
{
"unknown",
"rotational",
"translational",
"coincidentFullMatch",
"noOrdering"
};
const NamedEnum<coupledPolyPatch::transformType, 5>
coupledPolyPatch::transformTypeNames;
}
const Foam::Enum
<
Foam::coupledPolyPatch::transformType
>
Foam::coupledPolyPatch::transformTypeNames
{
{ transformType::UNKNOWN, "unknown" },
{ transformType::ROTATIONAL, "rotational" },
{ transformType::TRANSLATIONAL, "translational" },
{ transformType::COINCIDENTFULLMATCH, "coincidentFullMatch" },
{ transformType::NOORDERING, "noOrdering" },
};
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::coupledPolyPatch::writeOBJ(Ostream& os, const point& pt)
@ -500,9 +501,12 @@ Foam::coupledPolyPatch::coupledPolyPatch
matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)),
transform_
(
dict.found("transform")
? transformTypeNames.read(dict.lookup("transform"))
: UNKNOWN
transformTypeNames.lookupOrDefault
(
"transform",
dict,
transformType::UNKNOWN
)
)
{}
@ -562,10 +566,8 @@ void Foam::coupledPolyPatch::write(Ostream& os) const
polyPatch::write(os);
//if (matchTolerance_ != defaultMatchTol_)
{
os.writeKeyword("matchTolerance") << matchTolerance_
<< token::END_STATEMENT << nl;
os.writeKeyword("transform") << transformTypeNames[transform_]
<< token::END_STATEMENT << nl;
os.writeEntry("matchTolerance", matchTolerance_);
os.writeEntry("transform", transformTypeNames[transform_]);
}
}

View File

@ -65,7 +65,7 @@ public:
NOORDERING // unspecified, no automatic ordering
};
static const NamedEnum<transformType, 5> transformTypeNames;
static const Enum<transformType> transformTypeNames;
private:

View File

@ -29,37 +29,27 @@ License
Foam::scalar Foam::intersection::planarTol_ = 0.2;
namespace Foam
const Foam::Enum
<
Foam::intersection::direction
>
Foam::intersection::directionNames_
{
template<>
const char* Foam::NamedEnum
<
Foam::intersection::direction,
2
>::names[] =
{
"vector",
"contactSphere"
};
{ intersection::direction::VECTOR, "vector" },
{ intersection::direction::CONTACT_SPHERE, "contactSphere" },
};
template<>
const char* Foam::NamedEnum
<
Foam::intersection::algorithm,
3
>::names[] =
{
"fullRay",
"halfRay",
"visible"
};
}
const Foam::NamedEnum<Foam::intersection::direction, 2>
Foam::intersection::directionNames_;
const Foam::NamedEnum<Foam::intersection::algorithm, 3>
Foam::intersection::algorithmNames_;
const Foam::Enum
<
Foam::intersection::algorithm
>
Foam::intersection::algorithmNames_
{
{ intersection::algorithm::FULL_RAY, "fullRay" },
{ intersection::algorithm::HALF_RAY, "halfRay" },
{ intersection::algorithm::VISIBLE, "visible" },
};
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +28,7 @@ Description
Foam::intersection
SourceFiles
intersection.C
intersection.C
\*---------------------------------------------------------------------------*/
@ -36,7 +36,7 @@ SourceFiles
#define intersection_H
#include "scalar.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,10 +77,10 @@ public:
// Static Member Functions
//- Direction names
static const NamedEnum<direction, 2> directionNames_;
static const Enum<direction> directionNames_;
//- Projection algorithm names
static const NamedEnum<algorithm, 3> algorithmNames_;
static const Enum<algorithm> algorithmNames_;
//- Return planar tolerance
static scalar planarTol()

View File

@ -27,23 +27,16 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::orientedType::orientedOption
>
Foam::orientedType::orientedOptionNames
{
template<>
const char* NamedEnum
<
orientedType::orientedOption,
3
>::names[] =
{
"oriented",
"unoriented",
"unknown"
};
}
const Foam::NamedEnum<Foam::orientedType::orientedOption, 3>
Foam::orientedType::orientedOptionNames;
{ orientedOption::ORIENTED, "oriented" },
{ orientedOption::UNORIENTED, "unoriented" },
{ orientedOption::UNKNOWN, "unknown" },
};
bool Foam::orientedType::checkType
@ -118,14 +111,12 @@ void Foam::orientedType::setOriented(const bool oriented)
void Foam::orientedType::read(const dictionary& dict)
{
if (dict.found("oriented"))
{
oriented_ = orientedOptionNames.read(dict.lookup("oriented"));
}
else
{
oriented_ = UNKNOWN;
}
oriented_ = orientedOptionNames.lookupOrDefault
(
"oriented",
dict,
orientedOption::UNKNOWN
);
}

View File

@ -38,7 +38,7 @@ SourceFiles
#include "Istream.H"
#include "Ostream.H"
#include "dictionary.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,9 +49,9 @@ namespace Foam
class orientedType;
Istream& operator>>(Istream&, orientedType&);
Istream& operator>>(Istream& is, orientedType& ot);
Ostream& operator<<(Ostream&, const orientedType&);
Ostream& operator<<(Ostream& os, const orientedType& ot);
/*---------------------------------------------------------------------------*\
Class orientedType Declaration
@ -71,7 +71,7 @@ public:
UNKNOWN
};
static const NamedEnum<orientedOption, 3> orientedOptionNames;
static const Enum<orientedOption> orientedOptionNames;
private:

View File

@ -33,27 +33,16 @@ using Foam::constant::physicoChemical::sigma;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char*
NamedEnum
<
externalWallHeatFluxTemperatureFvPatchScalarField::operationMode,
3
>::names[] =
{
"power",
"flux",
"coefficient"
};
}
const Foam::NamedEnum
const Foam::Enum
<
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode,
3
> Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames;
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode
>
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames
{
{ operationMode::fixedPower, "power" },
{ operationMode::fixedHeatFlux, "flux" },
{ operationMode::fixedHeatTransferCoeff, "coefficient" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -92,7 +81,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict),
mode_(operationModeNames.read(dict.lookup("mode"))),
mode_(operationModeNames.lookup("mode", dict)),
Q_(0),
relaxation_(dict.lookupOrDefault<scalar>("relaxation", 1)),
emissivity_(dict.lookupOrDefault<scalar>("emissivity", 0)),
@ -457,17 +446,14 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
{
fvPatchScalarField::write(os);
os.writeKeyword("mode")
<< operationModeNames[mode_] << token::END_STATEMENT << nl;
os.writeEntry("mode", operationModeNames[mode_]);
temperatureCoupledBase::write(os);
switch (mode_)
{
case fixedPower:
{
os.writeKeyword("Q")
<< Q_ << token::END_STATEMENT << nl;
os.writeEntry("Q", Q_);
break;
}
case fixedHeatFlux:
@ -483,14 +469,12 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
if (relaxation_ < 1)
{
os.writeKeyword("relaxation")
<< relaxation_ << token::END_STATEMENT << nl;
os.writeEntry("relaxation", relaxation_);
}
if (emissivity_ > 0)
{
os.writeKeyword("emissivity")
<< emissivity_ << token::END_STATEMENT << nl;
os.writeEntry("emissivity", emissivity_);
}
if (thicknessLayers_.size())
@ -503,12 +487,11 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
}
}
os.writeKeyword("qr")<< qrName_ << token::END_STATEMENT << nl;
os.writeEntry("qr", qrName_);
if (qrName_ != "none")
{
os.writeKeyword("qrRelaxation")
<< qrRelaxation_ << token::END_STATEMENT << nl;
os.writeEntry("qrRelaxation", qrRelaxation_);
qrPrevious_.writeEntry("qrPrevious", os);
}

View File

@ -127,7 +127,7 @@ public:
fixedHeatTransferCoeff, //!< Fixed heat transfer coefficient
};
static const NamedEnum<operationMode, 3> operationModeNames;
static const Enum<operationMode> operationModeNames;
private:

View File

@ -31,25 +31,17 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::temperatureCoupledBase::KMethodType
>
Foam::temperatureCoupledBase::KMethodTypeNames_
{
template<>
const char* Foam::NamedEnum
<
Foam::temperatureCoupledBase::KMethodType,
4
>::names[] =
{
"fluidThermo",
"solidThermo",
"directionalSolidThermo",
"lookup"
};
}
const Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4>
Foam::temperatureCoupledBase::KMethodTypeNames_;
{ KMethodType::mtFluidThermo, "fluidThermo" },
{ KMethodType::mtSolidThermo, "solidThermo" },
{ KMethodType::mtDirectionalSolidThermo, "directionalSolidThermo" },
{ KMethodType::mtLookup, "lookup" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -76,7 +68,7 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
)
:
patch_(patch),
method_(KMethodTypeNames_.read(dict.lookup("kappaMethod"))),
method_(KMethodTypeNames_.lookup("kappaMethod", dict)),
kappaName_(dict.lookupOrDefault<word>("kappa", "none")),
alphaAniName_(dict.lookupOrDefault<word>("alphaAni","none"))
{}
@ -232,10 +224,9 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
void Foam::temperatureCoupledBase::write(Ostream& os) const
{
os.writeKeyword("kappaMethod") << KMethodTypeNames_[method_]
<< token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappaName_ << token::END_STATEMENT << nl;
os.writeKeyword("alphaAni") << alphaAniName_ << token::END_STATEMENT << nl;
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
os.writeEntry("kappa", kappaName_);
os.writeEntry("alphaAni", alphaAniName_);
}

View File

@ -66,7 +66,7 @@ SourceFiles
#define temperatureCoupledBase_H
#include "scalarField.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "fvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,7 +98,7 @@ protected:
// Protected data
static const NamedEnum<KMethodType, 4> KMethodTypeNames_;
static const Enum<KMethodType> KMethodTypeNames_;
//- Underlying patch
const fvPatch& patch_;

View File

@ -39,14 +39,12 @@ Foam::combustionModels::EDC<Type>::EDC
laminar<Type>(modelType, mesh, combustionProperties, phaseName),
version_
(
EDCversionNames
[
this->coeffs().lookupOrDefault
(
"version",
word(EDCversionNames[EDCdefaultVersion])
)
]
EDCversionNames.lookupOrDefault
(
"version",
this->coeffs(),
EDCdefaultVersion
)
),
C1_(this->coeffs().lookupOrDefault("C1", 0.05774)),
C2_(this->coeffs().lookupOrDefault("C2", 0.5)),
@ -220,14 +218,12 @@ bool Foam::combustionModels::EDC<Type>::read()
{
version_ =
(
EDCversionNames
[
this->coeffs().lookupOrDefault
(
"version",
word(EDCversionNames[EDCdefaultVersion])
)
]
EDCversionNames.lookupOrDefault
(
"version",
this->coeffs(),
EDCdefaultVersion
)
);
C1_ = this->coeffs().lookupOrDefault("C1", 0.05774);
C2_ = this->coeffs().lookupOrDefault("C2", 0.5);

View File

@ -100,7 +100,7 @@ SourceFiles
#define EDC_H
#include "../laminar/laminar.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -118,7 +118,7 @@ enum class EDCversions
v2016
};
extern const NamedEnum<EDCversions, 4> EDCversionNames;
extern const Enum<EDCversions> EDCversionNames;
extern const EDCversions EDCdefaultVersion;
const scalar EDCexp1[] = {3, 2, 2, 2};

View File

@ -31,31 +31,26 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::combustionModels::EDCversions,
4
>::names[] =
Foam::combustionModels::EDCversions
>
Foam::combustionModels::EDCversionNames
{
"v1981",
"v1996",
"v2005",
"v2016"
{ EDCversions::v1981, "v1981" },
{ EDCversions::v1996, "v1996" },
{ EDCversions::v2005, "v2005" },
{ EDCversions::v2016, "v2016" },
};
const Foam::NamedEnum<Foam::combustionModels::EDCversions, 4>
Foam::combustionModels::EDCversionNames;
const Foam::combustionModels::EDCversions
Foam::combustionModels::EDCdefaultVersion
(
Foam::combustionModels::EDCversions::v2005
);
Foam::combustionModels::EDCdefaultVersion(EDCversions::v2005);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeCombustionTypes(EDC, psiChemistryCombustion, psiCombustionModel);
makeCombustionTypes(EDC, rhoChemistryCombustion, rhoCombustionModel);
// ************************************************************************* //

View File

@ -36,23 +36,16 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
const Foam::Enum
<
Foam::directions::directionType
>
Foam::directions::directionTypeNames_
{
template<>
const char* Foam::NamedEnum
<
Foam::directions::directionType,
3
>::names[] =
{
"tan1",
"tan2",
"normal"
};
}
const Foam::NamedEnum<Foam::directions::directionType, 3>
Foam::directions::directionTypeNames_;
{ directionType::TAN1, "tan1" },
{ directionType::TAN2, "tan2" },
{ directionType::NORMAL, "normal" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -289,9 +282,9 @@ Foam::directions::directions
if (coordSystem != "fieldBased")
{
forAll(wantedDirs, i)
for (const word& wantedName : wantedDirs)
{
directionType wantedDir = directionTypeNames_[wantedDirs[i]];
directionType wantedDir = directionTypeNames_[wantedName];
if (wantedDir == NORMAL)
{

View File

@ -43,7 +43,7 @@ SourceFiles
#include "List.H"
#include "vectorField.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,7 +82,7 @@ public:
private:
static const NamedEnum<directionType, 3> directionTypeNames_;
static const Enum<directionType> directionTypeNames_;
// Private Member Functions

View File

@ -36,18 +36,19 @@ License
namespace Foam
{
defineTypeNameAndDebug(tetDecomposer, 0);
template<>
const char* NamedEnum<tetDecomposer::decompositionType, 2>::names[] =
{
"faceCentre",
"faceDiagonal"
};
const NamedEnum<tetDecomposer::decompositionType, 2>
tetDecomposer::decompositionTypeNames;
}
const Foam::Enum
<
Foam::tetDecomposer::decompositionType
>
Foam::tetDecomposer::decompositionTypeNames
{
{ decompositionType::FACE_CENTRE_TRIS, "faceCentre" },
{ decompositionType::FACE_DIAG_TRIS, "faceDiagonal" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::tetDecomposer::modifyFace

View File

@ -39,7 +39,7 @@ SourceFiles
#include "PackedBoolList.H"
#include "boolList.H"
#include "typeInfo.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,7 +68,7 @@ public:
FACE_DIAG_TRIS //- Faces decomposed into triangles diagonally
};
static const NamedEnum<decompositionType, 2> decompositionTypeNames;
static const Enum<decompositionType> decompositionTypeNames;
private:

View File

@ -45,22 +45,18 @@ namespace Foam
slidingInterface,
dictionary
);
template<>
const char* Foam::NamedEnum
<
Foam::slidingInterface::typeOfMatch,
2
>::names[] =
{
"integral",
"partial"
};
}
const Foam::NamedEnum<Foam::slidingInterface::typeOfMatch, 2>
Foam::slidingInterface::typeOfMatchNames_;
const Foam::Enum
<
Foam::slidingInterface::typeOfMatch
>
Foam::slidingInterface::typeOfMatchNames_
{
{ typeOfMatch::INTEGRAL, "integral" },
{ typeOfMatch::PARTIAL, "partial" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -248,7 +244,7 @@ Foam::slidingInterface::slidingInterface
dict.lookup("slavePatchName"),
mme.mesh().boundaryMesh()
),
matchType_(typeOfMatchNames_.read((dict.lookup("typeOfMatch")))),
matchType_(typeOfMatchNames_.lookup("typeOfMatch", dict)),
coupleDecouple_(dict.lookup("coupleDecouple")),
attached_(dict.lookup("attached")),
projectionAlgo_

View File

@ -85,7 +85,7 @@ public:
};
//- Direction names
static const NamedEnum<typeOfMatch, 2> typeOfMatchNames_;
static const Enum<typeOfMatch> typeOfMatchNames_;
private:

View File

@ -27,15 +27,18 @@ License
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
const Foam::Enum<Foam::coordSet::coordFormat>
Foam::coordSet::coordFormatNames_
{
{ coordFormat::XYZ, "xyz" },
{ coordFormat::X, "x" },
{ coordFormat::Y, "y" },
{ coordFormat::Z, "z" },
{ coordFormat::DISTANCE, "distance" }
};
const Foam::Enum
<
Foam::coordSet::coordFormat
>
Foam::coordSet::coordFormatNames_
{
{ coordFormat::XYZ, "xyz" },
{ coordFormat::X, "x" },
{ coordFormat::Y, "y" },
{ coordFormat::Z, "z" },
{ coordFormat::DISTANCE, "distance" }
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -27,14 +27,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::Enum<Foam::fileFormats::FIRECore::fileExt3d>
Foam::fileFormats::FIRECore::file3dExtensions
{
{ fileExt3d::POLY_ASCII, "fpma" },
{ fileExt3d::POLY_BINARY, "fpmb" },
{ fileExt3d::POLY_ASCII_Z, "fpmaz" },
{ fileExt3d::POLY_BINARY_Z, "fpmbz" }
};
const Foam::Enum
<
Foam::fileFormats::FIRECore::fileExt3d
>
Foam::fileFormats::FIRECore::file3dExtensions
{
{ fileExt3d::POLY_ASCII, "fpma" },
{ fileExt3d::POLY_BINARY, "fpmb" },
{ fileExt3d::POLY_ASCII_Z, "fpmaz" },
{ fileExt3d::POLY_BINARY_Z, "fpmbz" }
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -33,22 +33,30 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::Enum<Foam::fileFormats::STARCDCore::fileHeader>
Foam::fileFormats::STARCDCore::fileHeaders_
{
{ fileHeader::HEADER_CEL, "PROSTAR_CELL" },
{ fileHeader::HEADER_VRT, "PROSTAR_VERTEX" },
{ fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" }
};
const Foam::Enum
<
Foam::fileFormats::STARCDCore::fileHeader
>
Foam::fileFormats::STARCDCore::fileHeaders_
{
{ fileHeader::HEADER_CEL, "PROSTAR_CELL" },
{ fileHeader::HEADER_VRT, "PROSTAR_VERTEX" },
{ fileHeader::HEADER_BND, "PROSTAR_BOUNDARY" }
};
const Foam::Enum
<
Foam::fileFormats::STARCDCore::fileExt
>
Foam::fileFormats::STARCDCore::fileExtensions_
{
{ fileExt::CEL_FILE, "cel" },
{ fileExt::VRT_FILE, "vrt" },
{ fileExt::BND_FILE, "bnd" },
{ fileExt::INP_FILE, "inp" }
};
const Foam::Enum<Foam::fileFormats::STARCDCore::fileExt>
Foam::fileFormats::STARCDCore::fileExtensions_
{
{ 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";

View File

@ -27,7 +27,11 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const Foam::Enum<Foam::vtk::fileTag> Foam::vtk::fileTagNames
const Foam::Enum
<
Foam::vtk::fileTag
>
Foam::vtk::fileTagNames
{
{ fileTag::VTK_FILE, "VTKFile" },
{ fileTag::DATA_ARRAY, "DataArray" },
@ -45,7 +49,11 @@ const Foam::Enum<Foam::vtk::fileTag> Foam::vtk::fileTagNames
};
const Foam::Enum<Foam::vtk::fileAttr> Foam::vtk::fileAttrNames
const Foam::Enum
<
Foam::vtk::fileAttr
>
Foam::vtk::fileAttrNames
{
{ fileAttr::OFFSET, "offset" },
{ fileAttr::NUMBER_OF_COMPONENTS, "NumberOfComponents" },
@ -57,7 +65,11 @@ const Foam::Enum<Foam::vtk::fileAttr> Foam::vtk::fileAttrNames
};
const Foam::Enum<Foam::vtk::dataArrayAttr> Foam::vtk::dataArrayAttrNames
const Foam::Enum
<
Foam::vtk::dataArrayAttr
>
Foam::vtk::dataArrayAttrNames
{
{ dataArrayAttr::POINTS, "Points" },
{ dataArrayAttr::OFFSETS, "offsets" },

View File

@ -36,18 +36,24 @@ License
// * * * * * * * * * * * * * * * Static Data * * * * * * * * * * * * * * * * //
const Foam::Enum<Foam::vtk::fileTag>
const Foam::Enum
<
Foam::vtk::fileTag
>
Foam::vtk::legacy::contentNames
{
{ vtk::fileTag::POLY_DATA, "POLYDATA" },
{ vtk::fileTag::POLY_DATA, "POLYDATA" },
{ vtk::fileTag::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" },
};
const Foam::Enum<Foam::vtk::fileTag>
const Foam::Enum
<
Foam::vtk::fileTag
>
Foam::vtk::legacy::dataTypeNames
{
{ vtk::fileTag::CELL_DATA, "CELL_DATA" },
{ vtk::fileTag::CELL_DATA, "CELL_DATA" },
{ vtk::fileTag::POINT_DATA, "POINT_DATA" }
};

View File

@ -37,36 +37,47 @@ namespace Foam
defineTypeNameAndDebug(vtkUnstructuredReader, 1);
}
const Foam::Enum<Foam::vtkUnstructuredReader::vtkDataType>
Foam::vtkUnstructuredReader::vtkDataTypeNames
{
{ 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 Foam::Enum
<
Foam::vtkUnstructuredReader::vtkDataType
>
Foam::vtkUnstructuredReader::vtkDataTypeNames
{
{ 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 Foam::Enum<Foam::vtkUnstructuredReader::vtkDataSetType>
Foam::vtkUnstructuredReader::vtkDataSetTypeNames
{
{ vtkDataSetType::VTK_FIELD, "FIELD" },
{ vtkDataSetType::VTK_SCALARS, "SCALARS" },
{ vtkDataSetType::VTK_VECTORS, "VECTORS" }
};
const Foam::Enum<Foam::vtkUnstructuredReader::parseMode>
Foam::vtkUnstructuredReader::parseModeNames
{
{ parseMode::NOMODE, "NOMODE" },
{ parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" },
{ parseMode::POLYDATA, "POLYDATA" },
{ parseMode::CELL_DATA, "CELL_DATA" },
{ parseMode::POINT_DATA, "POINT_DATA" }
};
const Foam::Enum
<
Foam::vtkUnstructuredReader::vtkDataSetType
>
Foam::vtkUnstructuredReader::vtkDataSetTypeNames
{
{ vtkDataSetType::VTK_FIELD, "FIELD" },
{ vtkDataSetType::VTK_SCALARS, "SCALARS" },
{ vtkDataSetType::VTK_VECTORS, "VECTORS" }
};
const Foam::Enum
<
Foam::vtkUnstructuredReader::parseMode
>
Foam::vtkUnstructuredReader::parseModeNames
{
{ parseMode::NOMODE, "NOMODE" },
{ parseMode::UNSTRUCTURED_GRID, "UNSTRUCTURED_GRID" },
{ parseMode::POLYDATA, "POLYDATA" },
{ parseMode::CELL_DATA, "CELL_DATA" },
{ parseMode::POINT_DATA, "POINT_DATA" }
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -30,25 +30,15 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* NamedEnum
<
fanPressureFvPatchScalarField::fanFlowDirection,
2
>::names[] =
{
"in",
"out"
};
}
const Foam::NamedEnum
const Foam::Enum
<
Foam::fanPressureFvPatchScalarField::fanFlowDirection,
2
> Foam::fanPressureFvPatchScalarField::fanFlowDirectionNames_;
Foam::fanPressureFvPatchScalarField::fanFlowDirection
>
Foam::fanPressureFvPatchScalarField::fanFlowDirectionNames_
{
{ fanFlowDirection::ffdIn, "in" },
{ fanFlowDirection::ffdOut, "out" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -94,7 +84,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(p, iF, dict),
fanCurve_(dict),
direction_(fanFlowDirectionNames_.read(dict.lookup("direction"))),
direction_(fanFlowDirectionNames_.lookup("direction", dict)),
nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)),
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
dm_(dict.lookupOrDefault<scalar>("dm", 0.0))
@ -205,10 +195,8 @@ void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const
{
totalPressureFvPatchScalarField::write(os);
fanCurve_.write(os);
os.writeKeyword("direction")
<< fanFlowDirectionNames_[direction_] << token::END_STATEMENT << nl;
os.writeKeyword("nonDimensional") << nonDimensional_
<< token::END_STATEMENT << nl;
os.writeEntry("direction", fanFlowDirectionNames_[direction_]);
os.writeEntry("nonDimensional", nonDimensional_);
os.writeEntry("rpm", rpm_);
os.writeEntry("dm", dm_);
}

View File

@ -123,8 +123,8 @@ public:
ffdOut
};
//- Fan flow directions names
static const NamedEnum<fanFlowDirection, 2> fanFlowDirectionNames_;
//- Fan flow direction names
static const Enum<fanFlowDirection> fanFlowDirectionNames_;
private:

View File

@ -35,27 +35,25 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* NamedEnum
<
waveSurfacePressureFvPatchScalarField::ddtSchemeType,
3
>::names[] =
{
fv::EulerDdtScheme<scalar>::typeName_(),
fv::CrankNicolsonDdtScheme<scalar>::typeName_(),
fv::backwardDdtScheme<scalar>::typeName_()
};
}
const Foam::NamedEnum
const Foam::Enum
<
Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeType,
3
> Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeTypeNames_;
Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeType
>
Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeTypeNames_
{
{
ddtSchemeType::tsEuler,
fv::EulerDdtScheme<scalar>::typeName_()
},
{
ddtSchemeType::tsCrankNicolson,
fv::CrankNicolsonDdtScheme<scalar>::typeName_()
},
{
ddtSchemeType::tsBackward,
fv::backwardDdtScheme<scalar>::typeName_()
},
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -79,7 +79,7 @@ SourceFiles
#define waveSurfacePressureFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -121,7 +121,7 @@ private:
word rhoName_;
//- Time scheme type names
static const NamedEnum<ddtSchemeType, 3> ddtSchemeTypeNames_;
static const Enum<ddtSchemeType> ddtSchemeTypeNames_;
public:

View File

@ -37,19 +37,16 @@ namespace functionObjects
}
}
template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::volRegion::regionTypes,
2
>::names[] = {"cellZone", "all"};
const Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::volRegion::regionTypes,
2
> Foam::functionObjects::volRegion::regionTypeNames_;
Foam::functionObjects::volRegion::regionTypes
>
Foam::functionObjects::volRegion::regionTypeNames_
{
{ regionTypes::vrtCellZone, "cellZone" },
{ regionTypes::vrtAll, "all" },
};
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -79,9 +76,12 @@ Foam::functionObjects::volRegion::volRegion
mesh_(mesh),
regionType_
(
dict.found("regionType")
? regionTypeNames_.read(dict.lookup("regionType"))
: vrtAll
regionTypeNames_.lookupOrDefault
(
"regionType",
dict,
regionTypes::vrtAll
)
),
regionName_(polyMesh::defaultRegion),
regionID_(-1)
@ -144,7 +144,7 @@ bool Foam::functionObjects::volRegion::read
{
FatalIOErrorInFunction(dict)
<< "Unknown region type. Valid region types are:"
<< regionTypeNames_.toc()
<< regionTypeNames_.sortedToc()
<< exit(FatalIOError);
}
}

View File

@ -71,7 +71,7 @@ SourceFiles
#define functionObjects_volRegion_H
#include "writeFile.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -111,7 +111,7 @@ public:
};
//- Region type names
static const NamedEnum<regionTypes, 2> regionTypeNames_;
static const Enum<regionTypes> regionTypeNames_;
protected:

View File

@ -50,13 +50,16 @@ namespace functionObjects
}
}
const Foam::Enum<Foam::functionObjects::externalCoupled::stateEnd>
Foam::functionObjects::externalCoupled::stateEndNames_
{
{ stateEnd::REMOVE, "remove" },
{ stateEnd::DONE, "done" }
// 'IGNORE' is internal use only and thus without a name
};
const Foam::Enum
<
Foam::functionObjects::externalCoupled::stateEnd
>
Foam::functionObjects::externalCoupled::stateEndNames_
{
{ stateEnd::REMOVE, "remove" },
{ stateEnd::DONE, "done" }
// 'IGNORE' is internal use only and thus without a name
};
Foam::word Foam::functionObjects::externalCoupled::lockName = "OpenFOAM";

View File

@ -37,18 +37,16 @@ const Foam::word Foam::functionObjects::fieldAverageItem::EXT_PRIME2MEAN
"Prime2Mean"
);
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldAverageItem::baseType,
2
>::names[] = { "iteration", "time"};
const Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::fieldAverageItem::baseType,
2
> Foam::functionObjects::fieldAverageItem::baseTypeNames_;
Foam::functionObjects::fieldAverageItem::baseType
>
Foam::functionObjects::fieldAverageItem::baseTypeNames_
{
{ baseType::ITER, "iteration" },
{ baseType::TIME, "time" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -50,7 +50,7 @@ SourceFiles
#ifndef fieldAverageItem_H
#define fieldAverageItem_H
#include "NamedEnum.H"
#include "Enum.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -119,7 +119,7 @@ private:
word prime2MeanFieldName_;
//- Averaging base type names
static const NamedEnum<baseType, 2> baseTypeNames_;
static const Enum<baseType> baseTypeNames_;
//- Averaging base type
baseType base_;

View File

@ -47,7 +47,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
fieldName_ = entry.keyword();
mean_ = readBool(entry.lookup("mean"));
prime2Mean_ = readBool(entry.lookup("prime2Mean"));
base_ = baseTypeNames_[entry.lookup("base")];
base_ = baseTypeNames_.lookup("base", entry);
window_ = entry.lookupOrDefault<scalar>("window", -1.0);
windowName_ = entry.lookupOrDefault<word>("windowName", "");
@ -77,7 +77,7 @@ Foam::Istream& Foam::functionObjects::operator>>
faItem.fieldName_ = entry.keyword();
faItem.mean_ = readBool(entry.lookup("mean"));
faItem.prime2Mean_ = readBool(entry.lookup("prime2Mean"));
faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")];
faItem.base_ = faItem.baseTypeNames_.lookup("base", entry);
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
faItem.windowName_ = entry.lookupOrDefault<word>("windowName", "");

View File

@ -38,18 +38,15 @@ namespace functionObjects
}
}
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::fieldMinMax::modeType,
2
>::names[] = {"magnitude", "component"};
const Foam::NamedEnum
<
Foam::functionObjects::fieldMinMax::modeType,
2
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
Foam::functionObjects::fieldMinMax::modeType
>
Foam::functionObjects::fieldMinMax::modeTypeNames_
{
{ modeType::mdMag, "magnitude" },
{ modeType::mdCmpt, "component" },
};
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -126,7 +123,7 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
location_ = dict.lookupOrDefault<Switch>("location", true);
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
mode_ = modeTypeNames_.lookupOrDefault("mode", dict, modeType::mdMag);
dict.lookup("fields") >> fieldSet_;
return true;

View File

@ -78,7 +78,7 @@ SourceFiles
#define functionObjects_fieldMinMax_H
#include "Switch.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "vector.H"
@ -115,7 +115,7 @@ protected:
// Protected data
//- Mode type names
static const NamedEnum<modeType, 2> modeTypeNames_;
static const Enum<modeType> modeTypeNames_;
//- Switch to write location of min/max values
Switch location_;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,24 +40,19 @@ namespace fieldValues
}
}
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::fieldValues::fieldValueDelta::operationType,
5
>::names[] =
Foam::functionObjects::fieldValues::fieldValueDelta::operationType
>
Foam::functionObjects::fieldValues::fieldValueDelta::operationTypeNames_
{
"add",
"subtract",
"min",
"max",
"average"
{ operationType::opAdd, "add" },
{ operationType::opSubtract, "subtract" },
{ operationType::opMin, "min" },
{ operationType::opMax, "max" },
{ operationType::opAverage, "average" },
};
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::fieldValueDelta::operationType,
5
> Foam::functionObjects::fieldValues::fieldValueDelta::operationTypeNames_;
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
@ -151,7 +146,7 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
).ptr()
);
operation_ = operationTypeNames_.read(dict.lookup("operation"));
operation_ = operationTypeNames_.lookup("operation", dict);
return true;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,6 +85,7 @@ SourceFiles
#include "stateFunctionObject.H"
#include "writeFile.H"
#include "fieldValue.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -116,7 +117,7 @@ public:
};
//- Operation type names
static const NamedEnum<operationType, 5> operationTypeNames_;
static const Enum<operationType> operationTypeNames_;
private:

View File

@ -49,75 +49,54 @@ namespace fieldValues
}
}
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
4
>::names[] =
{
"faceZone",
"patch",
"surface",
"sampledSurface"
};
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
17
>::names[] =
{
"none",
"sum",
"weightedSum",
"sumMag",
"sumDirection",
"sumDirectionBalance",
"average",
"weightedAverage",
"areaAverage",
"weightedAreaAverage",
"areaIntegrate",
"weightedAreaIntegrate",
"min",
"max",
"CoV",
"areaNormalAverage",
"areaNormalIntegrate"
};
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType,
2
>::names[] =
{
"none",
"sqrt"
};
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
4
> Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
17
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType,
2
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes
>
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_;
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_
{
{ regionTypes::stFaceZone, "faceZone" },
{ regionTypes::stPatch, "patch" },
{ regionTypes::stSurface, "surface" },
{ regionTypes::stSampledSurface, "sampledSurface" },
};
const Foam::Enum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType
>
Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_
{
{ operationType::opNone, "none" },
{ operationType::opSum, "sum" },
{ operationType::opWeightedSum, "weightedSum" },
{ operationType::opSumMag, "sumMag" },
{ operationType::opSumDirection, "sumDirection" },
{ operationType::opSumDirectionBalance, "sumDirectionBalance" },
{ operationType::opAverage, "average" },
{ operationType::opWeightedAverage, "weightedAverage" },
{ operationType::opAreaAverage, "areaAverage" },
{ operationType::opWeightedAreaAverage, "weightedAreaAverage" },
{ operationType::opAreaIntegrate, "areaIntegrate" },
{ operationType::opWeightedAreaIntegrate, "weightedAreaIntegrate" },
{ operationType::opMin, "min" },
{ operationType::opMax, "max" },
{ operationType::opCoV, "CoV" },
{ operationType::opAreaNormalAverage, "areaNormalAverage" },
{ operationType::opAreaNormalIntegrate, "areaNormalIntegrate" },
};
const Foam::Enum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType
>
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_
{
{ postOperationType::postOpNone, "none" },
{ postOperationType::postOpSqrt, "sqrt" },
};
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -832,12 +811,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
)
:
fieldValue(name, runTime, dict, typeName),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
regionType_(regionTypeNames_.lookup("regionType", dict)),
operation_(operationTypeNames_.lookup("operation", dict)),
postOperation_
(
postOperationTypeNames_
[dict.lookupOrDefault<word>("postOperation", "none")]
postOperationTypeNames_.lookupOrDefault
(
"postOperation",
dict,
postOperationType::postOpNone
)
),
weightFieldName_("none"),
writeArea_(dict.lookupOrDefault("writeArea", false)),
@ -859,12 +842,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
)
:
fieldValue(name, obr, dict, typeName),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
regionType_(regionTypeNames_.lookup("regionType", dict)),
operation_(operationTypeNames_.lookup("operation", dict)),
postOperation_
(
postOperationTypeNames_
[dict.lookupOrDefault<word>("postOperation", "none")]
postOperationTypeNames_.lookupOrDefault
(
"postOperation",
dict,
postOperationType::postOpNone
)
),
weightFieldName_("none"),
writeArea_(dict.lookupOrDefault("writeArea", false)),

View File

@ -156,7 +156,7 @@ SourceFiles
#define functionObjects_surfaceFieldValue_H
#include "fieldValue.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "meshedSurf.H"
#include "surfaceMesh.H"
#include "fvsPatchField.H"
@ -198,7 +198,7 @@ public:
};
//- Region type names
static const NamedEnum<regionTypes, 4> regionTypeNames_;
static const Enum<regionTypes> regionTypeNames_;
//- Operation type enumeration
@ -224,7 +224,7 @@ public:
};
//- Operation type names
static const NamedEnum<operationType, 17> operationTypeNames_;
static const Enum<operationType> operationTypeNames_;
//- Post-operation type enumeration
@ -235,7 +235,7 @@ public:
};
//- Operation type names
static const NamedEnum<postOperationType, 2> postOperationTypeNames_;
static const Enum<postOperationType> postOperationTypeNames_;
private:

View File

@ -43,35 +43,27 @@ namespace fieldValues
}
}
template<>
const char*
Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::fieldValues::volFieldValue::operationType,
13
>::names[] =
Foam::functionObjects::fieldValues::volFieldValue::operationType
>
Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_
{
"none",
"sum",
"weightedSum",
"sumMag",
"average",
"weightedAverage",
"volAverage",
"weightedVolAverage",
"volIntegrate",
"weightedVolIntegrate",
"min",
"max",
"CoV"
{ operationType::opNone, "none" },
{ operationType::opSum, "sum" },
{ operationType::opWeightedSum, "weightedSum" },
{ operationType::opSumMag, "sumMag" },
{ operationType::opAverage, "average" },
{ operationType::opWeightedAverage, "weightedAverage" },
{ operationType::opVolAverage, "volAverage" },
{ operationType::opWeightedVolAverage, "weightedVolAverage" },
{ operationType::opVolIntegrate, "volIntegrate" },
{ operationType::opWeightedVolIntegrate, "weightedVolIntegrate" },
{ operationType::opMin, "min" },
{ operationType::opMax, "max" },
{ operationType::opCoV, "CoV" },
};
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::volFieldValue::operationType,
13
> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -198,7 +190,7 @@ Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
:
fieldValue(name, runTime, dict, typeName),
volRegion(fieldValue::mesh_, dict),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
operation_(operationTypeNames_.lookup("operation", dict)),
weightFieldName_("none")
{
read(dict);
@ -215,7 +207,7 @@ Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
:
fieldValue(name, obr, dict, typeName),
volRegion(fieldValue::mesh_, dict),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
operation_(operationTypeNames_.lookup("operation", dict)),
weightFieldName_("none")
{
read(dict);

View File

@ -153,7 +153,7 @@ public:
};
//- Operation type names
static const NamedEnum<operationType, 13> operationTypeNames_;
static const Enum<operationType> operationTypeNames_;
protected:

View File

@ -52,24 +52,20 @@ namespace functionObjects
dictionary
);
}
template<>
const char* NamedEnum
<
functionObjects::fluxSummary::modeType,
5
>::names[] =
{
"faceZone",
"faceZoneAndDirection",
"cellZoneAndDirection",
"surface",
"surfaceAndDirection"
};
}
const Foam::NamedEnum<Foam::functionObjects::fluxSummary::modeType, 5>
Foam::functionObjects::fluxSummary::modeTypeNames_;
const Foam::Enum
<
Foam::functionObjects::fluxSummary::modeType
>
Foam::functionObjects::fluxSummary::modeTypeNames_
{
{ modeType::mdFaceZone , "faceZone" },
{ modeType::mdFaceZoneAndDirection, "faceZoneAndDirection" },
{ modeType::mdCellZoneAndDirection, "cellZoneAndDirection" },
{ modeType::mdSurface, "surface" },
{ modeType::mdSurfaceAndDirection, "surfaceAndDirection" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -823,7 +819,7 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
mode_ = modeTypeNames_.read(dict.lookup("mode"));
mode_ = modeTypeNames_.lookup("mode", dict);
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0);
tolerance_ = dict.lookupOrDefault<scalar>("tolerance", 0.8);

View File

@ -124,7 +124,7 @@ public:
};
//- Mode type names
static const NamedEnum<modeType, 5> modeTypeNames_;
static const Enum<modeType> modeTypeNames_;
protected:

View File

@ -48,7 +48,10 @@ namespace functionObjects
}
const Foam::Enum<Foam::functionObjects::setFlow::modeType>
const Foam::Enum
<
Foam::functionObjects::setFlow::modeType
>
Foam::functionObjects::setFlow::modeTypeNames
{
{ functionObjects::setFlow::modeType::FUNCTION, "function" },

View File

@ -110,7 +110,7 @@ class setFlow
VORTEX3D
};
static const Foam::Enum<modeType> modeTypeNames;
static const Enum<modeType> modeTypeNames;
// Private Data

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,51 +45,39 @@ namespace functionObjects
}
}
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::turbulenceFields::compressibleField,
9
>::names[] =
Foam::functionObjects::turbulenceFields::compressibleField
>
Foam::functionObjects::turbulenceFields::compressibleFieldNames_
{
"k",
"epsilon",
"omega",
"mut",
"muEff",
"alphat",
"alphaEff",
"R",
"devRhoReff"
{ compressibleField::cfK, "k" },
{ compressibleField::cfEpsilon, "epsilon" },
{ compressibleField::cfOmega, "omega" },
{ compressibleField::cfMut, "mut" },
{ compressibleField::cfMuEff, "muEff" },
{ compressibleField::cfAlphat, "alphat" },
{ compressibleField::cfAlphaEff, "alphaEff" },
{ compressibleField::cfR, "R" },
{ compressibleField::cfDevRhoReff, "devRhoReff" },
};
const Foam::NamedEnum
<
Foam::functionObjects::turbulenceFields::compressibleField,
9
> Foam::functionObjects::turbulenceFields::compressibleFieldNames_;
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::turbulenceFields::incompressibleField,
7
>::names[] =
Foam::functionObjects::turbulenceFields::incompressibleField
>
Foam::functionObjects::turbulenceFields::incompressibleFieldNames_
{
"k",
"epsilon",
"omega",
"nut",
"nuEff",
"R",
"devReff"
{ incompressibleField::ifK, "k" },
{ incompressibleField::ifEpsilon, "epsilon" },
{ incompressibleField::ifOmega, "omega" },
{ incompressibleField::ifNut, "nut" },
{ incompressibleField::ifNuEff, "nuEff" },
{ incompressibleField::ifR, "R" },
{ incompressibleField::ifDevReff, "devReff" },
};
const Foam::NamedEnum
<
Foam::functionObjects::turbulenceFields::incompressibleField,
7
> Foam::functionObjects::turbulenceFields::incompressibleFieldNames_;
const Foam::word Foam::functionObjects::turbulenceFields::modelName
(

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -90,7 +90,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "HashSet.H"
#include "NamedEnum.H"
#include "Enum.H"
#include "volFieldsFwd.H"
#include "Switch.H"
@ -123,7 +123,7 @@ public:
cfR,
cfDevRhoReff
};
static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
static const Enum<compressibleField> compressibleFieldNames_;
enum incompressibleField
{
@ -135,7 +135,7 @@ public:
ifR,
ifDevReff
};
static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
static const Enum<incompressibleField> incompressibleFieldNames_;
static const word modelName;

View File

@ -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");

View File

@ -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:

View File

@ -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"))

View File

@ -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:

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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:

View File

@ -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"

View File

@ -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),

View File

@ -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:

View File

@ -48,23 +48,17 @@ namespace functionObjects
}
}
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::abort::actionType,
3
>::names[] =
{
"noWriteNow",
"writeNow",
"nextWrite"
};
const Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::abort::actionType,
3
> Foam::functionObjects::abort::actionTypeNames_;
Foam::Time::stopAtControls
>
Foam::functionObjects::abort::actionNames_
{
{ Time::stopAtControls::saNoWriteNow, "noWriteNow" },
{ Time::stopAtControls::saWriteNow, "writeNow" },
{ Time::stopAtControls::saNextWrite, "nextWrite" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -94,7 +88,7 @@ Foam::functionObjects::abort::abort
functionObject(name),
time_(runTime),
abortFile_("$FOAM_CASE/" + name),
action_(nextWrite)
action_(Time::stopAtControls::saNextWrite)
{
abortFile_.expand();
read(dict);
@ -116,14 +110,12 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
{
functionObject::read(dict);
if (dict.found("action"))
{
action_ = actionTypeNames_.read(dict.lookup("action"));
}
else
{
action_ = nextWrite;
}
action_ = actionNames_.lookupOrDefault
(
"action",
dict,
Time::stopAtControls::saNextWrite
);
if (dict.readIfPresent("file", abortFile_))
{
@ -143,9 +135,9 @@ bool Foam::functionObjects::abort::execute()
{
switch (action_)
{
case noWriteNow :
case Time::saNoWriteNow :
{
if (time_.stopAt(Time::saNoWriteNow))
if (time_.stopAt(action_))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< time_.timeIndex()
@ -155,9 +147,9 @@ bool Foam::functionObjects::abort::execute()
break;
}
case writeNow :
case Time::saWriteNow :
{
if (time_.stopAt(Time::saWriteNow))
if (time_.stopAt(action_))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< time_.timeIndex()
@ -167,9 +159,9 @@ bool Foam::functionObjects::abort::execute()
break;
}
case nextWrite :
case Time::saNextWrite :
{
if (time_.stopAt(Time::saNextWrite))
if (time_.stopAt(action_))
{
Info<< "USER REQUESTED ABORT (timeIndex="
<< time_.timeIndex()
@ -178,6 +170,11 @@ bool Foam::functionObjects::abort::execute()
}
break;
}
default:
{
// Invalid choices already filtered out by Enum
}
}
}

View File

@ -45,7 +45,7 @@ SourceFiles
#define functionObjects_abort_H
#include "functionObject.H"
#include "NamedEnum.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,33 +62,19 @@ class abort
:
public functionObject
{
public:
// Public data
//- Enumeration defining the type of action
enum actionType
{
noWriteNow, //!< stop immediately without writing data
writeNow, //!< write data and stop immediately
nextWrite //!< stop the next time data are written
};
private:
// Private data
//- A subset of Time stopAtControls
static const Enum<Time::stopAtControls> actionNames_;
//- Reference to the Time
const Time& time_;
//- The fully-qualified name of the abort file
fileName abortFile_;
//- Action type names
static const NamedEnum<actionType, 3> actionTypeNames_;
//- The type of action
actionType action_;
Time::stopAtControls action_;
// Private Member Functions
@ -97,10 +83,10 @@ private:
void removeFile() const;
//- Disallow default bitwise copy construct
abort(const abort&);
abort(const abort&) = delete;
//- Disallow default bitwise assignment
void operator=(const abort&);
void operator=(const abort&) = delete;
public:
@ -127,7 +113,7 @@ public:
// Member Functions
//- Read the dictionary settings
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Execute, check existence of abort file and take action
virtual bool execute();

View File

@ -47,32 +47,21 @@ namespace runTimeControls
}
}
}
template<>
const char* Foam::NamedEnum
<
Foam
::functionObjects
::runTimeControls
::equationInitialResidualCondition
::operatingMode,
2
>::names[] =
{
"minimum",
"maximum"
};
const Foam::NamedEnum
const Foam::Enum
<
Foam
::functionObjects
::runTimeControls
::equationInitialResidualCondition
::operatingMode,
2
::operatingMode
>
Foam::functionObjects::runTimeControls::equationInitialResidualCondition::
operatingModeNames;
operatingModeNames
{
{ operatingMode::omMin, "minimum" },
{ operatingMode::omMax, "maximum" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -90,7 +79,7 @@ equationInitialResidualCondition
fieldNames_(dict.lookup("fields")),
value_(readScalar(dict.lookup("value"))),
timeStart_(dict.lookupOrDefault("timeStart", -GREAT)),
mode_(operatingModeNames.read(dict.lookup("mode")))
mode_(operatingModeNames.lookup("mode", dict))
{
if (fieldNames_.size())
{

View File

@ -37,7 +37,7 @@ SourceFiles
#define functionObjects_runTimeControls_equationInitialResidualCondition_H
#include "runTimeCondition.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +64,7 @@ public:
omMax //!< Maximum
};
static const NamedEnum<operatingMode, 2> operatingModeNames;
static const Enum<operatingMode> operatingModeNames;
protected:

View File

@ -57,27 +57,19 @@ namespace runTimeControls
}
}
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::runTimeControls::minMaxCondition::modeType,
2
>::names[] =
{
"minimum",
"maximum"
};
const Foam::NamedEnum
const Foam::Enum
<
Foam
::functionObjects
::runTimeControls
::minMaxCondition
::modeType,
2
::modeType
>
Foam::functionObjects::runTimeControls::minMaxCondition::modeTypeNames_;
Foam::functionObjects::runTimeControls::minMaxCondition::modeTypeNames_
{
{ modeType::mdMin, "minimum" },
{ modeType::mdMax, "maximum" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -92,7 +84,7 @@ Foam::functionObjects::runTimeControls::minMaxCondition::minMaxCondition
:
runTimeCondition(name, obr, dict, state),
functionObjectName_(dict.lookup("functionObject")),
mode_(modeTypeNames_.read(dict.lookup("mode"))),
mode_(modeTypeNames_.lookup("mode", dict)),
fieldNames_(dict.lookup("fields")),
value_(readScalar(dict.lookup("value")))
{}

View File

@ -38,7 +38,7 @@ SourceFiles
#define functionObjects_runTimeControls_minMaxCondition_H
#include "runTimeCondition.H"
#include "NamedEnum.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,7 +68,7 @@ public:
mdMax //!< Maximum
};
static const NamedEnum<modeType, 2> modeTypeNames_;
static const Enum<modeType> modeTypeNames_;
protected:

View File

@ -37,7 +37,6 @@ SourceFiles
#define functionObjects_runTimeConditions_minTimeStepCondition_H
#include "runTimeCondition.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -45,24 +45,17 @@ namespace functionObjects
}
}
template<>
const char* Foam::NamedEnum
const Foam::Enum
<
Foam::functionObjects::writeObjects::writeOption,
3
>::names[] =
Foam::functionObjects::writeObjects::writeOption
>
Foam::functionObjects::writeObjects::writeOptionNames_
{
"autoWrite",
"noWrite",
"anyWrite"
{ writeOption::AUTO_WRITE, "autoWrite" },
{ writeOption::NO_WRITE, "noWrite" },
{ writeOption::ANY_WRITE, "anyWrite" },
};
const Foam::NamedEnum
<
Foam::functionObjects::writeObjects::writeOption,
3
> Foam::functionObjects::writeObjects::writeOptionNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -114,14 +107,12 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
dict.lookup("objects") >> objectNames_;
}
if (dict.found("writeOption"))
{
writeOption_ = writeOptionNames_.read(dict.lookup("writeOption"));
}
else
{
writeOption_ = ANY_WRITE;
}
writeOption_ = writeOptionNames_.lookupOrDefault
(
"writeOption",
dict,
writeOption::ANY_WRITE
);
return true;
}

View File

@ -84,8 +84,8 @@ SourceFiles
#define functionObjects_writeObjects_H
#include "functionObject.H"
#include "wordReList.H"
#include "NamedEnum.H"
#include "wordRes.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -119,7 +119,7 @@ public:
ANY_WRITE
};
static const NamedEnum<writeOption, 3> writeOptionNames_;
static const Enum<writeOption> writeOptionNames_;
private:
@ -138,10 +138,10 @@ private:
// Private Member Functions
//- Disallow default bitwise copy construct
writeObjects(const writeObjects&);
writeObjects(const writeObjects&) = delete;
//- Disallow default bitwise assignment
void operator=(const writeObjects&);
void operator=(const writeObjects&) = delete;
public:

Some files were not shown because too many files have changed in this diff Show More