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 "fvcFlux.H"
|
||||||
#include "fvcMeshPhi.H"
|
#include "fvcMeshPhi.H"
|
||||||
#include "surfaceInterpolate.H"
|
#include "surfaceInterpolate.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,10 +44,6 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::scalar Foam::multiphaseMixtureThermo::convertToRad =
|
|
||||||
Foam::constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::multiphaseMixtureThermo::calcAlphas()
|
void Foam::multiphaseMixtureThermo::calcAlphas()
|
||||||
@ -855,7 +852,7 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
|
|||||||
|
|
||||||
bool matched = (tp.key().first() == alpha1.name());
|
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);
|
scalarField theta(boundary[patchi].size(), theta0);
|
||||||
|
|
||||||
scalar uTheta = tp().uTheta();
|
scalar uTheta = tp().uTheta();
|
||||||
@ -863,8 +860,8 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
|
|||||||
// Calculate the dynamic contact angle if required
|
// Calculate the dynamic contact angle if required
|
||||||
if (uTheta > SMALL)
|
if (uTheta > SMALL)
|
||||||
{
|
{
|
||||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||||
|
|
||||||
// Calculated the component of the velocity parallel to the wall
|
// Calculated the component of the velocity parallel to the wall
|
||||||
vectorField Uwall
|
vectorField Uwall
|
||||||
|
|||||||
@ -144,9 +144,6 @@ private:
|
|||||||
//- Stabilisation for normalisation of the interface normal
|
//- Stabilisation for normalisation of the interface normal
|
||||||
const dimensionedScalar deltaN_;
|
const dimensionedScalar deltaN_;
|
||||||
|
|
||||||
//- Conversion factor for degrees into radians
|
|
||||||
static const scalar convertToRad;
|
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
|
|||||||
@ -30,12 +30,7 @@ License
|
|||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvcGrad.H"
|
#include "fvcGrad.H"
|
||||||
#include "fvcSnGrad.H"
|
#include "fvcSnGrad.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const Foam::scalar Foam::threePhaseInterfaceProperties::convertToRad =
|
|
||||||
Foam::constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -83,7 +78,7 @@ void Foam::threePhaseInterfaceProperties::correctContactAngle
|
|||||||
|
|
||||||
scalarField theta
|
scalarField theta
|
||||||
(
|
(
|
||||||
convertToRad
|
degToRad()
|
||||||
* (
|
* (
|
||||||
twoPhaseAlpha2*(180 - a2cap.theta(U[patchi], nHatp))
|
twoPhaseAlpha2*(180 - a2cap.theta(U[patchi], nHatp))
|
||||||
+ twoPhaseAlpha3*(180 - a3cap.theta(U[patchi], nHatp))
|
+ twoPhaseAlpha3*(180 - a3cap.theta(U[patchi], nHatp))
|
||||||
|
|||||||
@ -91,10 +91,6 @@ class threePhaseInterfaceProperties
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Conversion factor for degrees into radians
|
|
||||||
static const scalar convertToRad;
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from volume fraction field alpha and IOdictionary
|
//- Construct from volume fraction field alpha and IOdictionary
|
||||||
|
|||||||
@ -35,12 +35,7 @@ License
|
|||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvcFlux.H"
|
#include "fvcFlux.H"
|
||||||
#include "fvcAverage.H"
|
#include "fvcAverage.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const Foam::scalar Foam::multiphaseSystem::convertToRad =
|
|
||||||
Foam::constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -290,7 +285,7 @@ void Foam::multiphaseSystem::correctContactAngle
|
|||||||
|
|
||||||
bool matched = (tp.key().first() == phase1.name());
|
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);
|
scalarField theta(boundary[patchi].size(), theta0);
|
||||||
|
|
||||||
scalar uTheta = tp().uTheta();
|
scalar uTheta = tp().uTheta();
|
||||||
@ -298,8 +293,8 @@ void Foam::multiphaseSystem::correctContactAngle
|
|||||||
// Calculate the dynamic contact angle if required
|
// Calculate the dynamic contact angle if required
|
||||||
if (uTheta > SMALL)
|
if (uTheta > SMALL)
|
||||||
{
|
{
|
||||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||||
|
|
||||||
// Calculated the component of the velocity parallel to the wall
|
// Calculated the component of the velocity parallel to the wall
|
||||||
vectorField Uwall
|
vectorField Uwall
|
||||||
|
|||||||
@ -187,9 +187,6 @@ private:
|
|||||||
//- Stabilisation for normalisation of the interface normal
|
//- Stabilisation for normalisation of the interface normal
|
||||||
const dimensionedScalar deltaN_;
|
const dimensionedScalar deltaN_;
|
||||||
|
|
||||||
//- Conversion factor for degrees into radians
|
|
||||||
static const scalar convertToRad;
|
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
|
|||||||
@ -33,12 +33,7 @@ License
|
|||||||
#include "fvcSnGrad.H"
|
#include "fvcSnGrad.H"
|
||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvcFlux.H"
|
#include "fvcFlux.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const Foam::scalar Foam::multiphaseMixture::convertToRad =
|
|
||||||
Foam::constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -456,7 +451,7 @@ void Foam::multiphaseMixture::correctContactAngle
|
|||||||
|
|
||||||
bool matched = (tp.key().first() == alpha1.name());
|
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);
|
scalarField theta(boundary[patchi].size(), theta0);
|
||||||
|
|
||||||
scalar uTheta = tp().uTheta();
|
scalar uTheta = tp().uTheta();
|
||||||
@ -464,8 +459,8 @@ void Foam::multiphaseMixture::correctContactAngle
|
|||||||
// Calculate the dynamic contact angle if required
|
// Calculate the dynamic contact angle if required
|
||||||
if (uTheta > SMALL)
|
if (uTheta > SMALL)
|
||||||
{
|
{
|
||||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||||
|
|
||||||
// Calculated the component of the velocity parallel to the wall
|
// Calculated the component of the velocity parallel to the wall
|
||||||
vectorField Uwall
|
vectorField Uwall
|
||||||
|
|||||||
@ -154,9 +154,6 @@ private:
|
|||||||
//- Stabilisation for normalisation of the interface normal
|
//- Stabilisation for normalisation of the interface normal
|
||||||
const dimensionedScalar deltaN_;
|
const dimensionedScalar deltaN_;
|
||||||
|
|
||||||
//- Conversion factor for degrees into radians
|
|
||||||
static const scalar convertToRad;
|
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,8 @@ License
|
|||||||
#include "fvmLaplacian.H"
|
#include "fvmLaplacian.H"
|
||||||
#include "fvmSup.H"
|
#include "fvmSup.H"
|
||||||
|
|
||||||
|
#include "unitConversion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -48,9 +50,6 @@ namespace Foam
|
|||||||
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
|
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Foam::scalar Foam::multiphaseSystem::convertToRad =
|
|
||||||
Foam::constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -399,7 +398,7 @@ void Foam::multiphaseSystem::correctContactAngle
|
|||||||
|
|
||||||
bool matched = (tp.key().first() == phase1.name());
|
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);
|
scalarField theta(boundary[patchi].size(), theta0);
|
||||||
|
|
||||||
scalar uTheta = tp().uTheta();
|
scalar uTheta = tp().uTheta();
|
||||||
@ -407,8 +406,8 @@ void Foam::multiphaseSystem::correctContactAngle
|
|||||||
// Calculate the dynamic contact angle if required
|
// Calculate the dynamic contact angle if required
|
||||||
if (uTheta > SMALL)
|
if (uTheta > SMALL)
|
||||||
{
|
{
|
||||||
scalar thetaA = convertToRad*tp().thetaA(matched);
|
const scalar thetaA = degToRad(tp().thetaA(matched));
|
||||||
scalar thetaR = convertToRad*tp().thetaR(matched);
|
const scalar thetaR = degToRad(tp().thetaR(matched));
|
||||||
|
|
||||||
// Calculated the component of the velocity parallel to the wall
|
// Calculated the component of the velocity parallel to the wall
|
||||||
vectorField Uwall
|
vectorField Uwall
|
||||||
|
|||||||
@ -65,9 +65,6 @@ class multiphaseSystem
|
|||||||
//- Stabilisation for normalisation of the interface normal
|
//- Stabilisation for normalisation of the interface normal
|
||||||
const dimensionedScalar deltaN_;
|
const dimensionedScalar deltaN_;
|
||||||
|
|
||||||
//- Conversion factor for degrees into radians
|
|
||||||
static const scalar convertToRad;
|
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
@ -207,10 +204,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "multiphaseSystemI.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -43,26 +43,17 @@ using namespace Foam::constant::mathematical;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<>
|
const Foam::Enum
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
<
|
||||||
Foam::compressible::
|
Foam::compressible::
|
||||||
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType,
|
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType
|
||||||
2
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"vapor",
|
|
||||||
"liquid"
|
|
||||||
};
|
|
||||||
|
|
||||||
const Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::compressible::
|
|
||||||
alphatWallBoilingWallFunctionFvPatchScalarField::phaseType,
|
|
||||||
2
|
|
||||||
>
|
>
|
||||||
Foam::compressible::
|
Foam::compressible::
|
||||||
alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_;
|
alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_
|
||||||
|
{
|
||||||
|
{ phaseType::vaporPhase, "vapor" },
|
||||||
|
{ phaseType::liquidPhase, "liquid" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -111,7 +102,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict),
|
alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict),
|
||||||
phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))),
|
phaseType_(phaseTypeNames_.lookup("phaseType", dict)),
|
||||||
relax_(dict.lookupOrDefault<scalar>("relax", 0.5)),
|
relax_(dict.lookupOrDefault<scalar>("relax", 0.5)),
|
||||||
AbyV_(p.size(), 0),
|
AbyV_(p.size(), 0),
|
||||||
alphatConv_(p.size(), 0),
|
alphatConv_(p.size(), 0),
|
||||||
|
|||||||
@ -164,7 +164,7 @@ private:
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Heat source type names
|
//- Heat source type names
|
||||||
static const NamedEnum<phaseType, 2> phaseTypeNames_;
|
static const Enum<phaseType> phaseTypeNames_;
|
||||||
|
|
||||||
//- Heat source type
|
//- Heat source type
|
||||||
phaseType phaseType_;
|
phaseType phaseType_;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
std::vector<bool> stlVector(n, true);
|
std::vector<bool> stlVector(n, true);
|
||||||
|
|
||||||
labelHashSet emptyHash;
|
labelHashSet emptyHash;
|
||||||
labelHashSet fullHash(1000);
|
labelHashSet fullHash(1024);
|
||||||
for (label i = 0; i < n; i++)
|
for (label i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
fullHash.insert(i);
|
fullHash.insert(i);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
dictionary dict;
|
dictionary dict;
|
||||||
dict.add(word("aa" + getEnv("WM_MPLIB") + "cc"), 16);
|
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);
|
stringOps::inplaceExpand(s, dict, true, false);
|
||||||
Info<< "variable expansion:" << s << endl;
|
Info<< "variable expansion:" << s << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void testMapDistribute()
|
|||||||
List<Tuple2<label, List<scalar>>> complexData(100);
|
List<Tuple2<label, List<scalar>>> complexData(100);
|
||||||
forAll(complexData, i)
|
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().setSize(3);
|
||||||
complexData[i].second()[0] = 1;
|
complexData[i].second()[0] = 1;
|
||||||
complexData[i].second()[1] = 2;
|
complexData[i].second()[1] = 2;
|
||||||
|
|||||||
@ -122,7 +122,7 @@ int main(int argc, char *argv[])
|
|||||||
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
||||||
OFstream pFile(pointsFile);
|
OFstream pFile(pointsFile);
|
||||||
|
|
||||||
scalar a(degToRad(0.1));
|
const scalar a = 0.1_deg;
|
||||||
tensor rotateZ =
|
tensor rotateZ =
|
||||||
tensor
|
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
|
// 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 iterf = pFaces[WEDGE][0].begin();
|
||||||
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
||||||
|
|||||||
@ -69,18 +69,12 @@ enum ExtrudeMode
|
|||||||
SURFACE
|
SURFACE
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Foam
|
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||||
{
|
{
|
||||||
template<>
|
{ ExtrudeMode::MESH, "mesh" },
|
||||||
const char* NamedEnum<ExtrudeMode, 3>::names[] =
|
{ ExtrudeMode::PATCH, "patch" },
|
||||||
{
|
{ ExtrudeMode::SURFACE, "surface" },
|
||||||
"mesh",
|
};
|
||||||
"patch",
|
|
||||||
"surface"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
|
|
||||||
|
|
||||||
|
|
||||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
||||||
@ -305,9 +299,10 @@ int main(int argc, char *argv[])
|
|||||||
const Switch flipNormals(dict.lookup("flipNormals"));
|
const Switch flipNormals(dict.lookup("flipNormals"));
|
||||||
|
|
||||||
// What to extrude
|
// What to extrude
|
||||||
const ExtrudeMode mode = ExtrudeModeNames.read
|
const ExtrudeMode mode = ExtrudeModeNames.lookup
|
||||||
(
|
(
|
||||||
dict.lookup("constructFrom")
|
"constructFrom",
|
||||||
|
dict
|
||||||
);
|
);
|
||||||
|
|
||||||
// Any merging of small edges
|
// Any merging of small edges
|
||||||
|
|||||||
@ -60,17 +60,11 @@ enum ExtrudeMode
|
|||||||
MESHEDSURFACE
|
MESHEDSURFACE
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Foam
|
static const Enum<ExtrudeMode> ExtrudeModeNames
|
||||||
{
|
{
|
||||||
template<>
|
{ ExtrudeMode::POLYMESH2D, "polyMesh2D" },
|
||||||
const char* NamedEnum<ExtrudeMode, 2>::names[] =
|
{ ExtrudeMode::MESHEDSURFACE, "MeshedSurface" },
|
||||||
{
|
};
|
||||||
"polyMesh2D",
|
|
||||||
"MeshedSurface"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
|
|
||||||
|
|
||||||
|
|
||||||
//pointField moveInitialPoints
|
//pointField moveInitialPoints
|
||||||
|
|||||||
@ -42,24 +42,20 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
defineTypeNameAndDebug(conformalVoronoiMesh, 0);
|
||||||
|
|
||||||
template<>
|
|
||||||
const char* NamedEnum
|
|
||||||
<
|
|
||||||
conformalVoronoiMesh::dualMeshPointType,
|
|
||||||
5
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"internal",
|
|
||||||
"surface",
|
|
||||||
"featureEdge",
|
|
||||||
"featurePoint",
|
|
||||||
"constrained"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::conformalVoronoiMesh::dualMeshPointType, 5>
|
const Foam::Enum
|
||||||
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_;
|
<
|
||||||
|
Foam::conformalVoronoiMesh::dualMeshPointType
|
||||||
|
>
|
||||||
|
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_
|
||||||
|
{
|
||||||
|
{ dualMeshPointType::internal, "internal" },
|
||||||
|
{ dualMeshPointType::surface, "surface" },
|
||||||
|
{ dualMeshPointType::featureEdge, "featureEdge" },
|
||||||
|
{ dualMeshPointType::featurePoint, "featurePoint" },
|
||||||
|
{ dualMeshPointType::constrained, "constrained" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -122,7 +122,7 @@ public:
|
|||||||
constrained = 4
|
constrained = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NamedEnum<dualMeshPointType, 5> dualMeshPointTypeNames_;
|
static const Enum<dualMeshPointType> dualMeshPointTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -33,10 +33,10 @@ License
|
|||||||
using namespace Foam::vectorTools;
|
using namespace Foam::vectorTools;
|
||||||
|
|
||||||
const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle
|
const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle
|
||||||
= Foam::cos(degToRad(30));
|
= Foam::cos(30.0_deg);
|
||||||
|
|
||||||
const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface
|
const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface
|
||||||
= Foam::cos(degToRad(150));
|
= Foam::cos(150.0_deg);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -27,20 +27,19 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<>
|
const Foam::Enum
|
||||||
const char*
|
<
|
||||||
Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>::names[] =
|
Foam::indexedCellEnum::cellTypes
|
||||||
|
>
|
||||||
|
Foam::indexedCellEnum::cellTypesNames_
|
||||||
{
|
{
|
||||||
"Unassigned",
|
{ cellTypes::ctUnassigned, "Unassigned" },
|
||||||
"Internal",
|
{ cellTypes::ctFar, "Far" },
|
||||||
"Surface",
|
{ cellTypes::ctInternal, "Internal" },
|
||||||
"FeatureEdge",
|
{ cellTypes::ctSurface, "Surface" },
|
||||||
"FeaturePoint",
|
{ cellTypes::ctFeatureEdge, "FeatureEdge" },
|
||||||
"Far"
|
{ cellTypes::ctFeaturePoint,"FeaturePoint" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>
|
|
||||||
cellTypesNames_;
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef indexedCellEnum_H
|
#ifndef indexedCellEnum_H
|
||||||
#define indexedCellEnum_H
|
#define indexedCellEnum_H
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,7 +47,6 @@ class indexedCellEnum
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
enum cellTypes
|
enum cellTypes
|
||||||
{
|
{
|
||||||
ctUnassigned = INT_MIN,
|
ctUnassigned = INT_MIN,
|
||||||
@ -58,7 +57,7 @@ public:
|
|||||||
ctFeaturePoint = INT_MIN + 5
|
ctFeaturePoint = INT_MIN + 5
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Foam::NamedEnum<cellTypes, 6> cellTypesNames_;
|
static const Enum<cellTypes> cellTypesNames_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,42 +28,42 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<>
|
const Foam::Enum
|
||||||
const char*
|
<
|
||||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>::names[] =
|
Foam::indexedVertexEnum::vertexType
|
||||||
|
>
|
||||||
|
Foam::indexedVertexEnum::vertexTypeNames_
|
||||||
{
|
{
|
||||||
"Unassigned",
|
{ vertexType::vtUnassigned, "Unassigned" },
|
||||||
"Internal",
|
{ vertexType::vtInternal, "Internal" },
|
||||||
"InternalNearBoundary",
|
{ vertexType::vtInternalNearBoundary, "InternalNearBoundary" },
|
||||||
"InternalSurface",
|
{ vertexType::vtInternalSurface, "InternalSurface" },
|
||||||
"InternalSurfaceBaffle",
|
{ vertexType::vtInternalSurfaceBaffle, "InternalSurfaceBaffle" },
|
||||||
"ExternalSurfaceBaffle",
|
{ vertexType::vtExternalSurfaceBaffle, "ExternalSurfaceBaffle" },
|
||||||
"InternalFeatureEdge",
|
{ vertexType::vtInternalFeatureEdge, "InternalFeatureEdge" },
|
||||||
"InternalFeatureEdgeBaffle",
|
{ vertexType::vtInternalFeatureEdgeBaffle, "InternalFeatureEdgeBaffle" },
|
||||||
"ExternalFeatureEdgeBaffle",
|
{ vertexType::vtExternalFeatureEdgeBaffle, "ExternalFeatureEdgeBaffle" },
|
||||||
"InternalFeaturePoint",
|
{ vertexType::vtInternalFeaturePoint, "InternalFeaturePoint" },
|
||||||
"ExternalSurface",
|
{ vertexType::vtExternalSurface, "ExternalSurface" },
|
||||||
"ExternalFeatureEdge",
|
{ vertexType::vtExternalFeatureEdge, "ExternalFeatureEdge" },
|
||||||
"ExternalFeaturePoint",
|
{ vertexType::vtExternalFeaturePoint, "ExternalFeaturePoint" },
|
||||||
"Far",
|
{ vertexType::vtFar, "Far" },
|
||||||
"Constrained"
|
{ vertexType::vtConstrained, "Constrained" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 15>
|
|
||||||
Foam::indexedVertexEnum::vertexTypeNames_;
|
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
template<>
|
<
|
||||||
const char*
|
Foam::indexedVertexEnum::vertexMotion
|
||||||
Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>::names[] =
|
>
|
||||||
|
Foam::indexedVertexEnum::vertexMotionNames_
|
||||||
{
|
{
|
||||||
"fixed",
|
{ vertexMotion::fixed, "fixed" },
|
||||||
"movable"
|
{ vertexMotion::movable, "movable" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>
|
|
||||||
vertexMotionNames_;
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<
|
Foam::Ostream& Foam::operator<<
|
||||||
(
|
(
|
||||||
|
|||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef indexedVertexEnum_H
|
#ifndef indexedVertexEnum_H
|
||||||
#define indexedVertexEnum_H
|
#define indexedVertexEnum_H
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ public:
|
|||||||
movable = 1
|
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&);
|
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.
|
// Collect sizes. Hash on names to handle local-only patches (e.g.
|
||||||
// processor patches)
|
// processor patches)
|
||||||
HashTable<label> patchSize(1000);
|
HashTable<label> patchSize(1024);
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
forAllConstIter(labelHashSet, includePatches, iter)
|
forAllConstIter(labelHashSet, includePatches, iter)
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ void extractSurface
|
|||||||
|
|
||||||
|
|
||||||
// Allocate zone/patch for all patches
|
// Allocate zone/patch for all patches
|
||||||
HashTable<label> compactZoneID(1000);
|
HashTable<label> compactZoneID(1024);
|
||||||
forAllConstIter(HashTable<label>, patchSize, iter)
|
forAllConstIter(HashTable<label>, patchSize, iter)
|
||||||
{
|
{
|
||||||
label sz = compactZoneID.size();
|
label sz = compactZoneID.size();
|
||||||
@ -848,7 +848,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
meshRefinement::readFlags
|
meshRefinement::readFlags
|
||||||
(
|
(
|
||||||
meshRefinement::IOdebugTypeNames,
|
meshRefinement::debugTypeNames,
|
||||||
flags
|
flags
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -873,7 +873,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
meshRefinement::readFlags
|
meshRefinement::readFlags
|
||||||
(
|
(
|
||||||
meshRefinement::IOwriteTypeNames,
|
meshRefinement::writeTypeNames,
|
||||||
flags
|
flags
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -892,7 +892,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
meshRefinement::readFlags
|
meshRefinement::readFlags
|
||||||
(
|
(
|
||||||
meshRefinement::IOoutputTypeNames,
|
meshRefinement::outputTypeNames,
|
||||||
flags
|
flags
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -59,6 +59,7 @@ Usage
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
#include "sigFpe.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "fvMeshTools.H"
|
#include "fvMeshTools.H"
|
||||||
@ -2277,7 +2278,7 @@ int main(int argc, char *argv[])
|
|||||||
bool newTimes = args.optionFound("newTimes");
|
bool newTimes = args.optionFound("newTimes");
|
||||||
|
|
||||||
|
|
||||||
if (env("FOAM_SIGFPE"))
|
if (Foam::sigFpe::requested())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
|
<< "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> selectedFields(0);
|
||||||
const HashSet<word> selectedLagrangianFields(0);
|
const HashSet<word> selectedLagrangianFields(0);
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ Description
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "globalFoam.H"
|
#include "globalFoam.H"
|
||||||
|
#include "foamVersion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -33,23 +33,14 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
const Foam::Enum
|
||||||
{
|
<
|
||||||
template<>
|
Foam::vector::components
|
||||||
const char* Foam::NamedEnum
|
>
|
||||||
<
|
Foam::channelIndex::vectorComponentsNames_
|
||||||
Foam::vector::components,
|
(
|
||||||
3
|
Foam::vector::components::X, { "x", "y", "z" }
|
||||||
>::names[] =
|
);
|
||||||
{
|
|
||||||
"x",
|
|
||||||
"y",
|
|
||||||
"z"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::vector::components, 3>
|
|
||||||
Foam::channelIndex::vectorComponentsNames_;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -233,7 +224,7 @@ Foam::channelIndex::channelIndex
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
symmetric_(readBool(dict.lookup("symmetric"))),
|
symmetric_(readBool(dict.lookup("symmetric"))),
|
||||||
dir_(vectorComponentsNames_.read(dict.lookup("component")))
|
dir_(vectorComponentsNames_.lookup("component", dict))
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class channelIndex
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
static const NamedEnum<vector::components, 3> vectorComponentsNames_;
|
static const Enum<vector::components> vectorComponentsNames_;
|
||||||
|
|
||||||
//- Is mesh symmetric
|
//- Is mesh symmetric
|
||||||
const bool symmetric_;
|
const bool symmetric_;
|
||||||
|
|||||||
@ -29,24 +29,19 @@ License
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "regionProperties.H"
|
#include "regionProperties.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::solverTemplate::solverType
|
||||||
|
>
|
||||||
|
Foam::solverTemplate::solverTypeNames_
|
||||||
{
|
{
|
||||||
template<>
|
{ solverType::stCompressible, "compressible" },
|
||||||
const char* Foam::NamedEnum<Foam::solverTemplate::solverType, 4>::names[] =
|
{ solverType::stIncompressible, "incompressible" },
|
||||||
{
|
{ solverType::stBuoyant, "buoyant" },
|
||||||
"compressible",
|
{ solverType::stUnknown, "unknown" },
|
||||||
"incompressible",
|
};
|
||||||
"buoyant",
|
|
||||||
"unknown"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::solverTemplate::solverType, 4>
|
|
||||||
Foam::solverTemplate::solverTypeNames_;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -261,7 +256,7 @@ Foam::solverTemplate::solverTemplate
|
|||||||
|
|
||||||
Info<< "Selecting " << solverName << ": ";
|
Info<< "Selecting " << solverName << ": ";
|
||||||
|
|
||||||
solverType_ = solverTypeNames_.read(solverDict.lookup("solverType"));
|
solverType_ = solverTypeNames_.lookup("solverType", solverDict);
|
||||||
Info<< solverTypeNames_[solverType_];
|
Info<< solverTypeNames_[solverType_];
|
||||||
|
|
||||||
multiRegion_ = readBool(solverDict.lookup("multiRegion"));
|
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();
|
return regionTypes_.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Description
|
|||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
#include "dimensionSet.H"
|
#include "dimensionSet.H"
|
||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Solver type names
|
//- Solver type names
|
||||||
static const NamedEnum<solverType, 4> solverTypeNames_;
|
static const Enum<solverType> solverTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
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;
|
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::PLANE, "plane" },
|
||||||
{ shapeSelector::shapeType::SPHERE, "sphere" },
|
{ shapeSelector::shapeType::SPHERE, "sphere" },
|
||||||
|
|||||||
@ -41,22 +41,16 @@ namespace Foam
|
|||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::tabulatedWallFunctions::general::interpolationType,
|
|
||||||
1
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"linear"
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const
|
const Foam::Enum
|
||||||
Foam::NamedEnum<Foam::tabulatedWallFunctions::general::interpolationType, 1>
|
<
|
||||||
Foam::tabulatedWallFunctions::general::interpolationTypeNames_;
|
Foam::tabulatedWallFunctions::general::interpolationType
|
||||||
|
>
|
||||||
|
Foam::tabulatedWallFunctions::general::interpolationTypeNames_
|
||||||
|
{
|
||||||
|
{ interpolationType::itLinear, "linear" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
@ -138,7 +132,7 @@ Foam::tabulatedWallFunctions::general::general
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
tabulatedWallFunction(dict, mesh, typeName),
|
tabulatedWallFunction(dict, mesh, typeName),
|
||||||
interpType_(interpolationTypeNames_[coeffDict_.lookup("interpType")]),
|
interpType_(interpolationTypeNames_.lookup("interpType", coeffDict_)),
|
||||||
yPlus_(),
|
yPlus_(),
|
||||||
uPlus_(),
|
uPlus_(),
|
||||||
log10YPlus_(coeffDict_.lookup("log10YPlus")),
|
log10YPlus_(coeffDict_.lookup("log10YPlus")),
|
||||||
|
|||||||
@ -63,7 +63,7 @@ SourceFiles
|
|||||||
#define general_H
|
#define general_H
|
||||||
|
|
||||||
#include "tabulatedWallFunction.H"
|
#include "tabulatedWallFunction.H"
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
itLinear
|
itLinear
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NamedEnum<interpolationType, 1> interpolationTypeNames_;
|
static const Enum<interpolationType> interpolationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -230,7 +230,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// From (name of) patch to compact 'zone' index
|
// From (name of) patch to compact 'zone' index
|
||||||
HashTable<label> compactZoneID(1000);
|
HashTable<label> compactZoneID(1024);
|
||||||
// Mesh face and compact zone indx
|
// Mesh face and compact zone indx
|
||||||
DynamicList<label> faceLabels;
|
DynamicList<label> faceLabels;
|
||||||
DynamicList<label> compactZones;
|
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.
|
// Collect sizes. Hash on names to handle local-only patches (e.g.
|
||||||
// processor patches)
|
// processor patches)
|
||||||
HashTable<label> patchSize(1000);
|
HashTable<label> patchSize(1024);
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
forAllConstIter(labelHashSet, includePatches, iter)
|
forAllConstIter(labelHashSet, includePatches, iter)
|
||||||
{
|
{
|
||||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
|||||||
nFaces += pp.size();
|
nFaces += pp.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
HashTable<label> zoneSize(1000);
|
HashTable<label> zoneSize(1024);
|
||||||
forAllConstIter(labelHashSet, includeFaceZones, iter)
|
forAllConstIter(labelHashSet, includeFaceZones, iter)
|
||||||
{
|
{
|
||||||
const faceZone& pp = fzm[iter.key()];
|
const faceZone& pp = fzm[iter.key()];
|
||||||
|
|||||||
@ -39,8 +39,9 @@ usage: ${0##*/}
|
|||||||
-foamVersion ver specify project version (eg, 1612)
|
-foamVersion ver specify project version (eg, 1612)
|
||||||
-projectName name specify project directory name (eg, openfoam1612)
|
-projectName name specify project directory name (eg, openfoam1612)
|
||||||
-archOption 32|64 specify 'WM_ARCH_OPTION' architecture option
|
-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'
|
-int32 | -int64 specify 'WM_LABEL_SIZE'
|
||||||
-SP | -DP specify 'WM_PRECISION_OPTION'
|
|
||||||
-system name specify 'system' compiler to be used
|
-system name specify 'system' compiler to be used
|
||||||
-third name specify 'ThirdParty' compiler to be used
|
-third name specify 'ThirdParty' compiler to be used
|
||||||
-boost ver specify 'boost_version'
|
-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)
|
-scotch-path dir specify 'SCOTCH_ARCH_PATH' (eg, /opt/OpenFOAM-scotch_6.0.4)
|
||||||
-vtk ver specify 'vtk_version' (eg, VTK-7.1.0)
|
-vtk ver specify 'vtk_version' (eg, VTK-7.1.0)
|
||||||
-mesa ver specify 'mesa_version' (eg, mesa-13.0.1)
|
-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)
|
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
||||||
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
||||||
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
||||||
@ -251,6 +252,18 @@ do
|
|||||||
shift
|
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)
|
-int32 | -int64)
|
||||||
# Replace WM_LABEL_SIZE=...
|
# Replace WM_LABEL_SIZE=...
|
||||||
optionValue="${1#-int}"
|
optionValue="${1#-int}"
|
||||||
@ -258,13 +271,6 @@ do
|
|||||||
adjusted=true
|
adjusted=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-SP | -DP)
|
|
||||||
# Replace WM_PRECISION_OPTION=...
|
|
||||||
optionValue="${1#-}"
|
|
||||||
replace etc/bashrc WM_PRECISION_OPTION "$optionValue"
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
-system)
|
-system)
|
||||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -471,20 +477,8 @@ do
|
|||||||
adjusted=true
|
adjusted=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-sigfpe)
|
-sigfpe | -no-sigfpe)
|
||||||
# Enable FOAM_SIGFPE handling
|
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
|
||||||
_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"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
12
etc/bashrc
12
etc/bashrc
@ -96,13 +96,13 @@ export WM_MPLIB=SYSTEMOPENMPI
|
|||||||
# WM_OSTYPE = POSIX
|
# WM_OSTYPE = POSIX
|
||||||
#export WM_OSTYPE=POSIX
|
#export WM_OSTYPE=POSIX
|
||||||
|
|
||||||
#- Floating-point signal handling:
|
#- Alternative to 'trapFpe' controlDict entry
|
||||||
# set or unset
|
# for floating-point exceptions (true|false)
|
||||||
export FOAM_SIGFPE=
|
#export FOAM_SIGFPE=true
|
||||||
|
|
||||||
#- memory initialisation:
|
#- Alternative to 'setNaN' controlDict entry
|
||||||
# set or unset
|
# for memory initialisation (true|false)
|
||||||
#export FOAM_SETNAN=
|
#export FOAM_SETNAN=false
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@ -16,11 +16,9 @@ FoamFile
|
|||||||
|
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
extractFromSurfaceCoeffs
|
includedAngle 150;
|
||||||
{
|
|
||||||
includedAngle 150;
|
geometricTestOnly no;
|
||||||
geometricTestOnly no;
|
|
||||||
}
|
|
||||||
|
|
||||||
subsetFeatures
|
subsetFeatures
|
||||||
{
|
{
|
||||||
|
|||||||
@ -257,19 +257,7 @@ if ( "$FOAM_MPI" != dummy ) then
|
|||||||
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}
|
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Alternative to 'mpiBufferSize' controlDict entry
|
||||||
# Minimum MPI buffer size (used by all except SGI MPI)
|
#setenv MPI_BUFFER_SIZE 20000000
|
||||||
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
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -274,18 +274,7 @@ then
|
|||||||
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI
|
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Alternative to 'mpiBufferSize' controlDict entry
|
||||||
# Minimum MPI buffer size (used by all except SGI MPI)
|
#export MPI_BUFFER_SIZE=20000000
|
||||||
: ${minBufferSize:=20000000}
|
|
||||||
if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
|
|
||||||
then
|
|
||||||
MPI_BUFFER_SIZE=$minBufferSize
|
|
||||||
fi
|
|
||||||
export MPI_BUFFER_SIZE
|
|
||||||
|
|
||||||
|
|
||||||
# Cleanup environment
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~
|
|
||||||
unset minBufferSize
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -65,6 +65,11 @@ OptimisationSwitches
|
|||||||
floatTransfer 0;
|
floatTransfer 0;
|
||||||
nProcsSimpleSum 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
|
// Optional max size (bytes) for unstructured data exchanges. In some
|
||||||
// phases of OpenFOAM it can send over very large data chunks
|
// phases of OpenFOAM it can send over very large data chunks
|
||||||
// (e.g. in parallel load balancing) and some Pstream implementations have
|
// (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)
|
// global reduction, even if multi-pass is not needed)
|
||||||
maxCommsSize 0;
|
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)
|
// Force dumping (at next timestep) upon signal (-1 to disable)
|
||||||
writeNowSignal -1; // 10;
|
writeNowSignal -1; // 10;
|
||||||
|
|
||||||
|
|||||||
12
etc/cshrc
12
etc/cshrc
@ -93,13 +93,13 @@ setenv WM_MPLIB SYSTEMOPENMPI
|
|||||||
# WM_OSTYPE = POSIX
|
# WM_OSTYPE = POSIX
|
||||||
#setenv WM_OSTYPE POSIX
|
#setenv WM_OSTYPE POSIX
|
||||||
|
|
||||||
#- Floating-point signal handling:
|
#- Alternative to 'trapFpe' controlDict entry
|
||||||
# set or unset
|
# for floating-point exceptions (true|false)
|
||||||
setenv FOAM_SIGFPE
|
#setenv FOAM_SIGFPE true
|
||||||
|
|
||||||
#- memory initialisation:
|
#- Alternative to 'setNaN' controlDict entry
|
||||||
# set or unset
|
# for memory initialisation (true|false)
|
||||||
#setenv FOAM_SETNAN
|
#setenv FOAM_SETNAN false
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@ -18,10 +18,7 @@ CAD.obj
|
|||||||
{
|
{
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
extractFromSurfaceCoeffs
|
includedAngle 150;
|
||||||
{
|
|
||||||
includedAngle 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
subsetFeatures
|
subsetFeatures
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,10 +18,7 @@ CAD.obj
|
|||||||
{
|
{
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
extractFromSurfaceCoeffs
|
includedAngle 150;
|
||||||
{
|
|
||||||
includedAngle 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
subsetFeatures
|
subsetFeatures
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,10 +18,7 @@ CAD.obj
|
|||||||
{
|
{
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
extractFromSurfaceCoeffs
|
includedAngle 150;
|
||||||
{
|
|
||||||
includedAngle 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
subsetFeatures
|
subsetFeatures
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,25 +45,22 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
|
const Foam::Enum
|
||||||
Foam::fileMonitor::fileStateNames_;
|
<
|
||||||
|
Foam::fileMonitor::fileState
|
||||||
|
>
|
||||||
|
Foam::fileMonitor::fileStateNames_
|
||||||
|
{
|
||||||
|
{ fileState::UNMODIFIED, "unmodified" },
|
||||||
|
{ fileState::MODIFIED, "modified" },
|
||||||
|
{ fileState::DELETED, "deleted" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fileMonitor, 0);
|
defineTypeNameAndDebug(fileMonitor, 0);
|
||||||
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::fileMonitor::fileState,
|
|
||||||
3
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"unmodified",
|
|
||||||
"modified",
|
|
||||||
"deleted"
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Reduction operator for PackedList of fileState
|
//- Reduction operator for PackedList of fileState
|
||||||
class reduceFileStates
|
class reduceFileStates
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,7 +43,7 @@ SourceFiles
|
|||||||
#define fileMonitor_H
|
#define fileMonitor_H
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
DELETED = 2
|
DELETED = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NamedEnum<fileState, 3> fileStateNames_;
|
static const Enum<fileState> fileStateNames_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private data
|
// 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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::regExp::set(const char* pattern, bool ignoreCase)
|
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.
|
//- Return true if it matches and sets the sub-groups matched.
|
||||||
bool matchGrouping
|
bool matchGrouping
|
||||||
(
|
(
|
||||||
const std::string&,
|
const std::string& text,
|
||||||
List<std::string>& groups
|
List<std::string>& groups
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -99,17 +99,23 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- 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
|
//- 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
|
//- Construct from string, optionally ignore case
|
||||||
regExp(const std::string& pattern, bool ignoreCase=false);
|
inline regExp(const std::string& pattern, bool ignoreCase);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~regExp();
|
inline ~regExp();
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
@ -143,20 +149,20 @@ public:
|
|||||||
|
|
||||||
// Matching/Searching
|
// Matching/Searching
|
||||||
|
|
||||||
//- Find position within string.
|
//- Find position within the text.
|
||||||
// \Return The index where it begins or string::npos if not found
|
// \return The index where it begins or string::npos if not found
|
||||||
std::string::size_type find(const std::string& text) const;
|
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
|
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||||
bool match(const std::string& text) const;
|
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
|
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||||
bool match(const std::string& text, List<std::string>& groups) const;
|
bool match(const std::string& text, List<std::string>& groups) const;
|
||||||
|
|
||||||
//- Return true if the regex was found within string
|
//- Return true if the regex was found within the text
|
||||||
bool search(const std::string& text) const;
|
inline bool search(const std::string& text) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// 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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::regExp::empty() const
|
inline bool Foam::regExp::empty() const
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "JobInfo.H"
|
#include "JobInfo.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
#ifdef LINUX_GNUC
|
#ifdef LINUX_GNUC
|
||||||
#ifndef __USE_GNU
|
#ifndef __USE_GNU
|
||||||
@ -43,17 +44,41 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * 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_;
|
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)
|
void Foam::sigFpe::fillNan(UList<scalar>& lst)
|
||||||
{
|
{
|
||||||
lst = std::numeric_limits<scalar>::signaling_NaN();
|
lst = std::numeric_limits<scalar>::signaling_NaN();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::sigFpe::mallocNanActive_ = false;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -128,9 +153,15 @@ Foam::sigFpe::~sigFpe()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sigFpe::requested()
|
||||||
|
{
|
||||||
|
return isTrue("FOAM_SIGFPE", switchFpe_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sigFpe::set(const bool verbose)
|
void Foam::sigFpe::set(const bool verbose)
|
||||||
{
|
{
|
||||||
if (!sigFpeActive_ && env("FOAM_SIGFPE"))
|
if (!sigActive_ && requested())
|
||||||
{
|
{
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
|
|
||||||
@ -155,7 +186,7 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
sigFpeActive_ = true;
|
sigActive_ = true;
|
||||||
|
|
||||||
#elif defined(sgiN32) || defined(sgiN32Gcc)
|
#elif defined(sgiN32) || defined(sgiN32Gcc)
|
||||||
supported = true;
|
supported = true;
|
||||||
@ -179,28 +210,28 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
nullptr
|
nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
sigFpeActive_ = true;
|
sigActive_ = true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
|
Info<< "trapFpe: Floating point exception trapping ";
|
||||||
|
|
||||||
if (supported)
|
if (supported)
|
||||||
{
|
{
|
||||||
Info<< "sigFpe : Enabling floating point exception trapping"
|
Info<< "enabled (FOAM_SIGFPE)." << endl;
|
||||||
<< " (FOAM_SIGFPE)." << endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "sigFpe : Floating point exception trapping"
|
Info<< "- not supported on this platform" << endl;
|
||||||
<< " - not supported on this platform" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (env("FOAM_SETNAN"))
|
if (isTrue("FOAM_SETNAN", switchNan_))
|
||||||
{
|
{
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
mallocNanActive_ = true;
|
mallocNanActive_ = true;
|
||||||
@ -208,15 +239,15 @@ void Foam::sigFpe::set(const bool verbose)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
|
Info<< "setNaN : Initialise allocated memory to NaN ";
|
||||||
|
|
||||||
if (mallocNanActive_)
|
if (mallocNanActive_)
|
||||||
{
|
{
|
||||||
Info<< "SetNaN : Initialising allocated memory to NaN"
|
Info<< "enabled (FOAM_SETNAN)." << endl;
|
||||||
<< " (FOAM_SETNAN)." << endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "SetNaN : Initialise allocated memory to NaN"
|
Info<< " - not supported on this platform" << endl;
|
||||||
<< " - not supported on this platform" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +258,7 @@ void Foam::sigFpe::unset(const bool verbose)
|
|||||||
{
|
{
|
||||||
#ifdef LINUX_GNUC
|
#ifdef LINUX_GNUC
|
||||||
// Reset signal
|
// Reset signal
|
||||||
if (sigFpeActive_)
|
if (sigActive_)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -256,7 +287,7 @@ void Foam::sigFpe::unset(const bool verbose)
|
|||||||
<< "Cannot reset SIGFPE trapping"
|
<< "Cannot reset SIGFPE trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
sigFpeActive_ = false;
|
sigActive_ = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -27,17 +27,24 @@ Class
|
|||||||
Description
|
Description
|
||||||
Set up trapping for floating point exceptions (signal FPE).
|
Set up trapping for floating point exceptions (signal FPE).
|
||||||
|
|
||||||
Controlled by two env vars:
|
Defined by controlDict InfoSwitch entries:
|
||||||
- \par FOAM_SIGFPE
|
- \par trapFpe
|
||||||
Exception trapping
|
Enable floating point 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.
|
|
||||||
|
|
||||||
Can be used either directly through the static member functions or
|
- \par setNaN
|
||||||
through the scope of the object (constructor sets trapping; destructor
|
Initialization all malloced memory to NaN.
|
||||||
restores original).
|
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
|
SourceFiles
|
||||||
sigFpe.C
|
sigFpe.C
|
||||||
@ -73,12 +80,20 @@ class sigFpe
|
|||||||
{
|
{
|
||||||
// Private data
|
// 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
|
//- Saved old signal trapping setting
|
||||||
static struct sigaction oldAction_;
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
//- Flag to indicate floating point trapping is enabled
|
|
||||||
static bool sigFpeActive_;
|
|
||||||
|
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
@ -90,6 +105,11 @@ class sigFpe
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public data
|
||||||
|
|
||||||
|
//- Flag to indicate mallocNan is enabled
|
||||||
|
static bool mallocNanActive_;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -103,6 +123,11 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// 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
|
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
|
||||||
// Fill memory with NaN when FOAM_SETNAN is %set
|
// Fill memory with NaN when FOAM_SETNAN is %set
|
||||||
static void set(const bool verbose);
|
static void set(const bool verbose);
|
||||||
@ -110,16 +135,13 @@ public:
|
|||||||
//- Deactivate SIGFPE signal handler and NaN memory initialisation
|
//- Deactivate SIGFPE signal handler and NaN memory initialisation
|
||||||
static void unset(const bool verbose);
|
static void unset(const bool verbose);
|
||||||
|
|
||||||
//- Flag to indicate mallocNan is enabled
|
|
||||||
static bool mallocNanActive_;
|
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
//- Malloc function which initializes to NaN
|
//- Malloc function which initializes to NaN
|
||||||
static void* mallocNan(size_t size);
|
static void* mallocNan(size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- Fill block of data with NaN
|
//- 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)
|
if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot call sigQuit::set() more than once"
|
<< "Cannot call more than once"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
sigActive_ = true;
|
sigActive_ = true;
|
||||||
@ -100,9 +100,9 @@ void Foam::sigQuit::unset(const bool)
|
|||||||
{
|
{
|
||||||
if (sigaction(SIGQUIT, &oldAction_, nullptr) < 0)
|
if (sigaction(SIGQUIT, &oldAction_, nullptr) < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot set SIGQUIT trapping"
|
<< "Cannot unset SIGQUIT trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
sigActive_ = false;
|
sigActive_ = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void Foam::sigSegv::set(const bool)
|
|||||||
if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)
|
if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot call sigSegv::set() more than once"
|
<< "Cannot call more than once"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
sigActive_ = true;
|
sigActive_ = true;
|
||||||
@ -101,7 +101,7 @@ void Foam::sigSegv::unset(const bool)
|
|||||||
if (sigaction(SIGSEGV, &oldAction_, nullptr) < 0)
|
if (sigaction(SIGSEGV, &oldAction_, nullptr) < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot set SIGSEGV trapping"
|
<< "Cannot unset SIGSEGV trapping"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
sigActive_ = false;
|
sigActive_ = false;
|
||||||
|
|||||||
@ -78,7 +78,6 @@ addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_
|
|||||||
|
|
||||||
Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ = nullptr;
|
Foam::Time const* Foam::sigStopAtWriteNow::runTimePtr_ = nullptr;
|
||||||
|
|
||||||
|
|
||||||
struct sigaction Foam::sigStopAtWriteNow::oldAction_;
|
struct sigaction Foam::sigStopAtWriteNow::oldAction_;
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +108,8 @@ void Foam::sigStopAtWriteNow::sigHandler(int)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow(){}
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||||
|
|||||||
@ -67,6 +67,7 @@ class sigStopAtWriteNow
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Handler for caught signals
|
||||||
static void sigHandler(int);
|
static void sigHandler(int);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,13 +33,13 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Signal number to catch
|
// Signal number to catch
|
||||||
int sigWriteNow::signal_
|
int sigWriteNow::signal_
|
||||||
(
|
(
|
||||||
debug::optimisationSwitch("writeNowSignal", -1)
|
debug::optimisationSwitch("writeNowSignal", -1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Register re-reader
|
// Register re-reader
|
||||||
class addwriteNowSignalToOpt
|
class addwriteNowSignalToOpt
|
||||||
:
|
:
|
||||||
@ -75,7 +75,6 @@ addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal");
|
|||||||
|
|
||||||
Foam::Time* Foam::sigWriteNow::runTimePtr_ = nullptr;
|
Foam::Time* Foam::sigWriteNow::runTimePtr_ = nullptr;
|
||||||
|
|
||||||
|
|
||||||
struct sigaction Foam::sigWriteNow::oldAction_;
|
struct sigaction Foam::sigWriteNow::oldAction_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class sigWriteNow
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Handler for caught signals
|
||||||
static void sigHandler(int);
|
static void sigHandler(int);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -123,6 +123,7 @@ $(ranges)/labelRange/labelRange.C
|
|||||||
$(ranges)/labelRange/labelRanges.C
|
$(ranges)/labelRange/labelRanges.C
|
||||||
$(ranges)/scalarRange/scalarRange.C
|
$(ranges)/scalarRange/scalarRange.C
|
||||||
$(ranges)/scalarRange/scalarRanges.C
|
$(ranges)/scalarRange/scalarRanges.C
|
||||||
|
$(ranges)/tableBounds/tableBounds.C
|
||||||
|
|
||||||
spatialVectorAlgebra = primitives/spatialVectorAlgebra
|
spatialVectorAlgebra = primitives/spatialVectorAlgebra
|
||||||
$(spatialVectorAlgebra)/SpatialVector/spatialVector/spatialVector.C
|
$(spatialVectorAlgebra)/SpatialVector/spatialVector/spatialVector.C
|
||||||
|
|||||||
@ -27,23 +27,17 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::volumeType
|
||||||
|
>
|
||||||
|
Foam::volumeType::names
|
||||||
{
|
{
|
||||||
template<>
|
{ type::UNKNOWN, "unknown" },
|
||||||
const char* Foam::NamedEnum
|
{ type::MIXED, "mixed" },
|
||||||
<
|
{ type::INSIDE, "inside" },
|
||||||
Foam::volumeType,
|
{ type::OUTSIDE, "outside" },
|
||||||
4
|
};
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"unknown",
|
|
||||||
"mixed",
|
|
||||||
"inside",
|
|
||||||
"outside"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef volumeType_H
|
#ifndef volumeType_H
|
||||||
#define volumeType_H
|
#define volumeType_H
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ namespace Foam
|
|||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class volumeType;
|
class volumeType;
|
||||||
Istream& operator>>(Istream& is, volumeType&);
|
Istream& operator>>(Istream& is, volumeType& vt);
|
||||||
Ostream& operator<<(Ostream& os, const volumeType& C);
|
Ostream& operator<<(Ostream& os, const volumeType& vt);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -65,6 +65,9 @@ public:
|
|||||||
OUTSIDE = 3
|
OUTSIDE = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
static const Enum<volumeType> names;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -76,11 +79,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data
|
|
||||||
|
|
||||||
static const NamedEnum<volumeType, 4> names;
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
|
|||||||
@ -50,7 +50,7 @@ Foam::Distribution<Type>::Distribution(const Type& binWidth)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Distribution<Type>::Distribution(const Distribution<Type>& d)
|
Foam::Distribution<Type>::Distribution(const Distribution<Type>& d)
|
||||||
:
|
:
|
||||||
List<List<scalar>>(static_cast<const List<List<scalar>>& >(d)),
|
List<List<scalar>>(static_cast<const List<List<scalar>>&>(d)),
|
||||||
binWidth_(d.binWidth()),
|
binWidth_(d.binWidth()),
|
||||||
listStarts_(d.listStarts())
|
listStarts_(d.listStarts())
|
||||||
{}
|
{}
|
||||||
@ -603,7 +603,7 @@ Foam::Ostream& Foam::operator<<
|
|||||||
const Distribution<Type>& d
|
const Distribution<Type>& d
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << static_cast<const List<List<scalar>>& >(d)
|
os << static_cast<const List<List<scalar>>&>(d)
|
||||||
<< d.binWidth_ << token::SPACE
|
<< d.binWidth_ << token::SPACE
|
||||||
<< d.listStarts_;
|
<< d.listStarts_;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,37 +32,32 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(IOobject, 0);
|
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
|
// Default fileCheck type
|
||||||
Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking
|
Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking
|
||||||
(
|
(
|
||||||
fileCheckTypesNames.read
|
fileCheckTypesNames.lookup
|
||||||
(
|
(
|
||||||
debug::optimisationSwitches().lookup
|
"fileModificationChecking",
|
||||||
(
|
debug::optimisationSwitches()
|
||||||
"fileModificationChecking"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
// Register re-reader
|
// 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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Return components following the IOobject requirements
|
// Return components following the IOobject requirements
|
||||||
@ -109,10 +115,10 @@ namespace Foam
|
|||||||
// ----- ------
|
// ----- ------
|
||||||
// "foo" ("", "", "foo")
|
// "foo" ("", "", "foo")
|
||||||
// "foo/bar" ("foo", "", "bar")
|
// "foo/bar" ("foo", "", "bar")
|
||||||
// "/XXX/bar" ("/XXX", "", "bar")
|
|
||||||
// "foo/bar/" ERROR - no name
|
// "foo/bar/" ERROR - no name
|
||||||
// "foo/xxx/bar" ("foo", "xxx", "bar")
|
// "foo/xxx/bar" ("foo", "xxx", "bar")
|
||||||
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
|
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
|
||||||
|
// "/xxx/yyy/bar" ("/xxx/yyy", "", "bar")
|
||||||
bool Foam::IOobject::fileNameComponents
|
bool Foam::IOobject::fileNameComponents
|
||||||
(
|
(
|
||||||
const fileName& path,
|
const fileName& path,
|
||||||
@ -125,7 +131,7 @@ bool Foam::IOobject::fileNameComponents
|
|||||||
local.clear();
|
local.clear();
|
||||||
name.clear();
|
name.clear();
|
||||||
|
|
||||||
// called with directory
|
// Called with directory
|
||||||
if (isDir(path))
|
if (isDir(path))
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
@ -134,44 +140,49 @@ bool Foam::IOobject::fileNameComponents
|
|||||||
return false;
|
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);
|
instance = path.substr(0, last);
|
||||||
|
|
||||||
// Check afterwards
|
const std::string ending = path.substr(last+1);
|
||||||
name.string::operator=(path.substr(last+1));
|
nameLen = ending.size(); // The raw length of name
|
||||||
|
name = word::validated(ending, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string::size_type first = path.find('/');
|
// Normal case.
|
||||||
|
// First part is instance, remainder is local
|
||||||
|
instance = path.substr(0, first);
|
||||||
|
|
||||||
if (first == string::npos)
|
if (last > first)
|
||||||
{
|
{
|
||||||
// no '/' found - no instance or local
|
// With local
|
||||||
|
local = path.substr(first+1, last-first-1);
|
||||||
// check afterwards
|
|
||||||
name.string::operator=(path);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
instance = path.substr(0, first);
|
|
||||||
|
|
||||||
string::size_type last = path.rfind('/');
|
const std::string ending = path.substr(last+1);
|
||||||
if (last > first)
|
nameLen = ending.size(); // The raw length of name
|
||||||
{
|
name = word::validated(ending, false);
|
||||||
// with local
|
|
||||||
local = path.substr(first+1, last-first-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check afterwards
|
|
||||||
name.string::operator=(path.substr(last+1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check for valid (and stripped) name, regardless of the debug level
|
// Check for valid (and stripped) name, regardless of the debug level
|
||||||
if (name.empty() || string::stripInvalid<word>(name))
|
if (!nameLen || nameLen != name.size())
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "has invalid word for name: \"" << name
|
<< "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
|
const Foam::fileName& Foam::IOobject::caseName() const
|
||||||
{
|
{
|
||||||
return time().caseName();
|
return time().caseName();
|
||||||
@ -359,24 +376,24 @@ const Foam::fileName& Foam::IOobject::caseName() const
|
|||||||
|
|
||||||
Foam::word Foam::IOobject::group() 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;
|
return word::null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return name_.substr(i+1, word::npos);
|
return name_.substr(i+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::IOobject::member() const
|
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_;
|
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
|
Foam::fileName Foam::IOobject::path() const
|
||||||
{
|
{
|
||||||
if (instance().isAbsolute())
|
if (isOutsideOfCase(instance()))
|
||||||
{
|
{
|
||||||
return instance();
|
return instance();
|
||||||
}
|
}
|
||||||
@ -419,9 +430,9 @@ Foam::fileName Foam::IOobject::path
|
|||||||
|
|
||||||
Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
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))
|
if (isFile(objectPath))
|
||||||
{
|
{
|
||||||
@ -434,8 +445,8 @@ Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileName path = this->path();
|
const fileName path = this->path();
|
||||||
fileName objectPath = path/name();
|
const fileName objectPath = path/name();
|
||||||
|
|
||||||
if (isFile(objectPath))
|
if (isFile(objectPath))
|
||||||
{
|
{
|
||||||
@ -445,14 +456,14 @@ Foam::fileName Foam::IOobject::localFilePath(const bool search) const
|
|||||||
{
|
{
|
||||||
if (!isDir(path) && search)
|
if (!isDir(path) && search)
|
||||||
{
|
{
|
||||||
word newInstancePath = time().findInstancePath
|
const word newInstancePath = time().findInstancePath
|
||||||
(
|
(
|
||||||
instant(instance())
|
instant(instance())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newInstancePath.size())
|
if (newInstancePath.size())
|
||||||
{
|
{
|
||||||
fileName fName
|
const fileName fName
|
||||||
(
|
(
|
||||||
rootPath()/caseName()
|
rootPath()/caseName()
|
||||||
/newInstancePath/db_.dbDir()/local()/name()
|
/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
|
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 (isFile(objectPath))
|
||||||
{
|
{
|
||||||
if (objectRegistry::debug)
|
if (objectRegistry::debug)
|
||||||
@ -497,8 +508,8 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileName path = this->path();
|
const fileName path = this->path();
|
||||||
fileName objectPath = path/name();
|
const fileName objectPath = path/name();
|
||||||
|
|
||||||
if (isFile(objectPath))
|
if (isFile(objectPath))
|
||||||
{
|
{
|
||||||
@ -521,7 +532,7 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
|||||||
{
|
{
|
||||||
// Constant & system can come from global case
|
// Constant & system can come from global case
|
||||||
|
|
||||||
fileName parentObjectPath =
|
const fileName parentObjectPath =
|
||||||
rootPath()/time().globalCaseName()
|
rootPath()/time().globalCaseName()
|
||||||
/instance()/db().dbDir()/local()/name();
|
/instance()/db().dbDir()/local()/name();
|
||||||
|
|
||||||
@ -539,14 +550,14 @@ Foam::fileName Foam::IOobject::globalFilePath(const bool search) const
|
|||||||
// Check for approximately same (local) time
|
// Check for approximately same (local) time
|
||||||
if (!isDir(path) && search)
|
if (!isDir(path) && search)
|
||||||
{
|
{
|
||||||
word newInstancePath = time().findInstancePath
|
const word newInstancePath = time().findInstancePath
|
||||||
(
|
(
|
||||||
instant(instance())
|
instant(instance())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newInstancePath.size())
|
if (newInstancePath.size())
|
||||||
{
|
{
|
||||||
fileName fName
|
const fileName fName
|
||||||
(
|
(
|
||||||
rootPath()/caseName()
|
rootPath()/caseName()
|
||||||
/newInstancePath/db().dbDir()/local()/name()
|
/newInstancePath/db().dbDir()/local()/name()
|
||||||
@ -591,10 +602,8 @@ Foam::Istream* Foam::IOobject::objectStream(const fileName& fName)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -617,6 +626,8 @@ void Foam::IOobject::setBad(const string& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::IOobject::operator=(const IOobject& io)
|
void Foam::IOobject::operator=(const IOobject& io)
|
||||||
{
|
{
|
||||||
name_ = io.name_;
|
name_ = io.name_;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,7 +76,7 @@ SourceFiles
|
|||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
inotifyMaster
|
inotifyMaster
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NamedEnum<fileCheckTypes, 4> fileCheckTypesNames;
|
static const Enum<fileCheckTypes> fileCheckTypesNames;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -191,6 +191,12 @@ public:
|
|||||||
TypeName("IOobject");
|
TypeName("IOobject");
|
||||||
|
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
//- Type of file modification checking
|
||||||
|
static fileCheckTypes fileModificationChecking;
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
//- Split path into instance, local, name components
|
//- Split path into instance, local, name components
|
||||||
@ -202,11 +208,9 @@ public:
|
|||||||
word& name
|
word& name
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class Name>
|
//- Create dot-delimited name.group
|
||||||
static inline word groupName(Name name, const word& group);
|
template<class StringType>
|
||||||
|
static inline word groupName(StringType name, const word& group);
|
||||||
//- Type of file modification checking
|
|
||||||
static fileCheckTypes fileModificationChecking;
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -280,214 +284,162 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// General access
|
// General access
|
||||||
|
|
||||||
//- Return time
|
//- Return the local objectRegistry
|
||||||
const Time& time() const;
|
const objectRegistry& db() const;
|
||||||
|
|
||||||
//- Return the local objectRegistry
|
//- Return time
|
||||||
const objectRegistry& db() const;
|
const Time& time() const;
|
||||||
|
|
||||||
//- Return name
|
//- Return name
|
||||||
const word& name() const
|
inline const word& name() const;
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return name of the class name read from header
|
//- Return name of the class name read from header
|
||||||
const word& headerClassName() const
|
inline const word& headerClassName() const;
|
||||||
{
|
|
||||||
return headerClassName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-constant access to the optional note
|
//- Return the optional note
|
||||||
string& note()
|
inline const string& note() const;
|
||||||
{
|
|
||||||
return note_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the optional note
|
//- Return non-constant access to the optional note
|
||||||
const string& note() const
|
inline string& note();
|
||||||
{
|
|
||||||
return note_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Rename
|
//- Rename
|
||||||
virtual void rename(const word& newName)
|
virtual void rename(const word& newName)
|
||||||
{
|
{
|
||||||
name_ = newName;
|
name_ = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Register object created from this IOobject with registry if true
|
//- Register object created from this IOobject with registry if true
|
||||||
bool& registerObject()
|
inline bool registerObject() const;
|
||||||
{
|
|
||||||
return registerObject_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Register object created from this IOobject with registry if true
|
//- Register object created from this IOobject with registry if true
|
||||||
bool registerObject() const
|
inline bool& registerObject();
|
||||||
{
|
|
||||||
return registerObject_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Is object same for all processors
|
//- Is object same for all processors
|
||||||
bool& globalObject()
|
inline bool globalObject() const;
|
||||||
{
|
|
||||||
return globalObject_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Is object same for all processors
|
//- Is object same for all processors
|
||||||
bool globalObject() const
|
inline bool& globalObject();
|
||||||
{
|
|
||||||
return globalObject_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Read/write options
|
// Read/write options
|
||||||
|
|
||||||
readOption readOpt() const
|
//- The read option
|
||||||
{
|
inline readOption readOpt() const;
|
||||||
return rOpt_;
|
|
||||||
}
|
|
||||||
|
|
||||||
readOption& readOpt()
|
//- Non-constant access to the read option
|
||||||
{
|
inline readOption& readOpt();
|
||||||
return rOpt_;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeOption writeOpt() const
|
//- The write option
|
||||||
{
|
inline writeOption writeOpt() const;
|
||||||
return wOpt_;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeOption& writeOpt()
|
//- Non-constant access to the write option
|
||||||
{
|
inline writeOption& writeOpt();
|
||||||
return wOpt_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Path components
|
// Path components
|
||||||
|
|
||||||
//- Return group (extension part of name)
|
//- Return group (extension part of name)
|
||||||
word group() const;
|
word group() const;
|
||||||
|
|
||||||
//- Return member (name without the extension)
|
//- Return member (name without the extension)
|
||||||
word member() const;
|
word member() const;
|
||||||
|
|
||||||
const fileName& rootPath() const;
|
const fileName& rootPath() const;
|
||||||
|
|
||||||
const fileName& caseName() const;
|
const fileName& caseName() const;
|
||||||
|
|
||||||
const fileName& instance() const
|
inline const fileName& instance() const;
|
||||||
{
|
|
||||||
return instance_;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileName& instance()
|
inline fileName& instance();
|
||||||
{
|
|
||||||
return instance_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileName& local() const
|
inline const fileName& local() const;
|
||||||
{
|
|
||||||
return local_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return complete path
|
//- Return complete path
|
||||||
fileName path() const;
|
fileName path() const;
|
||||||
|
|
||||||
//- Return complete path with alternative instance and local
|
//- Return complete path with alternative instance and local
|
||||||
fileName path
|
fileName path
|
||||||
(
|
(
|
||||||
const word& instance,
|
const word& instance,
|
||||||
const fileName& local = fileName::null
|
const fileName& local = fileName::null
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return complete path + object name
|
//- Return complete path + object name
|
||||||
fileName objectPath() const
|
inline fileName objectPath() const;
|
||||||
{
|
|
||||||
return path()/name();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Helper for filePath that searches locally.
|
//- Helper for filePath that searches locally.
|
||||||
// When search is false, simply use the current instance,
|
// When search is false, simply use the current instance,
|
||||||
// otherwise search previous instances.
|
// otherwise search previous instances.
|
||||||
fileName localFilePath(const bool search=true) const;
|
fileName localFilePath(const bool search=true) const;
|
||||||
|
|
||||||
//- Helper for filePath that searches up if in parallel
|
//- Helper for filePath that searches up if in parallel
|
||||||
// When search is false, simply use the current instance,
|
// When search is false, simply use the current instance,
|
||||||
// otherwise search previous instances.
|
// otherwise search previous instances.
|
||||||
fileName globalFilePath(const bool search=true) const;
|
fileName globalFilePath(const bool search=true) const;
|
||||||
|
|
||||||
|
|
||||||
// Reading
|
// Reading
|
||||||
|
|
||||||
//- Read header
|
//- Read header
|
||||||
bool readHeader(Istream&);
|
bool readHeader(Istream& is);
|
||||||
|
|
||||||
//- Read header (uses typeFilePath to find file) and check its info.
|
//- Read header (uses typeFilePath to find file) and check its info.
|
||||||
// Optionally checks headerClassName against the type-name.
|
// Optionally checks headerClassName against the type-name.
|
||||||
// When search is false, simply use the current instance,
|
// When search is false, simply use the current instance,
|
||||||
// otherwise search previous instances.
|
// otherwise search previous instances.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool typeHeaderOk
|
bool typeHeaderOk
|
||||||
(
|
(
|
||||||
const bool checkType = true,
|
const bool checkType = true,
|
||||||
const bool search = true
|
const bool search = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Helper: warn that type does not support re-reading
|
//- Helper: warn that type does not support re-reading
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void warnNoRereading() const;
|
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);
|
|
||||||
|
|
||||||
//- Write the standard file section divider
|
|
||||||
template<class Stream>
|
|
||||||
static inline Stream& writeDivider(Stream& os);
|
|
||||||
|
|
||||||
//- Write the standard end file divider
|
|
||||||
template<class Stream>
|
|
||||||
static inline Stream& writeEndDivider(Stream& os);
|
|
||||||
|
|
||||||
//- Write header
|
|
||||||
bool writeHeader(Ostream&) const;
|
|
||||||
|
|
||||||
//- Write header. Allow override of type
|
|
||||||
bool writeHeader(Ostream&, const word& objectType) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Error Handling
|
// Writing
|
||||||
|
|
||||||
bool good() const
|
//- Write the standard OpenFOAM file/dictionary banner
|
||||||
{
|
// Optionally without -*- C++ -*- editor hint (eg, for logs)
|
||||||
return objState_ == GOOD;
|
static Ostream& writeBanner(Ostream& os, bool noHint=false);
|
||||||
}
|
|
||||||
|
|
||||||
bool bad() const
|
//- Write the standard file section divider
|
||||||
{
|
static Ostream& writeDivider(Ostream& os);
|
||||||
return objState_ == BAD;
|
|
||||||
}
|
//- Write the standard end file divider
|
||||||
|
static Ostream& writeEndDivider(Ostream& os);
|
||||||
|
|
||||||
|
//- Write header
|
||||||
|
bool writeHeader(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write header. Allow override of type
|
||||||
|
bool writeHeader(Ostream& os, const word& objectType) const;
|
||||||
|
|
||||||
|
|
||||||
// Info
|
// Error Handling
|
||||||
|
|
||||||
//- Return info proxy.
|
inline bool good() const;
|
||||||
// Used to print token information to a stream
|
|
||||||
InfoProxy<IOobject> info() const
|
inline bool bad() const;
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
// Info
|
||||||
|
|
||||||
|
//- Return info proxy.
|
||||||
|
// Used to print token information to a stream
|
||||||
|
InfoProxy<IOobject> info() const
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
void operator=(const IOobject&);
|
void operator=(const IOobject& io);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,95 +23,137 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "foamVersion.H"
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
template<class StringType>
|
||||||
|
inline Foam::word Foam::IOobject::groupName(StringType name, const word& group)
|
||||||
template<class Name>
|
|
||||||
inline Foam::word Foam::IOobject::groupName(Name name, const word& group)
|
|
||||||
{
|
{
|
||||||
if (group != word::null)
|
if (group.empty())
|
||||||
{
|
|
||||||
return name + ('.' + group);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return name;
|
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';
|
|
||||||
}
|
|
||||||
spacesSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noHint)
|
|
||||||
{
|
|
||||||
os <<
|
|
||||||
"/*--------------------------------------"
|
|
||||||
"-------------------------------------*\\\n";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os <<
|
return name + ('.' + group);
|
||||||
"/*--------------------------------*- 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Stream>
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
inline Stream& Foam::IOobject::writeDivider(Stream& os)
|
|
||||||
{
|
|
||||||
os <<
|
|
||||||
"// * * * * * * * * * * * * * * * * * "
|
|
||||||
"* * * * * * * * * * * * * * * * * * * * //\n";
|
|
||||||
|
|
||||||
return os;
|
// General access
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::IOobject::name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Stream>
|
|
||||||
inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
|
|
||||||
{
|
|
||||||
os << "\n\n"
|
|
||||||
"// *****************************************"
|
|
||||||
"******************************** //\n";
|
|
||||||
|
|
||||||
return os;
|
inline const Foam::word& Foam::IOobject::headerClassName() const
|
||||||
|
{
|
||||||
|
return headerClassName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::string& Foam::IOobject::note() const
|
||||||
|
{
|
||||||
|
return note_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
WarningInFunction
|
||||||
<< Type::typeName << ' ' << name()
|
<< Type::typeName << ' ' << name()
|
||||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
<< " constructed with IOobject::MUST_READ_IF_MODIFIED but "
|
||||||
" but " << Type::typeName
|
<< Type::typeName << " does not support automatic rereading."
|
||||||
<< " does not support automatic rereading."
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,29 +29,91 @@ Description
|
|||||||
|
|
||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
#include "endian.H"
|
#include "foamVersion.H"
|
||||||
#include "label.H"
|
|
||||||
#include "scalar.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// file-scope
|
// A banner corresponding to this:
|
||||||
// Hint about machine endian, OpenFOAM label and scalar sizes
|
//
|
||||||
static const std::string archHint =
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
(
|
| ========= | |
|
||||||
#ifdef WM_LITTLE_ENDIAN
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
"LSB"
|
| \\ / O peration | Version: VERSION |
|
||||||
#elif defined (WM_BIG_ENDIAN)
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
"MSB"
|
| \\/ M anipulation | |
|
||||||
#else
|
\*---------------------------------------------------------------------------*/
|
||||||
"???"
|
|
||||||
#endif
|
Foam::Ostream& Foam::IOobject::writeBanner(Ostream& os, bool noHint)
|
||||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
{
|
||||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
// 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
|
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)
|
if (os.format() == IOstream::BINARY)
|
||||||
{
|
{
|
||||||
os << " arch " << archHint << ";\n";
|
os << " arch " << Foam::FOAMbuildArch << ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!note().empty())
|
if (!note().empty())
|
||||||
|
|||||||
@ -91,12 +91,11 @@ Foam::IFstream::IFstream
|
|||||||
ISstream
|
ISstream
|
||||||
(
|
(
|
||||||
*ifPtr_,
|
*ifPtr_,
|
||||||
"IFstream.sourceFile_",
|
pathname,
|
||||||
format,
|
format,
|
||||||
version,
|
version,
|
||||||
IFstreamAllocator::compression_
|
IFstreamAllocator::compression_
|
||||||
),
|
)
|
||||||
pathname_(pathname)
|
|
||||||
{
|
{
|
||||||
setClosed();
|
setClosed();
|
||||||
|
|
||||||
@ -166,7 +165,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
|||||||
if (!good())
|
if (!good())
|
||||||
{
|
{
|
||||||
// also checks .gz file
|
// also checks .gz file
|
||||||
if (isFile(pathname_, true))
|
if (isFile(this->name(), true))
|
||||||
{
|
{
|
||||||
check("IFstream::operator()");
|
check("IFstream::operator()");
|
||||||
FatalIOError.exit();
|
FatalIOError.exit();
|
||||||
@ -174,7 +173,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(*this)
|
FatalIOErrorInFunction(*this)
|
||||||
<< "file " << pathname_ << " does not exist"
|
<< "file " << this->name() << " does not exist"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,10 +84,6 @@ class IFstream
|
|||||||
public IFstreamAllocator,
|
public IFstreamAllocator,
|
||||||
public ISstream
|
public ISstream
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
fileName pathname_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
// Declare name of the class and its debug switch
|
||||||
@ -113,17 +109,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the name of the stream
|
//- Read/write access to the name of the stream
|
||||||
const fileName& name() const
|
using ISstream::name;
|
||||||
{
|
|
||||||
return pathname_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
|
||||||
fileName& name()
|
|
||||||
{
|
|
||||||
return pathname_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// STL stream
|
// STL stream
|
||||||
|
|||||||
@ -93,8 +93,7 @@ Foam::OFstream::OFstream
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
OFstreamAllocator(pathname, compression),
|
OFstreamAllocator(pathname, compression),
|
||||||
OSstream(*ofPtr_, "OFstream.sinkFile_", format, version, compression),
|
OSstream(*ofPtr_, pathname, format, version, compression)
|
||||||
pathname_(pathname)
|
|
||||||
{
|
{
|
||||||
setClosed();
|
setClosed();
|
||||||
setState(ofPtr_->rdstate());
|
setState(ofPtr_->rdstate());
|
||||||
|
|||||||
@ -84,11 +84,6 @@ class OFstream
|
|||||||
private OFstreamAllocator,
|
private OFstreamAllocator,
|
||||||
public OSstream
|
public OSstream
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
fileName pathname_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
// Declare name of the class and its debug switch
|
||||||
@ -115,17 +110,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the name of the stream
|
//- Read/write access to the name of the stream
|
||||||
const fileName& name() const
|
using OSstream::name;
|
||||||
{
|
|
||||||
return pathname_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
|
||||||
fileName& name()
|
|
||||||
{
|
|
||||||
return pathname_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// STL stream
|
// STL stream
|
||||||
|
|||||||
@ -30,7 +30,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileName Foam::IOstream::name_("IOstream");
|
Foam::fileName Foam::IOstream::staticName_("IOstream");
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
@ -89,6 +89,18 @@ Foam::IOstream::compressionEnum(const word& compression)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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
|
bool Foam::IOstream::check(const char* operation) const
|
||||||
{
|
{
|
||||||
if (bad())
|
if (bad())
|
||||||
|
|||||||
@ -214,8 +214,8 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of the stream
|
//- Name for any generic stream - normally treat as readonly
|
||||||
static fileName name_;
|
static fileName staticName_;
|
||||||
|
|
||||||
streamFormat format_;
|
streamFormat format_;
|
||||||
versionNumber version_;
|
versionNumber version_;
|
||||||
@ -295,17 +295,11 @@ public:
|
|||||||
|
|
||||||
//- Return the name of the stream
|
//- Return the name of the stream
|
||||||
// Useful for Fstream to return the filename
|
// Useful for Fstream to return the filename
|
||||||
virtual const fileName& name() const
|
virtual const fileName& name() const;
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
//- Return non-const access to the name of the stream
|
||||||
// Useful to alter the stream name
|
// Useful to alter the stream name
|
||||||
virtual fileName& name()
|
virtual fileName& name();
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|||||||
@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Set stream status
|
//- Construct and set stream status
|
||||||
Istream
|
Istream
|
||||||
(
|
(
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Set stream status
|
//- Construct and set stream status
|
||||||
Ostream
|
Ostream
|
||||||
(
|
(
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
|
|||||||
@ -34,23 +34,18 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(UPstream, 0);
|
defineTypeNameAndDebug(UPstream, 0);
|
||||||
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::UPstream::commsTypes,
|
|
||||||
3
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"blocking",
|
|
||||||
"scheduled",
|
|
||||||
"nonBlocking"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
const Foam::NamedEnum<Foam::UPstream::commsTypes, 3>
|
<
|
||||||
Foam::UPstream::commsTypeNames;
|
Foam::UPstream::commsTypes
|
||||||
|
>
|
||||||
|
Foam::UPstream::commsTypeNames
|
||||||
|
{
|
||||||
|
{ commsTypes::blocking, "blocking" },
|
||||||
|
{ commsTypes::scheduled, "scheduled" },
|
||||||
|
{ commsTypes::nonBlocking, "nonBlocking" },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -351,7 +346,7 @@ template<>
|
|||||||
const Foam::UPstream::commsStruct&
|
const Foam::UPstream::commsStruct&
|
||||||
Foam::UList<Foam::UPstream::commsStruct>::operator[](const label procID) const
|
Foam::UList<Foam::UPstream::commsStruct>::operator[](const label procID) const
|
||||||
{
|
{
|
||||||
return const_cast<UList<UPstream::commsStruct>& >(*this).operator[](procID);
|
return const_cast<UList<UPstream::commsStruct>&>(*this).operator[](procID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -411,7 +406,11 @@ registerOptSwitch
|
|||||||
|
|
||||||
Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
||||||
(
|
(
|
||||||
commsTypeNames.read(Foam::debug::optimisationSwitches().lookup("commsType"))
|
commsTypeNames.lookup
|
||||||
|
(
|
||||||
|
"commsType",
|
||||||
|
Foam::debug::optimisationSwitches()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
namespace Foam
|
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 "DynamicList.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "LIFOStack.H"
|
#include "LIFOStack.H"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
nonBlocking
|
nonBlocking
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NamedEnum<commsTypes, 3> commsTypeNames;
|
static const Enum<commsTypes> commsTypeNames;
|
||||||
|
|
||||||
// Public classes
|
// Public classes
|
||||||
|
|
||||||
@ -272,6 +272,9 @@ public:
|
|||||||
//- Optional maximum message size (bytes)
|
//- Optional maximum message size (bytes)
|
||||||
static int maxCommsSize;
|
static int maxCommsSize;
|
||||||
|
|
||||||
|
//- MPI buffer-size (bytes)
|
||||||
|
static const int mpiBufferSize;
|
||||||
|
|
||||||
//- Default communicator (all processors)
|
//- Default communicator (all processors)
|
||||||
static label worldComm;
|
static label worldComm;
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class ISstream
|
|||||||
Istream& readVariable(string&);
|
Istream& readVariable(string&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const ISstream&);
|
void operator=(const ISstream&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -62,14 +62,14 @@ class OSstream
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const OSstream&);
|
void operator=(const OSstream&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Set stream status
|
//- Construct and set stream status
|
||||||
OSstream
|
OSstream
|
||||||
(
|
(
|
||||||
ostream& os,
|
ostream& os,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ namespace Foam
|
|||||||
|
|
||||||
//- Read a hex label from an input stream
|
//- Read a hex label from an input stream
|
||||||
template<class T>
|
template<class T>
|
||||||
T ReadHex(ISstream&);
|
T ReadHex(ISstream& is);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Set stream status
|
//- Construct and set stream status
|
||||||
prefixOSstream
|
prefixOSstream
|
||||||
(
|
(
|
||||||
ostream& os,
|
ostream& os,
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public:
|
|||||||
ISstream
|
ISstream
|
||||||
(
|
(
|
||||||
*(new std::istringstream(buffer)),
|
*(new std::istringstream(buffer)),
|
||||||
"IStringStream.sourceFile",
|
"input",
|
||||||
format,
|
format,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
ISstream
|
ISstream
|
||||||
(
|
(
|
||||||
*(new std::istringstream(buffer)),
|
*(new std::istringstream(buffer)),
|
||||||
"IStringStream.sourceFile",
|
"input",
|
||||||
format,
|
format,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public:
|
|||||||
OSstream
|
OSstream
|
||||||
(
|
(
|
||||||
*(new std::ostringstream()),
|
*(new std::ostringstream()),
|
||||||
"OStringStream.sinkFile",
|
"output",
|
||||||
format,
|
format,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
@ -126,7 +126,7 @@ public:
|
|||||||
// Print
|
// Print
|
||||||
|
|
||||||
//- Print description to Ostream
|
//- Print description to Ostream
|
||||||
void print(Ostream&) const;
|
void print(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Description
|
|||||||
void Foam::IStringStream::print(Ostream& os) const
|
void Foam::IStringStream::print(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << "IStringStream " << name() << " : "
|
os << "IStringStream " << name() << " : "
|
||||||
<< "buffer = \n" << str() << Foam::endl;
|
<< "buffer =\n" << str() << Foam::endl;
|
||||||
|
|
||||||
ISstream::print(os);
|
ISstream::print(os);
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ void Foam::IStringStream::print(Ostream& os) const
|
|||||||
void Foam::OStringStream::print(Ostream& os) const
|
void Foam::OStringStream::print(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << "OStringStream " << name() << " : "
|
os << "OStringStream " << name() << " : "
|
||||||
<< "buffer = \n" << str() << Foam::endl;
|
<< "buffer =\n" << str() << Foam::endl;
|
||||||
|
|
||||||
OSstream::print(os);
|
OSstream::print(os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,13 +126,13 @@ public:
|
|||||||
// Inquiry
|
// Inquiry
|
||||||
|
|
||||||
//- Return the name of the stream
|
//- Return the name of the stream
|
||||||
const fileName& name() const
|
virtual const fileName& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the name of the stream
|
//- Return non-const access to the name of the stream
|
||||||
fileName& name()
|
virtual fileName& name()
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ public:
|
|||||||
// Read functions
|
// Read functions
|
||||||
|
|
||||||
//- Return next token from stream
|
//- Return next token from stream
|
||||||
virtual Istream& read(token&);
|
virtual Istream& read(token& t);
|
||||||
|
|
||||||
//- Read a character
|
//- Read a character
|
||||||
virtual Istream& read(char&);
|
virtual Istream& read(char&);
|
||||||
@ -203,8 +203,8 @@ public:
|
|||||||
|
|
||||||
// Print
|
// Print
|
||||||
|
|
||||||
//- Print description of IOstream to Ostream
|
//- Print description of stream to Ostream
|
||||||
void print(Ostream&) const;
|
void print(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
//- Process unbuffered
|
//- Process unbuffered
|
||||||
virtual std::streamsize xsputn(const char* str, std::streamsize n)
|
virtual std::streamsize xsputn(const char* str, std::streamsize n)
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- This hides both signatures of std::basic_ios::rdbuf()
|
//- This hides both signatures of std::basic_ios::rdbuf()
|
||||||
sha1streambuf* rdbuf()
|
sha1streambuf* rdbuf()
|
||||||
@ -139,16 +139,16 @@ class OSHA1stream
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
OSHA1stream(const OSHA1stream&);
|
OSHA1stream(const OSHA1stream&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const OSHA1stream&);
|
void operator=(const OSHA1stream&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and set stream status
|
//- Construct with an empty digest
|
||||||
OSHA1stream
|
OSHA1stream
|
||||||
(
|
(
|
||||||
streamFormat format=ASCII,
|
streamFormat format=ASCII,
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
OSstream
|
OSstream
|
||||||
(
|
(
|
||||||
*(new osha1stream),
|
*(new osha1stream),
|
||||||
"OSHA1stream.sinkFile_",
|
"OSHA1stream",
|
||||||
format,
|
format,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Full access to the sha1
|
//- Full access to the sha1
|
||||||
Foam::SHA1& sha1()
|
Foam::SHA1& sha1()
|
||||||
@ -188,7 +188,8 @@ public:
|
|||||||
return sha1().digest();
|
return sha1().digest();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
//- Clear the SHA1 calculation
|
//- Clear the SHA1 calculation
|
||||||
void rewind()
|
void rewind()
|
||||||
|
|||||||
@ -134,10 +134,10 @@ public:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
compound(const compound&);
|
compound(const compound&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const compound&);
|
void operator=(const compound&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -195,11 +195,6 @@ public:
|
|||||||
|
|
||||||
virtual label size() const = 0;
|
virtual label size() const = 0;
|
||||||
|
|
||||||
|
|
||||||
// Check
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
virtual void write(Ostream&) const = 0;
|
virtual void write(Ostream&) const = 0;
|
||||||
|
|||||||
@ -37,40 +37,34 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(Time, 0);
|
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>
|
const Foam::Enum
|
||||||
Foam::Time::stopAtControlNames_;
|
<
|
||||||
|
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);
|
Foam::Time::fmtflags Foam::Time::format_(Foam::Time::general);
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ SourceFiles
|
|||||||
#include "TimeState.H"
|
#include "TimeState.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "instantList.H"
|
#include "instantList.H"
|
||||||
#include "NamedEnum.H"
|
#include "Enum.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "dlLibraryTable.H"
|
#include "dlLibraryTable.H"
|
||||||
#include "functionObjectList.H"
|
#include "functionObjectList.H"
|
||||||
@ -130,10 +130,10 @@ protected:
|
|||||||
scalar startTime_;
|
scalar startTime_;
|
||||||
mutable scalar endTime_;
|
mutable scalar endTime_;
|
||||||
|
|
||||||
static const NamedEnum<stopAtControls, 4> stopAtControlNames_;
|
static const Enum<stopAtControls> stopAtControlNames_;
|
||||||
mutable stopAtControls stopAt_;
|
mutable stopAtControls stopAt_;
|
||||||
|
|
||||||
static const NamedEnum<writeControls, 5> writeControlNames_;
|
static const Enum<writeControls> writeControlNames_;
|
||||||
writeControls writeControl_;
|
writeControls writeControl_;
|
||||||
|
|
||||||
scalar writeInterval_;
|
scalar writeInterval_;
|
||||||
|
|||||||
@ -201,9 +201,10 @@ void Foam::Time::readDict()
|
|||||||
|
|
||||||
if (controlDict_.found("writeControl"))
|
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 nothing is specified, the endTime is zero
|
||||||
if (controlDict_.found("stopAt"))
|
if (controlDict_.found("stopAt"))
|
||||||
{
|
{
|
||||||
stopAt_ = stopAtControlNames_.read(controlDict_.lookup("stopAt"));
|
stopAt_ = stopAtControlNames_.lookup("stopAt", controlDict_);
|
||||||
|
|
||||||
if (stopAt_ == saEndTime)
|
if (stopAt_ == saEndTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,12 +35,50 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(dictionary, 0);
|
defineTypeNameAndDebug(dictionary, 0);
|
||||||
const dictionary dictionary::null;
|
}
|
||||||
|
|
||||||
bool dictionary::writeOptionalEntries
|
const Foam::dictionary Foam::dictionary::null;
|
||||||
|
|
||||||
|
bool Foam::dictionary::writeOptionalEntries
|
||||||
|
(
|
||||||
|
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
|
||||||
(
|
(
|
||||||
debug::infoSwitch("writeOptionalEntries", 0)
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::dictionary::dictionary()
|
Foam::dictionary::dictionary()
|
||||||
@ -242,17 +218,17 @@ Foam::dictionary::dictionary
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionaryName(dict.name()),
|
dictionaryName(dict.name()),
|
||||||
IDLList<entry>(dict, *this),
|
parent_type(dict, *this),
|
||||||
parent_(parentDict)
|
parent_(parentDict)
|
||||||
{
|
{
|
||||||
forAllIter(IDLList<entry>, *this, iter)
|
forAllIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
hashedEntries_.insert(iter().keyword(), &iter());
|
hashedEntries_.insert(iter().keyword(), &iter());
|
||||||
|
|
||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
patternEntries_.insert(&iter());
|
patterns_.insert(&iter());
|
||||||
patternRegexps_.insert
|
regexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -267,17 +243,17 @@ Foam::dictionary::dictionary
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionaryName(dict.name()),
|
dictionaryName(dict.name()),
|
||||||
IDLList<entry>(dict, *this),
|
parent_type(dict, *this),
|
||||||
parent_(dictionary::null)
|
parent_(dictionary::null)
|
||||||
{
|
{
|
||||||
forAllIter(IDLList<entry>, *this, iter)
|
forAllIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
hashedEntries_.insert(iter().keyword(), &iter());
|
hashedEntries_.insert(iter().keyword(), &iter());
|
||||||
|
|
||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
patternEntries_.insert(&iter());
|
patterns_.insert(&iter());
|
||||||
patternRegexps_.insert
|
regexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -384,7 +360,7 @@ Foam::SHA1Digest Foam::dictionary::digest() const
|
|||||||
OSHA1stream os;
|
OSHA1stream os;
|
||||||
|
|
||||||
// Process entries
|
// Process entries
|
||||||
forAllConstIter(IDLList<entry>, *this, iter)
|
forAllConstIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
os << *iter;
|
os << *iter;
|
||||||
}
|
}
|
||||||
@ -423,31 +399,25 @@ bool Foam::dictionary::found
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (patternMatch && patterns_.size())
|
||||||
{
|
{
|
||||||
if (patternMatch && patternEntries_.size())
|
pattern_const_iterator wcLink = patterns_.begin();
|
||||||
{
|
regexp_const_iterator reLink = regexps_.begin();
|
||||||
DLList<entry*>::const_iterator wcLink =
|
|
||||||
patternEntries_.begin();
|
|
||||||
DLList<autoPtr<regExp>>::const_iterator reLink =
|
|
||||||
patternRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
|
||||||
{
|
{
|
||||||
return parent_.found(keyword, recursive, patternMatch);
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recursive && &parent_ != &dictionary::null)
|
||||||
|
{
|
||||||
|
return parent_.found(keyword, recursive, patternMatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -458,35 +428,31 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) 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();
|
||||||
{
|
}
|
||||||
DLList<entry*>::const_iterator wcLink =
|
|
||||||
patternEntries_.begin();
|
|
||||||
DLList<autoPtr<regExp>>::const_iterator reLink =
|
|
||||||
patternRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
if (patternMatch && patterns_.size())
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
{
|
||||||
{
|
pattern_const_iterator wcLink = patterns_.begin();
|
||||||
return wcLink();
|
regexp_const_iterator reLink = regexps_.begin();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
// Find in patterns using regular expressions only
|
||||||
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
|
return wcLink();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iter();
|
if (recursive && &parent_ != &dictionary::null)
|
||||||
|
{
|
||||||
|
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -497,40 +463,36 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
bool patternMatch
|
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();
|
||||||
{
|
}
|
||||||
DLList<entry*>::iterator wcLink =
|
|
||||||
patternEntries_.begin();
|
|
||||||
DLList<autoPtr<regExp>>::iterator reLink =
|
|
||||||
patternRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in patterns using regular expressions only
|
if (patternMatch && patterns_.size())
|
||||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
{
|
||||||
{
|
pattern_iterator wcLink = patterns_.begin();
|
||||||
return wcLink();
|
regexp_iterator reLink = regexps_.begin();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
// Find in patterns using regular expressions only
|
||||||
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return const_cast<dictionary&>(parent_).lookupEntryPtr
|
return wcLink();
|
||||||
(
|
|
||||||
keyword,
|
|
||||||
recursive,
|
|
||||||
patternMatch
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iter();
|
if (recursive && &parent_ != &dictionary::null)
|
||||||
|
{
|
||||||
|
return const_cast<dictionary&>(parent_).lookupEntryPtr
|
||||||
|
(
|
||||||
|
keyword,
|
||||||
|
recursive,
|
||||||
|
patternMatch
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -575,7 +537,7 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (keyword[0] == ':' || keyword[0] == '^')
|
if ((keyword[0] == ':' || keyword[0] == '^'))
|
||||||
{
|
{
|
||||||
// Go up to top level
|
// Go up to top level
|
||||||
const dictionary* dictPtr = this;
|
const dictionary* dictPtr = this;
|
||||||
@ -591,15 +553,13 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
|||||||
patternMatch
|
patternMatch
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return lookupScopedSubEntryPtr
|
||||||
return lookupScopedSubEntryPtr
|
(
|
||||||
(
|
keyword,
|
||||||
keyword,
|
recursive,
|
||||||
recursive,
|
patternMatch
|
||||||
patternMatch
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -609,7 +569,8 @@ bool Foam::dictionary::substituteScopedKeyword
|
|||||||
bool mergeEntry
|
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
|
// Lookup the variable name in the given dictionary
|
||||||
const entry* ePtr = lookupScopedEntryPtr(varName, true, true);
|
const entry* ePtr = lookupScopedEntryPtr(varName, true, true);
|
||||||
@ -619,7 +580,7 @@ bool Foam::dictionary::substituteScopedKeyword
|
|||||||
{
|
{
|
||||||
const dictionary& addDict = ePtr->dict();
|
const dictionary& addDict = ePtr->dict();
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, addDict, iter)
|
forAllConstIter(parent_type, addDict, iter)
|
||||||
{
|
{
|
||||||
add(iter(), mergeEntry);
|
add(iter(), mergeEntry);
|
||||||
}
|
}
|
||||||
@ -766,7 +727,7 @@ Foam::wordList Foam::dictionary::toc() const
|
|||||||
wordList keys(size());
|
wordList keys(size());
|
||||||
|
|
||||||
label nKeys = 0;
|
label nKeys = 0;
|
||||||
forAllConstIter(IDLList<entry>, *this, iter)
|
forAllConstIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
keys[nKeys++] = iter().keyword();
|
keys[nKeys++] = iter().keyword();
|
||||||
}
|
}
|
||||||
@ -786,7 +747,7 @@ Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
|||||||
List<keyType> keys(size());
|
List<keyType> keys(size());
|
||||||
|
|
||||||
label nKeys = 0;
|
label nKeys = 0;
|
||||||
forAllConstIter(IDLList<entry>, *this, iter)
|
forAllConstIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
if (iter().keyword().isPattern() ? patterns : !patterns)
|
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)
|
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||||
{
|
{
|
||||||
HashTable<entry*>::iterator iter = hashedEntries_.find
|
auto iter = hashedEntries_.find(entryPtr->keyword());
|
||||||
(
|
|
||||||
entryPtr->keyword()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mergeEntry && iter != hashedEntries_.end())
|
if (mergeEntry && iter.found())
|
||||||
{
|
{
|
||||||
// Merge dictionary with dictionary
|
// Merge dictionary with dictionary
|
||||||
if (iter()->isDict() && entryPtr->isDict())
|
if (iter()->isDict() && entryPtr->isDict())
|
||||||
@ -816,50 +774,50 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Replace existing dictionary with entry or vice versa
|
||||||
|
parent_type::replace(iter(), entryPtr);
|
||||||
|
delete iter();
|
||||||
|
hashedEntries_.erase(iter);
|
||||||
|
|
||||||
|
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||||
|
{
|
||||||
|
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
||||||
|
|
||||||
|
if (entryPtr->keyword().isPattern())
|
||||||
|
{
|
||||||
|
patterns_.insert(entryPtr);
|
||||||
|
regexps_.insert
|
||||||
|
(
|
||||||
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Replace existing dictionary with entry or vice versa
|
IOWarningInFunction((*this))
|
||||||
IDLList<entry>::replace(iter(), entryPtr);
|
<< "problem replacing entry "<< entryPtr->keyword()
|
||||||
delete iter();
|
<< " in dictionary " << name() << endl;
|
||||||
hashedEntries_.erase(iter);
|
|
||||||
|
|
||||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
parent_type::remove(entryPtr);
|
||||||
{
|
delete entryPtr;
|
||||||
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
return false;
|
||||||
|
|
||||||
if (entryPtr->keyword().isPattern())
|
|
||||||
{
|
|
||||||
patternEntries_.insert(entryPtr);
|
|
||||||
patternRegexps_.insert
|
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IOWarningInFunction((*this))
|
|
||||||
<< "problem replacing entry "<< entryPtr->keyword()
|
|
||||||
<< " in dictionary " << name() << endl;
|
|
||||||
|
|
||||||
IDLList<entry>::remove(entryPtr);
|
|
||||||
delete entryPtr;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||||
{
|
{
|
||||||
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
||||||
IDLList<entry>::append(entryPtr);
|
parent_type::append(entryPtr);
|
||||||
|
|
||||||
if (entryPtr->keyword().isPattern())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
patternEntries_.insert(entryPtr);
|
patterns_.insert(entryPtr);
|
||||||
patternRegexps_.insert
|
regexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
);
|
);
|
||||||
@ -928,6 +886,7 @@ void Foam::dictionary::add
|
|||||||
|
|
||||||
void Foam::dictionary::set(entry* entryPtr)
|
void Foam::dictionary::set(entry* entryPtr)
|
||||||
{
|
{
|
||||||
|
// Find non-recursive with patterns
|
||||||
entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true);
|
entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true);
|
||||||
|
|
||||||
// Clear dictionary so merge acts like overwrite
|
// 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)
|
bool Foam::dictionary::remove(const word& keyword)
|
||||||
{
|
{
|
||||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
auto iter = hashedEntries_.find(keyword);
|
||||||
|
|
||||||
if (iter.found())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
// Delete from patterns first
|
// Delete from patterns
|
||||||
DLList<entry*>::iterator wcLink =
|
pattern_iterator wcLink = patterns_.begin();
|
||||||
patternEntries_.begin();
|
regexp_iterator reLink = regexps_.begin();
|
||||||
DLList<autoPtr<regExp>>::iterator reLink =
|
|
||||||
patternRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in pattern using exact match only
|
// Find in pattern using exact match only
|
||||||
if (findInPatterns(false, keyword, wcLink, reLink))
|
if (findInPatterns(false, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
patternEntries_.remove(wcLink);
|
patterns_.remove(wcLink);
|
||||||
patternRegexps_.remove(reLink);
|
regexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDLList<entry>::remove(iter());
|
parent_type::remove(iter());
|
||||||
delete iter();
|
delete iter();
|
||||||
hashedEntries_.erase(iter);
|
hashedEntries_.erase(iter);
|
||||||
|
|
||||||
@ -996,10 +953,10 @@ bool Foam::dictionary::changeKeyword
|
|||||||
return false;
|
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.found())
|
||||||
if (iter == hashedEntries_.end())
|
|
||||||
{
|
{
|
||||||
return false;
|
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
|
// newKeyword already exists
|
||||||
if (iter2 != hashedEntries_.end())
|
if (iter2.found())
|
||||||
{
|
{
|
||||||
if (forceOverwrite)
|
if (forceOverwrite)
|
||||||
{
|
{
|
||||||
if (iter2()->keyword().isPattern())
|
if (iter2()->keyword().isPattern())
|
||||||
{
|
{
|
||||||
// Delete from patterns first
|
// Delete from patterns
|
||||||
DLList<entry*>::iterator wcLink =
|
pattern_iterator wcLink = patterns_.begin();
|
||||||
patternEntries_.begin();
|
regexp_iterator reLink = regexps_.begin();
|
||||||
DLList<autoPtr<regExp>>::iterator reLink =
|
|
||||||
patternRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in patterns using exact match only
|
// Find in patterns using exact match only
|
||||||
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
||||||
{
|
{
|
||||||
patternEntries_.remove(wcLink);
|
patterns_.remove(wcLink);
|
||||||
patternRegexps_.remove(reLink);
|
regexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDLList<entry>::replace(iter2(), iter());
|
parent_type::replace(iter2(), iter());
|
||||||
delete iter2();
|
delete iter2();
|
||||||
hashedEntries_.erase(iter2);
|
hashedEntries_.erase(iter2);
|
||||||
}
|
}
|
||||||
@ -1063,8 +1018,8 @@ bool Foam::dictionary::changeKeyword
|
|||||||
|
|
||||||
if (newKeyword.isPattern())
|
if (newKeyword.isPattern())
|
||||||
{
|
{
|
||||||
patternEntries_.insert(iter());
|
patterns_.insert(iter());
|
||||||
patternRegexps_.insert
|
regexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(newKeyword))
|
autoPtr<regExp>(new regExp(newKeyword))
|
||||||
);
|
);
|
||||||
@ -1086,11 +1041,11 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
|||||||
|
|
||||||
bool changed = false;
|
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
|
// Recursively merge sub-dictionaries
|
||||||
// TODO: merge without copying
|
// TODO: merge without copying
|
||||||
@ -1121,10 +1076,10 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
|||||||
|
|
||||||
void Foam::dictionary::clear()
|
void Foam::dictionary::clear()
|
||||||
{
|
{
|
||||||
IDLList<entry>::clear();
|
parent_type::clear();
|
||||||
hashedEntries_.clear();
|
hashedEntries_.clear();
|
||||||
patternEntries_.clear();
|
patterns_.clear();
|
||||||
patternRegexps_.clear();
|
regexps_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1134,10 +1089,10 @@ void Foam::dictionary::transfer(dictionary& dict)
|
|||||||
// but what about the names?
|
// but what about the names?
|
||||||
name() = dict.name();
|
name() = dict.name();
|
||||||
|
|
||||||
IDLList<entry>::transfer(dict);
|
parent_type::transfer(dict);
|
||||||
hashedEntries_.transfer(dict.hashedEntries_);
|
hashedEntries_.transfer(dict.hashedEntries_);
|
||||||
patternEntries_.transfer(dict.patternEntries_);
|
patterns_.transfer(dict.patterns_);
|
||||||
patternRegexps_.transfer(dict.patternRegexps_);
|
regexps_.transfer(dict.regexps_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1171,7 +1126,7 @@ void Foam::dictionary::operator=(const dictionary& rhs)
|
|||||||
// Create clones of the entries in the given dictionary
|
// Create clones of the entries in the given dictionary
|
||||||
// resetting the parentDict to this dictionary
|
// resetting the parentDict to this dictionary
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
forAllConstIter(parent_type, rhs, iter)
|
||||||
{
|
{
|
||||||
add(iter().clone(*this).ptr());
|
add(iter().clone(*this).ptr());
|
||||||
}
|
}
|
||||||
@ -1188,7 +1143,7 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
|
|||||||
<< abort(FatalIOError);
|
<< abort(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
forAllConstIter(parent_type, rhs, iter)
|
||||||
{
|
{
|
||||||
add(iter().clone(*this).ptr());
|
add(iter().clone(*this).ptr());
|
||||||
}
|
}
|
||||||
@ -1205,7 +1160,7 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
|
|||||||
<< abort(FatalIOError);
|
<< abort(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
forAllConstIter(parent_type, rhs, iter)
|
||||||
{
|
{
|
||||||
if (!found(iter().keyword()))
|
if (!found(iter().keyword()))
|
||||||
{
|
{
|
||||||
@ -1225,7 +1180,7 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
|
|||||||
<< abort(FatalIOError);
|
<< abort(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, rhs, iter)
|
forAllConstIter(parent_type, rhs, iter)
|
||||||
{
|
{
|
||||||
set(iter().clone(*this).ptr());
|
set(iter().clone(*this).ptr());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,8 +100,8 @@ class regExp;
|
|||||||
class dictionary;
|
class dictionary;
|
||||||
class SHA1Digest;
|
class SHA1Digest;
|
||||||
|
|
||||||
Istream& operator>>(Istream&, dictionary&);
|
Istream& operator>>(Istream& is, dictionary& dict);
|
||||||
Ostream& operator<<(Ostream&, const dictionary&);
|
Ostream& operator<<(Ostream& os, const dictionary& dict);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class dictionaryName Declaration
|
Class dictionaryName Declaration
|
||||||
@ -176,20 +176,31 @@ class dictionary
|
|||||||
//- Report optional keywords and values if not present in dictionary
|
//- Report optional keywords and values if not present in dictionary
|
||||||
static bool writeOptionalEntries;
|
static bool writeOptionalEntries;
|
||||||
|
|
||||||
//- HashTable of the entries held on the DL-list for quick lookup
|
|
||||||
HashTable<entry*> hashedEntries_;
|
|
||||||
|
|
||||||
//- Parent dictionary
|
//- Parent dictionary
|
||||||
const dictionary& parent_;
|
const dictionary& parent_;
|
||||||
|
|
||||||
|
//- HashTable of the entries held on the IDLList for quick lookup
|
||||||
|
HashTable<entry*> hashedEntries_;
|
||||||
|
|
||||||
//- Entries of matching patterns
|
//- Entries of matching patterns
|
||||||
DLList<entry*> patternEntries_;
|
DLList<entry*> patterns_;
|
||||||
|
|
||||||
//- Patterns as precompiled regular expressions
|
//- Patterns as precompiled regular expressions
|
||||||
DLList<autoPtr<regExp>> patternRegexps_;
|
DLList<autoPtr<regExp>> regexps_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// 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
|
||||||
|
|
||||||
//- Find and return an entry data stream pointer if present
|
//- Find and return an entry data stream pointer if present
|
||||||
// otherwise return nullptr. Allows scoping using '.'
|
// otherwise return nullptr. Allows scoping using '.'
|
||||||
@ -200,24 +211,6 @@ class dictionary
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const;
|
) 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:
|
public:
|
||||||
|
|
||||||
@ -228,8 +221,7 @@ public:
|
|||||||
// Declare name of the class and its debug switch
|
// Declare name of the class and its debug switch
|
||||||
ClassName("dictionary");
|
ClassName("dictionary");
|
||||||
|
|
||||||
|
//- An empty dictionary, which is also the parent for all dictionaries
|
||||||
//- Null dictionary
|
|
||||||
static const dictionary null;
|
static const dictionary null;
|
||||||
|
|
||||||
|
|
||||||
@ -287,6 +279,8 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
//- Return the parent dictionary
|
//- Return the parent dictionary
|
||||||
const dictionary& parent() const
|
const dictionary& parent() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -103,7 +103,7 @@ bool Foam::dictionary::read(Istream& is, const bool keepHeader)
|
|||||||
while (!is.eof() && entry::New(*this, is))
|
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)
|
if (!keepHeader)
|
||||||
{
|
{
|
||||||
remove("FoamFile");
|
remove("FoamFile");
|
||||||
@ -140,7 +140,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword, bool mergeEntry)
|
|||||||
{
|
{
|
||||||
const dictionary& addDict = ePtr->dict();
|
const dictionary& addDict = ePtr->dict();
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, addDict, iter)
|
forAllConstIter(parent_type, addDict, iter)
|
||||||
{
|
{
|
||||||
add(iter(), mergeEntry);
|
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
|
void Foam::dictionary::writeEntries(Ostream& os, const bool extraNewLine) const
|
||||||
{
|
{
|
||||||
forAllConstIter(IDLList<entry>, *this, iter)
|
forAllConstIter(parent_type, *this, iter)
|
||||||
{
|
{
|
||||||
const entry& e = *iter;
|
const entry& e = *iter;
|
||||||
|
|
||||||
|
|||||||
@ -28,27 +28,22 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::timeControl::timeControls
|
||||||
|
>
|
||||||
|
Foam::timeControl::timeControlNames_
|
||||||
{
|
{
|
||||||
template<>
|
{ timeControl::ocTimeStep, "timeStep" },
|
||||||
const char* NamedEnum<timeControl::timeControls, 9>::
|
{ timeControl::ocWriteTime, "writeTime" },
|
||||||
names[] =
|
{ timeControl::ocOutputTime, "outputTime" },
|
||||||
{
|
{ timeControl::ocAdjustableRunTime, "adjustableRunTime" },
|
||||||
"timeStep",
|
{ timeControl::ocRunTime, "runTime" },
|
||||||
"writeTime",
|
{ timeControl::ocClockTime, "clockTime" },
|
||||||
"outputTime",
|
{ timeControl::ocCpuTime, "cpuTime" },
|
||||||
"adjustableRunTime",
|
{ timeControl::ocOnEnd, "onEnd" },
|
||||||
"runTime",
|
{ timeControl::ocNone, "none" },
|
||||||
"clockTime",
|
};
|
||||||
"cpuTime",
|
|
||||||
"onEnd",
|
|
||||||
"none"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::timeControl::timeControls, 9>
|
|
||||||
Foam::timeControl::timeControlNames_;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -117,7 +112,7 @@ void Foam::timeControl::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (dict.found(controlName))
|
if (dict.found(controlName))
|
||||||
{
|
{
|
||||||
timeControl_ = timeControlNames_.read(dict.lookup(controlName));
|
timeControl_ = timeControlNames_.lookup(controlName, dict);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,7 +77,7 @@ private:
|
|||||||
const word prefix_;
|
const word prefix_;
|
||||||
|
|
||||||
//- String representation of timeControls enums
|
//- String representation of timeControls enums
|
||||||
static const NamedEnum<timeControls, 9> timeControlNames_;
|
static const Enum<timeControls> timeControlNames_;
|
||||||
|
|
||||||
//- Type of time control
|
//- Type of time control
|
||||||
timeControls timeControl_;
|
timeControls timeControl_;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ tmp<DimensionedField<TypeR, GeoMesh>> New
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DimensionedField<TypeR, GeoMesh>& df1 =
|
DimensionedField<TypeR, GeoMesh>& df1 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf1());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf1());
|
||||||
|
|
||||||
if (tdf1.isTmp())
|
if (tdf1.isTmp())
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ public:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DimensionedField<TypeR, GeoMesh>& df1 =
|
DimensionedField<TypeR, GeoMesh>& df1 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf1());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf1());
|
||||||
|
|
||||||
if (tdf1.isTmp())
|
if (tdf1.isTmp())
|
||||||
{
|
{
|
||||||
@ -192,7 +192,7 @@ public:
|
|||||||
{
|
{
|
||||||
const DimensionedField<Type1, GeoMesh>& df1 = tdf1();
|
const DimensionedField<Type1, GeoMesh>& df1 = tdf1();
|
||||||
DimensionedField<TypeR, GeoMesh>& df2 =
|
DimensionedField<TypeR, GeoMesh>& df2 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf2());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf2());
|
||||||
|
|
||||||
if (tdf2.isTmp())
|
if (tdf2.isTmp())
|
||||||
{
|
{
|
||||||
@ -235,7 +235,7 @@ public:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DimensionedField<TypeR, GeoMesh>& df1 =
|
DimensionedField<TypeR, GeoMesh>& df1 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf1());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf1());
|
||||||
|
|
||||||
if (tdf1.isTmp())
|
if (tdf1.isTmp())
|
||||||
{
|
{
|
||||||
@ -278,9 +278,9 @@ public:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DimensionedField<TypeR, GeoMesh>& df1 =
|
DimensionedField<TypeR, GeoMesh>& df1 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf1());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf1());
|
||||||
DimensionedField<TypeR, GeoMesh>& df2 =
|
DimensionedField<TypeR, GeoMesh>& df2 =
|
||||||
const_cast<DimensionedField<TypeR, GeoMesh>& >(tdf2());
|
const_cast<DimensionedField<TypeR, GeoMesh>&>(tdf2());
|
||||||
|
|
||||||
if (tdf1.isTmp())
|
if (tdf1.isTmp())
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user