mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-post-release-cleaning' into 'develop'
Feature post release cleaning See merge request !122
This commit is contained in:
@ -34,6 +34,7 @@ License
|
||||
#include "fvcFlux.H"
|
||||
#include "fvcMeshPhi.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -43,10 +44,6 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalar Foam::multiphaseMixtureThermo::convertToRad =
|
||||
Foam::constant::mathematical::pi/180.0;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::multiphaseMixtureThermo::calcAlphas()
|
||||
@ -855,7 +852,7 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
|
||||
|
||||
bool matched = (tp.key().first() == alpha1.name());
|
||||
|
||||
scalar theta0 = convertToRad*tp().theta0(matched);
|
||||
const scalar theta0 = degToRad(tp().theta0(matched));
|
||||
scalarField theta(boundary[patchi].size(), theta0);
|
||||
|
||||
scalar uTheta = tp().uTheta();
|
||||
@ -863,8 +860,8 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
|
||||
// Calculate the dynamic contact angle if required
|
||||
if (uTheta > SMALL)
|
||||
{
|
||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
||||
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||
|
||||
// Calculated the component of the velocity parallel to the wall
|
||||
vectorField Uwall
|
||||
|
||||
@ -144,9 +144,6 @@ private:
|
||||
//- Stabilisation for normalisation of the interface normal
|
||||
const dimensionedScalar deltaN_;
|
||||
|
||||
//- Conversion factor for degrees into radians
|
||||
static const scalar convertToRad;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
|
||||
@ -30,12 +30,7 @@ License
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcSnGrad.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::threePhaseInterfaceProperties::convertToRad =
|
||||
Foam::constant::mathematical::pi/180.0;
|
||||
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -83,7 +78,7 @@ void Foam::threePhaseInterfaceProperties::correctContactAngle
|
||||
|
||||
scalarField theta
|
||||
(
|
||||
convertToRad
|
||||
degToRad()
|
||||
* (
|
||||
twoPhaseAlpha2*(180 - a2cap.theta(U[patchi], nHatp))
|
||||
+ twoPhaseAlpha3*(180 - a3cap.theta(U[patchi], nHatp))
|
||||
|
||||
@ -91,10 +91,6 @@ class threePhaseInterfaceProperties
|
||||
|
||||
public:
|
||||
|
||||
//- Conversion factor for degrees into radians
|
||||
static const scalar convertToRad;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from volume fraction field alpha and IOdictionary
|
||||
|
||||
@ -35,12 +35,7 @@ License
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcFlux.H"
|
||||
#include "fvcAverage.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::multiphaseSystem::convertToRad =
|
||||
Foam::constant::mathematical::pi/180.0;
|
||||
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -290,7 +285,7 @@ void Foam::multiphaseSystem::correctContactAngle
|
||||
|
||||
bool matched = (tp.key().first() == phase1.name());
|
||||
|
||||
scalar theta0 = convertToRad*tp().theta0(matched);
|
||||
const scalar theta0 = degToRad(tp().theta0(matched));
|
||||
scalarField theta(boundary[patchi].size(), theta0);
|
||||
|
||||
scalar uTheta = tp().uTheta();
|
||||
@ -298,8 +293,8 @@ void Foam::multiphaseSystem::correctContactAngle
|
||||
// Calculate the dynamic contact angle if required
|
||||
if (uTheta > SMALL)
|
||||
{
|
||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
||||
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||
|
||||
// Calculated the component of the velocity parallel to the wall
|
||||
vectorField Uwall
|
||||
|
||||
@ -187,9 +187,6 @@ private:
|
||||
//- Stabilisation for normalisation of the interface normal
|
||||
const dimensionedScalar deltaN_;
|
||||
|
||||
//- Conversion factor for degrees into radians
|
||||
static const scalar convertToRad;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
|
||||
@ -33,12 +33,7 @@ License
|
||||
#include "fvcSnGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcFlux.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::multiphaseMixture::convertToRad =
|
||||
Foam::constant::mathematical::pi/180.0;
|
||||
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -456,7 +451,7 @@ void Foam::multiphaseMixture::correctContactAngle
|
||||
|
||||
bool matched = (tp.key().first() == alpha1.name());
|
||||
|
||||
scalar theta0 = convertToRad*tp().theta0(matched);
|
||||
const scalar theta0 = degToRad(tp().theta0(matched));
|
||||
scalarField theta(boundary[patchi].size(), theta0);
|
||||
|
||||
scalar uTheta = tp().uTheta();
|
||||
@ -464,8 +459,8 @@ void Foam::multiphaseMixture::correctContactAngle
|
||||
// Calculate the dynamic contact angle if required
|
||||
if (uTheta > SMALL)
|
||||
{
|
||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
||||
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||
|
||||
// Calculated the component of the velocity parallel to the wall
|
||||
vectorField Uwall
|
||||
|
||||
@ -154,9 +154,6 @@ private:
|
||||
//- Stabilisation for normalisation of the interface normal
|
||||
const dimensionedScalar deltaN_;
|
||||
|
||||
//- Conversion factor for degrees into radians
|
||||
static const scalar convertToRad;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
|
||||
@ -40,6 +40,8 @@ License
|
||||
#include "fvmLaplacian.H"
|
||||
#include "fvmSup.H"
|
||||
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -48,9 +50,6 @@ namespace Foam
|
||||
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
|
||||
}
|
||||
|
||||
const Foam::scalar Foam::multiphaseSystem::convertToRad =
|
||||
Foam::constant::mathematical::pi/180.0;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -399,7 +398,7 @@ void Foam::multiphaseSystem::correctContactAngle
|
||||
|
||||
bool matched = (tp.key().first() == phase1.name());
|
||||
|
||||
scalar theta0 = convertToRad*tp().theta0(matched);
|
||||
const scalar theta0 = degToRad(tp().theta0(matched));
|
||||
scalarField theta(boundary[patchi].size(), theta0);
|
||||
|
||||
scalar uTheta = tp().uTheta();
|
||||
@ -407,8 +406,8 @@ void Foam::multiphaseSystem::correctContactAngle
|
||||
// Calculate the dynamic contact angle if required
|
||||
if (uTheta > SMALL)
|
||||
{
|
||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
||||
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||
|
||||
// Calculated the component of the velocity parallel to the wall
|
||||
vectorField Uwall
|
||||
|
||||
@ -65,9 +65,6 @@ class multiphaseSystem
|
||||
//- Stabilisation for normalisation of the interface normal
|
||||
const dimensionedScalar deltaN_;
|
||||
|
||||
//- Conversion factor for degrees into radians
|
||||
static const scalar convertToRad;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
@ -207,10 +204,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "multiphaseSystemI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
||||
std::vector<bool> stlVector(n, true);
|
||||
|
||||
labelHashSet emptyHash;
|
||||
labelHashSet fullHash(1000);
|
||||
labelHashSet fullHash(1024);
|
||||
for (label i = 0; i < n; i++)
|
||||
{
|
||||
fullHash.insert(i);
|
||||
|
||||
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||
dictionary dict;
|
||||
dict.add(word("aa" + getEnv("WM_MPLIB") + "cc"), 16);
|
||||
|
||||
string s("DDD${aa${WM_MPLIB}cc}EEE");
|
||||
string s("DDD_${aa${WM_MPLIB}cc}_EEE");
|
||||
stringOps::inplaceExpand(s, dict, true, false);
|
||||
Info<< "variable expansion:" << s << endl;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ void testMapDistribute()
|
||||
List<Tuple2<label, List<scalar>>> complexData(100);
|
||||
forAll(complexData, i)
|
||||
{
|
||||
complexData[i].first() = rndGen.integer(0, Pstream::nProcs()-1);
|
||||
complexData[i].first() = rndGen.position(0, Pstream::nProcs()-1);
|
||||
complexData[i].second().setSize(3);
|
||||
complexData[i].second()[0] = 1;
|
||||
complexData[i].second()[1] = 2;
|
||||
|
||||
@ -122,7 +122,7 @@ int main(int argc, char *argv[])
|
||||
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
||||
OFstream pFile(pointsFile);
|
||||
|
||||
scalar a(degToRad(0.1));
|
||||
const scalar a = 0.1_deg;
|
||||
tensor rotateZ =
|
||||
tensor
|
||||
(
|
||||
|
||||
@ -419,7 +419,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
|
||||
{
|
||||
// Distribute the points to be +/- 2.5deg from the x-z plane
|
||||
|
||||
scalar tanTheta = Foam::tan(degToRad(2.5));
|
||||
const scalar tanTheta = Foam::tan(2.5_deg);
|
||||
|
||||
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
|
||||
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
||||
|
||||
@ -69,18 +69,12 @@ enum ExtrudeMode
|
||||
SURFACE
|
||||
};
|
||||
|
||||
namespace Foam
|
||||
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<ExtrudeMode, 3>::names[] =
|
||||
{
|
||||
"mesh",
|
||||
"patch",
|
||||
"surface"
|
||||
{ ExtrudeMode::MESH, "mesh" },
|
||||
{ ExtrudeMode::PATCH, "patch" },
|
||||
{ ExtrudeMode::SURFACE, "surface" },
|
||||
};
|
||||
}
|
||||
|
||||
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
|
||||
|
||||
|
||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||
@ -305,9 +299,10 @@ int main(int argc, char *argv[])
|
||||
const Switch flipNormals(dict.lookup("flipNormals"));
|
||||
|
||||
// What to extrude
|
||||
const ExtrudeMode mode = ExtrudeModeNames.read
|
||||
const ExtrudeMode mode = ExtrudeModeNames.lookup
|
||||
(
|
||||
dict.lookup("constructFrom")
|
||||
"constructFrom",
|
||||
dict
|
||||
);
|
||||
|
||||
// Any merging of small edges
|
||||
|
||||
@ -60,17 +60,11 @@ enum ExtrudeMode
|
||||
MESHEDSURFACE
|
||||
};
|
||||
|
||||
namespace Foam
|
||||
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<ExtrudeMode, 2>::names[] =
|
||||
{
|
||||
"polyMesh2D",
|
||||
"MeshedSurface"
|
||||
{ ExtrudeMode::POLYMESH2D, "polyMesh2D" },
|
||||
{ ExtrudeMode::MESHEDSURFACE, "MeshedSurface" },
|
||||
};
|
||||
}
|
||||
|
||||
static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
|
||||
|
||||
|
||||
//pointField moveInitialPoints
|
||||
|
||||
@ -42,24 +42,20 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
conformalVoronoiMesh::dualMeshPointType,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"internal",
|
||||
"surface",
|
||||
"featureEdge",
|
||||
"featurePoint",
|
||||
"constrained"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::conformalVoronoiMesh::dualMeshPointType, 5>
|
||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_;
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::conformalVoronoiMesh::dualMeshPointType
|
||||
>
|
||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_
|
||||
{
|
||||
{ dualMeshPointType::internal, "internal" },
|
||||
{ dualMeshPointType::surface, "surface" },
|
||||
{ dualMeshPointType::featureEdge, "featureEdge" },
|
||||
{ dualMeshPointType::featurePoint, "featurePoint" },
|
||||
{ dualMeshPointType::constrained, "constrained" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -122,7 +122,7 @@ public:
|
||||
constrained = 4
|
||||
};
|
||||
|
||||
static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_;
|
||||
static const Enum<dualMeshPointType> dualMeshPointTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -33,10 +33,10 @@ License
|
||||
using namespace Foam::vectorTools;
|
||||
|
||||
const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle
|
||||
= Foam::cos(degToRad(30));
|
||||
= Foam::cos(30.0_deg);
|
||||
|
||||
const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface
|
||||
= Foam::cos(degToRad(150));
|
||||
= Foam::cos(150.0_deg);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -27,20 +27,19 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedCellEnum::cellTypes
|
||||
>
|
||||
Foam::indexedCellEnum::cellTypesNames_
|
||||
{
|
||||
"Unassigned",
|
||||
"Internal",
|
||||
"Surface",
|
||||
"FeatureEdge",
|
||||
"FeaturePoint",
|
||||
"Far"
|
||||
{ cellTypes::ctUnassigned, "Unassigned" },
|
||||
{ cellTypes::ctFar, "Far" },
|
||||
{ cellTypes::ctInternal, "Internal" },
|
||||
{ cellTypes::ctSurface, "Surface" },
|
||||
{ cellTypes::ctFeatureEdge, "FeatureEdge" },
|
||||
{ cellTypes::ctFeaturePoint,"FeaturePoint" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>
|
||||
cellTypesNames_;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -34,7 +34,7 @@ SourceFiles
|
||||
#ifndef indexedCellEnum_H
|
||||
#define indexedCellEnum_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,7 +47,6 @@ class indexedCellEnum
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
enum cellTypes
|
||||
{
|
||||
ctUnassigned = INT_MIN,
|
||||
@ -58,7 +57,7 @@ public:
|
||||
ctFeaturePoint = INT_MIN + 5
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<cellTypes, 6> cellTypesNames_;
|
||||
static const Enum<cellTypes> cellTypesNames_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -28,42 +28,42 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedVertexEnum::vertexType
|
||||
>
|
||||
Foam::indexedVertexEnum::vertexTypeNames_
|
||||
{
|
||||
"Unassigned",
|
||||
"Internal",
|
||||
"InternalNearBoundary",
|
||||
"InternalSurface",
|
||||
"InternalSurfaceBaffle",
|
||||
"ExternalSurfaceBaffle",
|
||||
"InternalFeatureEdge",
|
||||
"InternalFeatureEdgeBaffle",
|
||||
"ExternalFeatureEdgeBaffle",
|
||||
"InternalFeaturePoint",
|
||||
"ExternalSurface",
|
||||
"ExternalFeatureEdge",
|
||||
"ExternalFeaturePoint",
|
||||
"Far",
|
||||
"Constrained"
|
||||
{ vertexType::vtUnassigned, "Unassigned" },
|
||||
{ vertexType::vtInternal, "Internal" },
|
||||
{ vertexType::vtInternalNearBoundary, "InternalNearBoundary" },
|
||||
{ vertexType::vtInternalSurface, "InternalSurface" },
|
||||
{ vertexType::vtInternalSurfaceBaffle, "InternalSurfaceBaffle" },
|
||||
{ vertexType::vtExternalSurfaceBaffle, "ExternalSurfaceBaffle" },
|
||||
{ vertexType::vtInternalFeatureEdge, "InternalFeatureEdge" },
|
||||
{ vertexType::vtInternalFeatureEdgeBaffle, "InternalFeatureEdgeBaffle" },
|
||||
{ vertexType::vtExternalFeatureEdgeBaffle, "ExternalFeatureEdgeBaffle" },
|
||||
{ vertexType::vtInternalFeaturePoint, "InternalFeaturePoint" },
|
||||
{ vertexType::vtExternalSurface, "ExternalSurface" },
|
||||
{ vertexType::vtExternalFeatureEdge, "ExternalFeatureEdge" },
|
||||
{ vertexType::vtExternalFeaturePoint, "ExternalFeaturePoint" },
|
||||
{ vertexType::vtFar, "Far" },
|
||||
{ vertexType::vtConstrained, "Constrained" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>
|
||||
Foam::indexedVertexEnum::vertexTypeNames_;
|
||||
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>::names[] =
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::indexedVertexEnum::vertexMotion
|
||||
>
|
||||
Foam::indexedVertexEnum::vertexMotionNames_
|
||||
{
|
||||
"fixed",
|
||||
"movable"
|
||||
{ vertexMotion::fixed, "fixed" },
|
||||
{ vertexMotion::movable, "movable" },
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>
|
||||
vertexMotionNames_;
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
|
||||
@ -34,7 +34,7 @@ SourceFiles
|
||||
#ifndef indexedVertexEnum_H
|
||||
#define indexedVertexEnum_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,9 +72,9 @@ public:
|
||||
movable = 1
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<vertexType, 15> vertexTypeNames_;
|
||||
static const Enum<vertexType> vertexTypeNames_;
|
||||
|
||||
static const Foam::NamedEnum<vertexMotion, 2> vertexMotionNames_;
|
||||
static const Enum<vertexMotion> vertexMotionNames_;
|
||||
|
||||
friend Ostream& operator<<(Foam::Ostream&, const vertexType&);
|
||||
|
||||
|
||||
@ -393,7 +393,7 @@ void extractSurface
|
||||
|
||||
// Collect sizes. Hash on names to handle local-only patches (e.g.
|
||||
// processor patches)
|
||||
HashTable<label> patchSize(1000);
|
||||
HashTable<label> patchSize(1024);
|
||||
label nFaces = 0;
|
||||
forAllConstIter(labelHashSet, includePatches, iter)
|
||||
{
|
||||
@ -405,7 +405,7 @@ void extractSurface
|
||||
|
||||
|
||||
// Allocate zone/patch for all patches
|
||||
HashTable<label> compactZoneID(1000);
|
||||
HashTable<label> compactZoneID(1024);
|
||||
forAllConstIter(HashTable<label>, patchSize, iter)
|
||||
{
|
||||
label sz = compactZoneID.size();
|
||||
@ -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
|
||||
)
|
||||
)
|
||||
|
||||
@ -59,6 +59,7 @@ Usage
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "sigFpe.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMeshTools.H"
|
||||
@ -2277,7 +2278,7 @@ int main(int argc, char *argv[])
|
||||
bool newTimes = args.optionFound("newTimes");
|
||||
|
||||
|
||||
if (env("FOAM_SIGFPE"))
|
||||
if (Foam::sigFpe::requested())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
|
||||
@ -2287,7 +2288,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
const HashSet<word> selectedFields(0);
|
||||
const HashSet<word> selectedLagrangianFields(0);
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ Description
|
||||
#include "fvMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "globalFoam.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -33,23 +33,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::vector::components,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::vector::components, 3>
|
||||
Foam::channelIndex::vectorComponentsNames_;
|
||||
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();
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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"
|
||||
{ solverType::stCompressible, "compressible" },
|
||||
{ solverType::stIncompressible, "incompressible" },
|
||||
{ solverType::stBuoyant, "buoyant" },
|
||||
{ solverType::stUnknown, "unknown" },
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::solverTemplate::solverType, 4>
|
||||
Foam::solverTemplate::solverTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * 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();
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
0
applications/utilities/preProcessing/setAlphaField/Make/files
Executable file → Normal file
0
applications/utilities/preProcessing/setAlphaField/Make/files
Executable file → Normal file
0
applications/utilities/preProcessing/setAlphaField/Make/options
Executable file → Normal file
0
applications/utilities/preProcessing/setAlphaField/Make/options
Executable file → Normal 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" },
|
||||
|
||||
@ -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")),
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -230,7 +230,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// From (name of) patch to compact 'zone' index
|
||||
HashTable<label> compactZoneID(1000);
|
||||
HashTable<label> compactZoneID(1024);
|
||||
// Mesh face and compact zone indx
|
||||
DynamicList<label> faceLabels;
|
||||
DynamicList<label> compactZones;
|
||||
@ -238,7 +238,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// Collect sizes. Hash on names to handle local-only patches (e.g.
|
||||
// processor patches)
|
||||
HashTable<label> patchSize(1000);
|
||||
HashTable<label> patchSize(1024);
|
||||
label nFaces = 0;
|
||||
forAllConstIter(labelHashSet, includePatches, iter)
|
||||
{
|
||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
nFaces += pp.size();
|
||||
}
|
||||
|
||||
HashTable<label> zoneSize(1000);
|
||||
HashTable<label> zoneSize(1024);
|
||||
forAllConstIter(labelHashSet, includeFaceZones, iter)
|
||||
{
|
||||
const faceZone& pp = fzm[iter.key()];
|
||||
|
||||
@ -39,8 +39,9 @@ usage: ${0##*/}
|
||||
-foamVersion ver specify project version (eg, 1612)
|
||||
-projectName name specify project directory name (eg, openfoam1612)
|
||||
-archOption 32|64 specify 'WM_ARCH_OPTION' architecture option
|
||||
-SP | -float32 specify 'WM_PRECISION_OPTION'
|
||||
-DP | -float64 specify 'WM_PRECISION_OPTION'
|
||||
-int32 | -int64 specify 'WM_LABEL_SIZE'
|
||||
-SP | -DP specify 'WM_PRECISION_OPTION'
|
||||
-system name specify 'system' compiler to be used
|
||||
-third name specify 'ThirdParty' compiler to be used
|
||||
-boost ver specify 'boost_version'
|
||||
@ -63,7 +64,7 @@ usage: ${0##*/}
|
||||
-scotch-path dir specify 'SCOTCH_ARCH_PATH' (eg, /opt/OpenFOAM-scotch_6.0.4)
|
||||
-vtk ver specify 'vtk_version' (eg, VTK-7.1.0)
|
||||
-mesa ver specify 'mesa_version' (eg, mesa-13.0.1)
|
||||
-sigfpe | -no-sigfpe activate/deactivate FOAM_SIGFPE handling
|
||||
-sigfpe | -no-sigfpe [defunct - now under etc/controlDict]
|
||||
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
||||
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
||||
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
||||
@ -251,6 +252,18 @@ do
|
||||
shift
|
||||
;;
|
||||
|
||||
-SP | -float32)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "SP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-DP | -float64)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "DP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-int32 | -int64)
|
||||
# Replace WM_LABEL_SIZE=...
|
||||
optionValue="${1#-int}"
|
||||
@ -258,13 +271,6 @@ do
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-SP | -DP)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
optionValue="${1#-}"
|
||||
replace etc/bashrc WM_PRECISION_OPTION "$optionValue"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-system)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||
@ -471,20 +477,8 @@ do
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-sigfpe)
|
||||
# Enable FOAM_SIGFPE handling
|
||||
_inlineSed etc/bashrc \
|
||||
"[a-z][a-z]* FOAM_SIGFPE.*" \
|
||||
"export FOAM_SIGFPE=" \
|
||||
"Activate FOAM_SIGFPE handling"
|
||||
;;
|
||||
|
||||
-no-sigfpe)
|
||||
# Disable FOAM_SIGFPE handling
|
||||
_inlineSed etc/bashrc \
|
||||
"[a-z][a-z]* FOAM_SIGFPE.*" \
|
||||
"unset FOAM_SIGFPE" \
|
||||
"Deactivate FOAM_SIGFPE handling"
|
||||
-sigfpe | -no-sigfpe)
|
||||
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
12
etc/bashrc
12
etc/bashrc
@ -96,13 +96,13 @@ export WM_MPLIB=SYSTEMOPENMPI
|
||||
# WM_OSTYPE = POSIX
|
||||
#export WM_OSTYPE=POSIX
|
||||
|
||||
#- Floating-point signal handling:
|
||||
# set or unset
|
||||
export FOAM_SIGFPE=
|
||||
#- Alternative to 'trapFpe' controlDict entry
|
||||
# for floating-point exceptions (true|false)
|
||||
#export FOAM_SIGFPE=true
|
||||
|
||||
#- memory initialisation:
|
||||
# set or unset
|
||||
#export FOAM_SETNAN=
|
||||
#- Alternative to 'setNaN' controlDict entry
|
||||
# for memory initialisation (true|false)
|
||||
#export FOAM_SETNAN=false
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -16,11 +16,9 @@ FoamFile
|
||||
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
includedAngle 150;
|
||||
|
||||
geometricTestOnly no;
|
||||
}
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
|
||||
@ -257,19 +257,7 @@ if ( "$FOAM_MPI" != dummy ) then
|
||||
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}
|
||||
endif
|
||||
|
||||
|
||||
# Minimum MPI buffer size (used by all except SGI MPI)
|
||||
if ( ! $?minBufferSize ) set minBufferSize=20000000
|
||||
if ( $?MPI_BUFFER_SIZE ) then
|
||||
if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
|
||||
setenv MPI_BUFFER_SIZE $minBufferSize
|
||||
endif
|
||||
else
|
||||
setenv MPI_BUFFER_SIZE $minBufferSize
|
||||
endif
|
||||
|
||||
# Cleanup environment
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset minBufferSize
|
||||
# Alternative to 'mpiBufferSize' controlDict entry
|
||||
#setenv MPI_BUFFER_SIZE 20000000
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -274,18 +274,7 @@ then
|
||||
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI
|
||||
fi
|
||||
|
||||
|
||||
# Minimum MPI buffer size (used by all except SGI MPI)
|
||||
: ${minBufferSize:=20000000}
|
||||
if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
|
||||
then
|
||||
MPI_BUFFER_SIZE=$minBufferSize
|
||||
fi
|
||||
export MPI_BUFFER_SIZE
|
||||
|
||||
|
||||
# Cleanup environment
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset minBufferSize
|
||||
# Alternative to 'mpiBufferSize' controlDict entry
|
||||
#export MPI_BUFFER_SIZE=20000000
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -65,6 +65,11 @@ OptimisationSwitches
|
||||
floatTransfer 0;
|
||||
nProcsSimpleSum 0;
|
||||
|
||||
// MPI buffer size (bytes)
|
||||
// Can override with the MPI_BUFFER_SIZE env variable.
|
||||
// The default and minimum is (20000000).
|
||||
mpiBufferSize 0;
|
||||
|
||||
// Optional max size (bytes) for unstructured data exchanges. In some
|
||||
// phases of OpenFOAM it can send over very large data chunks
|
||||
// (e.g. in parallel load balancing) and some Pstream implementations have
|
||||
@ -74,6 +79,14 @@ OptimisationSwitches
|
||||
// global reduction, even if multi-pass is not needed)
|
||||
maxCommsSize 0;
|
||||
|
||||
// Trap floating point exception.
|
||||
// Can override with FOAM_SIGFPE (true|false)
|
||||
trapFpe 1;
|
||||
|
||||
// Initialization malloced memory to NaN.
|
||||
// Can override with FOAM_SETNAN (true|false)
|
||||
setNaN 0;
|
||||
|
||||
// Force dumping (at next timestep) upon signal (-1 to disable)
|
||||
writeNowSignal -1; // 10;
|
||||
|
||||
|
||||
12
etc/cshrc
12
etc/cshrc
@ -93,13 +93,13 @@ setenv WM_MPLIB SYSTEMOPENMPI
|
||||
# WM_OSTYPE = POSIX
|
||||
#setenv WM_OSTYPE POSIX
|
||||
|
||||
#- Floating-point signal handling:
|
||||
# set or unset
|
||||
setenv FOAM_SIGFPE
|
||||
#- Alternative to 'trapFpe' controlDict entry
|
||||
# for floating-point exceptions (true|false)
|
||||
#setenv FOAM_SIGFPE true
|
||||
|
||||
#- memory initialisation:
|
||||
# set or unset
|
||||
#setenv FOAM_SETNAN
|
||||
#- Alternative to 'setNaN' controlDict entry
|
||||
# for memory initialisation (true|false)
|
||||
#setenv FOAM_SETNAN false
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -18,10 +18,7 @@ CAD.obj
|
||||
{
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
includedAngle 150;
|
||||
}
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
|
||||
@ -18,10 +18,7 @@ CAD.obj
|
||||
{
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
includedAngle 150;
|
||||
}
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
|
||||
@ -18,10 +18,7 @@ CAD.obj
|
||||
{
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
extractFromSurfaceCoeffs
|
||||
{
|
||||
includedAngle 150;
|
||||
}
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -77,38 +77,6 @@ bool Foam::regExp::matchGrouping
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regExp::regExp()
|
||||
:
|
||||
preg_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
Foam::regExp::regExp(const char* pattern, bool ignoreCase)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern, ignoreCase);
|
||||
}
|
||||
|
||||
|
||||
Foam::regExp::regExp(const std::string& pattern, bool ignoreCase)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern.c_str(), ignoreCase);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regExp::~regExp()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::regExp::set(const char* pattern, bool ignoreCase)
|
||||
|
||||
@ -77,7 +77,7 @@ class regExp
|
||||
//- Return true if it matches and sets the sub-groups matched.
|
||||
bool matchGrouping
|
||||
(
|
||||
const std::string&,
|
||||
const std::string& text,
|
||||
List<std::string>& groups
|
||||
) const;
|
||||
|
||||
@ -99,17 +99,23 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
regExp();
|
||||
inline regExp();
|
||||
|
||||
//- Construct from character array
|
||||
inline explicit regExp(const char* pattern);
|
||||
|
||||
//- Construct from string
|
||||
inline explicit regExp(const std::string& pattern);
|
||||
|
||||
//- Construct from character array, optionally ignore case
|
||||
regExp(const char* pattern, bool ignoreCase=false);
|
||||
inline regExp(const char* pattern, bool ignoreCase);
|
||||
|
||||
//- Construct from string, optionally ignore case
|
||||
regExp(const std::string& pattern, bool ignoreCase=false);
|
||||
inline regExp(const std::string& pattern, bool ignoreCase);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~regExp();
|
||||
inline ~regExp();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -143,20 +149,20 @@ public:
|
||||
|
||||
// Matching/Searching
|
||||
|
||||
//- Find position within string.
|
||||
// \Return The index where it begins or string::npos if not found
|
||||
//- Find position within the text.
|
||||
// \return The index where it begins or string::npos if not found
|
||||
std::string::size_type find(const std::string& text) const;
|
||||
|
||||
//- Return true if it matches the entire string
|
||||
//- True if the regex matches the entire text.
|
||||
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||
bool match(const std::string& text) const;
|
||||
|
||||
//- Return true if it matches and sets the sub-groups matched
|
||||
//- True if the regex matches the text, set the sub-groups matched.
|
||||
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||
bool match(const std::string& text, List<std::string>& groups) const;
|
||||
|
||||
//- Return true if the regex was found within string
|
||||
bool search(const std::string& text) const;
|
||||
//- Return true if the regex was found within the text
|
||||
inline bool search(const std::string& text) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -38,6 +38,54 @@ inline bool Foam::regExp::meta(const char c)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::regExp::regExp()
|
||||
:
|
||||
preg_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::regExp::regExp(const char* pattern)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern, false);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::regExp::regExp(const std::string& pattern)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern, false);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::regExp::regExp(const char* pattern, bool ignoreCase)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern, ignoreCase);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::regExp::regExp(const std::string& pattern, bool ignoreCase)
|
||||
:
|
||||
preg_(nullptr)
|
||||
{
|
||||
set(pattern, ignoreCase);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::regExp::~regExp()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::regExp::empty() const
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "JobInfo.H"
|
||||
#include "OSspecific.H"
|
||||
#include "IOstreams.H"
|
||||
#include "Switch.H"
|
||||
|
||||
#ifdef LINUX_GNUC
|
||||
#ifndef __USE_GNU
|
||||
@ -43,17 +44,41 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sigFpe::switchFpe_(Foam::debug::optimisationSwitch("trapFpe", 0));
|
||||
bool Foam::sigFpe::switchNan_(Foam::debug::optimisationSwitch("setNaN", 0));
|
||||
|
||||
bool Foam::sigFpe::sigActive_ = false;
|
||||
bool Foam::sigFpe::mallocNanActive_ = false;
|
||||
|
||||
struct sigaction Foam::sigFpe::oldAction_;
|
||||
|
||||
bool Foam::sigFpe::sigFpeActive_ = false;
|
||||
|
||||
// File-scope function.
|
||||
// Controlled by env variable containing a bool (true|false|on|off ...)
|
||||
// or by the specified flag
|
||||
static bool isTrue(const char* envName, const bool flag)
|
||||
{
|
||||
const std::string str = Foam::getEnv(envName);
|
||||
|
||||
if (str.size())
|
||||
{
|
||||
Foam::Switch sw(str, true); // silently ignore bad input
|
||||
if (sw.valid())
|
||||
{
|
||||
return sw;
|
||||
}
|
||||
}
|
||||
|
||||
// Env was not set or did not contain a valid bool value
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
void Foam::sigFpe::fillNan(UList<scalar>& lst)
|
||||
{
|
||||
lst = std::numeric_limits<scalar>::signaling_NaN();
|
||||
}
|
||||
|
||||
bool Foam::sigFpe::mallocNanActive_ = false;
|
||||
|
||||
|
||||
#ifdef LINUX
|
||||
extern "C"
|
||||
@ -128,9 +153,15 @@ Foam::sigFpe::~sigFpe()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sigFpe::requested()
|
||||
{
|
||||
return isTrue("FOAM_SIGFPE", switchFpe_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::sigFpe::set(const bool verbose)
|
||||
{
|
||||
if (!sigFpeActive_ && env("FOAM_SIGFPE"))
|
||||
if (!sigActive_ && requested())
|
||||
{
|
||||
bool supported = false;
|
||||
|
||||
@ -155,7 +186,7 @@ void Foam::sigFpe::set(const bool verbose)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
sigFpeActive_ = true;
|
||||
sigActive_ = true;
|
||||
|
||||
#elif defined(sgiN32) || defined(sgiN32Gcc)
|
||||
supported = true;
|
||||
@ -179,28 +210,28 @@ void Foam::sigFpe::set(const bool verbose)
|
||||
nullptr
|
||||
);
|
||||
|
||||
sigFpeActive_ = true;
|
||||
sigActive_ = true;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "trapFpe: Floating point exception trapping ";
|
||||
|
||||
if (supported)
|
||||
{
|
||||
Info<< "sigFpe : Enabling floating point exception trapping"
|
||||
<< " (FOAM_SIGFPE)." << endl;
|
||||
Info<< "enabled (FOAM_SIGFPE)." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "sigFpe : Floating point exception trapping"
|
||||
<< " - not supported on this platform" << endl;
|
||||
Info<< "- not supported on this platform" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (env("FOAM_SETNAN"))
|
||||
if (isTrue("FOAM_SETNAN", switchNan_))
|
||||
{
|
||||
#ifdef LINUX
|
||||
mallocNanActive_ = true;
|
||||
@ -208,15 +239,15 @@ void Foam::sigFpe::set(const bool verbose)
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "setNaN : Initialise allocated memory to NaN ";
|
||||
|
||||
if (mallocNanActive_)
|
||||
{
|
||||
Info<< "SetNaN : Initialising allocated memory to NaN"
|
||||
<< " (FOAM_SETNAN)." << endl;
|
||||
Info<< "enabled (FOAM_SETNAN)." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "SetNaN : Initialise allocated memory to NaN"
|
||||
<< " - not supported on this platform" << endl;
|
||||
Info<< " - not supported on this platform" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,7 +258,7 @@ void Foam::sigFpe::unset(const bool verbose)
|
||||
{
|
||||
#ifdef LINUX_GNUC
|
||||
// Reset signal
|
||||
if (sigFpeActive_)
|
||||
if (sigActive_)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
@ -256,7 +287,7 @@ void Foam::sigFpe::unset(const bool verbose)
|
||||
<< "Cannot reset SIGFPE trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
sigFpeActive_ = false;
|
||||
sigActive_ = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -27,17 +27,24 @@ Class
|
||||
Description
|
||||
Set up trapping for floating point exceptions (signal FPE).
|
||||
|
||||
Controlled by two env vars:
|
||||
- \par FOAM_SIGFPE
|
||||
Exception trapping
|
||||
- \par FOAM_SETNAN
|
||||
Initialization of all malloced memory to NaN. If FOAM_SIGFPE
|
||||
also set, this will cause usage of uninitialized scalars to trigger
|
||||
an abort.
|
||||
Defined by controlDict InfoSwitch entries:
|
||||
- \par trapFpe
|
||||
Enable floating point exception trapping.
|
||||
|
||||
Can be used either directly through the static member functions or
|
||||
through the scope of the object (constructor sets trapping; destructor
|
||||
restores original).
|
||||
- \par setNaN
|
||||
Initialization all malloced memory to NaN.
|
||||
Combined with \c trapFpe, this causes usage of uninitialized scalars
|
||||
to trigger an abort.
|
||||
|
||||
Environment variables:
|
||||
- \par FOAM_SIGFPE (true|false)
|
||||
overrides \c trapFpe
|
||||
- \par FOAM_SETNAN (true|false)
|
||||
overrides \c setNaN
|
||||
|
||||
Note that trapping can be set/removed through the static member functions
|
||||
or through the scope of the object (constructor sets trapping; destructor
|
||||
restores original). The class behaves as a singleton.
|
||||
|
||||
SourceFiles
|
||||
sigFpe.C
|
||||
@ -73,12 +80,20 @@ class sigFpe
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Flag that floating point trapping should be used.
|
||||
// Can override with FOAM_SIGFPE env variable
|
||||
static bool switchFpe_;
|
||||
|
||||
//- Flag that NaN initialisation should be used.
|
||||
// Can override with FOAM_SETNAN env variable
|
||||
static bool switchNan_;
|
||||
|
||||
//- Flag to indicate floating point trapping is currently active
|
||||
static bool sigActive_;
|
||||
|
||||
//- Saved old signal trapping setting
|
||||
static struct sigaction oldAction_;
|
||||
|
||||
//- Flag to indicate floating point trapping is enabled
|
||||
static bool sigFpeActive_;
|
||||
|
||||
|
||||
// Static data members
|
||||
|
||||
@ -90,6 +105,11 @@ class sigFpe
|
||||
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Flag to indicate mallocNan is enabled
|
||||
static bool mallocNanActive_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -103,6 +123,11 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Check if SIGFPE signals handler is to be enabled.
|
||||
// This is controlled by the trapFpe entry or the FOAM_SIGFPE
|
||||
// environment variable
|
||||
static bool requested();
|
||||
|
||||
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
|
||||
// Fill memory with NaN when FOAM_SETNAN is %set
|
||||
static void set(const bool verbose);
|
||||
@ -110,16 +135,13 @@ public:
|
||||
//- Deactivate SIGFPE signal handler and NaN memory initialisation
|
||||
static void unset(const bool verbose);
|
||||
|
||||
//- Flag to indicate mallocNan is enabled
|
||||
static bool mallocNanActive_;
|
||||
|
||||
#ifdef LINUX
|
||||
//- Malloc function which initializes to NaN
|
||||
static void* mallocNan(size_t size);
|
||||
#endif
|
||||
|
||||
//- Fill block of data with NaN
|
||||
static void fillNan(UList<scalar>&);
|
||||
static void fillNan(UList<scalar>& lst);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ void Foam::sigQuit::set(const bool verbose)
|
||||
if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot call sigQuit::set() more than once"
|
||||
<< "Cannot call more than once"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
sigActive_ = true;
|
||||
@ -101,7 +101,7 @@ void Foam::sigQuit::unset(const bool)
|
||||
if (sigaction(SIGQUIT, &oldAction_, nullptr) < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot set SIGQUIT trapping"
|
||||
<< "Cannot unset SIGQUIT trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
sigActive_ = false;
|
||||
|
||||
@ -86,7 +86,7 @@ void Foam::sigSegv::set(const bool)
|
||||
if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot call sigSegv::set() more than once"
|
||||
<< "Cannot call more than once"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
sigActive_ = true;
|
||||
@ -101,7 +101,7 @@ void Foam::sigSegv::unset(const bool)
|
||||
if (sigaction(SIGSEGV, &oldAction_, nullptr) < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot set SIGSEGV trapping"
|
||||
<< "Cannot unset SIGSEGV trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
sigActive_ = false;
|
||||
|
||||
@ -78,7 +78,6 @@ addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_
|
||||
|
||||
Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ = nullptr;
|
||||
|
||||
|
||||
struct sigaction Foam::sigStopAtWriteNow::oldAction_;
|
||||
|
||||
|
||||
@ -109,7 +108,8 @@ void Foam::sigStopAtWriteNow::sigHandler(int)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow(){}
|
||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow()
|
||||
{}
|
||||
|
||||
|
||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
|
||||
@ -67,6 +67,7 @@ class sigStopAtWriteNow
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Handler for caught signals
|
||||
static void sigHandler(int);
|
||||
|
||||
|
||||
|
||||
@ -33,13 +33,13 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Signal number to catch
|
||||
int sigWriteNow::signal_
|
||||
(
|
||||
debug::optimisationSwitch("writeNowSignal", -1)
|
||||
);
|
||||
|
||||
|
||||
// Register re-reader
|
||||
class addwriteNowSignalToOpt
|
||||
:
|
||||
@ -75,7 +75,6 @@ addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal");
|
||||
|
||||
Foam::Time* Foam::sigWriteNow::runTimePtr_ = nullptr;
|
||||
|
||||
|
||||
struct sigaction Foam::sigWriteNow::oldAction_;
|
||||
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@ class sigWriteNow
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Handler for caught signals
|
||||
static void sigHandler(int);
|
||||
|
||||
|
||||
|
||||
@ -123,6 +123,7 @@ $(ranges)/labelRange/labelRange.C
|
||||
$(ranges)/labelRange/labelRanges.C
|
||||
$(ranges)/scalarRange/scalarRange.C
|
||||
$(ranges)/scalarRange/scalarRanges.C
|
||||
$(ranges)/tableBounds/tableBounds.C
|
||||
|
||||
spatialVectorAlgebra = primitives/spatialVectorAlgebra
|
||||
$(spatialVectorAlgebra)/SpatialVector/spatialVector/spatialVector.C
|
||||
|
||||
@ -27,23 +27,17 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::volumeType,
|
||||
4
|
||||
>::names[] =
|
||||
Foam::volumeType
|
||||
>
|
||||
Foam::volumeType::names
|
||||
{
|
||||
"unknown",
|
||||
"mixed",
|
||||
"inside",
|
||||
"outside"
|
||||
{ type::UNKNOWN, "unknown" },
|
||||
{ type::MIXED, "mixed" },
|
||||
{ type::INSIDE, "inside" },
|
||||
{ type::OUTSIDE, "outside" },
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -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
|
||||
@ -100,6 +95,17 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// file-scope
|
||||
//
|
||||
// A file is 'outside' of the case if it has been specified using an
|
||||
// absolute path (starts with '/')
|
||||
//
|
||||
static inline bool isOutsideOfCase(const std::string& file)
|
||||
{
|
||||
return !file.empty() && file[0] == '/';
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Return components following the IOobject requirements
|
||||
@ -109,10 +115,10 @@ namespace Foam
|
||||
// ----- ------
|
||||
// "foo" ("", "", "foo")
|
||||
// "foo/bar" ("foo", "", "bar")
|
||||
// "/XXX/bar" ("/XXX", "", "bar")
|
||||
// "foo/bar/" ERROR - no name
|
||||
// "foo/xxx/bar" ("foo", "xxx", "bar")
|
||||
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
|
||||
// "/xxx/yyy/bar" ("/xxx/yyy", "", "bar")
|
||||
bool Foam::IOobject::fileNameComponents
|
||||
(
|
||||
const fileName& path,
|
||||
@ -125,7 +131,7 @@ bool Foam::IOobject::fileNameComponents
|
||||
local.clear();
|
||||
name.clear();
|
||||
|
||||
// called with directory
|
||||
// Called with directory
|
||||
if (isDir(path))
|
||||
{
|
||||
WarningInFunction
|
||||
@ -134,44 +140,49 @@ bool Foam::IOobject::fileNameComponents
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path.isAbsolute())
|
||||
const auto first = path.find('/');
|
||||
const auto last = path.rfind('/');
|
||||
|
||||
// The raw length of name (without validating for word chars)
|
||||
auto nameLen = path.size();
|
||||
|
||||
if (first == std::string::npos)
|
||||
{
|
||||
string::size_type last = path.rfind('/');
|
||||
// No '/' found (or empty entirely)
|
||||
// => no instance or local
|
||||
|
||||
name = word::validated(path, false);
|
||||
}
|
||||
else if (first == 0)
|
||||
{
|
||||
// Absolute path (starts with '/')
|
||||
// => no local
|
||||
|
||||
instance = path.substr(0, last);
|
||||
|
||||
// Check afterwards
|
||||
name.string::operator=(path.substr(last+1));
|
||||
}
|
||||
else
|
||||
{
|
||||
string::size_type first = path.find('/');
|
||||
|
||||
if (first == string::npos)
|
||||
{
|
||||
// no '/' found - no instance or local
|
||||
|
||||
// check afterwards
|
||||
name.string::operator=(path);
|
||||
const std::string ending = path.substr(last+1);
|
||||
nameLen = ending.size(); // The raw length of name
|
||||
name = word::validated(ending, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal case.
|
||||
// First part is instance, remainder is local
|
||||
instance = path.substr(0, first);
|
||||
|
||||
string::size_type last = path.rfind('/');
|
||||
if (last > first)
|
||||
{
|
||||
// with local
|
||||
// With local
|
||||
local = path.substr(first+1, last-first-1);
|
||||
}
|
||||
|
||||
// check afterwards
|
||||
name.string::operator=(path.substr(last+1));
|
||||
const std::string ending = path.substr(last+1);
|
||||
nameLen = ending.size(); // The raw length of name
|
||||
name = word::validated(ending, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for valid (and stripped) name, regardless of the debug level
|
||||
if (name.empty() || string::stripInvalid<word>(name))
|
||||
if (!nameLen || nameLen != name.size())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "has invalid word for name: \"" << name
|
||||
@ -351,6 +362,12 @@ const Foam::Time& Foam::IOobject::time() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::rootPath() const
|
||||
{
|
||||
return time().rootPath();
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::caseName() const
|
||||
{
|
||||
return time().caseName();
|
||||
@ -359,24 +376,24 @@ const Foam::fileName& Foam::IOobject::caseName() const
|
||||
|
||||
Foam::word Foam::IOobject::group() const
|
||||
{
|
||||
word::size_type i = name_.find_last_of('.');
|
||||
const auto i = name_.rfind('.');
|
||||
|
||||
if (i == word::npos || i == 0)
|
||||
if (i == std::string::npos || i == 0)
|
||||
{
|
||||
return word::null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return name_.substr(i+1, word::npos);
|
||||
return name_.substr(i+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::IOobject::member() const
|
||||
{
|
||||
word::size_type i = name_.find_last_of('.');
|
||||
const auto i = name_.rfind('.');
|
||||
|
||||
if (i == word::npos || i == 0)
|
||||
if (i == std::string::npos || i == 0)
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
@ -387,15 +404,9 @@ Foam::word Foam::IOobject::member() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::rootPath() const
|
||||
{
|
||||
return time().rootPath();
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::IOobject::path() const
|
||||
{
|
||||
if (instance().isAbsolute())
|
||||
if (isOutsideOfCase(instance()))
|
||||
{
|
||||
return instance();
|
||||
}
|
||||
@ -419,9 +430,9 @@ Foam::fileName Foam::IOobject::path
|
||||
|
||||
Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
||||
{
|
||||
if (instance().isAbsolute())
|
||||
if (isOutsideOfCase(instance()))
|
||||
{
|
||||
fileName objectPath = instance()/name();
|
||||
const fileName objectPath = instance()/name();
|
||||
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
@ -434,8 +445,8 @@ Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName path = this->path();
|
||||
fileName objectPath = path/name();
|
||||
const fileName path = this->path();
|
||||
const fileName objectPath = path/name();
|
||||
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
@ -445,14 +456,14 @@ Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
||||
{
|
||||
if (!isDir(path) && search)
|
||||
{
|
||||
word newInstancePath = time().findInstancePath
|
||||
const word newInstancePath = time().findInstancePath
|
||||
(
|
||||
instant(instance())
|
||||
);
|
||||
|
||||
if (newInstancePath.size())
|
||||
{
|
||||
fileName fName
|
||||
const fileName fName
|
||||
(
|
||||
rootPath()/caseName()
|
||||
/newInstancePath/db_.dbDir()/local()/name()
|
||||
@ -473,9 +484,9 @@ Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
||||
|
||||
Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
||||
{
|
||||
if (instance().isAbsolute())
|
||||
if (isOutsideOfCase(instance()))
|
||||
{
|
||||
fileName objectPath = instance()/name();
|
||||
const fileName objectPath = instance()/name();
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
if (objectRegistry::debug)
|
||||
@ -497,8 +508,8 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName path = this->path();
|
||||
fileName objectPath = path/name();
|
||||
const fileName path = this->path();
|
||||
const fileName objectPath = path/name();
|
||||
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
@ -521,7 +532,7 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
||||
{
|
||||
// Constant & system can come from global case
|
||||
|
||||
fileName parentObjectPath =
|
||||
const fileName parentObjectPath =
|
||||
rootPath()/time().globalCaseName()
|
||||
/instance()/db().dbDir()/local()/name();
|
||||
|
||||
@ -539,14 +550,14 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
||||
// Check for approximately same (local) time
|
||||
if (!isDir(path) && search)
|
||||
{
|
||||
word newInstancePath = time().findInstancePath
|
||||
const word newInstancePath = time().findInstancePath
|
||||
(
|
||||
instant(instance())
|
||||
);
|
||||
|
||||
if (newInstancePath.size())
|
||||
{
|
||||
fileName fName
|
||||
const fileName fName
|
||||
(
|
||||
rootPath()/caseName()
|
||||
/newInstancePath/db().dbDir()/local()/name()
|
||||
@ -591,11 +602,9 @@ Foam::Istream* Foam::IOobject::objectStream(const fileName& fName)
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::IOobject::setBad(const string& s)
|
||||
@ -617,6 +626,8 @@ void Foam::IOobject::setBad(const string& s)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::IOobject::operator=(const IOobject& io)
|
||||
{
|
||||
name_ = io.name_;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -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:
|
||||
|
||||
@ -191,6 +191,12 @@ public:
|
||||
TypeName("IOobject");
|
||||
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Type of file modification checking
|
||||
static fileCheckTypes fileModificationChecking;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Split path into instance, local, name components
|
||||
@ -202,11 +208,9 @@ public:
|
||||
word& name
|
||||
);
|
||||
|
||||
template<class Name>
|
||||
static inline word groupName(Name name, const word& group);
|
||||
|
||||
//- Type of file modification checking
|
||||
static fileCheckTypes fileModificationChecking;
|
||||
//- Create dot-delimited name.group
|
||||
template<class StringType>
|
||||
static inline word groupName(StringType name, const word& group);
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -282,35 +286,23 @@ public:
|
||||
|
||||
// General access
|
||||
|
||||
//- Return time
|
||||
const Time& time() const;
|
||||
|
||||
//- Return the local objectRegistry
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return time
|
||||
const Time& time() const;
|
||||
|
||||
//- Return name
|
||||
const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
inline const word& name() const;
|
||||
|
||||
//- Return name of the class name read from header
|
||||
const word& headerClassName() const
|
||||
{
|
||||
return headerClassName_;
|
||||
}
|
||||
|
||||
//- Return non-constant access to the optional note
|
||||
string& note()
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
inline const word& headerClassName() const;
|
||||
|
||||
//- Return the optional note
|
||||
const string& note() const
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
inline const string& note() const;
|
||||
|
||||
//- Return non-constant access to the optional note
|
||||
inline string& note();
|
||||
|
||||
//- Rename
|
||||
virtual void rename(const word& newName)
|
||||
@ -319,51 +311,31 @@ public:
|
||||
}
|
||||
|
||||
//- Register object created from this IOobject with registry if true
|
||||
bool& registerObject()
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
inline bool registerObject() const;
|
||||
|
||||
//- Register object created from this IOobject with registry if true
|
||||
bool registerObject() const
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
inline bool& registerObject();
|
||||
|
||||
//- Is object same for all processors
|
||||
bool& globalObject()
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
inline bool globalObject() const;
|
||||
|
||||
//- Is object same for all processors
|
||||
bool globalObject() const
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
inline bool& globalObject();
|
||||
|
||||
|
||||
// Read/write options
|
||||
|
||||
readOption readOpt() const
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
//- The read option
|
||||
inline readOption readOpt() const;
|
||||
|
||||
readOption& readOpt()
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
//- Non-constant access to the read option
|
||||
inline readOption& readOpt();
|
||||
|
||||
writeOption writeOpt() const
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
//- The write option
|
||||
inline writeOption writeOpt() const;
|
||||
|
||||
writeOption& writeOpt()
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
//- Non-constant access to the write option
|
||||
inline writeOption& writeOpt();
|
||||
|
||||
|
||||
// Path components
|
||||
@ -378,20 +350,11 @@ public:
|
||||
|
||||
const fileName& caseName() const;
|
||||
|
||||
const fileName& instance() const
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
inline const fileName& instance() const;
|
||||
|
||||
fileName& instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
inline fileName& instance();
|
||||
|
||||
const fileName& local() const
|
||||
{
|
||||
return local_;
|
||||
}
|
||||
inline const fileName& local() const;
|
||||
|
||||
//- Return complete path
|
||||
fileName path() const;
|
||||
@ -404,10 +367,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return complete path + object name
|
||||
fileName objectPath() const
|
||||
{
|
||||
return path()/name();
|
||||
}
|
||||
inline fileName objectPath() const;
|
||||
|
||||
//- Helper for filePath that searches locally.
|
||||
// When search is false, simply use the current instance,
|
||||
@ -423,7 +383,7 @@ public:
|
||||
// Reading
|
||||
|
||||
//- Read header
|
||||
bool readHeader(Istream&);
|
||||
bool readHeader(Istream& is);
|
||||
|
||||
//- Read header (uses typeFilePath to find file) and check its info.
|
||||
// Optionally checks headerClassName against the type-name.
|
||||
@ -440,39 +400,31 @@ public:
|
||||
template<class Type>
|
||||
void warnNoRereading() const;
|
||||
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write the standard OpenFOAM file/dictionary banner
|
||||
// Optionally without -*- C++ -*- editor hint (eg, for logs)
|
||||
template<class Stream>
|
||||
static inline Stream& writeBanner(Stream& os, bool noHint=false);
|
||||
static Ostream& writeBanner(Ostream& os, bool noHint=false);
|
||||
|
||||
//- Write the standard file section divider
|
||||
template<class Stream>
|
||||
static inline Stream& writeDivider(Stream& os);
|
||||
static Ostream& writeDivider(Ostream& os);
|
||||
|
||||
//- Write the standard end file divider
|
||||
template<class Stream>
|
||||
static inline Stream& writeEndDivider(Stream& os);
|
||||
static Ostream& writeEndDivider(Ostream& os);
|
||||
|
||||
//- Write header
|
||||
bool writeHeader(Ostream&) const;
|
||||
bool writeHeader(Ostream& os) const;
|
||||
|
||||
//- Write header. Allow override of type
|
||||
bool writeHeader(Ostream&, const word& objectType) const;
|
||||
bool writeHeader(Ostream& os, const word& objectType) const;
|
||||
|
||||
|
||||
// Error Handling
|
||||
|
||||
bool good() const
|
||||
{
|
||||
return objState_ == GOOD;
|
||||
}
|
||||
inline bool good() const;
|
||||
|
||||
bool bad() const
|
||||
{
|
||||
return objState_ == BAD;
|
||||
}
|
||||
inline bool bad() const;
|
||||
|
||||
|
||||
// Info
|
||||
@ -487,7 +439,7 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
void operator=(const IOobject&);
|
||||
void operator=(const IOobject& io);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,95 +23,137 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "foamVersion.H"
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Name>
|
||||
inline Foam::word Foam::IOobject::groupName(Name name, const word& group)
|
||||
template<class StringType>
|
||||
inline Foam::word Foam::IOobject::groupName(StringType name, const word& group)
|
||||
{
|
||||
if (group != word::null)
|
||||
{
|
||||
return name + ('.' + group);
|
||||
}
|
||||
else
|
||||
if (group.empty())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||
{
|
||||
static bool spacesSet(false);
|
||||
static char spaces[40];
|
||||
|
||||
if (!spacesSet)
|
||||
{
|
||||
memset(spaces, ' ', 40);
|
||||
|
||||
size_t len = strlen(Foam::FOAMversion);
|
||||
if (len < 38)
|
||||
{
|
||||
spaces[38 - len] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
spaces[0] = '\0';
|
||||
return name + ('.' + group);
|
||||
}
|
||||
spacesSet = true;
|
||||
}
|
||||
|
||||
if (noHint)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// General access
|
||||
|
||||
inline const Foam::word& Foam::IOobject::name() const
|
||||
{
|
||||
os <<
|
||||
"/*--------------------------------------"
|
||||
"-------------------------------------*\\\n";
|
||||
return name_;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
inline const Foam::word& Foam::IOobject::headerClassName() const
|
||||
{
|
||||
os <<
|
||||
"/*--------------------------------*- C++ "
|
||||
"-*----------------------------------*\\\n";
|
||||
}
|
||||
|
||||
os <<
|
||||
"| ========= |"
|
||||
" |\n"
|
||||
"| \\\\ / F ield |"
|
||||
" OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration |"
|
||||
" Version: " << FOAMversion << spaces << "|\n"
|
||||
"| \\\\ / A nd |"
|
||||
" Web: www.OpenFOAM.com |\n"
|
||||
"| \\\\/ M anipulation |"
|
||||
" |\n"
|
||||
"\\*-----------------------------------------"
|
||||
"----------------------------------*/\n";
|
||||
|
||||
return os;
|
||||
return headerClassName_;
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeDivider(Stream& os)
|
||||
inline const Foam::string& Foam::IOobject::note() const
|
||||
{
|
||||
os <<
|
||||
"// * * * * * * * * * * * * * * * * * "
|
||||
"* * * * * * * * * * * * * * * * * * * * //\n";
|
||||
|
||||
return os;
|
||||
return note_;
|
||||
}
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
|
||||
{
|
||||
os << "\n\n"
|
||||
"// *****************************************"
|
||||
"******************************** //\n";
|
||||
|
||||
return os;
|
||||
inline Foam::string& Foam::IOobject::note()
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::registerObject() const
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool& Foam::IOobject::registerObject()
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::globalObject() const
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool& Foam::IOobject::globalObject()
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
|
||||
|
||||
// Read/write options
|
||||
|
||||
inline Foam::IOobject::readOption Foam::IOobject::readOpt() const
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::readOption& Foam::IOobject::readOpt()
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::writeOption Foam::IOobject::writeOpt() const
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::writeOption& Foam::IOobject::writeOpt()
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
|
||||
|
||||
// Path components
|
||||
|
||||
inline const Foam::fileName& Foam::IOobject::instance() const
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName& Foam::IOobject::instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::IOobject::local() const
|
||||
{
|
||||
return local_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::IOobject::objectPath() const
|
||||
{
|
||||
return path()/name();
|
||||
}
|
||||
|
||||
|
||||
// Error Handling
|
||||
|
||||
inline bool Foam::IOobject::good() const
|
||||
{
|
||||
return objState_ == GOOD;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::bad() const
|
||||
{
|
||||
return objState_ == BAD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -116,9 +116,8 @@ void Foam::IOobject::warnNoRereading() const
|
||||
{
|
||||
WarningInFunction
|
||||
<< Type::typeName << ' ' << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but " << Type::typeName
|
||||
<< " does not support automatic rereading."
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED but "
|
||||
<< Type::typeName << " does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,29 +29,91 @@ Description
|
||||
|
||||
#include "IOobject.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "endian.H"
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// file-scope
|
||||
// Hint about machine endian, OpenFOAM label and scalar sizes
|
||||
static const std::string archHint =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
// A banner corresponding to this:
|
||||
//
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: VERSION |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
Foam::Ostream& Foam::IOobject::writeBanner(Ostream& os, bool noHint)
|
||||
{
|
||||
// The version padded with spaces to fit after "Version: "
|
||||
// - initialized with zero-length string to detect if it has been populated
|
||||
static char paddedVersion[39] = "";
|
||||
|
||||
if (!*paddedVersion)
|
||||
{
|
||||
// Populate: like strncpy but without trailing '\0'
|
||||
const char *p = Foam::FOAMversion;
|
||||
|
||||
memset(paddedVersion, ' ', 38);
|
||||
for (int i = 0; *p && i < 38; ++i)
|
||||
{
|
||||
paddedVersion[i] = *p++;
|
||||
}
|
||||
paddedVersion[38] = '\0';
|
||||
}
|
||||
|
||||
os <<
|
||||
"/*--------------------------------";
|
||||
|
||||
if (noHint)
|
||||
{
|
||||
// Without syntax hint
|
||||
os << "---------";
|
||||
}
|
||||
else
|
||||
{
|
||||
// With syntax hint
|
||||
os << "*- C++ -*";
|
||||
}
|
||||
|
||||
os <<
|
||||
"----------------------------------*\\\n"
|
||||
"| ========= |"
|
||||
" |\n"
|
||||
"| \\\\ / F ield |"
|
||||
" OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration |"
|
||||
" Version: " << paddedVersion << "|\n"
|
||||
"| \\\\ / A nd |"
|
||||
" Web: www.OpenFOAM.com |\n"
|
||||
"| \\\\/ M anipulation |"
|
||||
" |\n"
|
||||
"\\*-----------------------------------------"
|
||||
"----------------------------------*/\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Foam::Ostream& Foam::IOobject::writeDivider(Ostream& os)
|
||||
{
|
||||
os <<
|
||||
"// * * * * * * * * * * * * * * * * * "
|
||||
"* * * * * * * * * * * * * * * * * * * * //\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::IOobject::writeEndDivider(Ostream& os)
|
||||
{
|
||||
os << "\n\n"
|
||||
"// *****************************************"
|
||||
"******************************** //\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOobject::writeHeader(Ostream& os, const word& type) const
|
||||
{
|
||||
@ -72,7 +134,7 @@ bool Foam::IOobject::writeHeader(Ostream& os, const word& type) const
|
||||
|
||||
if (os.format() == IOstream::BINARY)
|
||||
{
|
||||
os << " arch " << archHint << ";\n";
|
||||
os << " arch " << Foam::FOAMbuildArch << ";\n";
|
||||
}
|
||||
|
||||
if (!note().empty())
|
||||
|
||||
@ -91,12 +91,11 @@ Foam::IFstream::IFstream
|
||||
ISstream
|
||||
(
|
||||
*ifPtr_,
|
||||
"IFstream.sourceFile_",
|
||||
pathname,
|
||||
format,
|
||||
version,
|
||||
IFstreamAllocator::compression_
|
||||
),
|
||||
pathname_(pathname)
|
||||
)
|
||||
{
|
||||
setClosed();
|
||||
|
||||
@ -166,7 +165,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
||||
if (!good())
|
||||
{
|
||||
// also checks .gz file
|
||||
if (isFile(pathname_, true))
|
||||
if (isFile(this->name(), true))
|
||||
{
|
||||
check("IFstream::operator()");
|
||||
FatalIOError.exit();
|
||||
@ -174,7 +173,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "file " << pathname_ << " does not exist"
|
||||
<< "file " << this->name() << " does not exist"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,10 +84,6 @@ class IFstream
|
||||
public IFstreamAllocator,
|
||||
public ISstream
|
||||
{
|
||||
// Private data
|
||||
|
||||
fileName pathname_;
|
||||
|
||||
public:
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
@ -113,17 +109,8 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of the stream
|
||||
const fileName& name() const
|
||||
{
|
||||
return pathname_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the name of the stream
|
||||
fileName& name()
|
||||
{
|
||||
return pathname_;
|
||||
}
|
||||
//- Read/write access to the name of the stream
|
||||
using ISstream::name;
|
||||
|
||||
|
||||
// STL stream
|
||||
|
||||
@ -93,8 +93,7 @@ Foam::OFstream::OFstream
|
||||
)
|
||||
:
|
||||
OFstreamAllocator(pathname, compression),
|
||||
OSstream(*ofPtr_, "OFstream.sinkFile_", format, version, compression),
|
||||
pathname_(pathname)
|
||||
OSstream(*ofPtr_, pathname, format, version, compression)
|
||||
{
|
||||
setClosed();
|
||||
setState(ofPtr_->rdstate());
|
||||
|
||||
@ -84,11 +84,6 @@ class OFstream
|
||||
private OFstreamAllocator,
|
||||
public OSstream
|
||||
{
|
||||
// Private data
|
||||
|
||||
fileName pathname_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
@ -115,17 +110,8 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of the stream
|
||||
const fileName& name() const
|
||||
{
|
||||
return pathname_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the name of the stream
|
||||
fileName& name()
|
||||
{
|
||||
return pathname_;
|
||||
}
|
||||
//- Read/write access to the name of the stream
|
||||
using OSstream::name;
|
||||
|
||||
|
||||
// STL stream
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::IOstream::name_("IOstream");
|
||||
Foam::fileName Foam::IOstream::staticName_("IOstream");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
@ -89,6 +89,18 @@ Foam::IOstream::compressionEnum(const word& compression)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::fileName& Foam::IOstream::name() const
|
||||
{
|
||||
return staticName_;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName& Foam::IOstream::name()
|
||||
{
|
||||
return staticName_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOstream::check(const char* operation) const
|
||||
{
|
||||
if (bad())
|
||||
|
||||
@ -214,8 +214,8 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of the stream
|
||||
static fileName name_;
|
||||
//- Name for any generic stream - normally treat as readonly
|
||||
static fileName staticName_;
|
||||
|
||||
streamFormat format_;
|
||||
versionNumber version_;
|
||||
@ -295,17 +295,11 @@ public:
|
||||
|
||||
//- Return the name of the stream
|
||||
// Useful for Fstream to return the filename
|
||||
virtual const fileName& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
virtual const fileName& name() const;
|
||||
|
||||
//- Return non-const access to the name of the stream
|
||||
// Useful to alter the stream name
|
||||
virtual fileName& name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
virtual fileName& name();
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Set stream status
|
||||
//- Construct and set stream status
|
||||
Istream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Set stream status
|
||||
//- Construct and set stream status
|
||||
Ostream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
|
||||
@ -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
|
||||
@ -476,4 +475,10 @@ registerOptSwitch
|
||||
);
|
||||
|
||||
|
||||
const int Foam::UPstream::mpiBufferSize
|
||||
(
|
||||
Foam::debug::optimisationSwitch("mpiBufferSize", 0)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -272,6 +272,9 @@ public:
|
||||
//- Optional maximum message size (bytes)
|
||||
static int maxCommsSize;
|
||||
|
||||
//- MPI buffer-size (bytes)
|
||||
static const int mpiBufferSize;
|
||||
|
||||
//- Default communicator (all processors)
|
||||
static label worldComm;
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class ISstream
|
||||
Istream& readVariable(string&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ISstream&);
|
||||
void operator=(const ISstream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -62,14 +62,14 @@ class OSstream
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const OSstream&);
|
||||
void operator=(const OSstream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Set stream status
|
||||
//- Construct and set stream status
|
||||
OSstream
|
||||
(
|
||||
ostream& os,
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Foam
|
||||
|
||||
//- Read a hex label from an input stream
|
||||
template<class T>
|
||||
T ReadHex(ISstream&);
|
||||
T ReadHex(ISstream& is);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Set stream status
|
||||
//- Construct and set stream status
|
||||
prefixOSstream
|
||||
(
|
||||
ostream& os,
|
||||
|
||||
@ -67,7 +67,7 @@ public:
|
||||
ISstream
|
||||
(
|
||||
*(new std::istringstream(buffer)),
|
||||
"IStringStream.sourceFile",
|
||||
"input",
|
||||
format,
|
||||
version
|
||||
)
|
||||
@ -85,7 +85,7 @@ public:
|
||||
ISstream
|
||||
(
|
||||
*(new std::istringstream(buffer)),
|
||||
"IStringStream.sourceFile",
|
||||
"input",
|
||||
format,
|
||||
version
|
||||
)
|
||||
|
||||
@ -66,7 +66,7 @@ public:
|
||||
OSstream
|
||||
(
|
||||
*(new std::ostringstream()),
|
||||
"OStringStream.sinkFile",
|
||||
"output",
|
||||
format,
|
||||
version
|
||||
)
|
||||
@ -126,7 +126,7 @@ public:
|
||||
// Print
|
||||
|
||||
//- Print description to Ostream
|
||||
void print(Ostream&) const;
|
||||
void print(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -126,13 +126,13 @@ public:
|
||||
// Inquiry
|
||||
|
||||
//- Return the name of the stream
|
||||
const fileName& name() const
|
||||
virtual const fileName& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the name of the stream
|
||||
fileName& name()
|
||||
virtual fileName& name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
@ -165,7 +165,7 @@ public:
|
||||
// Read functions
|
||||
|
||||
//- Return next token from stream
|
||||
virtual Istream& read(token&);
|
||||
virtual Istream& read(token& t);
|
||||
|
||||
//- Read a character
|
||||
virtual Istream& read(char&);
|
||||
@ -203,8 +203,8 @@ public:
|
||||
|
||||
// Print
|
||||
|
||||
//- Print description of IOstream to Ostream
|
||||
void print(Ostream&) const;
|
||||
//- Print description of stream to Ostream
|
||||
void print(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -139,16 +139,16 @@ class OSHA1stream
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
OSHA1stream(const OSHA1stream&);
|
||||
OSHA1stream(const OSHA1stream&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const OSHA1stream&);
|
||||
void operator=(const OSHA1stream&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct and set stream status
|
||||
//- Construct with an empty digest
|
||||
OSHA1stream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
@ -158,7 +158,7 @@ public:
|
||||
OSstream
|
||||
(
|
||||
*(new osha1stream),
|
||||
"OSHA1stream.sinkFile_",
|
||||
"OSHA1stream",
|
||||
format,
|
||||
version
|
||||
)
|
||||
@ -188,6 +188,7 @@ public:
|
||||
return sha1().digest();
|
||||
}
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Clear the SHA1 calculation
|
||||
|
||||
@ -134,10 +134,10 @@ public:
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
compound(const compound&);
|
||||
compound(const compound&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const compound&);
|
||||
void operator=(const compound&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -195,11 +195,6 @@ public:
|
||||
|
||||
virtual label size() const = 0;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
// Edit
|
||||
|
||||
// Write
|
||||
|
||||
virtual void write(Ostream&) const = 0;
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -35,12 +35,50 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dictionary, 0);
|
||||
const dictionary dictionary::null;
|
||||
}
|
||||
|
||||
bool dictionary::writeOptionalEntries
|
||||
const Foam::dictionary Foam::dictionary::null;
|
||||
|
||||
bool Foam::dictionary::writeOptionalEntries
|
||||
(
|
||||
debug::infoSwitch("writeOptionalEntries", 0)
|
||||
Foam::debug::infoSwitch("writeOptionalEntries", 0)
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// file-scope
|
||||
//- Walk lists of patterns and regexps for an exact match
|
||||
// or regular expression match
|
||||
template<class WcIterator, class ReIterator>
|
||||
static bool findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const word& keyword,
|
||||
WcIterator& wcIter,
|
||||
ReIterator& reIter
|
||||
)
|
||||
{
|
||||
while (wcIter.found())
|
||||
{
|
||||
if
|
||||
(
|
||||
patternMatch
|
||||
? reIter()->match(keyword)
|
||||
: wcIter()->keyword() == keyword
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
++reIter;
|
||||
++wcIter;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -158,68 +196,6 @@ const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const word& keyword,
|
||||
DLList<entry*>::const_iterator& wcLink,
|
||||
DLList<autoPtr<regExp>>::const_iterator& reLink
|
||||
) const
|
||||
{
|
||||
if (patternEntries_.size())
|
||||
{
|
||||
while (wcLink != patternEntries_.end())
|
||||
{
|
||||
if
|
||||
(
|
||||
patternMatch
|
||||
? reLink()->match(keyword)
|
||||
: wcLink()->keyword() == keyword
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
++reLink;
|
||||
++wcLink;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const word& keyword,
|
||||
DLList<entry*>::iterator& wcLink,
|
||||
DLList<autoPtr<regExp>>::iterator& reLink
|
||||
)
|
||||
{
|
||||
if (patternEntries_.size())
|
||||
{
|
||||
while (wcLink != patternEntries_.end())
|
||||
{
|
||||
if
|
||||
(
|
||||
patternMatch
|
||||
? reLink()->match(keyword)
|
||||
: wcLink()->keyword() == keyword
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
++reLink;
|
||||
++wcLink;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dictionary::dictionary()
|
||||
@ -242,17 +218,17 @@ Foam::dictionary::dictionary
|
||||
)
|
||||
:
|
||||
dictionaryName(dict.name()),
|
||||
IDLList<entry>(dict, *this),
|
||||
parent_type(dict, *this),
|
||||
parent_(parentDict)
|
||||
{
|
||||
forAllIter(IDLList<entry>, *this, iter)
|
||||
forAllIter(parent_type, *this, iter)
|
||||
{
|
||||
hashedEntries_.insert(iter().keyword(), &iter());
|
||||
|
||||
if (iter().keyword().isPattern())
|
||||
{
|
||||
patternEntries_.insert(&iter());
|
||||
patternRegexps_.insert
|
||||
patterns_.insert(&iter());
|
||||
regexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||
);
|
||||
@ -267,17 +243,17 @@ Foam::dictionary::dictionary
|
||||
)
|
||||
:
|
||||
dictionaryName(dict.name()),
|
||||
IDLList<entry>(dict, *this),
|
||||
parent_type(dict, *this),
|
||||
parent_(dictionary::null)
|
||||
{
|
||||
forAllIter(IDLList<entry>, *this, iter)
|
||||
forAllIter(parent_type, *this, iter)
|
||||
{
|
||||
hashedEntries_.insert(iter().keyword(), &iter());
|
||||
|
||||
if (iter().keyword().isPattern())
|
||||
{
|
||||
patternEntries_.insert(&iter());
|
||||
patternRegexps_.insert
|
||||
patterns_.insert(&iter());
|
||||
regexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||
);
|
||||
@ -384,7 +360,7 @@ Foam::SHA1Digest Foam::dictionary::digest() const
|
||||
OSHA1stream os;
|
||||
|
||||
// Process entries
|
||||
forAllConstIter(IDLList<entry>, *this, iter)
|
||||
forAllConstIter(parent_type, *this, iter)
|
||||
{
|
||||
os << *iter;
|
||||
}
|
||||
@ -423,14 +399,11 @@ bool Foam::dictionary::found
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (patternMatch && patterns_.size())
|
||||
{
|
||||
if (patternMatch && patternEntries_.size())
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp>>::const_iterator reLink =
|
||||
patternRegexps_.begin();
|
||||
pattern_const_iterator wcLink = patterns_.begin();
|
||||
regexp_const_iterator reLink = regexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
@ -443,12 +416,9 @@ bool Foam::dictionary::found
|
||||
{
|
||||
return parent_.found(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
@ -458,16 +428,17 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
|
||||
auto iter = hashedEntries_.cfind(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
if (iter.found())
|
||||
{
|
||||
if (patternMatch && patternEntries_.size())
|
||||
return iter();
|
||||
}
|
||||
|
||||
if (patternMatch && patterns_.size())
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp>>::const_iterator reLink =
|
||||
patternRegexps_.begin();
|
||||
pattern_const_iterator wcLink = patterns_.begin();
|
||||
regexp_const_iterator reLink = regexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
@ -480,13 +451,8 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
{
|
||||
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return iter();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -497,16 +463,17 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
bool patternMatch
|
||||
)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
||||
auto iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter == hashedEntries_.end())
|
||||
if (iter.found())
|
||||
{
|
||||
if (patternMatch && patternEntries_.size())
|
||||
return iter();
|
||||
}
|
||||
|
||||
if (patternMatch && patterns_.size())
|
||||
{
|
||||
DLList<entry*>::iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp>>::iterator reLink =
|
||||
patternRegexps_.begin();
|
||||
pattern_iterator wcLink = patterns_.begin();
|
||||
regexp_iterator reLink = regexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
@ -524,13 +491,8 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return iter();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -575,7 +537,7 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
if (keyword[0] == ':' || keyword[0] == '^')
|
||||
if ((keyword[0] == ':' || keyword[0] == '^'))
|
||||
{
|
||||
// Go up to top level
|
||||
const dictionary* dictPtr = this;
|
||||
@ -591,8 +553,7 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return lookupScopedSubEntryPtr
|
||||
(
|
||||
keyword,
|
||||
@ -600,7 +561,6 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::substituteScopedKeyword
|
||||
@ -609,7 +569,8 @@ bool Foam::dictionary::substituteScopedKeyword
|
||||
bool mergeEntry
|
||||
)
|
||||
{
|
||||
const word varName = keyword(1, keyword.size()-1);
|
||||
// Drop first character of keyword to get the var-name, already validated.
|
||||
const word varName(keyword.substr(1), false);
|
||||
|
||||
// Lookup the variable name in the given dictionary
|
||||
const entry* ePtr = lookupScopedEntryPtr(varName, true, true);
|
||||
@ -619,7 +580,7 @@ bool Foam::dictionary::substituteScopedKeyword
|
||||
{
|
||||
const dictionary& addDict = ePtr->dict();
|
||||
|
||||
forAllConstIter(IDLList<entry>, addDict, iter)
|
||||
forAllConstIter(parent_type, addDict, iter)
|
||||
{
|
||||
add(iter(), mergeEntry);
|
||||
}
|
||||
@ -766,7 +727,7 @@ Foam::wordList Foam::dictionary::toc() const
|
||||
wordList keys(size());
|
||||
|
||||
label nKeys = 0;
|
||||
forAllConstIter(IDLList<entry>, *this, iter)
|
||||
forAllConstIter(parent_type, *this, iter)
|
||||
{
|
||||
keys[nKeys++] = iter().keyword();
|
||||
}
|
||||
@ -786,7 +747,7 @@ Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
||||
List<keyType> keys(size());
|
||||
|
||||
label nKeys = 0;
|
||||
forAllConstIter(IDLList<entry>, *this, iter)
|
||||
forAllConstIter(parent_type, *this, iter)
|
||||
{
|
||||
if (iter().keyword().isPattern() ? patterns : !patterns)
|
||||
{
|
||||
@ -801,12 +762,9 @@ Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
||||
|
||||
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find
|
||||
(
|
||||
entryPtr->keyword()
|
||||
);
|
||||
auto iter = hashedEntries_.find(entryPtr->keyword());
|
||||
|
||||
if (mergeEntry && iter != hashedEntries_.end())
|
||||
if (mergeEntry && iter.found())
|
||||
{
|
||||
// Merge dictionary with dictionary
|
||||
if (iter()->isDict() && entryPtr->isDict())
|
||||
@ -816,10 +774,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
// Replace existing dictionary with entry or vice versa
|
||||
IDLList<entry>::replace(iter(), entryPtr);
|
||||
parent_type::replace(iter(), entryPtr);
|
||||
delete iter();
|
||||
hashedEntries_.erase(iter);
|
||||
|
||||
@ -829,8 +787,8 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
patternEntries_.insert(entryPtr);
|
||||
patternRegexps_.insert
|
||||
patterns_.insert(entryPtr);
|
||||
regexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||
);
|
||||
@ -844,22 +802,22 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
<< "problem replacing entry "<< entryPtr->keyword()
|
||||
<< " in dictionary " << name() << endl;
|
||||
|
||||
IDLList<entry>::remove(entryPtr);
|
||||
parent_type::remove(entryPtr);
|
||||
delete entryPtr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
||||
IDLList<entry>::append(entryPtr);
|
||||
parent_type::append(entryPtr);
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
patternEntries_.insert(entryPtr);
|
||||
patternRegexps_.insert
|
||||
patterns_.insert(entryPtr);
|
||||
regexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||
);
|
||||
@ -928,6 +886,7 @@ void Foam::dictionary::add
|
||||
|
||||
void Foam::dictionary::set(entry* entryPtr)
|
||||
{
|
||||
// Find non-recursive with patterns
|
||||
entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true);
|
||||
|
||||
// Clear dictionary so merge acts like overwrite
|
||||
@ -953,24 +912,22 @@ void Foam::dictionary::set(const keyType& k, const dictionary& d)
|
||||
|
||||
bool Foam::dictionary::remove(const word& keyword)
|
||||
{
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
||||
auto iter = hashedEntries_.find(keyword);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
// Delete from patterns first
|
||||
DLList<entry*>::iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp>>::iterator reLink =
|
||||
patternRegexps_.begin();
|
||||
// Delete from patterns
|
||||
pattern_iterator wcLink = patterns_.begin();
|
||||
regexp_iterator reLink = regexps_.begin();
|
||||
|
||||
// Find in pattern using exact match only
|
||||
if (findInPatterns(false, keyword, wcLink, reLink))
|
||||
{
|
||||
patternEntries_.remove(wcLink);
|
||||
patternRegexps_.remove(reLink);
|
||||
patterns_.remove(wcLink);
|
||||
regexps_.remove(reLink);
|
||||
}
|
||||
|
||||
IDLList<entry>::remove(iter());
|
||||
parent_type::remove(iter());
|
||||
delete iter();
|
||||
hashedEntries_.erase(iter);
|
||||
|
||||
@ -996,10 +953,10 @@ bool Foam::dictionary::changeKeyword
|
||||
return false;
|
||||
}
|
||||
|
||||
HashTable<entry*>::iterator iter = hashedEntries_.find(oldKeyword);
|
||||
// Check that oldKeyword exists and can be changed
|
||||
auto iter = hashedEntries_.find(oldKeyword);
|
||||
|
||||
// oldKeyword not found - do nothing
|
||||
if (iter == hashedEntries_.end())
|
||||
if (!iter.found())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1016,30 +973,28 @@ bool Foam::dictionary::changeKeyword
|
||||
}
|
||||
|
||||
|
||||
HashTable<entry*>::iterator iter2 = hashedEntries_.find(newKeyword);
|
||||
auto iter2 = hashedEntries_.find(newKeyword);
|
||||
|
||||
// newKeyword already exists
|
||||
if (iter2 != hashedEntries_.end())
|
||||
if (iter2.found())
|
||||
{
|
||||
if (forceOverwrite)
|
||||
{
|
||||
if (iter2()->keyword().isPattern())
|
||||
{
|
||||
// Delete from patterns first
|
||||
DLList<entry*>::iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
DLList<autoPtr<regExp>>::iterator reLink =
|
||||
patternRegexps_.begin();
|
||||
// Delete from patterns
|
||||
pattern_iterator wcLink = patterns_.begin();
|
||||
regexp_iterator reLink = regexps_.begin();
|
||||
|
||||
// Find in patterns using exact match only
|
||||
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
||||
{
|
||||
patternEntries_.remove(wcLink);
|
||||
patternRegexps_.remove(reLink);
|
||||
patterns_.remove(wcLink);
|
||||
regexps_.remove(reLink);
|
||||
}
|
||||
}
|
||||
|
||||
IDLList<entry>::replace(iter2(), iter());
|
||||
parent_type::replace(iter2(), iter());
|
||||
delete iter2();
|
||||
hashedEntries_.erase(iter2);
|
||||
}
|
||||
@ -1063,8 +1018,8 @@ bool Foam::dictionary::changeKeyword
|
||||
|
||||
if (newKeyword.isPattern())
|
||||
{
|
||||
patternEntries_.insert(iter());
|
||||
patternRegexps_.insert
|
||||
patterns_.insert(iter());
|
||||
regexps_.insert
|
||||
(
|
||||
autoPtr<regExp>(new regExp(newKeyword))
|
||||
);
|
||||
@ -1086,11 +1041,11 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
||||
|
||||
bool changed = false;
|
||||
|
||||
forAllConstIter(IDLList<entry>, dict, iter)
|
||||
forAllConstIter(parent_type, dict, iter)
|
||||
{
|
||||
HashTable<entry*>::iterator fnd = hashedEntries_.find(iter().keyword());
|
||||
auto fnd = hashedEntries_.find(iter().keyword());
|
||||
|
||||
if (fnd != hashedEntries_.end())
|
||||
if (fnd.found())
|
||||
{
|
||||
// Recursively merge sub-dictionaries
|
||||
// TODO: merge without copying
|
||||
@ -1121,10 +1076,10 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
||||
|
||||
void Foam::dictionary::clear()
|
||||
{
|
||||
IDLList<entry>::clear();
|
||||
parent_type::clear();
|
||||
hashedEntries_.clear();
|
||||
patternEntries_.clear();
|
||||
patternRegexps_.clear();
|
||||
patterns_.clear();
|
||||
regexps_.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -1134,10 +1089,10 @@ void Foam::dictionary::transfer(dictionary& dict)
|
||||
// but what about the names?
|
||||
name() = dict.name();
|
||||
|
||||
IDLList<entry>::transfer(dict);
|
||||
parent_type::transfer(dict);
|
||||
hashedEntries_.transfer(dict.hashedEntries_);
|
||||
patternEntries_.transfer(dict.patternEntries_);
|
||||
patternRegexps_.transfer(dict.patternRegexps_);
|
||||
patterns_.transfer(dict.patterns_);
|
||||
regexps_.transfer(dict.regexps_);
|
||||
}
|
||||
|
||||
|
||||
@ -1171,7 +1126,7 @@ void Foam::dictionary::operator=(const dictionary& rhs)
|
||||
// Create clones of the entries in the given dictionary
|
||||
// resetting the parentDict to this dictionary
|
||||
|
||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
||||
forAllConstIter(parent_type, rhs, iter)
|
||||
{
|
||||
add(iter().clone(*this).ptr());
|
||||
}
|
||||
@ -1188,7 +1143,7 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
||||
forAllConstIter(parent_type, rhs, iter)
|
||||
{
|
||||
add(iter().clone(*this).ptr());
|
||||
}
|
||||
@ -1205,7 +1160,7 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
||||
forAllConstIter(parent_type, rhs, iter)
|
||||
{
|
||||
if (!found(iter().keyword()))
|
||||
{
|
||||
@ -1225,7 +1180,7 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
||||
forAllConstIter(parent_type, rhs, iter)
|
||||
{
|
||||
set(iter().clone(*this).ptr());
|
||||
}
|
||||
|
||||
@ -100,8 +100,8 @@ class regExp;
|
||||
class dictionary;
|
||||
class SHA1Digest;
|
||||
|
||||
Istream& operator>>(Istream&, dictionary&);
|
||||
Ostream& operator<<(Ostream&, const dictionary&);
|
||||
Istream& operator>>(Istream& is, dictionary& dict);
|
||||
Ostream& operator<<(Ostream& os, const dictionary& dict);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dictionaryName Declaration
|
||||
@ -176,17 +176,28 @@ class dictionary
|
||||
//- Report optional keywords and values if not present in dictionary
|
||||
static bool writeOptionalEntries;
|
||||
|
||||
//- HashTable of the entries held on the DL-list for quick lookup
|
||||
HashTable<entry*> hashedEntries_;
|
||||
|
||||
//- Parent dictionary
|
||||
const dictionary& parent_;
|
||||
|
||||
//- HashTable of the entries held on the IDLList for quick lookup
|
||||
HashTable<entry*> hashedEntries_;
|
||||
|
||||
//- Entries of matching patterns
|
||||
DLList<entry*> patternEntries_;
|
||||
DLList<entry*> patterns_;
|
||||
|
||||
//- Patterns as precompiled regular expressions
|
||||
DLList<autoPtr<regExp>> patternRegexps_;
|
||||
DLList<autoPtr<regExp>> regexps_;
|
||||
|
||||
|
||||
// Typedefs
|
||||
|
||||
//- The storage container
|
||||
typedef IDLList<entry> parent_type;
|
||||
|
||||
typedef DLList<entry*>::iterator pattern_iterator;
|
||||
typedef DLList<entry*>::const_iterator pattern_const_iterator;
|
||||
typedef DLList<autoPtr<regExp>>::iterator regexp_iterator;
|
||||
typedef DLList<autoPtr<regExp>>::const_iterator regexp_const_iterator;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -200,24 +211,6 @@ class dictionary
|
||||
bool patternMatch
|
||||
) const;
|
||||
|
||||
//- Search patterns table for exact match or regular expression match
|
||||
bool findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::const_iterator& wcLink,
|
||||
DLList<autoPtr<regExp>>::const_iterator& reLink
|
||||
) const;
|
||||
|
||||
//- Search patterns table for exact match or regular expression match
|
||||
bool findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const word& Keyword,
|
||||
DLList<entry*>::iterator& wcLink,
|
||||
DLList<autoPtr<regExp>>::iterator& reLink
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -228,8 +221,7 @@ public:
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("dictionary");
|
||||
|
||||
|
||||
//- Null dictionary
|
||||
//- An empty dictionary, which is also the parent for all dictionaries
|
||||
static const dictionary null;
|
||||
|
||||
|
||||
@ -287,6 +279,8 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the parent dictionary
|
||||
const dictionary& parent() const
|
||||
{
|
||||
|
||||
@ -103,7 +103,7 @@ bool Foam::dictionary::read(Istream& is, const bool keepHeader)
|
||||
while (!is.eof() && entry::New(*this, is))
|
||||
{}
|
||||
|
||||
// normally remove the FoamFile header entry if it exists
|
||||
// Normally remove the FoamFile header entry if it exists
|
||||
if (!keepHeader)
|
||||
{
|
||||
remove("FoamFile");
|
||||
@ -140,7 +140,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword, bool mergeEntry)
|
||||
{
|
||||
const dictionary& addDict = ePtr->dict();
|
||||
|
||||
forAllConstIter(IDLList<entry>, addDict, iter)
|
||||
forAllConstIter(parent_type, addDict, iter)
|
||||
{
|
||||
add(iter(), mergeEntry);
|
||||
}
|
||||
@ -179,7 +179,7 @@ void Foam::dictionary::writeEntry(const keyType& kw, Ostream& os) const
|
||||
|
||||
void Foam::dictionary::writeEntries(Ostream& os, const bool extraNewLine) const
|
||||
{
|
||||
forAllConstIter(IDLList<entry>, *this, iter)
|
||||
forAllConstIter(parent_type, *this, iter)
|
||||
{
|
||||
const entry& e = *iter;
|
||||
|
||||
|
||||
@ -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"
|
||||
{ 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" },
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::timeControl::timeControls, 9>
|
||||
Foam::timeControl::timeControlNames_;
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -37,7 +37,7 @@ License
|
||||
#include "sigInt.H"
|
||||
#include "sigQuit.H"
|
||||
#include "sigSegv.H"
|
||||
#include "endian.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@ -54,22 +54,6 @@ Foam::string::size_type Foam::argList::usageMin = 20;
|
||||
Foam::string::size_type Foam::argList::usageMax = 80;
|
||||
Foam::word Foam::argList::postProcessOptionName("postProcess");
|
||||
|
||||
// file-scope
|
||||
// Hint about machine endian, OpenFOAM label and scalar sizes
|
||||
static const std::string archHint =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
|
||||
|
||||
Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
argList::addOption
|
||||
@ -407,11 +391,11 @@ void Foam::argList::getRootCase()
|
||||
fileName casePath;
|
||||
|
||||
// [-case dir] specified
|
||||
HashTable<string>::const_iterator iter = options_.find("case");
|
||||
auto optIter = options_.cfind("case");
|
||||
|
||||
if (iter != options_.end())
|
||||
if (optIter.found())
|
||||
{
|
||||
casePath = iter();
|
||||
casePath = optIter.object();
|
||||
casePath.clean();
|
||||
|
||||
if (casePath.empty() || casePath == ".")
|
||||
@ -639,7 +623,7 @@ void Foam::argList::parse
|
||||
{
|
||||
IOobject::writeBanner(Info, true)
|
||||
<< "Build : " << Foam::FOAMbuild << nl
|
||||
<< "Arch : " << archHint << nl
|
||||
<< "Arch : " << Foam::FOAMbuildArch << nl
|
||||
<< "Exec : " << argListStr_.c_str() << nl
|
||||
<< "Date : " << dateString.c_str() << nl
|
||||
<< "Time : " << timeString.c_str() << nl
|
||||
@ -650,7 +634,7 @@ void Foam::argList::parse
|
||||
jobInfo.add("startDate", dateString);
|
||||
jobInfo.add("startTime", timeString);
|
||||
jobInfo.add("userName", userName());
|
||||
jobInfo.add("foamVersion", word(FOAMversion));
|
||||
jobInfo.add("foamVersion", word(Foam::FOAMversion));
|
||||
jobInfo.add("code", executable_);
|
||||
jobInfo.add("argList", argListStr_);
|
||||
jobInfo.add("currentDir", cwd());
|
||||
@ -660,10 +644,10 @@ void Foam::argList::parse
|
||||
// Add build information - only use the first word
|
||||
{
|
||||
std::string build(Foam::FOAMbuild);
|
||||
std::string::size_type found = build.find(' ');
|
||||
if (found != std::string::npos)
|
||||
std::string::size_type space = build.find(' ');
|
||||
if (space != std::string::npos)
|
||||
{
|
||||
build.resize(found);
|
||||
build.resize(space);
|
||||
}
|
||||
jobInfo.add("foamBuild", build);
|
||||
}
|
||||
@ -695,15 +679,12 @@ void Foam::argList::parse
|
||||
source = options_["decomposeParDict"];
|
||||
if (isDir(source))
|
||||
{
|
||||
adjustOpt = true;
|
||||
source = source/"decomposeParDict";
|
||||
adjustOpt = true;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
!source.isAbsolute()
|
||||
&& !(source.size() && source[0] == '.')
|
||||
)
|
||||
// Case-relative if not absolute and not "./" etc
|
||||
if (!source.isAbsolute() && !source.startsWith("."))
|
||||
{
|
||||
source = rootPath_/globalCase_/source;
|
||||
adjustOpt = true;
|
||||
@ -1185,32 +1166,26 @@ void Foam::argList::printUsage() const
|
||||
|
||||
Info<< "\noptions:\n";
|
||||
|
||||
wordList opts = validOptions.sortedToc();
|
||||
forAll(opts, optI)
|
||||
const wordList opts = validOptions.sortedToc();
|
||||
for (const word& optionName : opts)
|
||||
{
|
||||
const word& optionName = opts[optI];
|
||||
|
||||
HashTable<string>::const_iterator iter = validOptions.find(optionName);
|
||||
Info<< " -" << optionName;
|
||||
label len = optionName.size() + 3; // Length includes leading ' -'
|
||||
|
||||
if (iter().size())
|
||||
auto optIter = validOptions.cfind(optionName);
|
||||
|
||||
if (optIter().size())
|
||||
{
|
||||
// Length includes space and between option/param and '<>'
|
||||
len += iter().size() + 3;
|
||||
Info<< " <" << iter().c_str() << '>';
|
||||
// Length includes space between option/param and '<>'
|
||||
len += optIter().size() + 3;
|
||||
Info<< " <" << optIter().c_str() << '>';
|
||||
}
|
||||
|
||||
HashTable<string>::const_iterator usageIter =
|
||||
optionUsage.find(optionName);
|
||||
auto usageIter = optionUsage.cfind(optionName);
|
||||
|
||||
if (usageIter != optionUsage.end())
|
||||
if (usageIter.found())
|
||||
{
|
||||
printOptionUsage
|
||||
(
|
||||
len,
|
||||
usageIter()
|
||||
);
|
||||
printOptionUsage(len, usageIter());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1220,26 +1195,13 @@ void Foam::argList::printUsage() const
|
||||
|
||||
// Place srcDoc/doc/help options at the end
|
||||
Info<< " -srcDoc";
|
||||
printOptionUsage
|
||||
(
|
||||
9,
|
||||
"display source code in browser"
|
||||
);
|
||||
printOptionUsage(9, "display source code in browser" );
|
||||
|
||||
Info<< " -doc";
|
||||
printOptionUsage
|
||||
(
|
||||
6,
|
||||
"display application documentation in browser"
|
||||
);
|
||||
printOptionUsage(6, "display application documentation in browser");
|
||||
|
||||
Info<< " -help";
|
||||
printOptionUsage
|
||||
(
|
||||
7,
|
||||
"print the usage"
|
||||
);
|
||||
|
||||
printOptionUsage(7, "print the usage");
|
||||
|
||||
printNotes();
|
||||
|
||||
@ -1247,7 +1209,7 @@ void Foam::argList::printUsage() const
|
||||
<<"Using: OpenFOAM-" << Foam::FOAMversion
|
||||
<< " (see www.OpenFOAM.com)" << nl
|
||||
<< "Build: " << Foam::FOAMbuild << nl
|
||||
<< "Arch: " << archHint << nl
|
||||
<< "Arch: " << Foam::FOAMbuildArch << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -1261,20 +1223,20 @@ void Foam::argList::displayDoc(bool source) const
|
||||
// For source code: change foo_8C.html to foo_8C_source.html
|
||||
if (source)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
for (fileName& ext : docExts)
|
||||
{
|
||||
docExts[extI].replace(".", "_source.");
|
||||
ext.replace(".", "_source.");
|
||||
}
|
||||
}
|
||||
|
||||
fileName docFile;
|
||||
bool found = false;
|
||||
|
||||
forAll(docDirs, dirI)
|
||||
for (const fileName& dir : docDirs)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
for (const fileName& ext : docExts)
|
||||
{
|
||||
docFile = docDirs[dirI]/executable_ + docExts[extI];
|
||||
docFile = dir/executable_ + ext;
|
||||
docFile.expand();
|
||||
|
||||
if (isFile(docFile))
|
||||
|
||||
@ -32,13 +32,20 @@ Global
|
||||
Foam::FOAMversion
|
||||
|
||||
Description
|
||||
OpenFOAM version number static string.
|
||||
OpenFOAM version number as a static string.
|
||||
|
||||
Global
|
||||
Foam::FOAMbuild
|
||||
|
||||
Description
|
||||
OpenFOAM version number static string with build information
|
||||
OpenFOAM build information as a static string
|
||||
|
||||
Global
|
||||
Foam::FOAMbuildArch
|
||||
|
||||
Description
|
||||
OpenFOAM build architecture information (endian, label/scalar sizes)
|
||||
as a static string
|
||||
|
||||
SourceFiles
|
||||
global.Cver
|
||||
@ -48,6 +55,8 @@ SourceFiles
|
||||
#ifndef foamVersion_H
|
||||
#define foamVersion_H
|
||||
|
||||
#include <string>
|
||||
|
||||
// The directory name for user-resources (located in the HOME directory)
|
||||
#define WM_USER_RESOURCE_DIRNAME ".OpenFOAM"
|
||||
|
||||
@ -57,6 +66,7 @@ namespace Foam
|
||||
{
|
||||
extern const char* const FOAMversion;
|
||||
extern const char* const FOAMbuild;
|
||||
extern const std::string FOAMbuildArch;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,10 +33,30 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#include "foamVersion.H"
|
||||
#include "endian.H"
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::FOAMversion = "VERSION_STRING";
|
||||
const char* const Foam::FOAMbuild = "BUILD_STRING";
|
||||
|
||||
// Information about machine endian, label and scalar sizes
|
||||
const std::string Foam::FOAMbuildArch =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Setup an error handler for the global new operator
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user