mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,10 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::KRR4, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(KRR4, 0);
|
||||
|
||||
addToRunTimeSelectionTable(ODESolver, KRR4, ODE);
|
||||
|
||||
const scalar
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,9 +27,9 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::ODESolver, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ODESolver, 0);
|
||||
defineRunTimeSelectionTable(ODESolver, ODE);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Foam::RK, 0);
|
||||
defineTypeNameAndDebug(RK, 0);
|
||||
addToRunTimeSelectionTable(ODESolver, RK, ODE);
|
||||
|
||||
const scalar
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,10 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::SIBS, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(SIBS, 0);
|
||||
|
||||
addToRunTimeSelectionTable(ODESolver, SIBS, ODE);
|
||||
|
||||
const label SIBS::nSeq_[iMaxX_] = {2, 6, 10, 14, 22, 34, 50, 70};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -67,7 +67,11 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::POSIX, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(POSIX, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -45,13 +45,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::fileMonitor, 0);
|
||||
|
||||
const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
|
||||
Foam::fileMonitor::fileStateNames_;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fileMonitor, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,11 +31,41 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Signal number to catch
|
||||
int Foam::sigStopAtWriteNow::signal_
|
||||
int sigStopAtWriteNow::signal_
|
||||
(
|
||||
debug::optimisationSwitch("stopAtWriteNowSignal", -1)
|
||||
);
|
||||
// Register re-reader
|
||||
class addstopAtWriteNowSignalToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addstopAtWriteNowSignalToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addstopAtWriteNowSignalToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
sigStopAtWriteNow::signal_ = readLabel(is);
|
||||
sigStopAtWriteNow::set(true);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << sigStopAtWriteNow::signal_;
|
||||
}
|
||||
};
|
||||
addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_
|
||||
(
|
||||
"stopAtWriteNowSignal"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static Foam::Time const* runTimePtr_ = NULL;
|
||||
|
||||
@ -80,6 +110,36 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
const bool verbose,
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
set(verbose);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
||||
{
|
||||
// Reset old handling
|
||||
if (signal_ > 0)
|
||||
{
|
||||
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigStopAtWriteNow::~sigStopAtWriteNow()"
|
||||
) << "Cannot reset " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sigStopAtWriteNow::set(const bool verbose)
|
||||
{
|
||||
if (signal_ > 0)
|
||||
{
|
||||
@ -98,9 +158,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
}
|
||||
|
||||
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
@ -125,27 +182,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
||||
{
|
||||
// Reset old handling
|
||||
if (signal_ > 0)
|
||||
{
|
||||
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigStopAtWriteNow::~sigStopAtWriteNow()"
|
||||
) << "Cannot reset " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sigStopAtWriteNow::active() const
|
||||
{
|
||||
return signal_ > 0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -68,6 +68,9 @@ class sigStopAtWriteNow
|
||||
|
||||
public:
|
||||
|
||||
//- wip. Have setter have access to signal_
|
||||
friend class addstopAtWriteNowSignalToOpt;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -83,6 +86,9 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- (re)set signal catcher
|
||||
static void set(const bool verbose);
|
||||
|
||||
//- Is active?
|
||||
bool active() const;
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,11 +31,39 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Signal number to catch
|
||||
int Foam::sigWriteNow::signal_
|
||||
int sigWriteNow::signal_
|
||||
(
|
||||
debug::optimisationSwitch("writeNowSignal", -1)
|
||||
);
|
||||
// Register re-reader
|
||||
class addwriteNowSignalToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addwriteNowSignalToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addwriteNowSignalToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
sigWriteNow::signal_ = readLabel(is);
|
||||
sigWriteNow::set(true);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << sigWriteNow::signal_;
|
||||
}
|
||||
};
|
||||
addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static Foam::Time* runTimePtr_ = NULL;
|
||||
|
||||
@ -64,31 +92,10 @@ Foam::sigWriteNow::sigWriteNow()
|
||||
|
||||
Foam::sigWriteNow::sigWriteNow(const bool verbose, Time& runTime)
|
||||
{
|
||||
if (signal_ >= 0)
|
||||
{
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
sigemptyset(&newAction.sa_mask);
|
||||
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigWriteNow::sigWriteNow(const bool, const Time&)"
|
||||
) << "Cannot set " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "sigWriteNow :"
|
||||
<< " Enabling writing upon signal " << signal_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
set(verbose);
|
||||
}
|
||||
|
||||
|
||||
@ -113,6 +120,33 @@ Foam::sigWriteNow::~sigWriteNow()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sigWriteNow::set(const bool verbose)
|
||||
{
|
||||
if (signal_ >= 0)
|
||||
{
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
sigemptyset(&newAction.sa_mask);
|
||||
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigWriteNow::sigWriteNow(const bool, const Time&)"
|
||||
) << "Cannot set " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "sigWriteNow :"
|
||||
<< " Enabling writing upon signal " << signal_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::sigWriteNow::active() const
|
||||
{
|
||||
return signal_ > 0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,6 +69,9 @@ public:
|
||||
|
||||
friend class sigStopAtWriteNow;
|
||||
|
||||
//- wip. Have setter have access to signal_
|
||||
friend class addwriteNowSignalToOpt;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -84,6 +87,9 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- (re)set signal catcher
|
||||
static void set(const bool verbose);
|
||||
|
||||
//- Is active?
|
||||
bool active() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,13 +30,17 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::timer, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(timer, 0);
|
||||
|
||||
jmp_buf Foam::timer::envAlarm;
|
||||
jmp_buf timer::envAlarm;
|
||||
|
||||
struct sigaction Foam::timer::oldAction_;
|
||||
struct sigaction timer::oldAction_;
|
||||
|
||||
unsigned int timer::oldTimeOut_ = 0;
|
||||
}
|
||||
|
||||
unsigned int Foam::timer::oldTimeOut_ = 0;
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ primitives/globalIndexAndTransform/globalIndexAndTransform.C
|
||||
primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
|
||||
primitives/quaternion/quaternion.C
|
||||
primitives/septernion/septernion.C
|
||||
primitives/triad/triad.C
|
||||
|
||||
/* functions, data entries */
|
||||
primitives/functions/DataEntry/makeDataEntries.C
|
||||
@ -254,8 +255,10 @@ $(lduMatrix)/solvers/ICCG/ICCG.C
|
||||
$(lduMatrix)/solvers/BICCG/BICCG.C
|
||||
|
||||
$(lduMatrix)/smoothers/GaussSeidel/GaussSeidelSmoother.C
|
||||
$(lduMatrix)/smoothers/symGaussSeidel/symGaussSeidelSmoother.C
|
||||
$(lduMatrix)/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C
|
||||
$(lduMatrix)/smoothers/DIC/DICSmoother.C
|
||||
$(lduMatrix)/smoothers/FDIC/FDICSmoother.C
|
||||
$(lduMatrix)/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.C
|
||||
$(lduMatrix)/smoothers/DILU/DILUSmoother.C
|
||||
$(lduMatrix)/smoothers/DILUGaussSeidel/DILUGaussSeidelSmoother.C
|
||||
@ -424,6 +427,10 @@ $(polyMesh)/polyMeshInitMesh.C
|
||||
$(polyMesh)/polyMeshClear.C
|
||||
$(polyMesh)/polyMeshUpdate.C
|
||||
|
||||
polyMeshCheck = $(polyMesh)/polyMeshCheck
|
||||
$(polyMeshCheck)/polyMeshCheck.C
|
||||
$(polyMeshCheck)/polyMeshTools.C
|
||||
|
||||
primitiveMesh = meshes/primitiveMesh
|
||||
$(primitiveMesh)/primitiveMesh.C
|
||||
$(primitiveMesh)/primitiveMeshCellCells.C
|
||||
@ -444,9 +451,9 @@ $(primitiveMesh)/primitiveMeshCalcCellShapes.C
|
||||
|
||||
primitiveMeshCheck = $(primitiveMesh)/primitiveMeshCheck
|
||||
$(primitiveMeshCheck)/primitiveMeshCheck.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckMotion.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckPointNearness.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckEdgeLength.C
|
||||
$(primitiveMeshCheck)/primitiveMeshTools.C
|
||||
|
||||
primitivePatch = $(primitiveMesh)/primitivePatch
|
||||
$(primitivePatch)/patchZones.C
|
||||
@ -524,9 +531,10 @@ $(Fields)/sphericalTensorField/sphericalTensorField.C
|
||||
$(Fields)/diagTensorField/diagTensorField.C
|
||||
$(Fields)/symmTensorField/symmTensorField.C
|
||||
$(Fields)/tensorField/tensorField.C
|
||||
$(Fields)/triadField/triadField.C
|
||||
$(Fields)/complexFields/complexFields.C
|
||||
|
||||
$(Fields)/labelField/labelIOField.
|
||||
$(Fields)/labelField/labelIOField.C
|
||||
$(Fields)/labelField/labelFieldIOField.C
|
||||
$(Fields)/scalarField/scalarIOField.C
|
||||
$(Fields)/scalarField/scalarFieldIOField.C
|
||||
@ -542,6 +550,7 @@ $(Fields)/symmTensorField/symmTensorIOField.C
|
||||
$(Fields)/symmTensorField/symmTensorFieldIOField.C
|
||||
$(Fields)/tensorField/tensorIOField.C
|
||||
$(Fields)/tensorField/tensorFieldIOField.C
|
||||
$(Fields)/triadField/triadIOField.C
|
||||
$(Fields)/transformField/transformField.C
|
||||
|
||||
pointPatchFields = fields/pointPatchFields
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::dynamicIndexedOctreeName, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dynamicIndexedOctreeName, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::dynamicTreeDataPoint, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dynamicTreeDataPoint, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,36 +47,9 @@ bool Foam::indexedOctree<Type>::overlaps
|
||||
const point& sample
|
||||
)
|
||||
{
|
||||
// Find out where sample is in relation to bb.
|
||||
// Find nearest point on bb.
|
||||
scalar distSqr = 0;
|
||||
boundBox bb(p0, p1);
|
||||
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
{
|
||||
scalar d0 = p0[dir] - sample[dir];
|
||||
scalar d1 = p1[dir] - sample[dir];
|
||||
|
||||
if ((d0 > 0) != (d1 > 0))
|
||||
{
|
||||
// sample inside both extrema. This component does not add any
|
||||
// distance.
|
||||
}
|
||||
else if (mag(d0) < mag(d1))
|
||||
{
|
||||
distSqr += d0*d0;
|
||||
}
|
||||
else
|
||||
{
|
||||
distSqr += d1*d1;
|
||||
}
|
||||
|
||||
if (distSqr > nearestDistSqr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return bb.overlaps(sample, nearestDistSqr);
|
||||
}
|
||||
|
||||
|
||||
@ -379,124 +352,6 @@ Foam::label Foam::indexedOctree<Type>::compactContents
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
bool Foam::indexedOctree<Type>::quickCircumsphereRejection
|
||||
(
|
||||
const label nodeI,
|
||||
const point& cc,
|
||||
const scalar crSqr,
|
||||
const List<scalar>& nearestDistances
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
volumeType nodeType = volumeType(nodeTypes_.get(nodeI<<3));
|
||||
|
||||
//scalar boxDist = nearestDistances[nodeI] + 0.5*nod.bb_.mag();
|
||||
scalar boxDist = crSqr + magSqr(cc - nod.bb_.midpoint());
|
||||
|
||||
if
|
||||
(
|
||||
nodeType == INSIDE
|
||||
//&& (crSqr < sqr(boxDist))
|
||||
&& (boxDist < sqr(nearestDistances[nodeI]))
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction octant = nod.bb_.subOctant(cc);
|
||||
|
||||
labelBits index = nod.subNodes_[octant];
|
||||
|
||||
if (isNode(index))
|
||||
{
|
||||
return quickCircumsphereRejection
|
||||
(
|
||||
getNode(index),
|
||||
cc,
|
||||
crSqr,
|
||||
nearestDistances
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
bool Foam::indexedOctree<Type>::quickCircumsphereRejection
|
||||
(
|
||||
const point& cc,
|
||||
const scalar crSqr,
|
||||
const List<scalar>& nearestDistances
|
||||
) const
|
||||
{
|
||||
if (nodes_.size())
|
||||
{
|
||||
return quickCircumsphereRejection
|
||||
(
|
||||
0,
|
||||
cc,
|
||||
crSqr,
|
||||
nearestDistances
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
Foam::scalar
|
||||
Foam::indexedOctree<Type>::calcNearestDistance
|
||||
(
|
||||
const label nodeI
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
const point& nodeCentre = nod.bb_.midpoint();
|
||||
|
||||
scalar nearestDistance = 0.0;
|
||||
|
||||
pointIndexHit pHit = findNearest(nodeCentre, sqr(GREAT));
|
||||
|
||||
if (pHit.hit())
|
||||
{
|
||||
nearestDistance = mag(pHit.hitPoint() - nodeCentre);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Foam::indexedOctree<Type>::calcNearestDistance(const label)")
|
||||
<< "Cannot calculate distance of nearest point on surface from "
|
||||
<< "the midpoint of the octree node. Returning distance of zero."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return nearestDistance;
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
Foam::List<Foam::scalar>
|
||||
Foam::indexedOctree<Type>::calcNearestDistance() const
|
||||
{
|
||||
List<scalar> nearestDistances(nodes_.size());
|
||||
|
||||
forAll(nearestDistances, nodeI)
|
||||
{
|
||||
nearestDistances[nodeI] = calcNearestDistance(nodeI);
|
||||
}
|
||||
|
||||
return nearestDistances;
|
||||
}
|
||||
|
||||
|
||||
// Pre-calculates wherever possible the volume status per node/subnode.
|
||||
// Recurses to determine status of lowest level boxes. Level above is
|
||||
// combination of octants below.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -201,16 +201,6 @@ private:
|
||||
label& compactI
|
||||
);
|
||||
|
||||
scalar calcNearestDistance(const label nodeI) const;
|
||||
|
||||
bool quickCircumsphereRejection
|
||||
(
|
||||
const label nodeI,
|
||||
const point& cc,
|
||||
const scalar crSqr,
|
||||
const List<scalar>& nearestDistances
|
||||
) const;
|
||||
|
||||
//- Determine inside/outside per node (mixed if cannot be
|
||||
// determined). Only valid for closed shapes.
|
||||
volumeType calcVolumeType(const label nodeI) const;
|
||||
@ -658,16 +648,6 @@ public:
|
||||
CompareOp& cop
|
||||
) const;
|
||||
|
||||
//- Return a list containing the nearest distance of nodes to any
|
||||
// shapes
|
||||
List<scalar> calcNearestDistance() const;
|
||||
|
||||
bool quickCircumsphereRejection
|
||||
(
|
||||
const point& cc,
|
||||
const scalar crSqr,
|
||||
const List<scalar>& nearestDistances
|
||||
) const;
|
||||
|
||||
// Write
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::indexedOctreeName, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(indexedOctreeName, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::treeDataCell, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(treeDataCell, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -51,8 +51,13 @@ class subCycleField
|
||||
//- Reference to the field being sub-cycled
|
||||
GeometricField& gf_;
|
||||
|
||||
//- Reference to the field old-time field being sub-cycled
|
||||
// Needed to avoid calls to oldTime() which may cause
|
||||
// unexpected updates of the old-time field
|
||||
GeometricField& gf0_;
|
||||
|
||||
//- Copy of the "real" old-time value of the field
|
||||
GeometricField gf0_;
|
||||
GeometricField gf_0_;
|
||||
|
||||
|
||||
public:
|
||||
@ -63,19 +68,33 @@ public:
|
||||
subCycleField(GeometricField& gf)
|
||||
:
|
||||
gf_(gf),
|
||||
gf0_(gf.oldTime())
|
||||
gf0_(gf.oldTime()),
|
||||
gf_0_(gf0_.name() + "_", gf0_)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~subCycleField()
|
||||
{
|
||||
// Reset the old-time field
|
||||
gf0_ = gf_0_;
|
||||
|
||||
// Correct the time index of the field to correspond to the global time
|
||||
gf_.timeIndex() = gf_.time().timeIndex();
|
||||
gf0_.timeIndex() = gf_.time().timeIndex();
|
||||
}
|
||||
|
||||
// Reset the old-time field value
|
||||
gf_.oldTime() = gf0_;
|
||||
gf_.oldTime().timeIndex() = gf0_.timeIndex();
|
||||
|
||||
//- Correct the time index of the field to correspond to
|
||||
// the sub-cycling time.
|
||||
//
|
||||
// The time index is incremented to protect the old-time value from
|
||||
// being updated at the beginning of the time-loop in the case of
|
||||
// outer iteration
|
||||
void updateTimeIndex()
|
||||
{
|
||||
gf_.timeIndex() = gf_.time().timeIndex() + 1;
|
||||
gf0_.timeIndex() = gf_.time().timeIndex() + 1;
|
||||
}
|
||||
};
|
||||
|
||||
@ -106,16 +125,18 @@ public:
|
||||
//- Construct field and number of sub-cycles
|
||||
subCycle(GeometricField& gf, const label nSubCycles)
|
||||
:
|
||||
|
||||
subCycleField<GeometricField>(gf),
|
||||
subCycleTime(const_cast<Time&>(gf.time()), nSubCycles)
|
||||
{}
|
||||
{
|
||||
// Update the field time index to correspond to the sub-cycle time
|
||||
this->updateTimeIndex();
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
// End the subCycleTime, which restores the time state
|
||||
~subCycle()
|
||||
{
|
||||
// End the subCycleTime, which restores the time state
|
||||
endSubCycle();
|
||||
}
|
||||
};
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CirculatorBase
|
||||
|
||||
Description
|
||||
Base class for circulators
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CirculatorBase_H
|
||||
#define CirculatorBase_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CirculatorBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class CirculatorBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Direction type enumeration
|
||||
enum direction
|
||||
{
|
||||
NONE,
|
||||
CLOCKWISE,
|
||||
ANTICLOCKWISE
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
CirculatorBase(){};
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
227
src/OpenFOAM/containers/Circulators/circulator/circulator.H
Normal file
227
src/OpenFOAM/containers/Circulators/circulator/circulator.H
Normal file
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::circulator
|
||||
|
||||
Description
|
||||
Walks over a container as if it were circular. The container must have the
|
||||
following members defined:
|
||||
- value_type
|
||||
- size_type
|
||||
- difference_type
|
||||
- iterator
|
||||
- reference
|
||||
|
||||
Examples
|
||||
|
||||
\code
|
||||
face f(identity(5));
|
||||
|
||||
// Construct circulator from the face
|
||||
circulator<face> circ(f);
|
||||
|
||||
// First check that the circulator has a size to iterate over.
|
||||
// Then circulate around the list starting and finishing at the fulcrum.
|
||||
if (circ.size()) do
|
||||
{
|
||||
circ() += 1;
|
||||
|
||||
Info<< "Iterate forwards over face : " << circ() << endl;
|
||||
|
||||
} while (circ.circulate(CirculatorBase::CLOCKWISE));
|
||||
\endcode
|
||||
|
||||
SourceFiles
|
||||
circulatorI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef circulator_H
|
||||
#define circulator_H
|
||||
|
||||
#include "CirculatorBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class circulator Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ContainerType>
|
||||
class circulator
|
||||
:
|
||||
public CirculatorBase
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Iterator pointing to the beginning of the container
|
||||
typename ContainerType::iterator begin_;
|
||||
|
||||
//- Iterator pointing to the end of the container
|
||||
typename ContainerType::iterator end_;
|
||||
|
||||
//- Random access iterator for traversing ContainerType.
|
||||
typename ContainerType::iterator iter_;
|
||||
|
||||
//- Iterator holding the location of the fulcrum (start and end) of
|
||||
// the container. Used to decide when the iterator should stop
|
||||
// circulating over the container
|
||||
typename ContainerType::iterator fulcrum_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// STL type definitions
|
||||
|
||||
//- Type of values ContainerType contains.
|
||||
typedef typename ContainerType::value_type value_type;
|
||||
|
||||
//- The type that can represent the size of ContainerType
|
||||
typedef typename ContainerType::size_type size_type;
|
||||
|
||||
//- The type that can represent the difference between any two
|
||||
// iterator objects.
|
||||
typedef typename ContainerType::difference_type difference_type;
|
||||
|
||||
//- Random access iterator for traversing ContainerType.
|
||||
typedef typename ContainerType::iterator iterator;
|
||||
|
||||
//- Type that can be used for storing into
|
||||
// ContainerType::value_type objects.
|
||||
typedef typename ContainerType::reference reference;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline circulator();
|
||||
|
||||
//- Construct from a container.
|
||||
inline explicit circulator(ContainerType& container);
|
||||
|
||||
//- Construct from two iterators
|
||||
inline circulator(const iterator& begin, const iterator& end);
|
||||
|
||||
//- Construct as copy
|
||||
inline circulator(const circulator<ContainerType>&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~circulator();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the range of the iterator
|
||||
inline size_type size() const;
|
||||
|
||||
//- Circulate around the list in the given direction
|
||||
inline bool circulate(const CirculatorBase::direction dir = NONE);
|
||||
|
||||
//- Set the fulcrum to the current position of the iterator
|
||||
inline void setFulcrumToIterator();
|
||||
|
||||
//- Set the iterator to the current position of the fulcrum
|
||||
inline void setIteratorToFulcrum();
|
||||
|
||||
//- Return the distance between the iterator and the fulcrum. This is
|
||||
// equivalent to the number of rotations of the circulator.
|
||||
inline difference_type nRotations() const;
|
||||
|
||||
//- Dereference the next iterator and return
|
||||
inline reference next() const;
|
||||
|
||||
//- Dereference the previous iterator and return
|
||||
inline reference prev() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assignment operator for circulators that operate on the same
|
||||
// container type
|
||||
inline void operator=(const circulator<ContainerType>&);
|
||||
|
||||
//- Prefix increment. Increments the iterator.
|
||||
// Sets the iterator to the beginning of the container if it reaches
|
||||
// the end
|
||||
inline circulator<ContainerType>& operator++();
|
||||
|
||||
//- Postfix increment. Increments the iterator.
|
||||
// Sets the iterator to the beginning of the container if it reaches
|
||||
// the end
|
||||
inline circulator<ContainerType> operator++(int);
|
||||
|
||||
//- Prefix decrement. Decrements the iterator.
|
||||
// Sets the iterator to the end of the container if it reaches
|
||||
// the beginning
|
||||
inline circulator<ContainerType>& operator--();
|
||||
|
||||
//- Postfix decrement. Decrements the iterator.
|
||||
// Sets the iterator to the end of the container if it reaches
|
||||
// the beginning
|
||||
inline circulator<ContainerType> operator--(int);
|
||||
|
||||
//- Check for equality of this iterator with another iterator that
|
||||
// operate on the same container type
|
||||
inline bool operator==(const circulator<ContainerType>& c) const;
|
||||
|
||||
//- Check for inequality of this iterator with another iterator that
|
||||
// operate on the same container type
|
||||
inline bool operator!=(const circulator<ContainerType>& c) const;
|
||||
|
||||
//- Dereference the iterator and return
|
||||
inline reference operator*() const;
|
||||
|
||||
//- Dereference the iterator and return
|
||||
inline reference operator()() const;
|
||||
|
||||
//- Return the difference between this iterator and another iterator
|
||||
// that operate on the same container type
|
||||
inline difference_type operator-
|
||||
(
|
||||
const circulator<ContainerType>& c
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "circulatorI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
290
src/OpenFOAM/containers/Circulators/circulator/circulatorI.H
Normal file
290
src/OpenFOAM/containers/Circulators/circulator/circulatorI.H
Normal file
@ -0,0 +1,290 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>::circulator()
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(0),
|
||||
end_(0),
|
||||
iter_(0),
|
||||
fulcrum_(0)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>::circulator(ContainerType& container)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(container.begin()),
|
||||
end_(container.end()),
|
||||
iter_(begin_),
|
||||
fulcrum_(begin_)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>::circulator
|
||||
(
|
||||
const iterator& begin,
|
||||
const iterator& end
|
||||
)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(begin),
|
||||
end_(end),
|
||||
iter_(begin),
|
||||
fulcrum_(begin)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>::circulator
|
||||
(
|
||||
const circulator<ContainerType>& rhs
|
||||
)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(rhs.begin_),
|
||||
end_(rhs.end_),
|
||||
iter_(rhs.iter_),
|
||||
fulcrum_(rhs.fulcrum_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>::~circulator()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::size_type
|
||||
Foam::circulator<ContainerType>::size() const
|
||||
{
|
||||
return end_ - begin_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::circulator<ContainerType>::circulate
|
||||
(
|
||||
const CirculatorBase::direction dir
|
||||
)
|
||||
{
|
||||
if (dir == CirculatorBase::CLOCKWISE)
|
||||
{
|
||||
operator++();
|
||||
}
|
||||
else if (dir == CirculatorBase::ANTICLOCKWISE)
|
||||
{
|
||||
operator--();
|
||||
}
|
||||
|
||||
return !(iter_ == fulcrum_);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::circulator<ContainerType>::setFulcrumToIterator()
|
||||
{
|
||||
fulcrum_ = iter_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::circulator<ContainerType>::setIteratorToFulcrum()
|
||||
{
|
||||
iter_ = fulcrum_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::difference_type
|
||||
Foam::circulator<ContainerType>::nRotations() const
|
||||
{
|
||||
return (iter_ - fulcrum_);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::reference
|
||||
Foam::circulator<ContainerType>::next() const
|
||||
{
|
||||
if (iter_ == end_ - 1)
|
||||
{
|
||||
return *begin_;
|
||||
}
|
||||
|
||||
return *(iter_ + 1);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::reference
|
||||
Foam::circulator<ContainerType>::prev() const
|
||||
{
|
||||
if (iter_ == begin_)
|
||||
{
|
||||
return *(end_ - 1);
|
||||
}
|
||||
|
||||
return *(iter_ - 1);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::circulator<ContainerType>::operator=
|
||||
(
|
||||
const circulator<ContainerType>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::circulator<ContainerType>::operator="
|
||||
"(const Foam::circulator<ContainerType>&)"
|
||||
) << "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
begin_ = rhs.begin_;
|
||||
end_ = rhs.end_;
|
||||
iter_ = rhs.iter_;
|
||||
fulcrum_ = rhs.fulcrum_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>&
|
||||
Foam::circulator<ContainerType>::operator++()
|
||||
{
|
||||
++iter_;
|
||||
if (iter_ == end_)
|
||||
{
|
||||
iter_ = begin_;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>
|
||||
Foam::circulator<ContainerType>::operator++(int)
|
||||
{
|
||||
circulator<ContainerType> tmp = *this;
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>&
|
||||
Foam::circulator<ContainerType>::operator--()
|
||||
{
|
||||
if (iter_ == begin_)
|
||||
{
|
||||
iter_ = end_;
|
||||
}
|
||||
--iter_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::circulator<ContainerType>
|
||||
Foam::circulator<ContainerType>::operator--(int)
|
||||
{
|
||||
circulator<ContainerType> tmp = *this;
|
||||
--(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::circulator<ContainerType>::operator==
|
||||
(
|
||||
const circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
begin_ == c.begin_
|
||||
&& end_ == c.end_
|
||||
&& iter_ == c.iter_
|
||||
&& fulcrum_ == c.fulcrum_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::circulator<ContainerType>::operator!=
|
||||
(
|
||||
const circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return !(*this == c);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::reference
|
||||
Foam::circulator<ContainerType>::operator*() const
|
||||
{
|
||||
return *iter_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::reference
|
||||
Foam::circulator<ContainerType>::operator()() const
|
||||
{
|
||||
return operator*();
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::circulator<ContainerType>::difference_type
|
||||
Foam::circulator<ContainerType>::operator-
|
||||
(
|
||||
const circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return iter_ - c.iter_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,247 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::const_circulator
|
||||
|
||||
Description
|
||||
Walks over a container as if it were circular. The container must have the
|
||||
following members defined:
|
||||
- value_type
|
||||
- size_type
|
||||
- difference_type
|
||||
- const_iterator
|
||||
- const_reference
|
||||
|
||||
Examples:
|
||||
|
||||
\code
|
||||
face f(identity(5));
|
||||
|
||||
// Construct circulator from the face
|
||||
const_circulator<face> circ(f);
|
||||
|
||||
// First check that the circulator has a size to iterate over.
|
||||
// Then circulate around the list starting and finishing at the fulcrum.
|
||||
if (circ.size()) do
|
||||
{
|
||||
Info<< "Iterate forwards over face : " << circ() << endl;
|
||||
|
||||
} while (circ.circulate(CirculatorBase::CLOCKWISE));
|
||||
\endcode
|
||||
|
||||
\code
|
||||
face f(identity(5));
|
||||
|
||||
const_circulator<face> circClockwise(f);
|
||||
const_circulator<face> circAnticlockwise(f);
|
||||
|
||||
if (circClockwise.size() && circAnticlockwise.size()) do
|
||||
{
|
||||
Info<< "Iterate forward over face :" << circClockwise() << endl;
|
||||
Info<< "Iterate backward over face:" << circAnticlockwise() << endl;
|
||||
}
|
||||
while
|
||||
(
|
||||
circClockwise.circulate(CirculatorBase::CLOCKWISE),
|
||||
circAnticlockwise.circulate(CirculatorBase::ANTICLOCKWISE)
|
||||
);
|
||||
\endcode
|
||||
|
||||
SourceFiles
|
||||
const_circulatorI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef const_circulator_H
|
||||
#define const_circulator_H
|
||||
|
||||
#include "CirculatorBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class const_circulator Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ContainerType>
|
||||
class const_circulator
|
||||
:
|
||||
public CirculatorBase
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Iterator pointing to the beginning of the container
|
||||
typename ContainerType::const_iterator begin_;
|
||||
|
||||
//- Iterator pointing to the end of the container
|
||||
typename ContainerType::const_iterator end_;
|
||||
|
||||
//- Iterator
|
||||
typename ContainerType::const_iterator iter_;
|
||||
|
||||
//- Iterator holding the location of the fulcrum (start and end) of
|
||||
// the container. Used to decide when the iterator should stop
|
||||
// circulating over the container
|
||||
typename ContainerType::const_iterator fulcrum_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// STL type definitions
|
||||
|
||||
//- Type of values ContainerType contains.
|
||||
typedef typename ContainerType::value_type value_type;
|
||||
|
||||
//- The type that can represent the size of ContainerType
|
||||
typedef typename ContainerType::size_type size_type;
|
||||
|
||||
//- The type that can represent the difference between any two
|
||||
// iterator objects.
|
||||
typedef typename ContainerType::difference_type difference_type;
|
||||
|
||||
//- Random access iterator for traversing ContainerType.
|
||||
typedef typename ContainerType::const_iterator const_iterator;
|
||||
|
||||
//- Type that can be used for storing into
|
||||
// const ContainerType::value_type objects.
|
||||
typedef typename ContainerType::const_reference const_reference;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline const_circulator();
|
||||
|
||||
//- Construct from a container.
|
||||
inline explicit const_circulator(const ContainerType& container);
|
||||
|
||||
//- Construct from two iterators
|
||||
inline const_circulator
|
||||
(
|
||||
const const_iterator& begin,
|
||||
const const_iterator& end
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
inline const_circulator(const const_circulator<ContainerType>&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~const_circulator();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the range of the iterator
|
||||
inline size_type size() const;
|
||||
|
||||
//- Circulate around the list in the given direction
|
||||
inline bool circulate(const CirculatorBase::direction dir = NONE);
|
||||
|
||||
//- Set the fulcrum to the current position of the iterator
|
||||
inline void setFulcrumToIterator();
|
||||
|
||||
//- Set the iterator to the current position of the fulcrum
|
||||
inline void setIteratorToFulcrum();
|
||||
|
||||
//- Return the distance between the iterator and the fulcrum. This is
|
||||
// equivalent to the number of rotations of the circulator.
|
||||
inline difference_type nRotations() const;
|
||||
|
||||
//- Dereference the next iterator and return
|
||||
inline const_reference next() const;
|
||||
|
||||
//- Dereference the previous iterator and return
|
||||
inline const_reference prev() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assignment operator for circulators that operate on the same
|
||||
// container type
|
||||
inline void operator=(const const_circulator<ContainerType>&);
|
||||
|
||||
//- Prefix increment. Increments the iterator.
|
||||
// Sets the iterator to the beginning of the container if it reaches
|
||||
// the end
|
||||
inline const_circulator<ContainerType>& operator++();
|
||||
|
||||
//- Postfix increment. Increments the iterator.
|
||||
// Sets the iterator to the beginning of the container if it reaches
|
||||
// the end
|
||||
inline const_circulator<ContainerType> operator++(int);
|
||||
|
||||
//- Prefix decrement. Decrements the iterator.
|
||||
// Sets the iterator to the end of the container if it reaches
|
||||
// the beginning
|
||||
inline const_circulator<ContainerType>& operator--();
|
||||
|
||||
//- Postfix decrement. Decrements the iterator.
|
||||
// Sets the iterator to the end of the container if it reaches
|
||||
// the beginning
|
||||
inline const_circulator<ContainerType> operator--(int);
|
||||
|
||||
//- Check for equality of this iterator with another iterator that
|
||||
// operate on the same container type
|
||||
inline bool operator==(const const_circulator<ContainerType>& c) const;
|
||||
|
||||
//- Check for inequality of this iterator with another iterator that
|
||||
// operate on the same container type
|
||||
inline bool operator!=(const const_circulator<ContainerType>& c) const;
|
||||
|
||||
//- Dereference the iterator and return
|
||||
inline const_reference operator*() const;
|
||||
|
||||
//- Dereference the iterator and return
|
||||
inline const_reference operator()() const;
|
||||
|
||||
//- Return the difference between this iterator and another iterator
|
||||
// that operate on the same container type
|
||||
inline difference_type operator-
|
||||
(
|
||||
const const_circulator<ContainerType>& c
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "const_circulatorI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,293 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>::const_circulator()
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(0),
|
||||
end_(0),
|
||||
iter_(0),
|
||||
fulcrum_(0)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>::const_circulator
|
||||
(
|
||||
const ContainerType& container
|
||||
)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(container.begin()),
|
||||
end_(container.end()),
|
||||
iter_(begin_),
|
||||
fulcrum_(begin_)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>::const_circulator
|
||||
(
|
||||
const const_iterator& begin,
|
||||
const const_iterator& end
|
||||
)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(begin),
|
||||
end_(end),
|
||||
iter_(begin),
|
||||
fulcrum_(begin)
|
||||
{}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>::const_circulator
|
||||
(
|
||||
const const_circulator<ContainerType>& rhs
|
||||
)
|
||||
:
|
||||
CirculatorBase(),
|
||||
begin_(rhs.begin_),
|
||||
end_(rhs.end_),
|
||||
iter_(rhs.iter_),
|
||||
fulcrum_(rhs.fulcrum_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>::~const_circulator()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::size_type
|
||||
Foam::const_circulator<ContainerType>::size() const
|
||||
{
|
||||
return end_ - begin_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::const_circulator<ContainerType>::circulate
|
||||
(
|
||||
const CirculatorBase::direction dir
|
||||
)
|
||||
{
|
||||
if (dir == CirculatorBase::CLOCKWISE)
|
||||
{
|
||||
operator++();
|
||||
}
|
||||
else if (dir == CirculatorBase::ANTICLOCKWISE)
|
||||
{
|
||||
operator--();
|
||||
}
|
||||
|
||||
return !(iter_ == fulcrum_);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::const_circulator<ContainerType>::setFulcrumToIterator()
|
||||
{
|
||||
fulcrum_ = iter_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::const_circulator<ContainerType>::setIteratorToFulcrum()
|
||||
{
|
||||
iter_ = fulcrum_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::difference_type
|
||||
Foam::const_circulator<ContainerType>::nRotations() const
|
||||
{
|
||||
return (iter_ - fulcrum_);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::const_reference
|
||||
Foam::const_circulator<ContainerType>::next() const
|
||||
{
|
||||
if (iter_ == end_ - 1)
|
||||
{
|
||||
return *begin_;
|
||||
}
|
||||
|
||||
return *(iter_ + 1);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::const_reference
|
||||
Foam::const_circulator<ContainerType>::prev() const
|
||||
{
|
||||
if (iter_ == begin_)
|
||||
{
|
||||
return *(end_ - 1);
|
||||
}
|
||||
|
||||
return *(iter_ - 1);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class ContainerType>
|
||||
void Foam::const_circulator<ContainerType>::operator=
|
||||
(
|
||||
const const_circulator<ContainerType>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::const_circulator<ContainerType>::operator="
|
||||
"(const Foam::const_circulator<ContainerType>&)"
|
||||
) << "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
begin_ = rhs.begin_;
|
||||
end_ = rhs.end_;
|
||||
iter_ = rhs.iter_;
|
||||
fulcrum_ = rhs.fulcrum_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>&
|
||||
Foam::const_circulator<ContainerType>::operator++()
|
||||
{
|
||||
++iter_;
|
||||
if (iter_ == end_)
|
||||
{
|
||||
iter_ = begin_;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>
|
||||
Foam::const_circulator<ContainerType>::operator++(int)
|
||||
{
|
||||
const_circulator<ContainerType> tmp = *this;
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>&
|
||||
Foam::const_circulator<ContainerType>::operator--()
|
||||
{
|
||||
if (iter_ == begin_)
|
||||
{
|
||||
iter_ = end_;
|
||||
}
|
||||
--iter_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
Foam::const_circulator<ContainerType>
|
||||
Foam::const_circulator<ContainerType>::operator--(int)
|
||||
{
|
||||
const_circulator<ContainerType> tmp = *this;
|
||||
--(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::const_circulator<ContainerType>::operator==
|
||||
(
|
||||
const const_circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
begin_ == c.begin_
|
||||
&& end_ == c.end_
|
||||
&& iter_ == c.iter_
|
||||
&& fulcrum_ == c.fulcrum_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
bool Foam::const_circulator<ContainerType>::operator!=
|
||||
(
|
||||
const const_circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return !(*this == c);
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::const_reference
|
||||
Foam::const_circulator<ContainerType>::operator*() const
|
||||
{
|
||||
return *iter_;
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::const_reference
|
||||
Foam::const_circulator<ContainerType>::operator()() const
|
||||
{
|
||||
return operator*();
|
||||
}
|
||||
|
||||
|
||||
template<class ContainerType>
|
||||
typename Foam::const_circulator<ContainerType>::difference_type
|
||||
Foam::const_circulator<ContainerType>::operator-
|
||||
(
|
||||
const const_circulator<ContainerType>& c
|
||||
) const
|
||||
{
|
||||
return iter_ - c.iter_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::HashTableCore, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(HashTableCore, 0);
|
||||
}
|
||||
|
||||
const Foam::label Foam::HashTableCore::maxTableSize
|
||||
(
|
||||
@ -38,6 +41,7 @@ const Foam::label Foam::HashTableCore::maxTableSize
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::HashTableCore::canonicalSize(const label size)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::StaticHashTableCore, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(StaticHashTableCore, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -245,6 +245,36 @@ template<class Container, class T, int nRows, int nColumns>
|
||||
List<Container> initListList(const T[nRows][nColumns]);
|
||||
|
||||
|
||||
//- Helper class for list to append y onto the end of x
|
||||
template<class T>
|
||||
class ListAppendEqOp
|
||||
{
|
||||
public:
|
||||
void operator()(List<T>& x, const List<T>& y) const;
|
||||
};
|
||||
|
||||
|
||||
//- Reverse a list. First element becomes last element etc.
|
||||
template <class ListType>
|
||||
ListType reverseList(const ListType& list);
|
||||
|
||||
|
||||
//- Inplace reversal of a list using Swap.
|
||||
template <class ListType>
|
||||
void inplaceReverseList(ListType& list);
|
||||
|
||||
|
||||
//- Rotate a list by n places. If n is positive rotate clockwise/right/down.
|
||||
// If n is negative rotate anti-clockwise/left/up.
|
||||
template <class ListType>
|
||||
ListType rotateList(const ListType& list, const label n);
|
||||
|
||||
|
||||
//- Inplace reversal of a list using the Reversal Block Swapping algorithm.
|
||||
template <template <typename> class ListType, class DataType>
|
||||
void inplaceRotateList(ListType<DataType>& list, label n);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -684,4 +684,105 @@ Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const
|
||||
{
|
||||
if (y.size())
|
||||
{
|
||||
if (x.size())
|
||||
{
|
||||
label sz = x.size();
|
||||
x.setSize(sz + y.size());
|
||||
forAll(y, i)
|
||||
{
|
||||
x[sz++] = y[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class ListType>
|
||||
ListType Foam::reverseList(const ListType& list)
|
||||
{
|
||||
const label listSize = list.size();
|
||||
const label lastIndex = listSize - 1;
|
||||
|
||||
ListType tmpList(listSize);
|
||||
|
||||
forAll(tmpList, elemI)
|
||||
{
|
||||
tmpList[elemI] = list[lastIndex - elemI];
|
||||
}
|
||||
|
||||
return tmpList;
|
||||
}
|
||||
|
||||
|
||||
template <class ListType>
|
||||
void Foam::inplaceReverseList(ListType& list)
|
||||
{
|
||||
const label listSize = list.size();
|
||||
const label lastIndex = listSize - 1;
|
||||
const label nIterations = listSize >> 1;
|
||||
|
||||
label elemI = 0;
|
||||
while (elemI < nIterations)
|
||||
{
|
||||
Swap(list[elemI], list[lastIndex - elemI]);
|
||||
|
||||
elemI++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class ListType>
|
||||
ListType Foam::rotateList(const ListType& list, const label n)
|
||||
{
|
||||
const label listSize = list.size();
|
||||
|
||||
ListType tmpList(listSize);
|
||||
|
||||
forAll(tmpList, elemI)
|
||||
{
|
||||
label index = (elemI - n) % listSize;
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
index += listSize;
|
||||
}
|
||||
|
||||
tmpList[elemI] = list[index];
|
||||
}
|
||||
|
||||
return tmpList;
|
||||
}
|
||||
|
||||
|
||||
template <template <typename> class ListType, class DataType>
|
||||
void Foam::inplaceRotateList(ListType<DataType>& list, label n)
|
||||
{
|
||||
const label listSize = list.size();
|
||||
|
||||
n = (listSize - n) % listSize;
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
n += listSize;
|
||||
}
|
||||
|
||||
SubList<DataType> firstHalf(list, n, 0);
|
||||
SubList<DataType> secondHalf(list, listSize - n, n);
|
||||
|
||||
inplaceReverseList(firstHalf);
|
||||
inplaceReverseList(secondHalf);
|
||||
|
||||
inplaceReverseList(list);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::PackedListCore, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(PackedListCore, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::ParSortableListName, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ParSortableListName, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,6 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::CallbackRegistryName, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(CallbackRegistryName, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::IOobject, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(IOobject, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,7 +44,7 @@ defineTypeNameAndDebug(Foam::IOobject, 0);
|
||||
// ----- ------
|
||||
// "foo" ("", "", "foo")
|
||||
// "foo/bar" ("foo", "", "bar")
|
||||
// "/XXX" ERROR - no absolute path
|
||||
// "/XXX/bar" ("/XXX", "", "bar")
|
||||
// "foo/bar/" ERROR - no name
|
||||
// "foo/xxx/bar" ("foo", "xxx", "bar")
|
||||
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
|
||||
@ -64,14 +68,6 @@ bool Foam::IOobject::IOobject::fileNameComponents
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path.isAbsolute())
|
||||
{
|
||||
// called with absolute path
|
||||
WarningIn("IOobject::fileNameComponents(const fileName&, ...)")
|
||||
<< "called with absolute path: " << path << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
string::size_type first = path.find('/');
|
||||
|
||||
if (first == string::npos)
|
||||
@ -81,6 +77,15 @@ bool Foam::IOobject::IOobject::fileNameComponents
|
||||
// check afterwards
|
||||
name.string::operator=(path);
|
||||
}
|
||||
else if (first == 0)
|
||||
{
|
||||
// Leading '/'. Absolute fileName
|
||||
string::size_type last = path.rfind('/');
|
||||
instance = path.substr(0, last);
|
||||
|
||||
// check afterwards
|
||||
name.string::operator=(path.substr(last+1));
|
||||
}
|
||||
else
|
||||
{
|
||||
instance = path.substr(0, first);
|
||||
@ -246,7 +251,14 @@ const Foam::fileName& Foam::IOobject::rootPath() const
|
||||
|
||||
Foam::fileName Foam::IOobject::path() const
|
||||
{
|
||||
return rootPath()/caseName()/instance()/db_.dbDir()/local();
|
||||
if (instance().isAbsolute())
|
||||
{
|
||||
return instance();
|
||||
}
|
||||
else
|
||||
{
|
||||
return rootPath()/caseName()/instance()/db_.dbDir()/local();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -256,61 +268,80 @@ Foam::fileName Foam::IOobject::path
|
||||
const fileName& local
|
||||
) const
|
||||
{
|
||||
//Note: can only be called with relative instance since is word type
|
||||
return rootPath()/caseName()/instance/db_.dbDir()/local;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::IOobject::filePath() const
|
||||
{
|
||||
fileName path = this->path();
|
||||
fileName objectPath = path/name();
|
||||
|
||||
if (isFile(objectPath))
|
||||
if (instance().isAbsolute())
|
||||
{
|
||||
return objectPath;
|
||||
fileName objectPath = instance()/name();
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
return objectPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return fileName::null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if
|
||||
(
|
||||
time().processorCase()
|
||||
&& (
|
||||
instance() == time().system()
|
||||
|| instance() == time().constant()
|
||||
)
|
||||
)
|
||||
{
|
||||
fileName parentObjectPath =
|
||||
rootPath()/caseName()
|
||||
/".."/instance()/db_.dbDir()/local()/name();
|
||||
fileName path = this->path();
|
||||
fileName objectPath = path/name();
|
||||
|
||||
if (isFile(parentObjectPath))
|
||||
{
|
||||
return parentObjectPath;
|
||||
}
|
||||
if (isFile(objectPath))
|
||||
{
|
||||
return objectPath;
|
||||
}
|
||||
|
||||
if (!isDir(path))
|
||||
else
|
||||
{
|
||||
word newInstancePath = time().findInstancePath(instant(instance()));
|
||||
|
||||
if (newInstancePath.size())
|
||||
if
|
||||
(
|
||||
time().processorCase()
|
||||
&& (
|
||||
instance() == time().system()
|
||||
|| instance() == time().constant()
|
||||
)
|
||||
)
|
||||
{
|
||||
fileName fName
|
||||
(
|
||||
fileName parentObjectPath =
|
||||
rootPath()/caseName()
|
||||
/newInstancePath/db_.dbDir()/local()/name()
|
||||
/".."/instance()/db_.dbDir()/local()/name();
|
||||
|
||||
if (isFile(parentObjectPath))
|
||||
{
|
||||
return parentObjectPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isDir(path))
|
||||
{
|
||||
word newInstancePath = time().findInstancePath
|
||||
(
|
||||
instant(instance())
|
||||
);
|
||||
|
||||
if (isFile(fName))
|
||||
if (newInstancePath.size())
|
||||
{
|
||||
return fName;
|
||||
fileName fName
|
||||
(
|
||||
rootPath()/caseName()
|
||||
/newInstancePath/db_.dbDir()/local()/name()
|
||||
);
|
||||
|
||||
if (isFile(fName))
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fileName::null;
|
||||
return fileName::null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,12 +29,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::IOdictionary, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(IOdictionary, 0);
|
||||
|
||||
bool Foam::IOdictionary::writeDictionaries
|
||||
bool IOdictionary::writeDictionaries
|
||||
(
|
||||
Foam::debug::infoSwitch("writeDictionaries", 0)
|
||||
debug::infoSwitch("writeDictionaries", 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::IFstream, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(IFstream, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::OFstream, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(OFstream, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,13 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::Pstream, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Pstream, 0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -30,10 +30,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::UPstream, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(UPstream, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
@ -240,6 +240,12 @@ bool Foam::UPstream::floatTransfer
|
||||
(
|
||||
debug::optimisationSwitch("floatTransfer", 0)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::floatTransfer,
|
||||
floatTransfer,
|
||||
"floatTransfer"
|
||||
);
|
||||
|
||||
// Number of processors at which the reduce algorithm changes from linear to
|
||||
// tree
|
||||
@ -247,18 +253,55 @@ int Foam::UPstream::nProcsSimpleSum
|
||||
(
|
||||
debug::optimisationSwitch("nProcsSimpleSum", 16)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::nProcsSimpleSum,
|
||||
nProcsSimpleSum,
|
||||
"nProcsSimpleSum"
|
||||
);
|
||||
|
||||
// Default commsType
|
||||
Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
||||
(
|
||||
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
|
||||
);
|
||||
// Register re-reader
|
||||
class addcommsTypeToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addcommsTypeToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addcommsTypeToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
Foam::UPstream::defaultCommsType = Foam::UPstream::commsTypeNames.read
|
||||
(
|
||||
is
|
||||
);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << Foam::UPstream::commsTypeNames[Foam::UPstream::defaultCommsType];
|
||||
}
|
||||
};
|
||||
addcommsTypeToOpt addcommsTypeToOpt_("commsType");
|
||||
|
||||
|
||||
// Number of polling cycles in processor updates
|
||||
int Foam::UPstream::nPollProcInterfaces
|
||||
(
|
||||
debug::optimisationSwitch("nPollProcInterfaces", 0)
|
||||
);
|
||||
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::nPollProcInterfaces,
|
||||
nPollProcInterfaces,
|
||||
"nPollProcInterfaces"
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,11 +27,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::token::typeName = "token";
|
||||
Foam::token Foam::token::undefinedToken;
|
||||
namespace Foam
|
||||
{
|
||||
const char* const token::typeName = "token";
|
||||
token token::undefinedToken;
|
||||
|
||||
defineTypeNameAndDebug(Foam::token::compound, 0);
|
||||
defineRunTimeSelectionTable(Foam::token::compound, Istream);
|
||||
typedef token::compound tokenCompound;
|
||||
defineTypeNameAndDebug(tokenCompound, 0);
|
||||
defineRunTimeSelectionTable(tokenCompound, Istream);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -31,10 +31,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::Time, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Time, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
@ -148,7 +148,7 @@ void Foam::Time::setControls()
|
||||
else
|
||||
{
|
||||
// Search directory for valid time directories
|
||||
instantList timeDirs = findTimes(path());
|
||||
instantList timeDirs = findTimes(path(), constant());
|
||||
|
||||
if (startFrom == "firstTime")
|
||||
{
|
||||
@ -324,6 +324,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0), // bit less to allow calculations
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -416,6 +417,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -511,6 +513,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -608,6 +611,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
|
||||
@ -690,13 +694,13 @@ Foam::word Foam::Time::timeName() const
|
||||
// Search the construction path for times
|
||||
Foam::instantList Foam::Time::times() const
|
||||
{
|
||||
return findTimes(path());
|
||||
return findTimes(path(), constant());
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::Time::findInstancePath(const instant& t) const
|
||||
{
|
||||
instantList timeDirs = findTimes(path());
|
||||
instantList timeDirs = findTimes(path(), constant());
|
||||
|
||||
forAllReverse(timeDirs, timeI)
|
||||
{
|
||||
@ -712,7 +716,7 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const
|
||||
|
||||
Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
||||
{
|
||||
instantList timeDirs = findTimes(path());
|
||||
instantList timeDirs = findTimes(path(), constant());
|
||||
|
||||
// there is only one time (likely "constant") so return it
|
||||
if (timeDirs.size() == 1)
|
||||
@ -751,15 +755,16 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
||||
//
|
||||
// Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
||||
// {
|
||||
// instantList timeDirs = findTimes(path());
|
||||
// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0);
|
||||
// instantList timeDirs = findTimes(path(), constant());
|
||||
// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0, constant());
|
||||
// return timeDirs[timeIndex];
|
||||
// }
|
||||
|
||||
Foam::label Foam::Time::findClosestTimeIndex
|
||||
(
|
||||
const instantList& timeDirs,
|
||||
const scalar t
|
||||
const scalar t,
|
||||
const word& constantName
|
||||
)
|
||||
{
|
||||
label nearestIndex = -1;
|
||||
@ -767,7 +772,7 @@ Foam::label Foam::Time::findClosestTimeIndex
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
if (timeDirs[timeI].name() == "constant") continue;
|
||||
if (timeDirs[timeI].name() == constantName) continue;
|
||||
|
||||
scalar diff = mag(timeDirs[timeI].value() - t);
|
||||
if (diff < deltaT)
|
||||
@ -1070,11 +1075,13 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
|
||||
outputTime_ = false;
|
||||
primaryOutputTime_ = false;
|
||||
secondaryOutputTime_ = false;
|
||||
|
||||
switch (writeControl_)
|
||||
{
|
||||
case wcTimeStep:
|
||||
outputTime_ = !(timeIndex_ % label(writeInterval_));
|
||||
primaryOutputTime_ = !(timeIndex_ % label(writeInterval_));
|
||||
break;
|
||||
|
||||
case wcRunTime:
|
||||
@ -1088,7 +1095,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1110,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1118,7 +1125,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1130,9 +1137,8 @@ Foam::Time& Foam::Time::operator++()
|
||||
switch (secondaryWriteControl_)
|
||||
{
|
||||
case wcTimeStep:
|
||||
outputTime_ =
|
||||
outputTime_
|
||||
|| !(timeIndex_ % label(secondaryWriteInterval_));
|
||||
secondaryOutputTime_ =
|
||||
!(timeIndex_ % label(secondaryWriteInterval_));
|
||||
break;
|
||||
|
||||
case wcRunTime:
|
||||
@ -1146,7 +1152,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1161,7 +1167,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1176,7 +1182,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1184,6 +1190,9 @@ Foam::Time& Foam::Time::operator++()
|
||||
}
|
||||
|
||||
|
||||
outputTime_ = primaryOutputTime_ || secondaryOutputTime_;
|
||||
|
||||
|
||||
// see if endTime needs adjustment to stop at the next run()/end() check
|
||||
if (!end())
|
||||
{
|
||||
@ -1195,6 +1204,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
{
|
||||
endTime_ = value();
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
}
|
||||
else if (stopAt_ == saNextWrite && outputTime_ == true)
|
||||
{
|
||||
@ -1205,6 +1215,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
// Override outputTime if one-shot writing
|
||||
if (writeOnce_)
|
||||
{
|
||||
primaryOutputTime_ = true;
|
||||
outputTime_ = true;
|
||||
writeOnce_ = false;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -138,10 +138,15 @@ protected:
|
||||
|
||||
scalar secondaryWriteInterval_;
|
||||
|
||||
|
||||
label purgeWrite_;
|
||||
mutable FIFOStack<word> previousOutputTimes_;
|
||||
|
||||
// Additional purging
|
||||
|
||||
label secondaryPurgeWrite_;
|
||||
mutable FIFOStack<word> previousSecondaryOutputTimes_;
|
||||
|
||||
|
||||
// One-shot writing
|
||||
bool writeOnce_;
|
||||
|
||||
@ -369,7 +374,12 @@ public:
|
||||
instant findClosestTime(const scalar) const;
|
||||
|
||||
//- Search instantList for the time index closest to the given time
|
||||
static label findClosestTimeIndex(const instantList&, const scalar);
|
||||
static label findClosestTimeIndex
|
||||
(
|
||||
const instantList&,
|
||||
const scalar,
|
||||
const word& constantName = "constant"
|
||||
);
|
||||
|
||||
//- Write using given format, version and compression
|
||||
virtual bool writeObject
|
||||
@ -399,7 +409,11 @@ public:
|
||||
virtual word timeName() const;
|
||||
|
||||
//- Search a given directory for valid time directories
|
||||
static instantList findTimes(const fileName&);
|
||||
static instantList findTimes
|
||||
(
|
||||
const fileName&,
|
||||
const word& constantName = "constant"
|
||||
);
|
||||
|
||||
//- Return start time index
|
||||
virtual label startTimeIndex() const;
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "Time.H"
|
||||
#include "Pstream.H"
|
||||
#include "simpleObjectRegistry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +38,92 @@ void Foam::Time::readDict()
|
||||
setEnv("FOAM_APPLICATION", application, false);
|
||||
}
|
||||
|
||||
|
||||
// Check for local switches and settings
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Debug switches
|
||||
if (controlDict_.found("DebugSwitches"))
|
||||
{
|
||||
simpleObjectRegistry& objects = debug::debugObjects();
|
||||
const dictionary& localSettings = controlDict_.subDict("DebugSwitches");
|
||||
forAllConstIter(dictionary, localSettings, iter)
|
||||
{
|
||||
const word& name = iter().keyword();
|
||||
simpleObjectRegistry::iterator fnd = objects.find(name);
|
||||
if (fnd != objects.end())
|
||||
{
|
||||
Info<< controlDict_.name() << " : overriding debug switch : "
|
||||
<< iter() << endl;
|
||||
|
||||
if (iter().isDict())
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << iter().dict();
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
}
|
||||
else
|
||||
{
|
||||
fnd()->readData(iter().stream());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dimension sets
|
||||
if (controlDict_.found("DimensionSets"))
|
||||
{
|
||||
dictionary dict(Foam::dimensionSystems());
|
||||
dict.merge(controlDict_.subDict("DimensionSets"));
|
||||
|
||||
simpleObjectRegistry& objects = debug::dimensionSetObjects();
|
||||
simpleObjectRegistry::iterator fnd = objects.find("DimensionSets");
|
||||
if (fnd != objects.end())
|
||||
{
|
||||
Info<< controlDict_.name() << " : overriding DimensionSets" << endl;
|
||||
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << dict;
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
}
|
||||
}
|
||||
|
||||
// Optimisation Switches
|
||||
if (controlDict_.found("OptimisationSwitches"))
|
||||
{
|
||||
simpleObjectRegistry& objects = debug::optimisationObjects();
|
||||
const dictionary& localSettings = controlDict_.subDict
|
||||
(
|
||||
"OptimisationSwitches"
|
||||
);
|
||||
forAllConstIter(dictionary, localSettings, iter)
|
||||
{
|
||||
const word& name = iter().keyword();
|
||||
simpleObjectRegistry::iterator fnd = objects.find(name);
|
||||
if (fnd != objects.end())
|
||||
{
|
||||
Info<< controlDict_.name()
|
||||
<< " : overriding optimisation switch : " << iter() << endl;
|
||||
|
||||
if (iter().isDict())
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << iter().dict();
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
}
|
||||
else
|
||||
{
|
||||
fnd()->readData(iter().stream());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!deltaTchanged_)
|
||||
{
|
||||
deltaT_ = readScalar(controlDict_.lookup("deltaT"));
|
||||
@ -160,6 +247,20 @@ void Foam::Time::readDict()
|
||||
}
|
||||
}
|
||||
|
||||
if (controlDict_.readIfPresent("secondaryPurgeWrite", secondaryPurgeWrite_))
|
||||
{
|
||||
if (secondaryPurgeWrite_ < 0)
|
||||
{
|
||||
WarningIn("Time::readDict()")
|
||||
<< "invalid value for secondaryPurgeWrite "
|
||||
<< secondaryPurgeWrite_
|
||||
<< ", should be >= 0, setting to 0"
|
||||
<< endl;
|
||||
|
||||
secondaryPurgeWrite_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlDict_.found("timeFormat"))
|
||||
{
|
||||
const word formatName(controlDict_.lookup("timeFormat"));
|
||||
@ -347,13 +448,45 @@ bool Foam::Time::writeObject
|
||||
timeDict.regIOobject::writeObject(fmt, ver, cmp);
|
||||
bool writeOK = objectRegistry::writeObject(fmt, ver, cmp);
|
||||
|
||||
if (writeOK && purgeWrite_)
|
||||
if (writeOK)
|
||||
{
|
||||
previousOutputTimes_.push(tmName);
|
||||
|
||||
while (previousOutputTimes_.size() > purgeWrite_)
|
||||
// Does primary or secondary time trigger purging?
|
||||
// Note that primary times can only be purged by primary
|
||||
// purging. Secondary times can be purged by either primary
|
||||
// or secondary purging.
|
||||
if (primaryOutputTime_ && purgeWrite_)
|
||||
{
|
||||
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
||||
previousOutputTimes_.push(tmName);
|
||||
|
||||
while (previousOutputTimes_.size() > purgeWrite_)
|
||||
{
|
||||
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
||||
}
|
||||
}
|
||||
if
|
||||
(
|
||||
!primaryOutputTime_
|
||||
&& secondaryOutputTime_
|
||||
&& secondaryPurgeWrite_
|
||||
)
|
||||
{
|
||||
// Writing due to secondary
|
||||
previousSecondaryOutputTimes_.push(tmName);
|
||||
|
||||
while
|
||||
(
|
||||
previousSecondaryOutputTimes_.size()
|
||||
> secondaryPurgeWrite_
|
||||
)
|
||||
{
|
||||
rmDir
|
||||
(
|
||||
objectRegistry::path
|
||||
(
|
||||
previousSecondaryOutputTimes_.pop()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,6 +501,7 @@ bool Foam::Time::writeObject
|
||||
|
||||
bool Foam::Time::writeNow()
|
||||
{
|
||||
primaryOutputTime_ = true;
|
||||
outputTime_ = true;
|
||||
return write();
|
||||
}
|
||||
|
||||
@ -37,7 +37,9 @@ Foam::TimeState::TimeState()
|
||||
deltaT0_(0),
|
||||
deltaTchanged_(false),
|
||||
outputTimeIndex_(0),
|
||||
primaryOutputTime_(false),
|
||||
secondaryOutputTimeIndex_(0),
|
||||
secondaryOutputTime_(false),
|
||||
outputTime_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -61,8 +61,14 @@ protected:
|
||||
bool deltaTchanged_;
|
||||
|
||||
label outputTimeIndex_;
|
||||
//- Is outputTime because of primary?
|
||||
bool primaryOutputTime_;
|
||||
|
||||
label secondaryOutputTimeIndex_;
|
||||
bool outputTime_;
|
||||
//- Is outputTime because of secondary?
|
||||
bool secondaryOutputTime_;
|
||||
|
||||
bool outputTime_;
|
||||
|
||||
public:
|
||||
|
||||
@ -112,7 +118,7 @@ public:
|
||||
|
||||
// Check
|
||||
|
||||
//- Return true if this is an output time
|
||||
//- Return true if this is an output time (primary or secondary)
|
||||
bool outputTime() const;
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -132,15 +132,30 @@ Foam::word Foam::Time::findInstance
|
||||
|| rOpt == IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Time::findInstance"
|
||||
"(const fileName&, const word&"
|
||||
", const IOobject::readOption, const word&)"
|
||||
) << "Cannot find file \"" << name << "\" in directory "
|
||||
<< dir << " in times " << timeName()
|
||||
<< " down to " << stopInstance
|
||||
<< exit(FatalError);
|
||||
if (name.empty())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Time::findInstance"
|
||||
"(const fileName&, const word&"
|
||||
", const IOobject::readOption, const word&)"
|
||||
) << "Cannot find directory "
|
||||
<< dir << " in times " << timeName()
|
||||
<< " down to " << stopInstance
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Time::findInstance"
|
||||
"(const fileName&, const word&"
|
||||
", const IOobject::readOption, const word&)"
|
||||
) << "Cannot find file \"" << name << "\" in directory "
|
||||
<< dir << " in times " << timeName()
|
||||
<< " down to " << stopInstance
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return ts[instanceI].name();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,11 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::instantList Foam::Time::findTimes(const fileName& directory)
|
||||
Foam::instantList Foam::Time::findTimes
|
||||
(
|
||||
const fileName& directory,
|
||||
const word& constantName
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -53,7 +57,7 @@ Foam::instantList Foam::Time::findTimes(const fileName& directory)
|
||||
bool haveConstant = false;
|
||||
forAll(dirEntries, i)
|
||||
{
|
||||
if (dirEntries[i] == "constant")
|
||||
if (dirEntries[i] == constantName)
|
||||
{
|
||||
Times[nTimes].value() = 0;
|
||||
Times[nTimes].name() = dirEntries[i];
|
||||
|
||||
@ -155,7 +155,8 @@ void Foam::timeSelector::addOptions
|
||||
Foam::List<Foam::instant> Foam::timeSelector::select
|
||||
(
|
||||
const instantList& timeDirs,
|
||||
const argList& args
|
||||
const argList& args,
|
||||
const word& constantName
|
||||
)
|
||||
{
|
||||
if (timeDirs.size())
|
||||
@ -168,7 +169,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
if (timeDirs[timeI].name() == "constant")
|
||||
if (timeDirs[timeI].name() == constantName)
|
||||
{
|
||||
constantIdx = timeI;
|
||||
}
|
||||
@ -250,7 +251,12 @@ Foam::List<Foam::instant> Foam::timeSelector::select0
|
||||
const argList& args
|
||||
)
|
||||
{
|
||||
instantList timeDirs = timeSelector::select(runTime.times(), args);
|
||||
instantList timeDirs = timeSelector::select
|
||||
(
|
||||
runTime.times(),
|
||||
args,
|
||||
runTime.constant()
|
||||
);
|
||||
|
||||
if (timeDirs.empty())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -138,7 +138,8 @@ public:
|
||||
static instantList select
|
||||
(
|
||||
const instantList&,
|
||||
const argList& args
|
||||
const argList& args,
|
||||
const word& constantName = "constant"
|
||||
);
|
||||
|
||||
//- Return the set of times selected based on the argList options
|
||||
|
||||
@ -31,9 +31,11 @@ License
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
defineTypeNameAndDebug(Foam::dictionary, 0);
|
||||
|
||||
const Foam::dictionary Foam::dictionary::null;
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dictionary, 0);
|
||||
const dictionary dictionary::null;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -424,38 +426,87 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
string::size_type dotPos = keyword.find('.');
|
||||
|
||||
if (dotPos == string::npos)
|
||||
if (keyword[0] == ':')
|
||||
{
|
||||
return lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
// Go up to top level
|
||||
const dictionary* dictPtr = this;
|
||||
while (&dictPtr->parent_ != &dictionary::null)
|
||||
{
|
||||
dictPtr = &dictPtr->parent_;
|
||||
}
|
||||
|
||||
// At top. Recurse to find entries
|
||||
return dictPtr->lookupScopedEntryPtr
|
||||
(
|
||||
keyword.substr(1, keyword.size()-1),
|
||||
false,
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dotPos == 0)
|
||||
{
|
||||
const dictionary* dictPtr = this;
|
||||
while (&dictPtr->parent_ != &dictionary::null)
|
||||
{
|
||||
dictPtr = &dictPtr->parent_;
|
||||
}
|
||||
string::size_type dotPos = keyword.find('.');
|
||||
|
||||
// At top
|
||||
return dictPtr->lookupScopedEntryPtr
|
||||
(
|
||||
keyword.substr(1, keyword.size()-1),
|
||||
false,
|
||||
patternMatch
|
||||
);
|
||||
if (dotPos == string::npos)
|
||||
{
|
||||
// Non-scoped lookup
|
||||
return lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList entryNames(fileName(keyword).components('.'));
|
||||
|
||||
const entry* entPtr = lookupEntryPtr(entryNames[0], false, true);
|
||||
|
||||
for (int i=1; i<entryNames.size(); ++i)
|
||||
if (dotPos == 0)
|
||||
{
|
||||
// Starting with a '.'. Go up for every 2nd '.' found
|
||||
|
||||
const dictionary* dictPtr = this;
|
||||
|
||||
string::size_type begVar = dotPos + 1;
|
||||
string::const_iterator iter = keyword.begin() + begVar;
|
||||
string::size_type endVar = begVar;
|
||||
while
|
||||
(
|
||||
iter != keyword.end()
|
||||
&& *iter == '.'
|
||||
)
|
||||
{
|
||||
++iter;
|
||||
++endVar;
|
||||
|
||||
// Go to parent
|
||||
if (&dictPtr->parent_ == &dictionary::null)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dictionary::lookupScopedEntryPtr"
|
||||
"(const word&, bool, bool)",
|
||||
*this
|
||||
) << "No parent of current dictionary"
|
||||
<< " when searching for "
|
||||
<< keyword.substr(begVar, keyword.size()-begVar)
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
dictPtr = &dictPtr->parent_;
|
||||
}
|
||||
|
||||
return dictPtr->lookupScopedEntryPtr
|
||||
(
|
||||
keyword.substr(endVar),
|
||||
false,
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extract the first word
|
||||
word firstWord = keyword.substr(0, dotPos);
|
||||
|
||||
const entry* entPtr = lookupScopedEntryPtr
|
||||
(
|
||||
firstWord,
|
||||
false, //recursive
|
||||
patternMatch
|
||||
);
|
||||
|
||||
if (!entPtr)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
@ -463,46 +514,27 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr
|
||||
"dictionary::lookupScopedEntryPtr"
|
||||
"(const word&, bool, bool)",
|
||||
*this
|
||||
) << "keyword " << keyword
|
||||
) << "keyword " << firstWord
|
||||
<< " is undefined in dictionary "
|
||||
<< name() << endl
|
||||
<< "Valid keywords are " << keys()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
if (!entPtr->isDict())
|
||||
|
||||
if (entPtr->isDict())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
return entPtr->dict().lookupScopedEntryPtr
|
||||
(
|
||||
"dictionary::lookupScopedEntryPtr"
|
||||
"(const word&, bool, bool)",
|
||||
*this
|
||||
) << "Entry " << entPtr->name()
|
||||
<< " is not a dictionary so cannot lookup sub entry "
|
||||
<< entryNames[i]
|
||||
<< exit(FatalIOError);
|
||||
keyword.substr(dotPos, keyword.size()-dotPos),
|
||||
false,
|
||||
patternMatch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entPtr = entPtr->dict().lookupEntryPtr
|
||||
(
|
||||
entryNames[i],
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if (!entPtr)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dictionary::lookupScopedEntryPtr"
|
||||
"(const word&, bool, bool)",
|
||||
*this
|
||||
) << "keyword " << keyword
|
||||
<< " is not a valid scoped entry in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
return entPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,11 +117,12 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
if (keyword.size() > 2 && keyword[1] == token::BEGIN_BLOCK)
|
||||
{
|
||||
// Recursive substitution mode. Replace between {} with
|
||||
// expansion.
|
||||
// expansion and then let standard variable expansion deal
|
||||
// with rest.
|
||||
string s(keyword(2, keyword.size()-3));
|
||||
// Substitute dictionary and environment variables. Allow
|
||||
// Substitute dictionary and environment variables. Do not allow
|
||||
// empty substitutions.
|
||||
stringOps::inplaceExpand(s, parentDict, true, true);
|
||||
stringOps::inplaceExpand(s, parentDict, true, false);
|
||||
keyword.std::string::replace(1, keyword.size()-1, s);
|
||||
}
|
||||
parentDict.substituteScopedKeyword(keyword);
|
||||
|
||||
@ -47,13 +47,11 @@ bool Foam::primitiveEntry::expandVariable
|
||||
{
|
||||
if (w.size() > 2 && w[0] == '$' && w[1] == token::BEGIN_BLOCK)
|
||||
{
|
||||
// Recursive substitution mode. Replace between {} with
|
||||
// expansion.
|
||||
// Recursive substitution mode. Replace between {} with expansion.
|
||||
string s(w(2, w.size()-3));
|
||||
// Substitute dictionary and environment variables. Allow
|
||||
// Substitute dictionary and environment variables. Do not allow
|
||||
// empty substitutions.
|
||||
stringOps::inplaceExpand(s, dict, true, true);
|
||||
|
||||
stringOps::inplaceExpand(s, dict, true, false);
|
||||
string newW(w);
|
||||
newW.std::string::replace(1, newW.size()-1, s);
|
||||
|
||||
@ -83,6 +81,15 @@ bool Foam::primitiveEntry::expandVariable
|
||||
|
||||
if (envStr.empty())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"primitiveEntry::expandVariable"
|
||||
"(const string&, const dictionary&",
|
||||
dict
|
||||
) << "Illegal dictionary entry or environment variable name "
|
||||
<< varName << endl << "Valid dictionary entries are "
|
||||
<< dict.toc() << exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
}
|
||||
append(tokenList(IStringStream('(' + envStr + ')')()));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::dlLibraryTable, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dlLibraryTable, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName,
|
||||
const word& dictName,
|
||||
const IOobject::readOption rOpt,
|
||||
const bool readFromFiles
|
||||
)
|
||||
@ -66,6 +66,30 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
|
||||
{}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName,
|
||||
const IOobject::readOption rOpt,
|
||||
const bool readFromFiles
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dictName,
|
||||
obr,
|
||||
rOpt,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
OutputFilter(outputFilterName, obr, *this, readFromFiles)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class OutputFilter>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -89,7 +89,19 @@ public:
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry&,
|
||||
const fileName& dictName = OutputFilter::typeName() + "Dict",
|
||||
const word& dictName = OutputFilter::typeName() + "Dict",
|
||||
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
|
||||
const bool loadFromFile = false
|
||||
);
|
||||
|
||||
//- Construct for given objectRegistry and dictionary
|
||||
// Dictionary read from full path.
|
||||
// Allow the possibility to load fields from files
|
||||
IOOutputFilter
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry&,
|
||||
const fileName& dictName,
|
||||
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
|
||||
const bool loadFromFile = false
|
||||
);
|
||||
@ -121,10 +133,10 @@ public:
|
||||
}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const pointField& points)
|
||||
virtual void movePoints(const polyMesh& mesh)
|
||||
{
|
||||
read();
|
||||
OutputFilter::movePoints(points);
|
||||
OutputFilter::movePoints(mesh);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
#include "IOOutputFilter.H"
|
||||
#include "polyMesh.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Private Members * * * * * * * * * * * * * * //
|
||||
@ -221,4 +222,30 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::read
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
void Foam::OutputFilterFunctionObject<OutputFilter>::updateMesh
|
||||
(
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
if (active() && mpm.mesh().name() == regionName_)
|
||||
{
|
||||
ptr_->updateMesh(mpm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
void Foam::OutputFilterFunctionObject<OutputFilter>::movePoints
|
||||
(
|
||||
const polyMesh& mesh
|
||||
)
|
||||
{
|
||||
if (active() && mesh.name() == regionName_)
|
||||
{
|
||||
ptr_->movePoints(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -204,6 +204,12 @@ public:
|
||||
|
||||
//- Read and set the function object if its data have changed
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh& mesh);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,8 +30,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineRunTimeSelectionTable(Foam::functionObject, dictionary);
|
||||
int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0));
|
||||
namespace Foam
|
||||
{
|
||||
defineDebugSwitchWithName(functionObject, "functionObject", 0);
|
||||
defineRunTimeSelectionTable(functionObject, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,6 +49,8 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class Time;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObject Declaration
|
||||
@ -157,6 +159,12 @@ public:
|
||||
|
||||
//- Read and set the function object if its data have changed
|
||||
virtual bool read(const dictionary&) = 0;
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh& mesh) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ Foam::functionObjectFile::functionObjectFile
|
||||
names_.insert(name);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
filePtrs_.setSize(1);
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
@ -193,7 +193,7 @@ Foam::functionObjectFile::functionObjectFile
|
||||
names_.insert(names);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
filePtrs_.setSize(names_.size());
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ private:
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Prefix
|
||||
const word& prefix_;
|
||||
const word prefix_;
|
||||
|
||||
//- File names
|
||||
wordHashSet names_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,11 +25,15 @@ License
|
||||
|
||||
#include "functionObjectList.H"
|
||||
#include "Time.H"
|
||||
#include "mapPolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObject*
|
||||
Foam::functionObjectList::remove(const word& key, label& oldIndex)
|
||||
Foam::functionObject* Foam::functionObjectList::remove
|
||||
(
|
||||
const word& key,
|
||||
label& oldIndex
|
||||
)
|
||||
{
|
||||
functionObject* ptr = 0;
|
||||
|
||||
@ -319,4 +323,28 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectList::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
if (execution_)
|
||||
{
|
||||
forAll(*this, objectI)
|
||||
{
|
||||
operator[](objectI).updateMesh(mpm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectList::movePoints(const polyMesh& mesh)
|
||||
{
|
||||
if (execution_)
|
||||
{
|
||||
forAll(*this, objectI)
|
||||
{
|
||||
operator[](objectI).movePoints(mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,6 +49,8 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -163,6 +165,12 @@ public:
|
||||
|
||||
//- Read and set the function objects if their data have changed
|
||||
virtual bool read();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh& mesh);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,11 +30,8 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::outputFilterOutputControl::outputControls,
|
||||
2
|
||||
>::names[] =
|
||||
const char* NamedEnum<outputFilterOutputControl::outputControls, 2>::
|
||||
names[] =
|
||||
{
|
||||
"timeStep",
|
||||
"outputTime"
|
||||
|
||||
@ -28,7 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::objectRegistry, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(objectRegistry, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,19 +29,26 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::regIOobject, 0);
|
||||
|
||||
int Foam::regIOobject::fileModificationSkew
|
||||
(
|
||||
Foam::debug::optimisationSwitch("fileModificationSkew", 30)
|
||||
);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(regIOobject, 0);
|
||||
|
||||
int regIOobject::fileModificationSkew
|
||||
(
|
||||
debug::optimisationSwitch("fileModificationSkew", 30)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::regIOobject::fileModificationSkew,
|
||||
fileModificationSkew,
|
||||
"fileModificationSkew"
|
||||
);
|
||||
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
const char* NamedEnum
|
||||
<
|
||||
Foam::regIOobject::fileCheckTypes,
|
||||
regIOobject::fileCheckTypes,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
@ -67,6 +74,35 @@ Foam::regIOobject::fileCheckTypes Foam::regIOobject::fileModificationChecking
|
||||
)
|
||||
)
|
||||
);
|
||||
// Register re-reader
|
||||
class addfileModificationCheckingToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addfileModificationCheckingToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addfileModificationCheckingToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
Foam::regIOobject::fileModificationChecking =
|
||||
Foam::regIOobject::fileCheckTypesNames.read(is);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << Foam::regIOobject::fileCheckTypesNames
|
||||
[
|
||||
Foam::regIOobject::fileModificationChecking
|
||||
];
|
||||
}
|
||||
};
|
||||
addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
|
||||
(
|
||||
"fileModificationChecking"
|
||||
);
|
||||
|
||||
|
||||
bool Foam::regIOobject::masterOnlyReading = false;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,7 @@ Description
|
||||
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "debugName.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -133,60 +134,6 @@ public: \
|
||||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (debug information only)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#else
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#endif
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
// for templated sub-classes
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (with debug information)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
172
src/OpenFOAM/db/typeInfo/debugName.H
Normal file
172
src/OpenFOAM/db/typeInfo/debugName.H
Normal file
@ -0,0 +1,172 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Macro definitions for debug symbols etc.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef debugName_H
|
||||
#define debugName_H
|
||||
|
||||
#include "simpleRegIOobject.H"
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "label.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (debug information only)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define registerDebugSwitchWithName(Type,Tag,Name) \
|
||||
class add##Tag##ToDebug \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToDebug(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name) \
|
||||
{} \
|
||||
virtual ~add##Tag##ToDebug() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Type::debug = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Type::debug; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToDebug add##Tag##ToDebug_(Name)
|
||||
|
||||
|
||||
//- Register info switch (if int), lookup as \a Name
|
||||
#define registerInfoSwitchWithName(Switch,Tag,Name) \
|
||||
class add##Tag##ToInfo \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToInfo(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addInfoObject, name) \
|
||||
{} \
|
||||
virtual ~add##Tag##ToInfo() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Switch = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToInfo add##Tag##ToInfo_(Name)
|
||||
|
||||
|
||||
//- Register optimisation switch (if int), lookup as \a Name
|
||||
#define registerOptSwitchWithName(Switch,Tag,Name) \
|
||||
class add##Tag##ToOpt \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToOpt(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject,name)\
|
||||
{} \
|
||||
virtual ~add##Tag##ToOpt() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Switch = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToOpt add##Tag##ToOpt_(Name)
|
||||
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); \
|
||||
registerDebugSwitchWithName(Type, Type, Type::typeName_())
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#else
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#endif
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
// for templated sub-classes
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -29,8 +29,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::dimensionSet, 1);
|
||||
const Foam::scalar Foam::dimensionSet::smallExponent = SMALL;
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(dimensionSet, 1);
|
||||
const scalar dimensionSet::smallExponent = SMALL;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
@ -372,6 +375,12 @@ Foam::dimensionSet Foam::sqrt(const dimensionSet& ds)
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionSet Foam::cbrt(const dimensionSet& ds)
|
||||
{
|
||||
return pow(ds, 1.0/3.0);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionSet Foam::magSqr(const dimensionSet& ds)
|
||||
{
|
||||
return pow(ds, 2);
|
||||
|
||||
@ -76,6 +76,7 @@ dimensionSet pow6(const dimensionSet&);
|
||||
dimensionSet pow025(const dimensionSet&);
|
||||
|
||||
dimensionSet sqrt(const dimensionSet&);
|
||||
dimensionSet cbrt(const dimensionSet&);
|
||||
dimensionSet magSqr(const dimensionSet&);
|
||||
dimensionSet mag(const dimensionSet&);
|
||||
dimensionSet sign(const dimensionSet&);
|
||||
|
||||
@ -25,13 +25,15 @@ License
|
||||
|
||||
#include "dimensionSet.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "simpleRegIOobject.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
dictionary* dimensionSystemsPtr_(NULL);
|
||||
|
||||
@ -45,11 +47,35 @@ dictionary& dimensionSystems()
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
autoPtr<HashTable<dimensionedScalar> > unitSetPtr_;
|
||||
autoPtr<dimensionSets> writeUnitSetPtr_;
|
||||
|
||||
class addDimensionSetsToDebug
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addDimensionSetsToDebug(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addDimensionSetObject, name)
|
||||
{}
|
||||
virtual ~addDimensionSetsToDebug()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
deleteDemandDrivenData(dimensionSystemsPtr_);
|
||||
unitSetPtr_.clear();
|
||||
writeUnitSetPtr_.clear();
|
||||
dimensionSystemsPtr_ = new dictionary(is);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << dimensionSystems();
|
||||
}
|
||||
};
|
||||
addDimensionSetsToDebug addDimensionSetsToDebug_("DimensionSets");
|
||||
|
||||
|
||||
|
||||
const HashTable<dimensionedScalar>& unitSet()
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -377,6 +377,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,6 +85,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,6 +105,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -98,6 +98,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,7 @@ Description
|
||||
#include "sphericalTensor.H"
|
||||
#include "symmTensor.H"
|
||||
#include "tensor.H"
|
||||
#include "triad.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -128,6 +128,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -103,6 +103,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
46
src/OpenFOAM/fields/Fields/triadField/triadField.C
Normal file
46
src/OpenFOAM/fields/Fields/triadField/triadField.C
Normal file
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triadField.H"
|
||||
#include "transformField.H"
|
||||
|
||||
#define TEMPLATE
|
||||
#include "FieldFunctionsM.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "undefFieldFunctionsM.H"
|
||||
|
||||
// ************************************************************************* //
|
||||
63
src/OpenFOAM/fields/Fields/triadField/triadField.H
Normal file
63
src/OpenFOAM/fields/Fields/triadField/triadField.H
Normal file
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::triadField
|
||||
|
||||
Description
|
||||
Specialisation of Field\<T\> for triad.
|
||||
|
||||
SourceFiles
|
||||
triadField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef triadField_H
|
||||
#define triadField_H
|
||||
|
||||
#include "Field.H"
|
||||
#include "triad.H"
|
||||
|
||||
#define TEMPLATE
|
||||
#include "FieldFunctionsM.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef Field<triad> triadField;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "undefFieldFunctionsM.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
38
src/OpenFOAM/fields/Fields/triadField/triadIOField.C
Normal file
38
src/OpenFOAM/fields/Fields/triadField/triadIOField.C
Normal file
@ -0,0 +1,38 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
triadField with IO.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triadIOField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTemplateTypeNameAndDebugWithName(triadIOField, "triadField", 0);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
49
src/OpenFOAM/fields/Fields/triadField/triadIOField.H
Normal file
49
src/OpenFOAM/fields/Fields/triadField/triadIOField.H
Normal file
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::triadIOField
|
||||
|
||||
Description
|
||||
triadField with IO.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef triadIOField_H
|
||||
#define triadIOField_H
|
||||
|
||||
#include "triadField.H"
|
||||
#include "IOField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOField<triad> triadIOField;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,227 +28,27 @@ License
|
||||
#include "globalMeshData.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
readField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const word& patchFieldType
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const word&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldType,
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& constraintTypes
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const wordList&, const wordList&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
patchFieldTypes.size() != this->size()
|
||||
|| (constraintTypes.size() && (constraintTypes.size() != this->size()))
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const wordList&, const wordList&)"
|
||||
) << "Incorrect number of patch type specifications given" << nl
|
||||
<< " Number of patches in mesh = " << bmesh.size()
|
||||
<< " number of patch type specifications = "
|
||||
<< patchFieldTypes.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (constraintTypes.size())
|
||||
{
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldTypes[patchi],
|
||||
constraintTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const PtrList<PatchField<Type> >& ptfl
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const PatchField<Type>List&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, ptfl[patchi].clone(field));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const typename GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField& btf
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(btf.size()),
|
||||
bmesh_(btf.bmesh_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const GeometricBoundaryField<Type, "
|
||||
"PatchField, BoundaryMesh>&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, btf[patchi].clone(field));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct as copy
|
||||
// Dangerous because Field may be set to a field which gets deleted.
|
||||
// Need new type of GeometricBoundaryField, one which IS part of a geometric
|
||||
// field for which snGrad etc. may be called and a free standing
|
||||
// GeometricBoundaryField for which such operations are unavailable.
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const typename GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField& btf
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(btf),
|
||||
bmesh_(btf.bmesh_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const GeometricBoundaryField<Type, "
|
||||
"PatchField, BoundaryMesh>&)"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
this->setSize(bmesh_.size());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"(const BoundaryMesh&, const Field<Type>&, const dictionary&)"
|
||||
"GeometricBoundaryField::readField"
|
||||
"("
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Patch or patch-groups. (using non-wild card entries of dictionaries)
|
||||
forAllConstIter(dictionary, dict, iter)
|
||||
{
|
||||
@ -263,6 +63,7 @@ GeometricBoundaryField
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
label patchi = patchIDs[i];
|
||||
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
@ -326,12 +127,11 @@ GeometricBoundaryField
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::\n"
|
||||
"GeometricBoundaryField::GeometricBoundaryField\n"
|
||||
"(\n"
|
||||
" const BoundaryMesh&,\n"
|
||||
" const DimensionedField<Type, GeoMesh>&,\n"
|
||||
" const dictionary&\n"
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::readField"
|
||||
"("
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
) << "Cannot find patchField entry for cyclic "
|
||||
@ -344,12 +144,11 @@ GeometricBoundaryField
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::\n"
|
||||
"GeometricBoundaryField::GeometricBoundaryField\n"
|
||||
"(\n"
|
||||
" const BoundaryMesh&,\n"
|
||||
" const DimensionedField<Type, GeoMesh>&,\n"
|
||||
" const dictionary&\n"
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::readField"
|
||||
"("
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
) << "Cannot find patchField entry for "
|
||||
@ -360,6 +159,254 @@ GeometricBoundaryField
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const word& patchFieldType
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const DimensionedField<Type>&, const word&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldType,
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& constraintTypes
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type>&, "
|
||||
"const wordList&, "
|
||||
"const wordList&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
patchFieldTypes.size() != this->size()
|
||||
|| (constraintTypes.size() && (constraintTypes.size() != this->size()))
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type>&, "
|
||||
"const wordList&, "
|
||||
"const wordList&"
|
||||
")"
|
||||
) << "Incorrect number of patch type specifications given" << nl
|
||||
<< " Number of patches in mesh = " << bmesh.size()
|
||||
<< " number of patch type specifications = "
|
||||
<< patchFieldTypes.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (constraintTypes.size())
|
||||
{
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldTypes[patchi],
|
||||
constraintTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
patchi,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
patchFieldTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const PtrList<PatchField<Type> >& ptfl
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const PtrLIst<PatchField<Type> >&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, ptfl[patchi].clone(field));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const typename GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField& btf
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(btf.size()),
|
||||
bmesh_(btf.bmesh_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const typename GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, btf[patchi].clone(field));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct as copy
|
||||
// Dangerous because Field may be set to a field which gets deleted.
|
||||
// Need new type of GeometricBoundaryField, one which IS part of a geometric
|
||||
// field for which snGrad etc. may be called and a free standing
|
||||
// GeometricBoundaryField for which such operations are unavailable.
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const typename GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField& btf
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(btf),
|
||||
bmesh_(btf.bmesh_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
readField(field, dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,70 +47,49 @@ if ((gf1).mesh() != (gf2).mesh()) \
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp
|
||||
<
|
||||
typename Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField
|
||||
>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::readField
|
||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields
|
||||
(
|
||||
const dictionary& fieldDict
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField");
|
||||
DimensionedField<Type, GeoMesh>::readField(dict, "internalField");
|
||||
|
||||
tmp<GeometricBoundaryField> tboundaryField
|
||||
(
|
||||
new GeometricBoundaryField
|
||||
(
|
||||
this->mesh().boundary(),
|
||||
*this,
|
||||
fieldDict.subDict("boundaryField")
|
||||
)
|
||||
);
|
||||
boundaryField_.readField(*this, dict.subDict("boundaryField"));
|
||||
|
||||
if (fieldDict.found("referenceLevel"))
|
||||
if (dict.found("referenceLevel"))
|
||||
{
|
||||
Type fieldAverage(pTraits<Type>(fieldDict.lookup("referenceLevel")));
|
||||
Type fieldAverage(pTraits<Type>(dict.lookup("referenceLevel")));
|
||||
|
||||
Field<Type>::operator+=(fieldAverage);
|
||||
|
||||
GeometricBoundaryField& boundaryField = tboundaryField();
|
||||
|
||||
forAll(boundaryField, patchi)
|
||||
forAll(boundaryField_, patchi)
|
||||
{
|
||||
boundaryField[patchi] == boundaryField[patchi] + fieldAverage;
|
||||
boundaryField_[patchi] == boundaryField_[patchi] + fieldAverage;
|
||||
}
|
||||
}
|
||||
|
||||
return tboundaryField;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp
|
||||
<
|
||||
typename Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField
|
||||
>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
|
||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields()
|
||||
{
|
||||
return readField
|
||||
const IOdictionary dict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name(),
|
||||
this->time().timeName(),
|
||||
this->db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
is
|
||||
)
|
||||
this->name(),
|
||||
this->time().timeName(),
|
||||
this->db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->readStream(typeName)
|
||||
);
|
||||
|
||||
this->close();
|
||||
|
||||
readFields(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -132,8 +111,7 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
|
||||
}
|
||||
else if (this->readOpt() == IOobject::READ_IF_PRESENT && this->headerOk())
|
||||
{
|
||||
boundaryField_.transfer(readField(this->readStream(typeName))());
|
||||
this->close();
|
||||
readFields();
|
||||
|
||||
// Check compatibility between field and mesh
|
||||
if (this->size() != GeoMesh::size(this->mesh()))
|
||||
@ -360,9 +338,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
timeIndex_(this->time().timeIndex()),
|
||||
field0Ptr_(NULL),
|
||||
fieldPrevIterPtr_(NULL),
|
||||
boundaryField_(*this, readField(this->readStream(typeName)))
|
||||
boundaryField_(mesh.boundary())
|
||||
{
|
||||
this->close();
|
||||
readFields();
|
||||
|
||||
// Check compatibility between field and mesh
|
||||
|
||||
@ -401,8 +379,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
timeIndex_(this->time().timeIndex()),
|
||||
field0Ptr_(NULL),
|
||||
fieldPrevIterPtr_(NULL),
|
||||
boundaryField_(*this, readField(dict))
|
||||
boundaryField_(mesh.boundary())
|
||||
{
|
||||
readFields(dict);
|
||||
|
||||
// Check compatibility between field and mesh
|
||||
|
||||
if (this->size() != GeoMesh::size(this->mesh()))
|
||||
|
||||
@ -117,6 +117,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a BoundaryMesh
|
||||
GeometricBoundaryField(const BoundaryMesh&);
|
||||
|
||||
//- Construct from a BoundaryMesh,
|
||||
// reference to the internal field
|
||||
// and a patch type
|
||||
@ -177,6 +180,13 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Read the boundary field
|
||||
void readField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Update the boundary condition coefficients
|
||||
void updateCoeffs();
|
||||
|
||||
@ -247,10 +257,10 @@ private:
|
||||
// Private Member Functions
|
||||
|
||||
//- Read the field from the dictionary
|
||||
tmp<GeometricBoundaryField> readField(const dictionary&);
|
||||
void readFields(const dictionary&);
|
||||
|
||||
//- Read the field from the given stream
|
||||
tmp<GeometricBoundaryField> readField(Istream& is);
|
||||
//- Read the field - create the field dictionary on-the-fly
|
||||
void readFields();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -448,6 +448,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "processorFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,7 +41,8 @@ slicedBoundaryField
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly
|
||||
)
|
||||
{
|
||||
tmp<FieldField<PatchField, Type> > tbf
|
||||
@ -52,7 +54,15 @@ slicedBoundaryField
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
if (preserveCouples && mesh.boundary()[patchi].coupled())
|
||||
if
|
||||
(
|
||||
preserveCouples
|
||||
&& mesh.boundary()[patchi].coupled()
|
||||
&& (
|
||||
!preserveProcessorOnly
|
||||
|| isA<processorFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
)
|
||||
{
|
||||
// For coupled patched construct the correct patch field type
|
||||
bf.set
|
||||
@ -243,7 +253,8 @@ SlicedGeometricField
|
||||
const dimensionSet& ds,
|
||||
const Field<Type>& completeIField,
|
||||
const Field<Type>& completeBField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly
|
||||
)
|
||||
:
|
||||
GeometricField<Type, PatchField, GeoMesh>
|
||||
@ -252,7 +263,13 @@ SlicedGeometricField
|
||||
mesh,
|
||||
ds,
|
||||
Field<Type>(),
|
||||
slicedBoundaryField(mesh, completeBField, preserveCouples)
|
||||
slicedBoundaryField
|
||||
(
|
||||
mesh,
|
||||
completeBField,
|
||||
preserveCouples,
|
||||
preserveProcessorOnly
|
||||
)
|
||||
)
|
||||
{
|
||||
// Set the internalField to the slice of the complete field
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -83,7 +83,8 @@ private:
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
|
||||
//- Slice the given field and a create a PtrList of SlicedPatchField
|
||||
@ -133,7 +134,8 @@ public:
|
||||
const dimensionSet&,
|
||||
const Field<Type>& completeIField,
|
||||
const Field<Type>& completeBField,
|
||||
const bool preserveCouples=true
|
||||
const bool preserveCouples=true,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
|
||||
//- Construct from GeometricField. Reuses full internal and
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,10 +28,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::cloud, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cloud, 0);
|
||||
|
||||
const word cloud::prefix("lagrangian");
|
||||
word cloud::defaultName("defaultCloud");
|
||||
}
|
||||
|
||||
const Foam::word Foam::cloud::prefix("lagrangian");
|
||||
Foam::word Foam::cloud::defaultName("defaultCloud");
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,9 @@ Description
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "OSspecific.H"
|
||||
#include "Ostream.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "simpleObjectRegistry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,15 +57,35 @@ public:
|
||||
|
||||
~deleteControlDictPtr()
|
||||
{
|
||||
if (controlDictPtr_)
|
||||
{
|
||||
delete controlDictPtr_;
|
||||
controlDictPtr_ = 0;
|
||||
}
|
||||
deleteDemandDrivenData(controlDictPtr_);
|
||||
}
|
||||
};
|
||||
|
||||
deleteControlDictPtr deleteControlDictPtr_;
|
||||
|
||||
|
||||
// Debug switch read and write callback tables.
|
||||
simpleObjectRegistry* debugObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* infoObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* optimisationObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* dimensionSetObjectsPtr_(NULL);
|
||||
class deleteDebugSwitchPtr
|
||||
{
|
||||
public:
|
||||
|
||||
deleteDebugSwitchPtr()
|
||||
{}
|
||||
|
||||
~deleteDebugSwitchPtr()
|
||||
{
|
||||
deleteDemandDrivenData(debugObjectsPtr_);
|
||||
deleteDemandDrivenData(infoObjectsPtr_);
|
||||
deleteDemandDrivenData(optimisationObjectsPtr_);
|
||||
deleteDemandDrivenData(dimensionSetObjectsPtr_);
|
||||
}
|
||||
};
|
||||
|
||||
deleteDebugSwitchPtr deleteDebugSwitchPtr_;
|
||||
//! \endcond
|
||||
|
||||
|
||||
@ -165,6 +188,106 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addDebugObject(const char* name, simpleRegIOobject* obj)
|
||||
{
|
||||
if (!debugObjects().insert(name, obj))
|
||||
{
|
||||
//std::cerr<< "debug::addDebugObject : Duplicate entry " << name
|
||||
// << " in runtime selection table"
|
||||
// << std::endl;
|
||||
//error::safePrintStack(std::cerr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addInfoObject(const char* name, simpleRegIOobject* obj)
|
||||
{
|
||||
if (!infoObjects().insert(name, obj))
|
||||
{
|
||||
//std::cerr<< "debug::addInfoObject : Duplicate entry " << name
|
||||
// << " in runtime selection table"
|
||||
// << std::endl;
|
||||
//error::safePrintStack(std::cerr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addOptimisationObject
|
||||
(
|
||||
const char* name,
|
||||
simpleRegIOobject* obj
|
||||
)
|
||||
{
|
||||
if (!optimisationObjects().insert(name, obj))
|
||||
{
|
||||
//std::cerr<< "debug::addOptimisationObject : Duplicate entry " << name
|
||||
// << " in runtime selection table"
|
||||
// << std::endl;
|
||||
//error::safePrintStack(std::cerr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addDimensionSetObject
|
||||
(
|
||||
const char* name,
|
||||
simpleRegIOobject* obj
|
||||
)
|
||||
{
|
||||
if (!dimensionSetObjects().insert(name, obj))
|
||||
{
|
||||
//std::cerr<< "debug::addDimensionSetObject : Duplicate entry " << name
|
||||
// << " in runtime selection table"
|
||||
// << std::endl;
|
||||
//error::safePrintStack(std::cerr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::simpleObjectRegistry& Foam::debug::debugObjects()
|
||||
{
|
||||
if (!debugObjectsPtr_)
|
||||
{
|
||||
debugObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
}
|
||||
|
||||
return *debugObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
Foam::simpleObjectRegistry& Foam::debug::infoObjects()
|
||||
{
|
||||
if (!infoObjectsPtr_)
|
||||
{
|
||||
infoObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
}
|
||||
|
||||
return *infoObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
Foam::simpleObjectRegistry& Foam::debug::optimisationObjects()
|
||||
{
|
||||
if (!optimisationObjectsPtr_)
|
||||
{
|
||||
optimisationObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
}
|
||||
|
||||
return *optimisationObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
Foam::simpleObjectRegistry& Foam::debug::dimensionSetObjects()
|
||||
{
|
||||
if (!dimensionSetObjectsPtr_)
|
||||
{
|
||||
dimensionSetObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
}
|
||||
|
||||
return *dimensionSetObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,6 +42,10 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class dictionary;
|
||||
class Istream;
|
||||
class Ostream;
|
||||
class simpleRegIOobject;
|
||||
class simpleObjectRegistry;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -73,6 +77,36 @@ namespace debug
|
||||
//- Internal function to lookup a sub-dictionary from controlDict.
|
||||
dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
|
||||
|
||||
|
||||
|
||||
// Registered debug switches
|
||||
|
||||
//- Register debug switch read/write object
|
||||
void addDebugObject(const char* name, simpleRegIOobject* obj);
|
||||
|
||||
//- Register info switch read/write object
|
||||
void addInfoObject(const char* name, simpleRegIOobject* obj);
|
||||
|
||||
//- Register optimisation switch read/write object
|
||||
void addOptimisationObject(const char* name, simpleRegIOobject* obj);
|
||||
|
||||
//- Register DimensionSets read/write object
|
||||
void addDimensionSetObject(const char* name, simpleRegIOobject* obj);
|
||||
|
||||
|
||||
//- Get access to registered debug switch objects
|
||||
simpleObjectRegistry& debugObjects();
|
||||
|
||||
//- Get access to registered info switch objects
|
||||
simpleObjectRegistry& infoObjects();
|
||||
|
||||
//- Get access to registered optimisation switch objects
|
||||
simpleObjectRegistry& optimisationObjects();
|
||||
|
||||
//- Get access to registered dimensionSets switch objects
|
||||
simpleObjectRegistry& dimensionSetObjects();
|
||||
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
|
||||
74
src/OpenFOAM/global/debug/simpleObjectRegistry.H
Normal file
74
src/OpenFOAM/global/debug/simpleObjectRegistry.H
Normal file
@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::simpleObjectRegistry
|
||||
|
||||
Description
|
||||
Object registry for simpleRegIOobject
|
||||
|
||||
SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef simpleObjectRegistry_H
|
||||
#define simpleObjectRegistry_H
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "simpleRegIOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleObjectRegistry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleObjectRegistry
|
||||
:
|
||||
public HashTable<simpleRegIOobject*>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from initial estimate
|
||||
simpleObjectRegistry(const label nIoObjects = 128)
|
||||
:
|
||||
HashTable<simpleRegIOobject*>(nIoObjects)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
92
src/OpenFOAM/global/debug/simpleRegIOobject.H
Normal file
92
src/OpenFOAM/global/debug/simpleRegIOobject.H
Normal file
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::simpleRegIOobject
|
||||
|
||||
Description
|
||||
Abstract base class for registered object with I/O. Used in debug symbol
|
||||
registration.
|
||||
|
||||
SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef simpleRegIOobject_H
|
||||
#define simpleRegIOobject_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleRegIOobject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectregistry inserter and name
|
||||
simpleRegIOobject
|
||||
(
|
||||
void (*fn)(const char* name, simpleRegIOobject*),
|
||||
const char* name
|
||||
)
|
||||
{
|
||||
(*fn)(name, this);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~simpleRegIOobject()
|
||||
{};
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read
|
||||
virtual void readData(Istream&) = 0;
|
||||
|
||||
//- Write
|
||||
virtual void writeData(Ostream&) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,8 +33,9 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(graph::writer, 0);
|
||||
defineRunTimeSelectionTable(graph::writer, word);
|
||||
typedef graph::writer graphWriter;
|
||||
defineTypeNameAndDebug(graphWriter, 0);
|
||||
defineRunTimeSelectionTable(graphWriter, word);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,11 +28,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::gnuplotGraph, 0);
|
||||
const Foam::word Foam::gnuplotGraph::ext_("gplt");
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(gnuplotGraph, 0);
|
||||
const word gnuplotGraph::ext_("gplt");
|
||||
|
||||
typedef graph::writer graphWriter;
|
||||
addToRunTimeSelectionTable(graphWriter, gnuplotGraph, word);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,15 +28,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::jplotGraph, 0);
|
||||
const Foam::word Foam::jplotGraph::ext_("dat");
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(jplotGraph, 0);
|
||||
const word jplotGraph::ext_("dat");
|
||||
|
||||
typedef graph::writer graphWriter;
|
||||
addToRunTimeSelectionTable(graphWriter, jplotGraph, word);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::jplotGraph::write(const graph& g, Ostream& os) const
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,15 +28,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::rawGraph, 0);
|
||||
const Foam::word Foam::rawGraph::ext_("xy");
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(rawGraph, 0);
|
||||
const word rawGraph::ext_("xy");
|
||||
|
||||
typedef graph::writer graphWriter;
|
||||
addToRunTimeSelectionTable(graphWriter, rawGraph, word);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::rawGraph::write(const graph& g, Ostream& os) const
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,11 +28,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::xmgrGraph, 0);
|
||||
const Foam::word Foam::xmgrGraph::ext_("agr");
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(xmgrGraph, 0);
|
||||
const word xmgrGraph::ext_("agr");
|
||||
|
||||
typedef graph::writer graphWriter;
|
||||
addToRunTimeSelectionTable(graphWriter, xmgrGraph, word);
|
||||
}
|
||||
|
||||
10
src/OpenFOAM/include/addDictOption.H
Normal file
10
src/OpenFOAM/include/addDictOption.H
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// addDictOption.H
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
"read control dictionary from specified location"
|
||||
);
|
||||
33
src/OpenFOAM/include/setConstantMeshDictionaryIO.H
Normal file
33
src/OpenFOAM/include/setConstantMeshDictionaryIO.H
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// setConstantMeshDictionaryIO.H
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
fileName dictPath = "";
|
||||
if (args.optionFound("dict"))
|
||||
{
|
||||
dictPath = args["dict"];
|
||||
if (isDir(dictPath))
|
||||
{
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
}
|
||||
|
||||
IOobject dictIO
|
||||
(
|
||||
dictName,
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (dictPath.size())
|
||||
{
|
||||
dictIO = IOobject
|
||||
(
|
||||
dictPath,
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
}
|
||||
33
src/OpenFOAM/include/setSystemMeshDictionaryIO.H
Normal file
33
src/OpenFOAM/include/setSystemMeshDictionaryIO.H
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// setSystemMeshDictionaryIO.H
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
fileName dictPath = "";
|
||||
if (args.optionFound("dict"))
|
||||
{
|
||||
dictPath = args["dict"];
|
||||
if (isDir(dictPath))
|
||||
{
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
}
|
||||
|
||||
IOobject dictIO
|
||||
(
|
||||
dictName,
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (dictPath.size())
|
||||
{
|
||||
dictIO = IOobject
|
||||
(
|
||||
dictPath,
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user