mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -49,6 +49,9 @@ doc/[Dd]oxygen/man
|
|||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.tgz
|
*.tgz
|
||||||
|
|
||||||
|
# ignore the persistent .build tag in the main directory
|
||||||
|
/.build
|
||||||
|
|
||||||
# ignore .timeStamp in the main directory
|
# ignore .timeStamp in the main directory
|
||||||
/.timeStamp
|
/.timeStamp
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,8 @@ int main(int argc, char *argv[])
|
|||||||
+ turbulence->divDevReff(U)
|
+ turbulence->divDevReff(U)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (momentumPredictor)
|
||||||
{
|
{
|
||||||
solve(UEqn == -fvc::grad(p));
|
solve(UEqn == -fvc::grad(p));
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
if (nOuterCorr == 1)
|
if (nOuterCorr == 1)
|
||||||
{
|
{
|
||||||
p =
|
p =
|
||||||
(
|
(
|
||||||
rho
|
rho
|
||||||
- (1.0 - gamma)*rhol0
|
- (1.0 - gamma)*rhol0
|
||||||
@ -37,7 +37,14 @@
|
|||||||
- fvm::laplacian(rUAf, p)
|
- fvm::laplacian(rUAf, p)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.solve();
|
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pEqn.solve(mesh.solver(p.name()));
|
||||||
|
}
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
surfaceScalarField muf =
|
surfaceScalarField muEff
|
||||||
|
(
|
||||||
|
"muEff",
|
||||||
twoPhaseProperties.muf()
|
twoPhaseProperties.muf()
|
||||||
+ fvc::interpolate(rho*turbulence->nut());
|
+ fvc::interpolate(rho*turbulence->nut())
|
||||||
|
);
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(rho, U)
|
fvm::ddt(rho, U)
|
||||||
+ fvm::div(rhoPhi, U)
|
+ fvm::div(rhoPhi, U)
|
||||||
- fvm::laplacian(muf, U)
|
- fvm::laplacian(muEff, U)
|
||||||
- (fvc::grad(U) & fvc::grad(muf))
|
- (fvc::grad(U) & fvc::grad(muEff))
|
||||||
//- fvc::div(muf*(mesh.Sf() & fvc::interpolate(fvc::grad(U)().T())))
|
//- fvc::div(muf*(mesh.Sf() & fvc::interpolate(fvc::grad(U)().T())))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,9 @@
|
|||||||
surfaceScalarField phic = mag(phi/mesh.magSf());
|
surfaceScalarField phic = mag(phi/mesh.magSf());
|
||||||
phic = min(interface.cAlpha()*phic, max(phic));
|
phic = min(interface.cAlpha()*phic, max(phic));
|
||||||
|
|
||||||
|
fvc::makeAbsolute(phi, U);
|
||||||
volScalarField divU = fvc::div(phi);
|
volScalarField divU = fvc::div(phi);
|
||||||
|
fvc::makeRelative(phi, U);
|
||||||
|
|
||||||
if (nAlphaSubCycles > 1)
|
if (nAlphaSubCycles > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
)*rUAf*mesh.magSf();
|
)*rUAf*mesh.magSf();
|
||||||
|
|
||||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
fvScalarMatrix pdEqnIncomp
|
fvScalarMatrix pdEqnIncomp
|
||||||
(
|
(
|
||||||
@ -38,15 +38,36 @@
|
|||||||
- fvm::laplacian(rUAf, pd)
|
- fvm::laplacian(rUAf, pd)
|
||||||
);
|
);
|
||||||
|
|
||||||
solve
|
if
|
||||||
(
|
(
|
||||||
|
oCorr == nOuterCorr-1
|
||||||
|
&& corr == nCorr-1
|
||||||
|
&& nonOrth == nNonOrthCorr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
solve
|
||||||
(
|
(
|
||||||
max(alpha1, scalar(0))*(psi1/rho1)
|
(
|
||||||
+ max(alpha2, scalar(0))*(psi2/rho2)
|
max(alpha1, scalar(0))*(psi1/rho1)
|
||||||
)
|
+ max(alpha2, scalar(0))*(psi2/rho2)
|
||||||
*pdEqnComp()
|
)
|
||||||
+ pdEqnIncomp
|
*pdEqnComp()
|
||||||
);
|
+ pdEqnIncomp,
|
||||||
|
mesh.solver(pd.name() + "Final")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solve
|
||||||
|
(
|
||||||
|
(
|
||||||
|
max(alpha1, scalar(0))*(psi1/rho1)
|
||||||
|
+ max(alpha2, scalar(0))*(psi2/rho2)
|
||||||
|
)
|
||||||
|
*pdEqnComp()
|
||||||
|
+ pdEqnIncomp
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (nonOrth == nNonOrthCorr)
|
||||||
{
|
{
|
||||||
@ -62,7 +83,8 @@
|
|||||||
|
|
||||||
p = max
|
p = max
|
||||||
(
|
(
|
||||||
(pd + gh*(alpha1*rho10 + alpha2*rho20))/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
(pd + gh*(alpha1*rho10 + alpha2*rho20))
|
||||||
|
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
||||||
pMin
|
pMin
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,18 @@
|
|||||||
surfaceScalarField muf =
|
surfaceScalarField muEff
|
||||||
|
(
|
||||||
|
"muEff",
|
||||||
twoPhaseProperties->muf()
|
twoPhaseProperties->muf()
|
||||||
+ fvc::interpolate(rho*turbulence->nut());
|
+ fvc::interpolate(rho*turbulence->nut())
|
||||||
|
);
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(rho, U)
|
fvm::ddt(rho, U)
|
||||||
+ fvm::div(rhoPhi, U)
|
+ fvm::div(rhoPhi, U)
|
||||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||||
- fvm::laplacian(muf, U)
|
- fvm::laplacian(muEff, U)
|
||||||
- (fvc::grad(U) & fvc::grad(muf))
|
- (fvc::grad(U) & fvc::grad(muEff))
|
||||||
//- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
|
//- fvc::div(muEff*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
|
||||||
);
|
);
|
||||||
|
|
||||||
UEqn.relax();
|
UEqn.relax();
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -48,7 +48,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
myList.append(100.3);
|
myList.append(100.3);
|
||||||
|
|
||||||
myList.append(500.3);
|
myList.append(500.3);
|
||||||
|
|
||||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||||
@ -120,7 +119,18 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "element:" << *iter << endl;
|
Info<< "element:" << *iter << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << "Bye." << endl;
|
|
||||||
|
Info<< nl << "Testing transfer: " << nl << endl;
|
||||||
|
Info<< "original: " << myList << endl;
|
||||||
|
|
||||||
|
DLList<scalar> newList;
|
||||||
|
newList.transfer(myList);
|
||||||
|
|
||||||
|
Info<< nl << "source: " << myList << nl
|
||||||
|
<< nl << "target: " << newList << endl;
|
||||||
|
|
||||||
|
|
||||||
|
Info<< nl << "Done." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,15 +23,18 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "scalar.H"
|
||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "Dictionary.H"
|
#include "Dictionary.H"
|
||||||
|
#include "PtrDictionary.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -63,6 +66,36 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Scalar
|
||||||
|
{
|
||||||
|
scalar data_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Scalar()
|
||||||
|
:
|
||||||
|
data_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Scalar(scalar val)
|
||||||
|
:
|
||||||
|
data_(val)
|
||||||
|
{}
|
||||||
|
|
||||||
|
~Scalar()
|
||||||
|
{
|
||||||
|
Info <<"delete Scalar: " << data_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend Ostream& operator<<(Ostream& os, const Scalar& val)
|
||||||
|
{
|
||||||
|
os << val.data_;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
@ -92,12 +125,11 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "element : " << *iter;
|
Info<< "element : " << *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< dict.toc() << endl;
|
Info<< "keys: " << dict.toc() << endl;
|
||||||
|
|
||||||
delete dictPtr;
|
delete dictPtr;
|
||||||
|
|
||||||
dictPtr = new Dictionary<ent>;
|
Dictionary<ent> dict2;
|
||||||
Dictionary<ent>& dict2 = *dictPtr;
|
|
||||||
|
|
||||||
for (int i = 0; i<10; i++)
|
for (int i = 0; i<10; i++)
|
||||||
{
|
{
|
||||||
@ -106,9 +138,79 @@ int main(int argc, char *argv[])
|
|||||||
dict2.swapUp(ePtr);
|
dict2.swapUp(ePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< dict2 << endl;
|
Info<< "dict:\n" << dict2 << endl;
|
||||||
|
|
||||||
Info<< nl << "Bye." << endl;
|
Info<< nl << "Testing transfer: " << nl << endl;
|
||||||
|
Info<< "original: " << dict2 << endl;
|
||||||
|
|
||||||
|
Dictionary<ent> newDict;
|
||||||
|
newDict.transfer(dict2);
|
||||||
|
|
||||||
|
Info<< nl << "source: " << dict2 << nl
|
||||||
|
<< "keys: " << dict2.toc() << nl
|
||||||
|
<< "target: " << newDict << nl
|
||||||
|
<< "keys: " << newDict.toc() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
PtrDictionary<Scalar> scalarDict;
|
||||||
|
for (int i = 0; i<10; i++)
|
||||||
|
{
|
||||||
|
word key("ent" + name(i));
|
||||||
|
scalarDict.insert(key, new Scalar(1.3*i));
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl << "scalarDict1: " << endl;
|
||||||
|
for
|
||||||
|
(
|
||||||
|
PtrDictionary<Scalar>::const_iterator iter = scalarDict.begin();
|
||||||
|
iter != scalarDict.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< " = " << iter() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
PtrDictionary<Scalar> scalarDict2;
|
||||||
|
for (int i = 8; i<15; i++)
|
||||||
|
{
|
||||||
|
word key("ent" + name(i));
|
||||||
|
scalarDict2.insert(key, new Scalar(1.3*i));
|
||||||
|
}
|
||||||
|
Info<< nl << "scalarDict2: " << endl;
|
||||||
|
for
|
||||||
|
(
|
||||||
|
PtrDictionary<Scalar>::const_iterator iter = scalarDict2.begin();
|
||||||
|
iter != scalarDict2.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< "elem = " << *iter << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarDict.transfer(scalarDict2);
|
||||||
|
|
||||||
|
|
||||||
|
Scalar* p = scalarDict.lookupPtr("ent8");
|
||||||
|
|
||||||
|
// This does not (yet) work
|
||||||
|
// Scalar* q = scalarDict.remove("ent10");
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
Info << "found: " << *p << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info << "no p: " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarDict.clear();
|
||||||
|
|
||||||
|
// Info<< " = " << *iter << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Info<< nl << "Done." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -52,6 +52,13 @@ public:
|
|||||||
:
|
:
|
||||||
data_(s)
|
data_(s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
friend Ostream& operator<<(Ostream& os, const Scalar& s)
|
||||||
|
{
|
||||||
|
os << s.data_;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -68,10 +75,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
myList.append(new Scalar(100.3));
|
myList.append(new Scalar(100.3));
|
||||||
|
|
||||||
myList.append(new Scalar(500.3));
|
myList.append(new Scalar(500.3));
|
||||||
|
|
||||||
|
|
||||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||||
|
|
||||||
for
|
for
|
||||||
@ -99,6 +104,15 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< nl << "Testing transfer: " << nl << endl;
|
||||||
|
Info<< "original: " << myList << endl;
|
||||||
|
|
||||||
|
ISLList<Scalar> newList;
|
||||||
|
newList.transfer(myList);
|
||||||
|
|
||||||
|
Info<< nl << "source: " << myList << nl
|
||||||
|
<< nl << "target: " << newList << endl;
|
||||||
|
|
||||||
Info<< nl << "Bye." << endl;
|
Info<< nl << "Bye." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
3
applications/test/PtrList/Make/files
Normal file
3
applications/test/PtrList/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PtrListTest.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/PtrListTest
|
||||||
112
applications/test/PtrList/PtrListTest.C
Normal file
112
applications/test/PtrList/PtrListTest.C
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Application
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
|
#include "scalar.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "PtrList.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
class Scalar
|
||||||
|
{
|
||||||
|
scalar data_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Scalar()
|
||||||
|
:
|
||||||
|
data_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Scalar(scalar val)
|
||||||
|
:
|
||||||
|
data_(val)
|
||||||
|
{}
|
||||||
|
|
||||||
|
~Scalar()
|
||||||
|
{
|
||||||
|
Info <<"delete Scalar: " << data_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend Ostream& operator<<(Ostream& os, const Scalar& val)
|
||||||
|
{
|
||||||
|
os << val.data_;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
PtrList<Scalar> list1(10);
|
||||||
|
PtrList<Scalar> list2(15);
|
||||||
|
|
||||||
|
forAll(list1, i)
|
||||||
|
{
|
||||||
|
list1.set(i, new Scalar(1.3*i));
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(list2, i)
|
||||||
|
{
|
||||||
|
list2.set(i, new Scalar(10 + 1.3*i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<<"list1: " << list1 << endl;
|
||||||
|
Info<<"list2: " << list2 << endl;
|
||||||
|
|
||||||
|
Info<<"indirectly delete some items via set(.., 0) :" << endl;
|
||||||
|
for (label i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
list1.set(i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<<"transfer list2 -> list1:" << endl;
|
||||||
|
list1.transfer(list2);
|
||||||
|
|
||||||
|
Info<<"list1: " << list1 << endl;
|
||||||
|
Info<<"list2: " << list2 << endl;
|
||||||
|
|
||||||
|
Info<<"indirectly delete some items via setSize :" << endl;
|
||||||
|
list1.setSize(4);
|
||||||
|
|
||||||
|
Info<<"list1: " << list1 << endl;
|
||||||
|
|
||||||
|
Info<< nl << "Done." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -48,10 +48,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
myList.append(100.3);
|
myList.append(100.3);
|
||||||
|
|
||||||
myList.append(500.3);
|
myList.append(500.3);
|
||||||
|
|
||||||
|
|
||||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||||
|
|
||||||
for
|
for
|
||||||
@ -99,7 +97,27 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "element:" << *iter2 << endl;
|
Info<< "element:" << *iter2 << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << "Bye." << endl;
|
|
||||||
|
|
||||||
|
for (int i = 0; i<10; i++)
|
||||||
|
{
|
||||||
|
myList.append(1.3*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
myList.append(100.3);
|
||||||
|
myList.append(500.3);
|
||||||
|
|
||||||
|
Info<< nl << "Testing transfer: " << nl << endl;
|
||||||
|
Info<< "original: " << myList << endl;
|
||||||
|
|
||||||
|
SLList<scalar> newList;
|
||||||
|
newList.transfer(myList);
|
||||||
|
|
||||||
|
Info<< nl << "source: " << myList << nl
|
||||||
|
<< nl << "target: " << newList << endl;
|
||||||
|
|
||||||
|
|
||||||
|
Info<< nl << "Done." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -113,7 +113,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< dict2 << endl;
|
Info<< dict2 << endl;
|
||||||
|
|
||||||
Info<< nl << "Bye." << endl;
|
|
||||||
|
Info<< nl << "Testing transfer: " << nl << endl;
|
||||||
|
Info<< "original: " << dict2 << endl;
|
||||||
|
|
||||||
|
UDictionary<ent> newDict;
|
||||||
|
newDict.transfer(dict2);
|
||||||
|
|
||||||
|
Info<< nl << "source: " << dict2 << nl
|
||||||
|
<< "keys: " << dict2.toc() << nl
|
||||||
|
<< "target: " << newDict << nl
|
||||||
|
<< "keys: " << newDict.toc() << endl;
|
||||||
|
|
||||||
|
Info<< nl << "Done." << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,34 +41,44 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Info<< dictionary(IFstream("testDict")()) << endl;
|
{
|
||||||
|
dictionary dict(IFstream("testDict")());
|
||||||
|
Info<< "dict: " << dict << nl
|
||||||
|
<< "toc: " << dict.toc() << nl
|
||||||
|
<< "keys: " << dict.keys() << nl
|
||||||
|
<< "patterns: " << dict.keys(true) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
|
|
||||||
{
|
{
|
||||||
dictionary dict(IFstream("testDictRegex")());
|
dictionary dict(IFstream("testDictRegex")());
|
||||||
|
dict.add(keyType("fooba[rz]", true), "anything");
|
||||||
|
|
||||||
Info<< "dict:" << dict << endl;
|
Info<< "dict:" << dict << nl
|
||||||
|
<< "toc: " << dict.toc() << nl
|
||||||
|
<< "keys: " << dict.keys() << nl
|
||||||
|
<< "patterns: " << dict.keys(true) << endl;
|
||||||
|
|
||||||
// Wildcard find.
|
Info<< "Pattern find \"abc\" in top directory : "
|
||||||
Info<< "Wildcard find \"abc\" in top directory : "
|
|
||||||
<< dict.lookup("abc") << endl;
|
<< dict.lookup("abc") << endl;
|
||||||
Info<< "Wildcard find \"abc\" in sub directory : "
|
Info<< "Pattern find \"abc\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("abc")
|
<< dict.subDict("someDict").lookup("abc")
|
||||||
<< endl;
|
<< endl;
|
||||||
Info<< "Recursive wildcard find \"def\" in sub directory : "
|
Info<< "Recursive pattern find \"def\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("def", true)
|
<< dict.subDict("someDict").lookup("def", true)
|
||||||
<< endl;
|
<< endl;
|
||||||
Info<< "Recursive wildcard find \"foo\" in sub directory : "
|
Info<< "Recursive pattern find \"foo\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("foo", true)
|
<< dict.subDict("someDict").lookup("foo", true)
|
||||||
<< endl;
|
<< endl;
|
||||||
Info<< "Recursive wildcard find \"fooz\" in sub directory : "
|
Info<< "Recursive pattern find \"fooz\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("fooz", true)
|
<< dict.subDict("someDict").lookup("fooz", true)
|
||||||
<< endl;
|
<< endl;
|
||||||
Info<< "Recursive wildcard find \"bar\" in sub directory : "
|
Info<< "Recursive pattern find \"bar\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("bar", true)
|
<< dict.subDict("someDict").lookup("bar", true)
|
||||||
<< endl;
|
<< endl;
|
||||||
Info<< "Recursive wildcard find \"xxx\" in sub directory : "
|
Info<< "Recursive pattern find \"xxx\" in sub directory : "
|
||||||
<< dict.subDict("someDict").lookup("xxx", true)
|
<< dict.subDict("someDict").lookup("xxx", true)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,10 @@ FoamFile
|
|||||||
".*" parentValue1;
|
".*" parentValue1;
|
||||||
"[n-z].*" parentValue2;
|
"[n-z].*" parentValue2;
|
||||||
"f.*" parentValue3;
|
"f.*" parentValue3;
|
||||||
|
keyX parentValue4;
|
||||||
|
keyY parentValue5;
|
||||||
|
|
||||||
someDict
|
"(.*)Dict"
|
||||||
{
|
{
|
||||||
foo subdictValue0;
|
foo subdictValue0;
|
||||||
bar $f.*; // should this really match 'foo'?
|
bar $f.*; // should this really match 'foo'?
|
||||||
@ -28,7 +30,7 @@ someDict
|
|||||||
"a.*c" subdictValue3;
|
"a.*c" subdictValue3;
|
||||||
"ab.*" subdictValue2;
|
"ab.*" subdictValue2;
|
||||||
"a.*" subdictValue1;
|
"a.*" subdictValue1;
|
||||||
abcd subdictValue4;
|
abcd \1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -32,6 +32,7 @@ Description
|
|||||||
|
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -57,7 +58,16 @@ int main()
|
|||||||
Info<< "pathName.components() = " << pathName.components() << endl;
|
Info<< "pathName.components() = " << pathName.components() << endl;
|
||||||
Info<< "pathName.component(2) = " << pathName.component(2) << endl;
|
Info<< "pathName.component(2) = " << pathName.component(2) << endl;
|
||||||
|
|
||||||
Info<< "end" << endl;
|
|
||||||
|
// test findEtcFile
|
||||||
|
Info<< "\n\nfindEtcFile tests:" << nl
|
||||||
|
<< " controlDict => " << findEtcFile("controlDict") << nl
|
||||||
|
<< " badName => " << findEtcFile("badName") << endl;
|
||||||
|
Info<< "This should emit a fatal error:" << endl;
|
||||||
|
Info<< " badName(die) => " << findEtcFile("badName", true) << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
Info<< "\nEnd" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
getRoots.C
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/getRoots
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
|
|
||||||
/* EXE_LIBS = -lfiniteVolume */
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#include "dictionary.H"
|
|
||||||
#include "fileNameList.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
#include "OSspecific.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
Info << "\nReading Roots" << endl;
|
|
||||||
|
|
||||||
IFstream rootsFile(home()/".foam/apps/openDX/roots");
|
|
||||||
fileNameList rootsList(dictionary(rootsFile).lookup("roots"));
|
|
||||||
|
|
||||||
char** rootsStrings = new char*[rootsList.size() + 1];
|
|
||||||
rootsStrings[rootsList.size()] = 0;
|
|
||||||
|
|
||||||
if (rootsList.size())
|
|
||||||
{
|
|
||||||
for (int i=0; i<rootsList.size(); i++)
|
|
||||||
{
|
|
||||||
rootsStrings[i] = new char[rootsList[i].size() + 1];
|
|
||||||
strcpy(rootsStrings[i], rootsList[i].c_str());
|
|
||||||
|
|
||||||
Info<< rootsStrings[i] << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
calcEntry/calcEntry.C
|
|
||||||
dictionaryTest.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/dictionaryTest
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
|
|
||||||
root "";
|
|
||||||
case "";
|
|
||||||
instance "";
|
|
||||||
local "";
|
|
||||||
|
|
||||||
class dictionary;
|
|
||||||
object testDict;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
|
||||||
internalField uniform 1;
|
|
||||||
|
|
||||||
active
|
|
||||||
{
|
|
||||||
type turbulentIntensityKineticEnergyInlet;
|
|
||||||
intensity 0.1;
|
|
||||||
value $internalField;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inactive
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
boundaryField
|
|
||||||
{
|
|
||||||
Default_Boundary_Region
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
|
|
||||||
inlet_1 { $active }
|
|
||||||
inlet_2 { $inactive }
|
|
||||||
inlet_3 { $inactive }
|
|
||||||
|
|
||||||
#include "testDictInc"
|
|
||||||
|
|
||||||
outlet
|
|
||||||
{
|
|
||||||
type inletOutlet;
|
|
||||||
inletValue $internalField;
|
|
||||||
value #include "value";
|
|
||||||
x 5;
|
|
||||||
y 6;
|
|
||||||
another #calc{x $x; y $y;};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
inlet_4
|
|
||||||
{
|
|
||||||
type inletOutlet;
|
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
uniform 2
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
EXE_LIBS = \
|
|
||||||
$(FOAM_LIBBIN)/libOSspecific.o
|
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,36 @@ int main(int argc, char *argv[])
|
|||||||
Info << endl;
|
Info << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<<"test regExp(const char*) ..." << endl;
|
||||||
|
string me("Mark");
|
||||||
|
|
||||||
|
if (regExp("[Mm]ar[ck]").match(me))
|
||||||
|
{
|
||||||
|
Info<< "matched: " << me << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "no match" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regExp("").match(me))
|
||||||
|
{
|
||||||
|
Info<< "matched: " << me << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "no match" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regExp(NULL).match(me))
|
||||||
|
{
|
||||||
|
Info<< "matched: " << me << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "no match" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -59,23 +59,24 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
|
|||||||
// Receive data
|
// Receive data
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int slave=Pstream::firstSlave(), procIndex = 1;
|
int slave = Pstream::firstSlave(), procIndex = 1;
|
||||||
slave<=Pstream::lastSlave();
|
slave <= Pstream::lastSlave();
|
||||||
slave++, procIndex++
|
slave++, procIndex++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IPstream fromSlave(slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
fromSlave >> this->operator[](procIndex);
|
fromSlave >> this->operator[](procIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int slave=Pstream::firstSlave(), procIndex = 1;
|
int slave = Pstream::firstSlave(), procIndex = 1;
|
||||||
slave<=Pstream::lastSlave();
|
slave <= Pstream::lastSlave();
|
||||||
slave++, procIndex++
|
slave++, procIndex++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
OPstream toSlave(slave);
|
OPstream toSlave(Pstream::scheduled, slave);
|
||||||
|
|
||||||
if (redistribute)
|
if (redistribute)
|
||||||
{
|
{
|
||||||
@ -92,12 +93,13 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
|
|||||||
{
|
{
|
||||||
// Slave: send my local data to master
|
// Slave: send my local data to master
|
||||||
{
|
{
|
||||||
OPstream toMaster(Pstream::masterNo());
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
toMaster << localData;
|
toMaster << localData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive data from master
|
// Receive data from master
|
||||||
{
|
{
|
||||||
IPstream fromMaster(Pstream::masterNo());
|
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
if (redistribute)
|
if (redistribute)
|
||||||
{
|
{
|
||||||
fromMaster >> *this;
|
fromMaster >> *this;
|
||||||
|
|||||||
@ -289,9 +289,7 @@ int main(int argc, char *argv[])
|
|||||||
<< patchNames[patchI] << "\t\t"
|
<< patchNames[patchI] << "\t\t"
|
||||||
<< allPatchFaces[patchI].size() << endl;
|
<< allPatchFaces[patchI].size() << endl;
|
||||||
|
|
||||||
allPatchFaces[patchI].shrink();
|
|
||||||
patchFaces[patchI].transfer(allPatchFaces[patchI]);
|
patchFaces[patchI].transfer(allPatchFaces[patchI]);
|
||||||
allPatchFaces[patchI].clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|||||||
@ -461,7 +461,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Trim
|
// Trim
|
||||||
boundaryFaces.setSize(faceI);
|
boundaryFaces.setSize(faceI);
|
||||||
boundaryPatch.setSize(faceI);
|
boundaryPatch.setSize(faceI);
|
||||||
@ -515,7 +515,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< " " << patchNames[patchI] << " : "
|
Info<< " " << patchNames[patchI] << " : "
|
||||||
<< allPatchFaces[patchI].size() << endl;
|
<< allPatchFaces[patchI].size() << endl;
|
||||||
|
|
||||||
patchFaces[patchI].transfer(allPatchFaces[patchI].shrink());
|
patchFaces[patchI].transfer(allPatchFaces[patchI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
@ -548,7 +548,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
meshPtr().write();
|
meshPtr().write();
|
||||||
|
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
# the pqReader.xml file contains xml defining readers with their
|
# the pqReader.xml file contains xml defining readers with their
|
||||||
# file extensions and descriptions.
|
# file extensions and descriptions.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.4)
|
||||||
|
|
||||||
FIND_PACKAGE(ParaView REQUIRED)
|
FIND_PACKAGE(ParaView REQUIRED)
|
||||||
INCLUDE(${PARAVIEW_USE_FILE})
|
INCLUDE(${PARAVIEW_USE_FILE})
|
||||||
|
|
||||||
|
|||||||
@ -74,10 +74,7 @@ void Foam::readerDatabase::getPolyHedra()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
polys.shrink();
|
|
||||||
|
|
||||||
Info<< "Found " << polys.size() << " polyhedral cells " << endl;
|
Info<< "Found " << polys.size() << " polyhedral cells " << endl;
|
||||||
|
|
||||||
polys_.transfer(polys);
|
polys_.transfer(polys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,8 +101,23 @@ int main(int argc, char *argv[])
|
|||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
IOsampledSets sSets(mesh, "sampleDict", IOobject::MUST_READ, true);
|
IOsampledSets sSets
|
||||||
IOsampledSurfaces sSurfs(mesh, "sampleDict", IOobject::MUST_READ, true);
|
(
|
||||||
|
sampledSets::typeName,
|
||||||
|
mesh,
|
||||||
|
"sampleDict",
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
IOsampledSurfaces sSurfs
|
||||||
|
(
|
||||||
|
sampledSurfaces::typeName,
|
||||||
|
mesh,
|
||||||
|
"sampleDict",
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Reading Burcat data dictionary" << endl;
|
Info<< nl << "Reading Burcat data dictionary" << endl;
|
||||||
|
|
||||||
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
|
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
|
||||||
|
|
||||||
// Construct control dictionary
|
// Construct control dictionary
|
||||||
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
||||||
|
|||||||
@ -79,7 +79,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Reading Burcat data dictionary" << endl;
|
Info<< nl << "Reading Burcat data dictionary" << endl;
|
||||||
|
|
||||||
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
|
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
|
||||||
|
|
||||||
// Construct control dictionary
|
// Construct control dictionary
|
||||||
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Reading Burcat data dictionary" << endl;
|
Info<< nl << "Reading Burcat data dictionary" << endl;
|
||||||
|
|
||||||
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
|
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
|
||||||
|
|
||||||
// Construct control dictionary
|
// Construct control dictionary
|
||||||
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
IFstream BurcatCpDataFile(BurcatCpDataFileName);
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
buildParaView3.3-cvs
|
|
||||||
192
bin/buildParaView3.5-cvs
Executable file
192
bin/buildParaView3.5-cvs
Executable file
@ -0,0 +1,192 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
# \\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# buildParaView3.5-cvs
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Build and install ParaView
|
||||||
|
# - run from folder above ParaView source folder or place the
|
||||||
|
# ParaView source under $WM_THIRD_PARTY_DIR
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
|
||||||
|
|
||||||
|
PARAVIEW_SRC=paraview-3.5-cvs
|
||||||
|
PARAVIEW_MAJOR_VERSION=3.5
|
||||||
|
|
||||||
|
# User options:
|
||||||
|
# ~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# MPI support:
|
||||||
|
WITH_MPI=OFF
|
||||||
|
MPI_MAX_PROCS=32
|
||||||
|
|
||||||
|
# Python support:
|
||||||
|
# note: script will try to determine the appropriate python library.
|
||||||
|
# If it fails, specify the path using the PYTHON_LIBRARY variable
|
||||||
|
WITH_PYTHON=OFF
|
||||||
|
PYTHON_LIBRARY=""
|
||||||
|
# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
|
||||||
|
|
||||||
|
# MESA graphics support:
|
||||||
|
WITH_MESA=OFF
|
||||||
|
|
||||||
|
#
|
||||||
|
# No further editing below this line
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
Script=${0##*/}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
|
usage: ${0##*/} [OPTION]
|
||||||
|
options:
|
||||||
|
-fast for repeated builds (-make -install) *use with caution*
|
||||||
|
-mpi with mpi (if not already enabled)
|
||||||
|
-python with python (if not already enabled)
|
||||||
|
-mesa with mesa (if not already enabled)
|
||||||
|
-verbose verbose output in Makefiles
|
||||||
|
-help
|
||||||
|
|
||||||
|
For finer control, the build stages can be also selected individually
|
||||||
|
(mutually exclusive)
|
||||||
|
-config
|
||||||
|
-make
|
||||||
|
-makedoc
|
||||||
|
-install
|
||||||
|
[-envpath] alter absolute paths in CMake files to use env variables
|
||||||
|
|
||||||
|
Build and install $PARAVIEW_SRC
|
||||||
|
- run from folder above the ParaView source folder or place the
|
||||||
|
ParaView source under \$WM_THIRD_PARTY_DIR
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# add options based on script name:
|
||||||
|
case "$Script" in *-mpi*) WITH_MPI=ON;; esac
|
||||||
|
case "$Script" in *-python*) WITH_PYTHON=ON;; esac
|
||||||
|
case "$Script" in *-mesa*) WITH_MESA=ON;; esac
|
||||||
|
|
||||||
|
runCONFIG=true
|
||||||
|
runMAKE=true
|
||||||
|
runMAKEDOC=true
|
||||||
|
runINSTALL=true
|
||||||
|
runENVPATH=false
|
||||||
|
|
||||||
|
# parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-config) # stage 1: config only
|
||||||
|
runCONFIG=true
|
||||||
|
runMAKE=false
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=false
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-make) # stage 2: make only
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=true
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=false
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-makedoc) # stage 3: generate html documentation
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=false
|
||||||
|
runMAKEDOC=true
|
||||||
|
runINSTALL=false
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-install) # stage 4: install only
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=false
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-envpath) # optional: change cmake files to use env variables
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=false
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=false
|
||||||
|
runENVPATH=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-fast) # shortcut for rebuild
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=true
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-mpi)
|
||||||
|
WITH_MPI=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-python)
|
||||||
|
WITH_PYTHON=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-mesa)
|
||||||
|
WITH_MESA=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-verbose)
|
||||||
|
VERBOSE=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage "unknown option/argument: '$*'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Set configure options
|
||||||
|
#~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
addVerbosity # verbose makefiles
|
||||||
|
addMpiSupport # set MPI-specific options
|
||||||
|
addPythonSupport # set Python-specific options
|
||||||
|
addMesaSupport # set MESA-specific options
|
||||||
|
|
||||||
|
getPaths # discover where things are or should be put
|
||||||
|
|
||||||
|
# Build and install
|
||||||
|
# ~~~~~~~~~~~~~~~~~
|
||||||
|
[ $runCONFIG = true ] && configParaView
|
||||||
|
[ $runMAKE = true ] && makeParaView
|
||||||
|
[ $runMAKEDOC = true ] && makeDocs
|
||||||
|
[ $runINSTALL = true ] && installParaView
|
||||||
|
[ $runENVPATH = true ] && fixCMakeFiles
|
||||||
|
|
||||||
|
echo "done"
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
1
bin/buildParaView3.5-cvs-python
Symbolic link
1
bin/buildParaView3.5-cvs-python
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
buildParaView3.5-cvs
|
||||||
@ -45,8 +45,8 @@ options:
|
|||||||
-h help
|
-h help
|
||||||
|
|
||||||
Updates the header of application files and removes consecutive blank lines.
|
Updates the header of application files and removes consecutive blank lines.
|
||||||
By default, writes current version in the header.
|
By default, writes current OpenFOAM version in the header.
|
||||||
An alternative version can be specified with -v option.
|
An alternative version can be specified with the -v option.
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
@ -59,8 +59,8 @@ printHeader() {
|
|||||||
| ========= | |
|
| ========= | |
|
||||||
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\\\ / O peration | Version: ${foamVersion} |
|
| \\\\ / O peration | Version: ${foamVersion} |
|
||||||
| \\\\ / A nd | Web: http://www.OpenFOAM.org |
|
| \\\\ / A nd | |
|
||||||
| \\\\/ M anipulation | |
|
| \\\\/ M anipulation | www.OpenFOAM.org |
|
||||||
\\*---------------------------------------------------------------------------*/
|
\\*---------------------------------------------------------------------------*/
|
||||||
FoamFile
|
FoamFile
|
||||||
{
|
{
|
||||||
@ -84,13 +84,13 @@ FoamFileAttribute() {
|
|||||||
#
|
#
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
#
|
#
|
||||||
OPTS=`getopt hv: $*`
|
opts=$(getopt hv: $*)
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "Aborting due to invalid option"
|
echo "Aborting due to invalid option"
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
eval set -- '$OPTS'
|
eval set -- '$opts'
|
||||||
while [ "$1" != "--" ]
|
while [ "$1" != "--" ]
|
||||||
do
|
do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -110,11 +110,13 @@ shift
|
|||||||
|
|
||||||
|
|
||||||
# constant width for version
|
# constant width for version
|
||||||
foamVersion=`printf %-36s $foamVersion`
|
foamVersion=$(printf %-36s $foamVersion)
|
||||||
|
|
||||||
#
|
#
|
||||||
# MAIN
|
# MAIN
|
||||||
#
|
#
|
||||||
|
unset NOTE
|
||||||
|
|
||||||
for caseFile
|
for caseFile
|
||||||
do
|
do
|
||||||
if grep FoamFile $caseFile >/dev/null 2>&1
|
if grep FoamFile $caseFile >/dev/null 2>&1
|
||||||
@ -122,16 +124,17 @@ do
|
|||||||
echo "Updating case file: $caseFile"
|
echo "Updating case file: $caseFile"
|
||||||
sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp
|
sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp
|
||||||
|
|
||||||
CLASS=`FoamFileAttribute class FoamFile.tmp`
|
FORMAT=$(FoamFileAttribute format FoamFile.tmp)
|
||||||
OBJECT=`FoamFileAttribute object FoamFile.tmp`
|
CLASS=$(FoamFileAttribute class FoamFile.tmp)
|
||||||
FORMAT=`FoamFileAttribute format FoamFile.tmp`
|
OBJECT=$(FoamFileAttribute object FoamFile.tmp)
|
||||||
|
# extract NOTE?
|
||||||
|
|
||||||
printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp
|
printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp
|
||||||
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
|
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
|
||||||
|
|
||||||
# use cat to avoid removing/replace soft-links
|
# use cat to avoid removing/replace soft-links
|
||||||
[ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile
|
[ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile
|
||||||
rm FoamFile.tmp
|
rm -f FoamFile.tmp 2>/dev/null
|
||||||
else
|
else
|
||||||
echo " Invalid case file: $caseFile" 1>&2
|
echo " Invalid case file: $caseFile" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# ========= |
|
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
# \\ / O peration |
|
|
||||||
# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
|
||||||
# \\/ 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 2 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, write to the Free Software Foundation,
|
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
#
|
|
||||||
# Script
|
|
||||||
# buildParaView3.2.1
|
|
||||||
#
|
|
||||||
# Description
|
|
||||||
# Build and install ParaView
|
|
||||||
# - run from folder above ParaView source folder or place the
|
|
||||||
# ParaView source under $WM_PROJECT_INST_DIR
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
|
|
||||||
|
|
||||||
PARAVIEW_SRC="ParaView3.2.1"
|
|
||||||
PARAVIEW_MAJOR_VERSION="3.2"
|
|
||||||
|
|
||||||
# User options:
|
|
||||||
# ~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
WITH_MPI=ON
|
|
||||||
MPI_MAX_PROCS=32
|
|
||||||
WITH_PYTHON=ON
|
|
||||||
PYTHON_LIBRARY=""
|
|
||||||
WITH__MESA=OFF
|
|
||||||
|
|
||||||
#
|
|
||||||
# No further editing below this line
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# shortcut for repeated builds - use with caution
|
|
||||||
if [ "$1" = "-fast" ]
|
|
||||||
then
|
|
||||||
CMAKE_SKIP=YES
|
|
||||||
elif [ "$#" -gt 0 ]
|
|
||||||
then
|
|
||||||
echo "$0: only supports a -fast option"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set configure options
|
|
||||||
#~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
addVerbosity # set cmake verbosity
|
|
||||||
addMpiSupport # set MPI-specific options
|
|
||||||
addPythonSupport # set Python-specific options
|
|
||||||
addMesaSupport # set MESA-specific options
|
|
||||||
|
|
||||||
buildParaView
|
|
||||||
installParaView
|
|
||||||
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -34,8 +34,8 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
|
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
|
||||||
|
|
||||||
PARAVIEW_SRC="ParaView3.3-cvs"
|
PARAVIEW_SRC=paraview-3.4
|
||||||
PARAVIEW_MAJOR_VERSION="3.3"
|
PARAVIEW_MAJOR_VERSION=3.4
|
||||||
|
|
||||||
# User options:
|
# User options:
|
||||||
# ~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~
|
||||||
@ -45,7 +45,7 @@ WITH_MPI=OFF
|
|||||||
MPI_MAX_PROCS=32
|
MPI_MAX_PROCS=32
|
||||||
|
|
||||||
# Python support:
|
# Python support:
|
||||||
# note: script will try to determine python library.
|
# note: script will try to determine the appropriate python library.
|
||||||
# If it fails, specify the path using the PYTHON_LIBRARY variable
|
# If it fails, specify the path using the PYTHON_LIBRARY variable
|
||||||
WITH_PYTHON=OFF
|
WITH_PYTHON=OFF
|
||||||
PYTHON_LIBRARY=""
|
PYTHON_LIBRARY=""
|
||||||
@ -60,18 +60,26 @@ WITH_MESA=OFF
|
|||||||
Script=${0##*/}
|
Script=${0##*/}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat<<USAGE
|
cat<<USAGE
|
||||||
|
|
||||||
usage: ${0##*/} [OPTION]
|
usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
-fast skip cmake for repeated builds - use with caution
|
-fast for repeated builds (-make -install) *use with caution*
|
||||||
-mpi with mpi (if not already enabled)
|
-mpi with mpi (if not already enabled)
|
||||||
-python with python (if not already enabled)
|
-python with python (if not already enabled)
|
||||||
-mesa with mesa (if not already enabled)
|
-mesa with mesa (if not already enabled)
|
||||||
-verbose verbose cmake output
|
-verbose verbose output in Makefiles
|
||||||
-help
|
-help
|
||||||
|
|
||||||
|
For finer control, the build stages can be also selected individually
|
||||||
|
(mutually exclusive)
|
||||||
|
-config
|
||||||
|
-make
|
||||||
|
-makedoc
|
||||||
|
-install
|
||||||
|
[-envpath] alter absolute paths in CMake files to use env variables
|
||||||
|
|
||||||
Build and install $PARAVIEW_SRC
|
Build and install $PARAVIEW_SRC
|
||||||
- run from folder above the ParaView source folder or place the
|
- run from folder above the ParaView source folder or place the
|
||||||
ParaView source under \$WM_THIRD_PARTY_DIR
|
ParaView source under \$WM_THIRD_PARTY_DIR
|
||||||
@ -80,57 +88,105 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# options based on the script name:
|
# add options based on script name:
|
||||||
case "$Script" in *-fast*) CMAKE_SKIP=ON;; esac
|
|
||||||
case "$Script" in *-mpi*) WITH_MPI=ON;; esac
|
case "$Script" in *-mpi*) WITH_MPI=ON;; esac
|
||||||
case "$Script" in *-python*) WITH_PYTHON=ON;; esac
|
case "$Script" in *-python*) WITH_PYTHON=ON;; esac
|
||||||
case "$Script" in *-mesa*) WITH_MESA=ON;; esac
|
case "$Script" in *-mesa*) WITH_MESA=ON;; esac
|
||||||
|
|
||||||
|
runCONFIG=true
|
||||||
|
runMAKE=true
|
||||||
|
runMAKEDOC=true
|
||||||
|
runINSTALL=true
|
||||||
|
runENVPATH=false
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
-fast)
|
-config) # stage 1: config only
|
||||||
CMAKE_SKIP=YES
|
runCONFIG=true
|
||||||
shift
|
runMAKE=false
|
||||||
;;
|
runMAKEDOC=false
|
||||||
-mpi)
|
runINSTALL=false
|
||||||
WITH_MPI=ON
|
shift
|
||||||
shift
|
;;
|
||||||
;;
|
-make) # stage 2: make only
|
||||||
-python)
|
runCONFIG=false
|
||||||
WITH_PYTHON=ON
|
runMAKE=true
|
||||||
shift
|
runMAKEDOC=false
|
||||||
;;
|
runINSTALL=false
|
||||||
-mesa)
|
shift
|
||||||
WITH_MESA=ON
|
;;
|
||||||
shift
|
-makedoc) # stage 3: generate html documentation
|
||||||
;;
|
runCONFIG=false
|
||||||
-verbose)
|
runMAKE=false
|
||||||
VERBOSE=ON
|
runMAKEDOC=true
|
||||||
shift
|
runINSTALL=false
|
||||||
;;
|
shift
|
||||||
*)
|
;;
|
||||||
usage "unknown option/argument: '$*'"
|
-install) # stage 4: install only
|
||||||
;;
|
runCONFIG=false
|
||||||
esac
|
runMAKE=false
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-envpath) # optional: change cmake files to use env variables
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=false
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=false
|
||||||
|
runENVPATH=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-fast) # shortcut for rebuild
|
||||||
|
runCONFIG=false
|
||||||
|
runMAKE=true
|
||||||
|
runMAKEDOC=false
|
||||||
|
runINSTALL=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-mpi)
|
||||||
|
WITH_MPI=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-python)
|
||||||
|
WITH_PYTHON=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-mesa)
|
||||||
|
WITH_MESA=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-verbose)
|
||||||
|
VERBOSE=ON
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage "unknown option/argument: '$*'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Set configure options
|
# Set configure options
|
||||||
#~~~~~~~~~~~~~~~~~~~~~~
|
#~~~~~~~~~~~~~~~~~~~~~~
|
||||||
addVerbosity # set CMake verbosity
|
addVerbosity # verbose makefiles
|
||||||
addMpiSupport # set MPI-specific options
|
addMpiSupport # set MPI-specific options
|
||||||
addPythonSupport # set Python-specific options
|
addPythonSupport # set Python-specific options
|
||||||
addMesaSupport # set MESA-specific options
|
addMesaSupport # set MESA-specific options
|
||||||
|
|
||||||
|
getPaths # discover where things are or should be put
|
||||||
|
|
||||||
# Build and install
|
# Build and install
|
||||||
# ~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~
|
||||||
buildParaView
|
[ $runCONFIG = true ] && configParaView
|
||||||
installParaView
|
[ $runMAKE = true ] && makeParaView
|
||||||
|
[ $runENVPATH = true ] && fixCMakeFiles
|
||||||
|
[ $runMAKEDOC = true ] && makeDocs
|
||||||
|
[ $runINSTALL = true ] && installParaView
|
||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -31,299 +31,366 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# ParaView_INST_DIR : location of the original sources
|
# ParaView_INST_DIR : location of the original sources
|
||||||
# ParaView_DIR : location of the compiled output
|
# ParaView_DIR : location of the build (for the ParaViewConfig.cmake)
|
||||||
|
# and the installed program
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# set CMake cache variables
|
||||||
|
#
|
||||||
addCMakeVariable()
|
addCMakeVariable()
|
||||||
{
|
{
|
||||||
while [ -n "$1" ]
|
while [ -n "$1" ]
|
||||||
do
|
do
|
||||||
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
|
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# verbose makefiles
|
||||||
|
#
|
||||||
addVerbosity()
|
addVerbosity()
|
||||||
{
|
{
|
||||||
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
|
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# define options for mpi support
|
||||||
|
#
|
||||||
addMpiSupport()
|
addMpiSupport()
|
||||||
{
|
{
|
||||||
[ "$WITH_MPI" = ON ] || return
|
[ "$WITH_MPI" = ON ] || return
|
||||||
OBJ_ADD="$OBJ_ADD-mpi"
|
OBJ_ADD="$OBJ_ADD-mpi"
|
||||||
|
|
||||||
addCMakeVariable PARAVIEW_USE_MPI=ON
|
addCMakeVariable PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON
|
||||||
addCMakeVariable VTK_USE_MPI=ON
|
addCMakeVariable MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
|
||||||
addCMakeVariable MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
|
addCMakeVariable MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
|
||||||
addCMakeVariable MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
|
addCMakeVariable VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
|
||||||
addCMakeVariable VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
|
addCMakeVariable VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS
|
||||||
addCMakeVariable VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# define options for python support
|
||||||
|
#
|
||||||
addPythonSupport()
|
addPythonSupport()
|
||||||
{
|
{
|
||||||
[ "$WITH_PYTHON" = ON ] || return
|
[ "$WITH_PYTHON" = ON ] || return
|
||||||
OBJ_ADD="$OBJ_ADD-py"
|
OBJ_ADD="$OBJ_ADD-py"
|
||||||
|
|
||||||
if pythonBin=$(which python 2>/dev/null)
|
if pythonBin=$(which python 2>/dev/null)
|
||||||
then
|
then
|
||||||
if [ -n "$PYTHON_LIBRARY" ]
|
if [ -n "$PYTHON_LIBRARY" ]
|
||||||
then
|
then
|
||||||
# check $PYTHON_LIBRARY if it has been set
|
# check $PYTHON_LIBRARY if it has been set
|
||||||
if [ ! -e "$PYTHON_LIBRARY" ]
|
if [ ! -e "$PYTHON_LIBRARY" ]
|
||||||
then
|
then
|
||||||
echo "*** Error: libpython not found at location specified " \
|
echo "*** Error: libpython not found at location specified " \
|
||||||
"by PYTHON_LIBRARY=$PYTHON_LIBRARY"
|
"by PYTHON_LIBRARY=$PYTHON_LIBRARY"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Try to get $PYTHON_LIBRARY from dynamically linked binary
|
# Try to get $PYTHON_LIBRARY from dynamically linked binary
|
||||||
PYTHON_LIBRARY=$(ldd $pythonBin | \
|
PYTHON_LIBRARY=$(ldd $pythonBin | \
|
||||||
sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
|
sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
|
||||||
|
|
||||||
if [ ! -e "$PYTHON_LIBRARY" ]
|
if [ ! -e "$PYTHON_LIBRARY" ]
|
||||||
then
|
then
|
||||||
echo "*** Error: Unable to determine path to python library."
|
echo "*** Error: Unable to determine path to python library."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e "$PYTHON_LIBRARY" ] || {
|
[ -e "$PYTHON_LIBRARY" ] || {
|
||||||
echo " Please set the variable PYTHON_LIBRARY to the full"
|
echo " Please set the variable PYTHON_LIBRARY to the full"
|
||||||
echo " path to (and including) libpython, or deactivate"
|
echo " path to (and including) libpython, or deactivate"
|
||||||
echo " python support by setting WITH_PYTHON=OFF"
|
echo " python support by setting WITH_PYTHON=OFF"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
|
pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
|
||||||
pythonInclude=/usr/include/python$pythonMajor
|
pythonInclude=/usr/include/python$pythonMajor
|
||||||
|
|
||||||
[ -e "$PYTHON_LIBRARY" ] || {
|
[ -e "$PYTHON_LIBRARY" ] || {
|
||||||
echo " Please set the variable PYTHON_LIBRARY to the full"
|
echo " Please set the variable PYTHON_LIBRARY to the full"
|
||||||
echo " path to (and including) libpython, or deactivate"
|
echo " path to (and including) libpython, or deactivate"
|
||||||
echo " python support by setting WITH_PYTHON=OFF"
|
echo " python support by setting WITH_PYTHON=OFF"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# note - we could also allow for a PYTHON_INCLUDE variable ...
|
# note - we could also allow for a PYTHON_INCLUDE variable ...
|
||||||
[ -e "$pythonInclude" ] || {
|
[ -e "$pythonInclude" ] || {
|
||||||
echo " No python include headers found"
|
echo " No python include headers found"
|
||||||
echo " Please install python headers or deactivate "
|
echo " Please install python headers or deactivate "
|
||||||
echo " python support by setting WITH_PYTHON=OFF"
|
echo " python support by setting WITH_PYTHON=OFF"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
addCMakeVariable PARAVIEW_ENABLE_PYTHON=ON
|
addCMakeVariable PARAVIEW_ENABLE_PYTHON=ON
|
||||||
addCMakeVariable PYTHON_INCLUDE_PATH=$pythonInclude
|
addCMakeVariable PYTHON_INCLUDE_PATH=$pythonInclude
|
||||||
addCMakeVariable PYTHON_LIBRARY=$PYTHON_LIBRARY
|
addCMakeVariable PYTHON_LIBRARY=$PYTHON_LIBRARY
|
||||||
|
|
||||||
echo "----"
|
echo "----"
|
||||||
echo "Python information:"
|
echo "Python information:"
|
||||||
echo " executable : $pythonBin"
|
echo " executable : $pythonBin"
|
||||||
echo " version : $pythonMajor"
|
echo " version : $pythonMajor"
|
||||||
echo " include path : $pythonInclude"
|
echo " include path : $pythonInclude"
|
||||||
echo " library : $PYTHON_LIBRARY"
|
echo " library : $PYTHON_LIBRARY"
|
||||||
|
|
||||||
unset pythonBin pythonInclude pythonMajor
|
unset pythonBin pythonInclude pythonMajor
|
||||||
else
|
else
|
||||||
echo "*** Error: python not installed"
|
echo "*** Error: python not installed"
|
||||||
echo "*** Deactivate python support by setting WITH_PYTHON=OFF"
|
echo "*** Deactivate python support by setting WITH_PYTHON=OFF"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# define options for mesa support
|
||||||
|
#
|
||||||
addMesaSupport()
|
addMesaSupport()
|
||||||
{
|
{
|
||||||
[ "$WITH_MESA" = ON ] || return
|
[ "$WITH_MESA" = ON ] || return
|
||||||
|
|
||||||
MESA_INCLUDE_DIR=/usr/include/GL
|
MESA_INCLUDE_DIR=/usr/include/GL
|
||||||
MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
|
MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
|
||||||
|
|
||||||
if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]
|
if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]
|
||||||
then
|
then
|
||||||
OBJ_ADD="$OBJ_ADD-mesa"
|
OBJ_ADD="$OBJ_ADD-mesa"
|
||||||
|
|
||||||
addCMakeVariable VTK_OPENGL_HAS_OSMESA=ON
|
addCMakeVariable VTK_OPENGL_HAS_OSMESA=ON
|
||||||
addCMakeVariable OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR
|
addCMakeVariable OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR
|
||||||
addCMakeVariable OSMESA_LIBRARY=$MESA_LIBRARY
|
addCMakeVariable OSMESA_LIBRARY=$MESA_LIBRARY
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "*** Error: no MESA information found"
|
echo "*** Error: no MESA information found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildParaView()
|
#
|
||||||
|
# discover where things are or should be put
|
||||||
|
#
|
||||||
|
getPaths()
|
||||||
{
|
{
|
||||||
# set paraview environment
|
# set paraview environment
|
||||||
for i in $PWD $WM_THIRD_PARTY_DIR
|
for i in $PWD $WM_THIRD_PARTY_DIR
|
||||||
do
|
do
|
||||||
ParaView_INST_DIR=$i/$PARAVIEW_SRC
|
ParaView_INST_DIR=$i/$PARAVIEW_SRC
|
||||||
[ -d $ParaView_INST_DIR ] && break
|
[ -d $ParaView_INST_DIR ] && break
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -d "$ParaView_INST_DIR" ]
|
if [ ! -d "$ParaView_INST_DIR" ]
|
||||||
then
|
then
|
||||||
# last chance: maybe already in the paraview directory
|
# last chance: maybe already in the paraview directory
|
||||||
[ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD
|
[ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD
|
||||||
|
|
||||||
[ -d "$ParaView_INST_DIR" ] || {
|
[ -d "$ParaView_INST_DIR" ] || {
|
||||||
echo "did not find $PARAVIEW_SRC in these directories:"
|
echo "did not find $PARAVIEW_SRC in these directories:"
|
||||||
echo " PWD=$PWD"
|
echo " PWD=$PWD"
|
||||||
echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
|
echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
|
||||||
echo "abort build"
|
echo "abort build"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
|
||||||
# ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
|
ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
||||||
ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
echo "ParaView_DIR=$ParaView_DIR"
|
||||||
|
|
||||||
# shortcut for repeated builds - use with caution
|
|
||||||
if [ "$CMAKE_SKIP" = YES ]
|
|
||||||
then
|
|
||||||
|
|
||||||
# change to build/install folder
|
|
||||||
cd $ParaView_DIR || exit 1
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# remove any existing build folder and recreate
|
|
||||||
rm -rf $ParaView_DIR
|
|
||||||
mkdir -p $ParaView_DIR
|
|
||||||
cd $ParaView_DIR
|
|
||||||
|
|
||||||
echo "----"
|
|
||||||
echo "Building $PARAVIEW_SRC"
|
|
||||||
echo " MPI support : $WITH_MPI"
|
|
||||||
echo " Python support : $WITH_PYTHON"
|
|
||||||
echo " MESA support : $WITH_MESA"
|
|
||||||
echo " Source : $ParaView_INST_DIR"
|
|
||||||
echo " Target : $ParaView_DIR"
|
|
||||||
echo "----"
|
|
||||||
|
|
||||||
# make paraview
|
|
||||||
cmake \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
|
|
||||||
$CMAKE_VARIABLES \
|
|
||||||
$ParaView_INST_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# change to build folder
|
|
||||||
echo " Starting make"
|
|
||||||
|
|
||||||
if [ -r /proc/cpuinfo ]
|
|
||||||
then
|
|
||||||
WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
|
|
||||||
|
|
||||||
if [ $WM_NCOMPPROCS -gt 8 ]
|
|
||||||
then
|
|
||||||
WM_NCOMPPROCS=8
|
|
||||||
fi
|
|
||||||
|
|
||||||
make -j $WM_NCOMPPROCS
|
|
||||||
else
|
|
||||||
make
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# adjust hard-links
|
#
|
||||||
|
# configure via cmake, but don't actually build anything
|
||||||
|
#
|
||||||
|
configParaView()
|
||||||
|
{
|
||||||
|
# remove any existing build folder and recreate
|
||||||
|
if [ -d $ParaView_DIR ]
|
||||||
|
then
|
||||||
|
echo "removing old build/install directory"
|
||||||
|
rm -rf $ParaView_DIR
|
||||||
|
fi
|
||||||
|
mkdir -p $ParaView_DIR
|
||||||
|
|
||||||
|
cd $ParaView_DIR
|
||||||
|
|
||||||
|
echo "----"
|
||||||
|
echo "Configuring $PARAVIEW_SRC"
|
||||||
|
echo " MPI support : $WITH_MPI"
|
||||||
|
echo " Python support : $WITH_PYTHON"
|
||||||
|
echo " MESA support : $WITH_MESA"
|
||||||
|
echo " Source : $ParaView_INST_DIR"
|
||||||
|
echo " Target : $ParaView_DIR"
|
||||||
|
echo "----"
|
||||||
|
echo
|
||||||
|
echo cmake \
|
||||||
|
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
|
||||||
|
$CMAKE_VARIABLES \
|
||||||
|
../..
|
||||||
|
echo
|
||||||
|
echo "----"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# run cmake to create Makefiles
|
||||||
|
cmake \
|
||||||
|
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
|
||||||
|
$CMAKE_VARIABLES \
|
||||||
|
../..
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# invoke make
|
||||||
|
# also link bin/ to lib/paraview-* for development without installation
|
||||||
|
#
|
||||||
|
makeParaView()
|
||||||
|
{
|
||||||
|
cd $ParaView_DIR || exit 1 # change to build folder
|
||||||
|
echo " Starting make"
|
||||||
|
|
||||||
|
if [ -r /proc/cpuinfo ]
|
||||||
|
then
|
||||||
|
WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
|
||||||
|
[ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8
|
||||||
|
|
||||||
|
time make -j $WM_NCOMPPROCS
|
||||||
|
else
|
||||||
|
time make
|
||||||
|
fi
|
||||||
|
echo " Done make"
|
||||||
|
|
||||||
|
echo " For quicker development, linking lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/"
|
||||||
|
rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
|
||||||
|
mkdir lib 2>/dev/null
|
||||||
|
( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# adjust hard-links (internal function)
|
||||||
# Note: use loop with grep to avoid touching too many files
|
# Note: use loop with grep to avoid touching too many files
|
||||||
fixCMakeHardLinks()
|
#
|
||||||
|
fixHardLinks()
|
||||||
{
|
{
|
||||||
fileSpec=$1
|
envName=$1
|
||||||
string=$2
|
string=$2
|
||||||
envName=$3
|
shift 2
|
||||||
|
|
||||||
echo -n " for \$$envName "
|
echo "-- Replacing path hard links for \$$envName"
|
||||||
for i in $(find . -type f -iname "$fileSpec")
|
|
||||||
do
|
for fileSpec
|
||||||
if grep -q "$string" $i
|
do
|
||||||
then
|
echo -n " $fileSpec: "
|
||||||
echo -n "#"
|
for i in $(find . -type f -iname "$fileSpec")
|
||||||
sed -i "s,$string,\$ENV{$envName},g" $i
|
do
|
||||||
fi
|
if grep -q "$string" $i
|
||||||
done
|
then
|
||||||
echo
|
echo -n "#"
|
||||||
|
sed -i "s,$string,\$ENV{$envName},g" $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# replace absolute paths with environment variables
|
||||||
|
# This triggers a partial (or even a full) rebuild, but might let us
|
||||||
|
# find our files later if we relocate the build
|
||||||
|
#
|
||||||
|
fixCMakeFiles()
|
||||||
|
{
|
||||||
|
cd $ParaView_DIR || exit 1 # change to build folder
|
||||||
|
|
||||||
|
# Replace path with env variable: ParaView_DIR
|
||||||
|
fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake'
|
||||||
|
|
||||||
|
# Replace path with env variable: ParaView_INST_DIR
|
||||||
|
fixHardLinks ParaView_INST_DIR "$ParaView_INST_DIR" '*.cmake'
|
||||||
|
|
||||||
|
# Replace path with env variable: MPI_ARCH_PATH
|
||||||
|
if [ "$WITH_MPI" = ON ]
|
||||||
|
then
|
||||||
|
fixHardLinks MPI_ARCH_PATH "$MPI_ARCH_PATH" '*.cmake'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace path with env variable: CMAKE_HOME
|
||||||
|
if [ -r "$CMAKE_HOME" ]
|
||||||
|
then
|
||||||
|
fixHardLinks CMAKE_HOME "$CMAKE_HOME" '*cmake*'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace path with env variable: WM_COMPILER_DIR
|
||||||
|
# (include cmake.check_cache)
|
||||||
|
# This triggers a complete rebuild (with cmake-2.6.2), but is likely
|
||||||
|
# needed when redistributing files
|
||||||
|
fixHardLinks WM_COMPILER_DIR "$WM_COMPILER_DIR" '*cmake*'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# make html documentation (mostly just for the readers/writers)
|
||||||
|
#
|
||||||
|
makeDocs()
|
||||||
|
{
|
||||||
|
cd $ParaView_DIR || exit 1 # change to build folder
|
||||||
|
echo " Creating html documentation"
|
||||||
|
|
||||||
|
make HTMLDocumentation
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# actually install the program
|
||||||
|
#
|
||||||
installParaView()
|
installParaView()
|
||||||
{
|
{
|
||||||
if [ ! -e "$ParaView_DIR/bin/paraview" ]
|
cd $ParaView_DIR || exit 1 # change to build folder
|
||||||
then
|
echo " Installing ParaView to $ParaView_DIR"
|
||||||
echo " Cannot install - no paraview binary found"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
echo " Build complete"
|
|
||||||
|
|
||||||
cd $ParaView_DIR
|
echo "disabled 'make install' for now, just use links"
|
||||||
|
|
||||||
echo " Replacing path hard links"
|
# about.txt may be missing
|
||||||
|
paraviewLibDir="$ParaView_DIR/lib/paraview-$PARAVIEW_MAJOR_VERSION"
|
||||||
|
if [ -d "$paraviewLibDir" -a ! -e "$paraviewLibDir/about.txt" ]
|
||||||
|
then
|
||||||
|
echo "paraview-$PARAVIEW_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt
|
||||||
|
fi
|
||||||
|
|
||||||
# Replace local ParaView_INST_DIR path with ParaView_INST_DIR
|
cat<< INFO
|
||||||
# environment variable
|
---
|
||||||
fixCMakeHardLinks '*.cmake' "$ParaView_INST_DIR" ParaView_INST_DIR
|
Installation complete
|
||||||
|
Set environment variables:
|
||||||
|
|
||||||
# Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH
|
export ParaView_INST_DIR=$ParaView_INST_DIR
|
||||||
# environment variable
|
export ParaView_DIR=$ParaView_DIR
|
||||||
if [ "$WITH_MPI" = ON ]
|
export PV_PLUGIN_PATH=$FOAM_LIBBIN
|
||||||
then
|
export PATH=\$ParaView_DIR/bin:\$PATH
|
||||||
fixCMakeHardLinks '*.cmake' "$MPI_ARCH_PATH" MPI_ARCH_PATH
|
---
|
||||||
fi
|
INFO
|
||||||
|
|
||||||
# Replace local CMAKE_HOME path with CMAKE_HOME
|
|
||||||
# environment variable
|
|
||||||
if [ -r "$CMAKE_HOME" ]
|
|
||||||
then
|
|
||||||
fixCMakeHardLinks '*cmake*' "$CMAKE_HOME" CMAKE_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR
|
|
||||||
# environment variable
|
|
||||||
fixCMakeHardLinks '*cmake*' "$WM_COMPILER_DIR" WM_COMPILER_DIR
|
|
||||||
|
|
||||||
# create a softlink to the $ParaView_DIR/bin folder
|
|
||||||
# - workaround for chosen install location
|
|
||||||
echo " Creating lib/paraview-$PARAVIEW_MAJOR_VERSION soft link to 'bin'"
|
|
||||||
rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
|
|
||||||
[ -d lib ] || mkdir lib
|
|
||||||
( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
|
|
||||||
|
|
||||||
# info on symlinks to screen
|
|
||||||
echo ""
|
|
||||||
echo " ---"
|
|
||||||
echo " Installation complete"
|
|
||||||
echo " Set environment variables:"
|
|
||||||
echo " - ParaView_INST_DIR to $ParaView_INST_DIR"
|
|
||||||
echo " - ParaView_DIR to $ParaView_DIR"
|
|
||||||
echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN"
|
|
||||||
echo " Add $ParaView_DIR/bin to PATH"
|
|
||||||
# echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
|
|
||||||
echo " ---"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# clear all the variables used before using any of the functions
|
# clear all the variables used before using any of the functions
|
||||||
|
|
||||||
unset VERBOSE
|
unset VERBOSE
|
||||||
unset WITH_MPI
|
unset WITH_MPI WITH_MESA
|
||||||
unset WITH_MESA
|
unset WITH_PYTHON PYTHON_LIBRARY
|
||||||
unset WITH_PYTHON
|
|
||||||
unset PYTHON_LIBRARY
|
|
||||||
unset CMAKE_VARIABLES
|
unset CMAKE_VARIABLES
|
||||||
unset CMAKE_SKIP
|
|
||||||
unset OBJ_ADD
|
unset OBJ_ADD
|
||||||
|
|
||||||
# start with these general settings
|
# start with these general settings
|
||||||
addCMakeVariable VTK_USE_TK=FALSE
|
addCMakeVariable VTK_USE_TK=FALSE
|
||||||
addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON
|
addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF
|
||||||
addCMakeVariable VTK_USE_RPATH:BOOL=OFF
|
|
||||||
addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release
|
addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release
|
||||||
|
|
||||||
|
# include development files in "make install"
|
||||||
|
addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -26,38 +26,49 @@
|
|||||||
# paraview3/bashrc
|
# paraview3/bashrc
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Setup file for ParaView3.
|
# Setup file for paraview-3.x
|
||||||
# Sourced from OpenFOAM-?.?/etc/bashrc
|
# Sourced from OpenFOAM-?.?/etc/bashrc
|
||||||
#
|
#
|
||||||
|
# Note
|
||||||
|
# The env. variable 'ParaView_DIR' is required for building plugins
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
|
# determine the cmake to be used
|
||||||
|
unset CMAKE_HOME
|
||||||
|
for cmake in cmake-2.6.2 cmake-2.4.6
|
||||||
|
do
|
||||||
|
cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
|
||||||
|
if [ -r $cmake ]
|
||||||
|
then
|
||||||
|
export CMAKE_HOME=$cmake
|
||||||
|
export PATH=$CMAKE_HOME/bin:$PATH
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ -r $CMAKE_HOME ]
|
paraviewMajor=paraview-3.5
|
||||||
then
|
export ParaView_VERSION=3.5-cvs
|
||||||
export PATH=$CMAKE_HOME/bin:$PATH
|
|
||||||
else
|
|
||||||
unset CMAKE_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
export ParaView_VERSION="3.3-cvs"
|
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
|
||||||
|
|
||||||
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
|
|
||||||
export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
||||||
|
|
||||||
if [ "$PYTHONPATH" ]
|
# add in python libraries if required
|
||||||
|
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||||
|
if [ -r $paraviewPython ]
|
||||||
then
|
then
|
||||||
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
|
if [ "$PYTHONPATH" ]
|
||||||
else
|
then
|
||||||
export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
|
export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
|
||||||
|
else
|
||||||
|
export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -r $ParaView_DIR ]
|
if [ -r $ParaView_DIR ]
|
||||||
then
|
then
|
||||||
export PATH=$ParaView_DIR/bin:$PATH
|
export PATH=$ParaView_DIR/bin:$PATH
|
||||||
export LD_LIBRARY_PATH=$ParaView_DIR/bin:$LD_LIBRARY_PATH
|
|
||||||
export PV_PLUGIN_PATH=$FOAM_LIBBIN
|
export PV_PLUGIN_PATH=$FOAM_LIBBIN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset cmake paraviewMajor paraviewPython
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
@ -26,34 +26,44 @@
|
|||||||
# paraview3/cshrc
|
# paraview3/cshrc
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Startup File for Paraview3
|
# Startup File for paraview-3.x
|
||||||
# Sourced from OpenFOAM-?.?/etc/cshrc
|
# Sourced from OpenFOAM-?.?/etc/cshrc
|
||||||
#
|
#
|
||||||
|
# Note
|
||||||
|
# The env. variable 'ParaView_DIR' is required for building plugins
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
setenv CMAKE_HOME $WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
|
# determine the cmake to be used
|
||||||
|
unsetenv CMAKE_HOME
|
||||||
|
foreach cmake ( cmake-2.6.2 cmake-2.4.6 )
|
||||||
|
set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
|
||||||
|
if ( -r $cmake ) then
|
||||||
|
setenv CMAKE_HOME $cmake
|
||||||
|
set path=($CMAKE_HOME/bin $path)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
end
|
||||||
|
|
||||||
if ( -r $CMAKE_HOME ) then
|
set paraviewMajor=paraview-3.5
|
||||||
set path=($CMAKE_HOME/bin $path)
|
setenv ParaView_VERSION 3.5-cvs
|
||||||
else
|
|
||||||
unsetenv CMAKE_HOME
|
|
||||||
endif
|
|
||||||
|
|
||||||
setenv ParaView_VERSION 3.3-cvs
|
setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
|
||||||
|
|
||||||
setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
|
|
||||||
setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
||||||
|
|
||||||
if ($?PYTHONPATH) then
|
# add in python libraries if required
|
||||||
setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
|
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||||
else
|
if ( -r $paraviewPython ) then
|
||||||
setenv PYTHONPATH $ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
|
if ($?PYTHONPATH) then
|
||||||
|
setenv PYTHONPATH ${PYTHONPATH}:$paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
|
||||||
|
else
|
||||||
|
setenv PYTHONPATH $paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ( -r $ParaView_INST_DIR ) then
|
if ( -r $ParaView_INST_DIR ) then
|
||||||
set path=($ParaView_DIR/bin $path)
|
set path=($ParaView_DIR/bin $path)
|
||||||
setenv LD_LIBRARY_PATH $ParaView_DIR/bin:$LD_LIBRARY_PATH
|
|
||||||
setenv PV_PLUGIN_PATH $FOAM_LIBBIN
|
setenv PV_PLUGIN_PATH $FOAM_LIBBIN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
unset cmake paraviewMajor paraviewPython
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
@ -91,7 +91,7 @@ export WM_COMPILER_LIB_ARCH=
|
|||||||
# WM_JAVAC_OPTION = Opt | Debug
|
# WM_JAVAC_OPTION = Opt | Debug
|
||||||
: ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
|
: ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
|
||||||
|
|
||||||
# WM_MPLIB = | OPENMPI| LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI
|
# WM_MPLIB = | OPENMPI | LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI
|
||||||
: ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
|
: ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,8 @@
|
|||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# update version string if under Git
|
# update Foam::FOAMversion string if required
|
||||||
git describe 2> /dev/null | \
|
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
|
||||||
(read project_string \
|
|
||||||
&& sed -e 's/WM_PROJECT_VERSION/\"'"${project_string}"'"/' \
|
|
||||||
OpenFOAM/global/global_raw.C >OpenFOAM/global/global.C)
|
|
||||||
|
|
||||||
wmakeLnInclude -f OpenFOAM
|
wmakeLnInclude -f OpenFOAM
|
||||||
wmakeLnInclude -f OSspecific/$WM_OS
|
wmakeLnInclude -f OSspecific/$WM_OS
|
||||||
|
|||||||
@ -211,7 +211,7 @@ bool Foam::chDir(const fileName& dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::dotFoam(const fileName& name)
|
Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
|
||||||
{
|
{
|
||||||
// Search user files:
|
// Search user files:
|
||||||
// ~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~
|
||||||
@ -268,6 +268,15 @@ Foam::fileName Foam::dotFoam(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not found
|
// Not found
|
||||||
|
// abort if the file is mandatory, otherwise return null
|
||||||
|
if (mandatory)
|
||||||
|
{
|
||||||
|
cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
|
||||||
|
" could not find mandatory file\n '"
|
||||||
|
<< name.c_str() << "'\n\n" << std::endl;
|
||||||
|
::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
return fileName::null;
|
return fileName::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,15 +37,20 @@ License
|
|||||||
void Foam::regExp::compile(const char* pat) const
|
void Foam::regExp::compile(const char* pat) const
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
preg_ = new regex_t;
|
|
||||||
|
|
||||||
if (regcomp(preg_, pat, REG_EXTENDED) != 0)
|
// avoid NULL and zero-length patterns
|
||||||
|
if (pat && *pat)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
preg_ = new regex_t;
|
||||||
(
|
|
||||||
"regExp::compile(const char*)"
|
if (regcomp(preg_, pat, REG_EXTENDED) != 0)
|
||||||
) << "Failed to compile regular expression '" << pat << "'"
|
{
|
||||||
<< exit(FatalError);
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"regExp::compile(const char*)"
|
||||||
|
) << "Failed to compile regular expression '" << pat << "'"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +65,7 @@ void Foam::regExp::clear() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::regExp::regExp()
|
Foam::regExp::regExp()
|
||||||
@ -83,6 +89,7 @@ Foam::regExp::regExp(const char* pat)
|
|||||||
compile(pat);
|
compile(pat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::regExp::~regExp()
|
Foam::regExp::~regExp()
|
||||||
@ -90,6 +97,7 @@ Foam::regExp::~regExp()
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int Foam::regExp::ngroups() const
|
int Foam::regExp::ngroups() const
|
||||||
@ -110,6 +118,7 @@ bool Foam::regExp::match
|
|||||||
regmatch_t pmatch[1];
|
regmatch_t pmatch[1];
|
||||||
|
|
||||||
// match and also verify that the entire string was matched
|
// match and also verify that the entire string was matched
|
||||||
|
// pmatch[0] is the entire match
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
||||||
@ -141,6 +150,8 @@ bool Foam::regExp::match
|
|||||||
regmatch_t pmatch[nmatch];
|
regmatch_t pmatch[nmatch];
|
||||||
|
|
||||||
// match and also verify that the entire string was matched
|
// match and also verify that the entire string was matched
|
||||||
|
// pmatch[0] is the entire match
|
||||||
|
// pmatch[1..] are the (...) sub-groups
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
|
||||||
@ -179,8 +190,8 @@ bool Foam::regExp::match
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::regExp::operator=(const string& pat)
|
void Foam::regExp::operator=(const string& pat)
|
||||||
{
|
{
|
||||||
@ -193,4 +204,5 @@ void Foam::regExp::operator=(const char* pat)
|
|||||||
compile(pat);
|
compile(pat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
global/global.C
|
global/global.Cver
|
||||||
|
|
||||||
global/dimensionedConstants/dimensionedConstants.C
|
global/dimensionedConstants/dimensionedConstants.C
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
@ -290,7 +289,6 @@ $(tetCell)/tetCell.C
|
|||||||
|
|
||||||
cellModeller = $(meshShapes)/cellModeller
|
cellModeller = $(meshShapes)/cellModeller
|
||||||
$(cellModeller)/cellModeller.C
|
$(cellModeller)/cellModeller.C
|
||||||
$(cellModeller)/cellModellerIO.C
|
|
||||||
|
|
||||||
cellModel = $(meshShapes)/cellModel
|
cellModel = $(meshShapes)/cellModel
|
||||||
$(cellModel)/cellModel.C
|
$(cellModel)/cellModel.C
|
||||||
|
|||||||
@ -28,22 +28,15 @@ Description
|
|||||||
|
|
||||||
#include "Dictionary.H"
|
#include "Dictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Null constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
Dictionary<T>::Dictionary()
|
Foam::Dictionary<T>::Dictionary()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Copy constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
Dictionary<T>::Dictionary(const Dictionary& dict)
|
Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
|
||||||
:
|
:
|
||||||
DictionaryBase<IDLList<T>, T>(dict)
|
DictionaryBase<IDLList<T>, T>(dict)
|
||||||
{}
|
{}
|
||||||
@ -52,10 +45,10 @@ Dictionary<T>::Dictionary(const Dictionary& dict)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool Dictionary<T>::erase(const word& Keyword)
|
bool Foam::Dictionary<T>::erase(const word& keyword)
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = this->remove(Keyword)))
|
if (tPtr = this->remove(keyword))
|
||||||
{
|
{
|
||||||
delete tPtr;
|
delete tPtr;
|
||||||
return true;
|
return true;
|
||||||
@ -69,6 +62,4 @@ bool Dictionary<T>::erase(const word& Keyword)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,8 +27,10 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Gerneral purpose template dictionary class which manages the storage
|
Gerneral purpose template dictionary class which manages the storage
|
||||||
associated with it. It is derived from DictionaryBase instantiated on
|
associated with it.
|
||||||
a memory managed form of intrusive doubly-linked list of \<T\>.
|
|
||||||
|
It is derived from DictionaryBase instantiated on a memory managed form
|
||||||
|
of intrusive doubly-linked list of \<T\>.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
Dictionary.C
|
Dictionary.C
|
||||||
@ -47,7 +49,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class Dictionary Declaration
|
Class Dictionary Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -69,11 +71,9 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Editing
|
//- Remove an entry specified by keyword and delete the pointer.
|
||||||
|
// Returns true if the keyword was found
|
||||||
//- Remove an entry specified by keyword from the dictionary
|
bool erase(const word& keyword);
|
||||||
// and delete it
|
|
||||||
bool erase(const word& keyword);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,15 +26,10 @@ License
|
|||||||
|
|
||||||
#include "DictionaryBase.H"
|
#include "DictionaryBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void DictionaryBase<IDLListType, T>::addEntries()
|
void Foam::DictionaryBase<IDLListType, T>::addEntries()
|
||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -51,12 +46,15 @@ void DictionaryBase<IDLListType, T>::addEntries()
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
DictionaryBase<IDLListType, T>::DictionaryBase()
|
Foam::DictionaryBase<IDLListType, T>::DictionaryBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
|
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
|
||||||
|
(
|
||||||
|
const DictionaryBase& dict
|
||||||
|
)
|
||||||
:
|
:
|
||||||
IDLListType(dict)
|
IDLListType(dict)
|
||||||
{
|
{
|
||||||
@ -66,17 +64,20 @@ DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
|
|||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is, const INew& inewt)
|
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
|
||||||
|
(
|
||||||
|
Istream& is,
|
||||||
|
const INew& iNew
|
||||||
|
)
|
||||||
:
|
:
|
||||||
IDLListType(is, inewt)
|
IDLListType(is, iNew)
|
||||||
{
|
{
|
||||||
addEntries();
|
addEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Istream constructor
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
Foam::DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
||||||
:
|
:
|
||||||
IDLListType(is)
|
IDLListType(is)
|
||||||
{
|
{
|
||||||
@ -88,25 +89,60 @@ DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
|
|||||||
|
|
||||||
// Find and return T
|
// Find and return T
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
bool DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
bool Foam::DictionaryBase<IDLListType, T>::found(const word& keyword) const
|
||||||
{
|
{
|
||||||
return hashedTs_.found(keyword);
|
return hashedTs_.found(keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find and return T*
|
// Find and return T*, return NULL if not found
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
|
||||||
|
(
|
||||||
|
const word& keyword
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
|
if (iter != hashedTs_.end())
|
||||||
|
{
|
||||||
|
return *iter;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find and return T*, return NULL if not found
|
||||||
|
template<class IDLListType, class T>
|
||||||
|
T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
|
||||||
|
{
|
||||||
|
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
|
if (iter != hashedTs_.end())
|
||||||
|
{
|
||||||
|
return *iter;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find and return T*, FatalError if keyword not found
|
||||||
|
template<class IDLListType, class T>
|
||||||
|
const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter == hashedTs_.end())
|
if (iter == hashedTs_.end())
|
||||||
{
|
{
|
||||||
// If keyword not found print error message ...
|
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"DictionaryBase<IDLListType, T>::"
|
"DictionaryBase<IDLListType, T>::lookup(const word&) const"
|
||||||
"lookup(const word& keyword) const"
|
|
||||||
) << keyword << " is undefined"
|
) << keyword << " is undefined"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -115,18 +151,17 @@ const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find and return T*
|
// Find and return T*, FatalError if keyword not found
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter == hashedTs_.end())
|
if (iter == hashedTs_.end())
|
||||||
{
|
{
|
||||||
// If keyword not found print error message ...
|
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"DictionaryBase<IDLListType, T>::lookup(const word& keyword)"
|
"DictionaryBase<IDLListType, T>::lookup(const word&)"
|
||||||
) << keyword << " is undefined"
|
) << keyword << " is undefined"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -137,7 +172,7 @@ T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
|||||||
|
|
||||||
// Return the table of contents
|
// Return the table of contents
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
wordList DictionaryBase<IDLListType, T>::toc() const
|
Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
||||||
{
|
{
|
||||||
wordList keywords(this->size());
|
wordList keywords(this->size());
|
||||||
|
|
||||||
@ -158,26 +193,28 @@ wordList DictionaryBase<IDLListType, T>::toc() const
|
|||||||
|
|
||||||
// Add at head of dictionary
|
// Add at head of dictionary
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||||
{
|
{
|
||||||
IDLListType::insert(tPtr);
|
// NOTE: we should probably check that HashTable::insert actually worked
|
||||||
hashedTs_.insert(keyword, tPtr);
|
hashedTs_.insert(keyword, tPtr);
|
||||||
|
IDLListType::insert(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add at tail of dictionary
|
// Add at tail of dictionary
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||||
{
|
{
|
||||||
IDLListType::append(tPtr);
|
// NOTE: we should probably check that HashTable::insert actually worked
|
||||||
hashedTs_.insert(keyword, tPtr);
|
hashedTs_.insert(keyword, tPtr);
|
||||||
|
IDLListType::append(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
|
T* Foam::DictionaryBase<IDLListType, T>::remove(const word& keyword)
|
||||||
{
|
{
|
||||||
typename HashTable<T*>::iterator iter = hashedTs_.find(Keyword);
|
typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
|
||||||
|
|
||||||
if (iter != hashedTs_.end())
|
if (iter != hashedTs_.end())
|
||||||
{
|
{
|
||||||
@ -192,19 +229,29 @@ T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Clear the dictionary
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void DictionaryBase<IDLListType, T>::clear()
|
void Foam::DictionaryBase<IDLListType, T>::clear()
|
||||||
{
|
{
|
||||||
IDLListType::clear();
|
IDLListType::clear();
|
||||||
hashedTs_.clear();
|
hashedTs_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class IDLListType, class T>
|
||||||
|
void Foam::DictionaryBase<IDLListType, T>::transfer
|
||||||
|
(
|
||||||
|
DictionaryBase<IDLListType, T>& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IDLListType::transfer(dict);
|
||||||
|
hashedTs_.transfer(dict.hashedTs_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
void DictionaryBase<IDLListType, T>::operator=
|
void Foam::DictionaryBase<IDLListType, T>::operator=
|
||||||
(
|
(
|
||||||
const DictionaryBase<IDLListType, T>& dict
|
const DictionaryBase<IDLListType, T>& dict
|
||||||
)
|
)
|
||||||
@ -218,25 +265,11 @@ void DictionaryBase<IDLListType, T>::operator=
|
|||||||
}
|
}
|
||||||
|
|
||||||
IDLListType::operator=(dict);
|
IDLListType::operator=(dict);
|
||||||
|
|
||||||
this->hashedTs_.clear();
|
this->hashedTs_.clear();
|
||||||
|
this->addEntries();
|
||||||
for
|
|
||||||
(
|
|
||||||
typename IDLListType::iterator iter = this->begin();
|
|
||||||
iter != this->end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->hashedTs_.insert((*iter).keyword(), &(*iter));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "DictionaryBaseIO.C"
|
#include "DictionaryBaseIO.C"
|
||||||
|
|||||||
@ -29,12 +29,12 @@ Description
|
|||||||
Base dictionary class templated on both the form of doubly-linked list
|
Base dictionary class templated on both the form of doubly-linked list
|
||||||
it uses as well as the type it holds.
|
it uses as well as the type it holds.
|
||||||
|
|
||||||
The double templating allows for the instantiation of forms with and
|
The double templating allows for the instantiation of forms with or
|
||||||
without storage management.
|
without storage management.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
The IDLListType parameter should itself be a template but this confused
|
The IDLListType parameter should itself be a template but this confused
|
||||||
gcc 2.95.2 so it has to be instantiated for T when an intantiation of
|
gcc 2.95.2 so it has to be instantiated for T when an instantiation of
|
||||||
DictionaryBase is requested
|
DictionaryBase is requested
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
@ -67,7 +67,7 @@ Ostream& operator<<(Ostream&, const DictionaryBase<IDLListType, T>&);
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class DictionaryBase Declaration
|
Class DictionaryBase Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
@ -77,7 +77,7 @@ class DictionaryBase
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- HashTable of the enries held on the DL-list for quick lookup
|
//- HashTable of the entries held on the IDLListType for quick lookup
|
||||||
HashTable<T*> hashedTs_;
|
HashTable<T*> hashedTs_;
|
||||||
|
|
||||||
|
|
||||||
@ -99,10 +99,10 @@ public:
|
|||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
//- Construct from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
DictionaryBase(Istream& is, const INew& inewt);
|
DictionaryBase(Istream&, const INew&);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream using default Istream constructor class
|
||||||
DictionaryBase(Istream& is);
|
DictionaryBase(Istream&);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
@ -110,7 +110,13 @@ public:
|
|||||||
// Search and lookup
|
// Search and lookup
|
||||||
|
|
||||||
//- Search DictionaryBase for given keyword
|
//- Search DictionaryBase for given keyword
|
||||||
bool found(const word& keyword) const;
|
bool found(const word&) const;
|
||||||
|
|
||||||
|
//- Find and return an entry if present, otherwise return NULL
|
||||||
|
const T* lookupPtr(const word&) const;
|
||||||
|
|
||||||
|
//- Find and return an entry if present, otherwise return NULL
|
||||||
|
T* lookupPtr(const word&);
|
||||||
|
|
||||||
//- Find and return entry
|
//- Find and return entry
|
||||||
const T* lookup(const word&) const;
|
const T* lookup(const word&) const;
|
||||||
@ -125,17 +131,21 @@ public:
|
|||||||
// Editing
|
// Editing
|
||||||
|
|
||||||
//- Add at head of dictionary
|
//- Add at head of dictionary
|
||||||
void insert(const word& keyword, T*);
|
void insert(const word&, T*);
|
||||||
|
|
||||||
//- Add at tail of dictionary
|
//- Add at tail of dictionary
|
||||||
void append(const word& keyword, T*);
|
void append(const word&, T*);
|
||||||
|
|
||||||
//- Remove and return entry specified by keyword
|
//- Remove and return entry specified by keyword.
|
||||||
T* remove(const word& keyword);
|
// Return NULL if the keyword was not found.
|
||||||
|
T* remove(const word&);
|
||||||
|
|
||||||
//- Clear the dictionary
|
//- Clear the dictionary
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this DictionaryBase
|
||||||
|
// and annull the argument.
|
||||||
|
void transfer(DictionaryBase<IDLListType, T>&);
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
|||||||
@ -30,15 +30,13 @@ Description
|
|||||||
#include "DictionaryBase.H"
|
#include "DictionaryBase.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class IDLListType, class T>
|
template<class IDLListType, class T>
|
||||||
Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const DictionaryBase<IDLListType, T>& dict)
|
||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -53,7 +51,7 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
|||||||
if (!os.good())
|
if (!os.good())
|
||||||
{
|
{
|
||||||
Info
|
Info
|
||||||
<< "operator<<(Ostream& os, const DictionaryBase&) : "
|
<< "operator<<(Ostream&, const DictionaryBase&) : "
|
||||||
<< "Can't write entry for DictionaryBase"
|
<< "Can't write entry for DictionaryBase"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -67,6 +65,4 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -26,20 +26,15 @@ License
|
|||||||
|
|
||||||
#include "PtrDictionary.H"
|
#include "PtrDictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
PtrDictionary<T>::PtrDictionary()
|
Foam::PtrDictionary<T>::PtrDictionary()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||||
:
|
:
|
||||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||||
{}
|
{}
|
||||||
@ -47,14 +42,14 @@ PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||||
:
|
:
|
||||||
DictionaryBase<DLPtrList<T>, T>(is, iNew)
|
DictionaryBase<DLPtrList<T>, T>(is, iNew)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
PtrDictionary<T>::PtrDictionary(Istream& is)
|
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||||
:
|
:
|
||||||
DictionaryBase<DLPtrList<T>, T>(is)
|
DictionaryBase<DLPtrList<T>, T>(is)
|
||||||
{}
|
{}
|
||||||
@ -62,6 +57,4 @@ PtrDictionary<T>::PtrDictionary(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,8 +27,10 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Template dictionary class which does not manages the storage
|
Template dictionary class which does not manages the storage
|
||||||
associated with it. It is derived from DictionaryBase instantiated on
|
associated with it.
|
||||||
a non-memory managed form of intrusive doubly-linked list of T.
|
|
||||||
|
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||||
|
form of intrusive doubly-linked list of T.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
PtrDictionary.C
|
PtrDictionary.C
|
||||||
@ -47,7 +49,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class PtrDictionary Declaration
|
Class PtrDictionary Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@ -26,22 +26,15 @@ License
|
|||||||
|
|
||||||
#include "UDictionary.H"
|
#include "UDictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Null constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
UDictionary<T>::UDictionary()
|
Foam::UDictionary<T>::UDictionary()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Copy constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
UDictionary<T>::UDictionary(const UDictionary& dict)
|
Foam::UDictionary<T>::UDictionary(const UDictionary& dict)
|
||||||
:
|
:
|
||||||
DictionaryBase<UIDLList<T>, T>(dict)
|
DictionaryBase<UIDLList<T>, T>(dict)
|
||||||
{}
|
{}
|
||||||
@ -49,6 +42,4 @@ UDictionary<T>::UDictionary(const UDictionary& dict)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -49,7 +49,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class UDictionary Declaration
|
Class UDictionary Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@ -26,22 +26,15 @@ License
|
|||||||
|
|
||||||
#include "UPtrDictionary.H"
|
#include "UPtrDictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Null constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
UPtrDictionary<T>::UPtrDictionary()
|
Foam::UPtrDictionary<T>::UPtrDictionary()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Copy constructor
|
|
||||||
template<class T>
|
template<class T>
|
||||||
UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||||
:
|
:
|
||||||
DictionaryBase<DLList<T*>, T>(dict)
|
DictionaryBase<DLList<T*>, T>(dict)
|
||||||
{}
|
{}
|
||||||
@ -49,6 +42,4 @@ UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,8 +27,10 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Template dictionary class which does not manages the storage
|
Template dictionary class which does not manages the storage
|
||||||
associated with it. It is derived from DictionaryBase instantiated on
|
associated with it.
|
||||||
a non-memory managed form of intrusive doubly-linked list of \<T\>.
|
|
||||||
|
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||||
|
form of intrusive doubly-linked list of \<T\>.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
UPtrDictionary.C
|
UPtrDictionary.C
|
||||||
@ -47,7 +49,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class UPtrDictionary Declaration
|
Class UPtrDictionary Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@ -456,6 +456,14 @@ void HashTable<T, Key, Hash>::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Key, class Hash>
|
||||||
|
void HashTable<T, Key, Hash>::clearStorage()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
resize(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Key, class Hash>
|
template<class T, class Key, class Hash>
|
||||||
void HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
|
void HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,6 +54,7 @@ template<class T>
|
|||||||
class List;
|
class List;
|
||||||
|
|
||||||
template<class T, class Key, class Hash> class HashTable;
|
template<class T, class Key, class Hash> class HashTable;
|
||||||
|
template<class T, class Key, class Hash> class HashPtrTable;
|
||||||
|
|
||||||
template<class T, class Key, class Hash> Istream& operator>>
|
template<class T, class Key, class Hash> Istream& operator>>
|
||||||
(
|
(
|
||||||
@ -102,7 +103,7 @@ class HashTable
|
|||||||
//- Construct given key, next pointer and object
|
//- Construct given key, next pointer and object
|
||||||
inline hashedEntry
|
inline hashedEntry
|
||||||
(
|
(
|
||||||
const Key& key,
|
const Key&,
|
||||||
hashedEntry* next,
|
hashedEntry* next,
|
||||||
const T& newEntry
|
const T& newEntry
|
||||||
);
|
);
|
||||||
@ -127,7 +128,7 @@ class HashTable
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Assign a new hashedEntry to a possibly already existing key
|
//- Assign a new hashedEntry to a possibly already existing key
|
||||||
bool set(const Key& key, const T& newElmt, bool protect);
|
bool set(const Key&, const T& newElmt, bool protect);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -173,15 +174,15 @@ public:
|
|||||||
inline label size() const;
|
inline label size() const;
|
||||||
|
|
||||||
//- Return true if hashedEntry is found in table
|
//- Return true if hashedEntry is found in table
|
||||||
bool found(const Key& key) const;
|
bool found(const Key&) const;
|
||||||
|
|
||||||
//- Find and return an iterator set at the hashedEntry
|
//- Find and return an iterator set at the hashedEntry
|
||||||
// If not found iterator = end()
|
// If not found iterator = end()
|
||||||
iterator find(const Key& key);
|
iterator find(const Key&);
|
||||||
|
|
||||||
//- Find and return an const_iterator set at the hashedEntry
|
//- Find and return an const_iterator set at the hashedEntry
|
||||||
// If not found iterator = end()
|
// If not found iterator = end()
|
||||||
const_iterator find(const Key& key) const;
|
const_iterator find(const Key&) const;
|
||||||
|
|
||||||
//- Return the table of contents
|
//- Return the table of contents
|
||||||
List<Key> toc() const;
|
List<Key> toc() const;
|
||||||
@ -190,16 +191,16 @@ public:
|
|||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Insert a new hashedEntry
|
//- Insert a new hashedEntry
|
||||||
inline bool insert(const Key& key, const T& newElmt);
|
inline bool insert(const Key&, const T& newElmt);
|
||||||
|
|
||||||
//- Assign a new hashedEntry, overwriting existing entries
|
//- Assign a new hashedEntry, overwriting existing entries
|
||||||
inline bool set(const Key& key, const T& newElmt);
|
inline bool set(const Key&, const T& newElmt);
|
||||||
|
|
||||||
//- Erase an hashedEntry specified by given iterator
|
//- Erase an hashedEntry specified by given iterator
|
||||||
bool erase(const iterator& it);
|
bool erase(const iterator&);
|
||||||
|
|
||||||
//- Erase an hashedEntry specified by given key if in table
|
//- Erase an hashedEntry specified by given key if in table
|
||||||
bool erase(const Key& key);
|
bool erase(const Key&);
|
||||||
|
|
||||||
//- Resize the hash table for efficiency
|
//- Resize the hash table for efficiency
|
||||||
void resize(const label newSize);
|
void resize(const label newSize);
|
||||||
@ -207,6 +208,10 @@ public:
|
|||||||
//- Clear all entries from table
|
//- Clear all entries from table
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Clear the table entries and the table itself.
|
||||||
|
// Equivalent to clear() followed by resize(0)
|
||||||
|
void clearStorage();
|
||||||
|
|
||||||
//- Transfer the contents of the argument table into this table
|
//- Transfer the contents of the argument table into this table
|
||||||
// and annull the argument table.
|
// and annull the argument table.
|
||||||
void transfer(HashTable<T, Key, Hash>&);
|
void transfer(HashTable<T, Key, Hash>&);
|
||||||
@ -215,14 +220,14 @@ public:
|
|||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Find and return an hashedEntry
|
//- Find and return an hashedEntry
|
||||||
inline T& operator[](const Key& key);
|
inline T& operator[](const Key&);
|
||||||
|
|
||||||
//- Find and return an hashedEntry
|
//- Find and return an hashedEntry
|
||||||
inline const T& operator[](const Key& key) const;
|
inline const T& operator[](const Key&) const;
|
||||||
|
|
||||||
//- Find and return an hashedEntry and
|
//- Find and return an hashedEntry and
|
||||||
// if it is not present create it null.
|
// if it is not present create it null.
|
||||||
inline T& operator()(const Key& key);
|
inline T& operator()(const Key&);
|
||||||
|
|
||||||
//- Assignment
|
//- Assignment
|
||||||
void operator=(const HashTable<T, Key, Hash>&);
|
void operator=(const HashTable<T, Key, Hash>&);
|
||||||
@ -290,13 +295,13 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
inline void operator=(const iterator& iter);
|
inline void operator=(const iterator&);
|
||||||
|
|
||||||
inline bool operator==(const iterator& iter) const;
|
inline bool operator==(const iterator&) const;
|
||||||
inline bool operator!=(const iterator& iter) const;
|
inline bool operator!=(const iterator&) const;
|
||||||
|
|
||||||
inline bool operator==(const const_iterator& iter) const;
|
inline bool operator==(const const_iterator&) const;
|
||||||
inline bool operator!=(const const_iterator& iter) const;
|
inline bool operator!=(const const_iterator&) const;
|
||||||
|
|
||||||
inline T& operator*();
|
inline T& operator*();
|
||||||
inline T& operator()();
|
inline T& operator()();
|
||||||
@ -352,13 +357,13 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
inline void operator=(const const_iterator& iter);
|
inline void operator=(const const_iterator&);
|
||||||
|
|
||||||
inline bool operator==(const const_iterator& iter) const;
|
inline bool operator==(const const_iterator&) const;
|
||||||
inline bool operator!=(const const_iterator& iter) const;
|
inline bool operator!=(const const_iterator&) const;
|
||||||
|
|
||||||
inline bool operator==(const iterator& iter) const;
|
inline bool operator==(const iterator&) const;
|
||||||
inline bool operator!=(const iterator& iter) const;
|
inline bool operator!=(const iterator&) const;
|
||||||
|
|
||||||
inline const T& operator*();
|
inline const T& operator*();
|
||||||
inline const T& operator()();
|
inline const T& operator()();
|
||||||
|
|||||||
@ -26,22 +26,17 @@ License
|
|||||||
|
|
||||||
#include "ILList.H"
|
#include "ILList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
Foam::ILList<LListBase, T>::ILList(const ILList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
UILList<LListBase, T>()
|
UILList<LListBase, T>()
|
||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -53,9 +48,9 @@ ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
|||||||
#ifndef __INTEL_COMPILER
|
#ifndef __INTEL_COMPILER
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class CloneArg>
|
template<class CloneArg>
|
||||||
ILList<LListBase, T>::ILList
|
Foam::ILList<LListBase, T>::ILList
|
||||||
(
|
(
|
||||||
const ILList<LListBase, T>& slpl,
|
const ILList<LListBase, T>& lst,
|
||||||
const CloneArg& cloneArg
|
const CloneArg& cloneArg
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -63,8 +58,8 @@ ILList<LListBase, T>::ILList
|
|||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -77,7 +72,7 @@ ILList<LListBase, T>::ILList
|
|||||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::~ILList()
|
Foam::ILList<LListBase, T>::~ILList()
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
@ -85,9 +80,8 @@ ILList<LListBase, T>::~ILList()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Return and remove head
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool ILList<LListBase, T>::eraseHead()
|
bool Foam::ILList<LListBase, T>::eraseHead()
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = this->removeHead()))
|
if ((tPtr = this->removeHead()))
|
||||||
@ -101,9 +95,8 @@ bool ILList<LListBase, T>::eraseHead()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return and remove element
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool ILList<LListBase, T>::erase(T* p)
|
bool Foam::ILList<LListBase, T>::erase(T* p)
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = remove(p)))
|
if ((tPtr = remove(p)))
|
||||||
@ -119,7 +112,7 @@ bool ILList<LListBase, T>::erase(T* p)
|
|||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void ILList<LListBase, T>::clear()
|
void Foam::ILList<LListBase, T>::clear()
|
||||||
{
|
{
|
||||||
label oldSize = this->size();
|
label oldSize = this->size();
|
||||||
for (label i=0; i<oldSize; i++)
|
for (label i=0; i<oldSize; i++)
|
||||||
@ -131,17 +124,25 @@ void ILList<LListBase, T>::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class LListBase, class T>
|
||||||
|
void Foam::ILList<LListBase, T>::transfer(ILList<LListBase, T>& lst)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
LListBase::transfer(lst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
void Foam::ILList<LListBase, T>::operator=(const ILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -149,11 +150,6 @@ void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "ILListIO.C"
|
#include "ILListIO.C"
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class ILList
|
|||||||
|
|
||||||
//- Read from Istream using given Istream constructor class
|
//- Read from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void read(Istream&, const INew& inewt);
|
void read(Istream&, const INew&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
//- Copy constructor with additional argument for clone
|
//- Copy constructor with additional argument for clone
|
||||||
template<class CloneArg>
|
template<class CloneArg>
|
||||||
ILList(const ILList<LListBase, T>& slpl, const CloneArg& cloneArg)
|
ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg)
|
||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
:
|
:
|
||||||
UILList<LListBase, T>()
|
UILList<LListBase, T>()
|
||||||
@ -104,8 +104,8 @@ public:
|
|||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter =
|
typename UILList<LListBase, T>::const_iterator iter =
|
||||||
slpl.begin();
|
lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
//- Construct from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
ILList(Istream&, const INew& inewt);
|
ILList(Istream&, const INew&);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@ -139,6 +139,10 @@ public:
|
|||||||
//- Clear the contents of the list
|
//- Clear the contents of the list
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this List
|
||||||
|
// and annull the argument list.
|
||||||
|
void transfer(ILList<LListBase, T>&);
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
|||||||
@ -30,24 +30,19 @@ Description
|
|||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "INew.H"
|
#include "INew.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : reading first token"
|
"operator>>(Istream&, ILList<LListBase, T>&) : reading first token"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstToken.isLabel())
|
if (firstToken.isLabel())
|
||||||
@ -63,26 +58,26 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; i++)
|
||||||
{
|
{
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||||
"reading entry"
|
"reading entry"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
T* tPtr = inewt(is).ptr();
|
T* tPtr = iNew(is).ptr();
|
||||||
append(tPtr);
|
append(tPtr);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||||
"reading entry"
|
"reading entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i=1; i<s; i++)
|
for (label i=1; i<s; i++)
|
||||||
{
|
{
|
||||||
append(new T(*tPtr));
|
append(new T(*tPtr));
|
||||||
@ -99,14 +94,14 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L)",
|
"operator>>(Istream&, ILList<LListBase, T>&)",
|
||||||
is
|
is
|
||||||
) << "incorrect first token, '(', found " << firstToken.info()
|
) << "incorrect first token, '(', found " << firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
token lastToken(is);
|
token lastToken(is);
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
|
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
@ -117,36 +112,34 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
is.putBack(lastToken);
|
is.putBack(lastToken);
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorIn("operator>>(Istream& is, ILList<LListBase, T>& L)", is)
|
FatalIOErrorIn("operator>>(Istream&, ILList<LListBase, T>&)", is)
|
||||||
<< "incorrect first token, expected <int> or '(', found "
|
<< "incorrect first token, expected <int> or '(', found "
|
||||||
<< firstToken.info()
|
<< firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
ILList<LListBase, T>::ILList(Istream& is, const INew& inewt)
|
Foam::ILList<LListBase, T>::ILList(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
read(is, inewt);
|
read(is, iNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct from Istream
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::ILList(Istream& is)
|
Foam::ILList<LListBase, T>::ILList(Istream& is)
|
||||||
{
|
{
|
||||||
read(is, INew<T>());
|
read(is, INew<T>());
|
||||||
}
|
}
|
||||||
@ -155,7 +148,7 @@ ILList<LListBase, T>::ILList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, ILList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
L.clear();
|
L.clear();
|
||||||
L.read(is, INew<T>());
|
L.read(is, INew<T>());
|
||||||
@ -166,6 +159,4 @@ Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,22 +27,16 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
#include "LList.H"
|
#include "LList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
Foam::LList<LListBase, T>::LList(const LList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
LListBase()
|
LListBase()
|
||||||
{
|
{
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter());
|
append(iter());
|
||||||
}
|
}
|
||||||
@ -50,7 +44,7 @@ LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
|||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::~LList()
|
Foam::LList<LListBase, T>::~LList()
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
@ -59,7 +53,7 @@ LList<LListBase, T>::~LList()
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LList<LListBase, T>::clear()
|
void Foam::LList<LListBase, T>::clear()
|
||||||
{
|
{
|
||||||
label oldSize = this->size();
|
label oldSize = this->size();
|
||||||
for (label i=0; i<oldSize; i++)
|
for (label i=0; i<oldSize; i++)
|
||||||
@ -71,24 +65,28 @@ void LList<LListBase, T>::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class LListBase, class T>
|
||||||
|
void Foam::LList<LListBase, T>::transfer(LList<LListBase, T>& lst)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
LListBase::transfer(lst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LList<LListBase, T>::operator=(const LList<LListBase, T>& slpl)
|
void Foam::LList<LListBase, T>::operator=(const LList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter());
|
append(iter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "LListIO.C"
|
#include "LListIO.C"
|
||||||
|
|||||||
@ -67,7 +67,7 @@ Ostream& operator<<
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class LList Declaration
|
Class LList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
@ -200,6 +200,9 @@ public:
|
|||||||
//- Delete contents of list
|
//- Delete contents of list
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this List
|
||||||
|
// and annull the argument list.
|
||||||
|
void transfer(LList<LListBase, T>&);
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
|||||||
@ -30,16 +30,10 @@ Description
|
|||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from Istream
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::LList(Istream& is)
|
Foam::LList<LListBase, T>::LList(Istream& is)
|
||||||
{
|
{
|
||||||
operator>>(is, *this);
|
operator>>(is, *this);
|
||||||
}
|
}
|
||||||
@ -48,18 +42,18 @@ LList<LListBase, T>::LList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
// Anull list
|
// Anull list
|
||||||
L.clear();
|
L.clear();
|
||||||
|
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
" operator>>(Istream& is, LList<LListBase, T>& L) : reading first token"
|
" operator>>(Istream&, LList<LListBase, T>&) : reading first token"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstToken.isLabel())
|
if (firstToken.isLabel())
|
||||||
@ -101,14 +95,14 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
" operator>>(Istream& is, LList<LListBase, T>& L)",
|
" operator>>(Istream&, LList<LListBase, T>&)",
|
||||||
is
|
is
|
||||||
) << "incorrect first token, '(', found " << firstToken.info()
|
) << "incorrect first token, '(', found " << firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
token lastToken(is);
|
token lastToken(is);
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
|
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
@ -124,19 +118,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
L.append(element);
|
L.append(element);
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorIn(" operator>>(Istream& is, LList<LListBase, T>& L)", is)
|
FatalIOErrorIn(" operator>>(Istream&, LList<LListBase, T>&)", is)
|
||||||
<< "incorrect first token, expected <int> or '(', found "
|
<< "incorrect first token, expected <int> or '(', found "
|
||||||
<< firstToken.info()
|
<< firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
@ -145,19 +139,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of LList
|
// Write size
|
||||||
os << nl << ll.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write LList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename LList<LListBase, T>::const_iterator iter = ll.begin();
|
typename LList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != ll.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -168,14 +162,10 @@ Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const LList&)");
|
os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -26,19 +26,14 @@ License
|
|||||||
|
|
||||||
#include "LPtrList.H"
|
#include "LPtrList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
|
Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
LList<LListBase, T*>()
|
LList<LListBase, T*>()
|
||||||
{
|
{
|
||||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter().clone().ptr());
|
append(iter().clone().ptr());
|
||||||
}
|
}
|
||||||
@ -48,7 +43,7 @@ LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LPtrList<LListBase, T>::~LPtrList()
|
Foam::LPtrList<LListBase, T>::~LPtrList()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
@ -56,9 +51,8 @@ LPtrList<LListBase, T>::~LPtrList()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Return and remove head
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool LPtrList<LListBase, T>::eraseHead()
|
bool Foam::LPtrList<LListBase, T>::eraseHead()
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = this->removeHead()))
|
if ((tPtr = this->removeHead()))
|
||||||
@ -74,7 +68,7 @@ bool LPtrList<LListBase, T>::eraseHead()
|
|||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LPtrList<LListBase, T>::clear()
|
void Foam::LPtrList<LListBase, T>::clear()
|
||||||
{
|
{
|
||||||
label oldSize = this->size();
|
label oldSize = this->size();
|
||||||
for (label i=0; i<oldSize; i++)
|
for (label i=0; i<oldSize; i++)
|
||||||
@ -86,24 +80,28 @@ void LPtrList<LListBase, T>::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class LListBase, class T>
|
||||||
|
void Foam::LPtrList<LListBase, T>::transfer(LPtrList<LListBase, T>& lst)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
LList<LListBase, T*>::transfer(lst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& slpl)
|
void Foam::LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter().clone().ptr());
|
append(iter().clone().ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "LPtrListIO.C"
|
#include "LPtrListIO.C"
|
||||||
|
|||||||
@ -149,12 +149,16 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Remove the head element specified from the list and delete it
|
//- Remove the head element from the list and delete the pointer
|
||||||
bool eraseHead();
|
bool eraseHead();
|
||||||
|
|
||||||
//- Remove the specified element from the list and delete it
|
//- Clear the contents of the list
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this List
|
||||||
|
// and annull the argument list.
|
||||||
|
void transfer(LPtrList<LListBase, T>&);
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
|||||||
@ -29,16 +29,11 @@ License
|
|||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
#include "INew.H"
|
#include "INew.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
@ -66,8 +61,8 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; i++)
|
||||||
{
|
{
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
||||||
@ -77,7 +72,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
T* tPtr = inewt(is).ptr();
|
T* tPtr = iNew(is).ptr();
|
||||||
append(tPtr);
|
append(tPtr);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
@ -85,7 +80,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
|
||||||
"reading entry"
|
"reading entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i=1; i<s; i++)
|
for (label i=1; i<s; i++)
|
||||||
{
|
{
|
||||||
append(tPtr->clone().ptr());
|
append(tPtr->clone().ptr());
|
||||||
@ -120,7 +115,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
is.putBack(lastToken);
|
is.putBack(lastToken);
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
@ -148,14 +143,14 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& inewt)
|
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
read(is, inewt);
|
read(is, iNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LPtrList<LListBase, T>::LPtrList(Istream& is)
|
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
|
||||||
{
|
{
|
||||||
read(is, INew<T>());
|
read(is, INew<T>());
|
||||||
}
|
}
|
||||||
@ -164,11 +159,10 @@ LPtrList<LListBase, T>::LPtrList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
// Anull list
|
|
||||||
L.clear();
|
L.clear();
|
||||||
|
L.read(is, INew<T>());
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
@ -177,19 +171,19 @@ Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
|||||||
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of LPtrList
|
// Write size
|
||||||
os << nl << slpl.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write LPtrList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename LPtrList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename LPtrList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -200,14 +194,9 @@ Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const LPtrList&)");
|
os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,17 +28,12 @@ Description
|
|||||||
|
|
||||||
#include "UILList.H"
|
#include "UILList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
Foam::UILList<LListBase, T>::UILList(const UILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(&iter());
|
append(&iter());
|
||||||
}
|
}
|
||||||
@ -48,22 +43,24 @@ UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
|||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void UILList<LListBase, T>::operator=(const UILList<LListBase, T>& slpl)
|
void Foam::UILList<LListBase, T>::operator=(const UILList<LListBase, T>& rhs)
|
||||||
{
|
{
|
||||||
LListBase::clear();
|
LListBase::clear();
|
||||||
|
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(&iter());
|
append(&iter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Comparison for equality
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
bool Foam::UILList<LListBase, T>::operator==
|
||||||
|
(
|
||||||
|
const UILList<LListBase, T>& rhs
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if (this->size() != slpl.size())
|
if (this->size() != rhs.size())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -71,7 +68,7 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
|||||||
bool equal = true;
|
bool equal = true;
|
||||||
|
|
||||||
const_iterator iter1 = this->begin();
|
const_iterator iter1 = this->begin();
|
||||||
const_iterator iter2 = slpl.begin();
|
const_iterator iter2 = rhs.begin();
|
||||||
|
|
||||||
for (; iter1 != this->end(); ++iter1, ++iter2)
|
for (; iter1 != this->end(); ++iter1, ++iter2)
|
||||||
{
|
{
|
||||||
@ -84,16 +81,15 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
|||||||
|
|
||||||
// Comparison for inequality
|
// Comparison for inequality
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool UILList<LListBase, T>::operator!=(const UILList<LListBase, T>& slpl) const
|
bool Foam::UILList<LListBase, T>::operator!=
|
||||||
|
(
|
||||||
|
const UILList<LListBase, T>& rhs
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return !operator==(slpl);
|
return !operator==(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "UILListIO.C"
|
#include "UILListIO.C"
|
||||||
|
|||||||
@ -245,7 +245,7 @@ public:
|
|||||||
|
|
||||||
const T& operator*()
|
const T& operator*()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
static_cast<const T&>
|
static_cast<const T&>
|
||||||
(LListBase_const_iterator::operator*());
|
(LListBase_const_iterator::operator*());
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ public:
|
|||||||
// STL member operators
|
// STL member operators
|
||||||
|
|
||||||
//- Equality operation on ULists of the same type.
|
//- Equality operation on ULists of the same type.
|
||||||
// Returns true when the ULists are elementwise equal
|
// Returns true when the ULists are element-wise equal
|
||||||
// (using UList::value_type::operator==). Takes linear time.
|
// (using UList::value_type::operator==). Takes linear time.
|
||||||
bool operator==(const UILList<LListBase, T>&) const;
|
bool operator==(const UILList<LListBase, T>&) const;
|
||||||
|
|
||||||
|
|||||||
@ -30,27 +30,22 @@ Description
|
|||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
#include "token.H"
|
#include "token.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of UILList
|
// Write size
|
||||||
os << nl << ill.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write UILList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = ill.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != ill.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -61,14 +56,9 @@ Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const UILList&)");
|
os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -32,17 +32,12 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
Foam::DLListBase::iterator Foam::DLListBase::endIter
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
DLListBase::iterator DLListBase::endIter
|
|
||||||
(
|
(
|
||||||
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
||||||
);
|
);
|
||||||
|
|
||||||
DLListBase::const_iterator DLListBase::endConstIter
|
Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter
|
||||||
(
|
(
|
||||||
static_cast<const DLListBase&>(DLListBase()),
|
static_cast<const DLListBase&>(DLListBase()),
|
||||||
reinterpret_cast<const link*>(NULL)
|
reinterpret_cast<const link*>(NULL)
|
||||||
@ -51,7 +46,7 @@ DLListBase::const_iterator DLListBase::endConstIter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void DLListBase::insert(DLListBase::link* a)
|
void Foam::DLListBase::insert(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -71,7 +66,7 @@ void DLListBase::insert(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DLListBase::append(DLListBase::link* a)
|
void Foam::DLListBase::append(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -91,7 +86,7 @@ void DLListBase::append(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DLListBase::swapUp(DLListBase::link* a)
|
bool Foam::DLListBase::swapUp(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
if (first_ != a)
|
if (first_ != a)
|
||||||
{
|
{
|
||||||
@ -132,7 +127,7 @@ bool DLListBase::swapUp(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DLListBase::swapDown(DLListBase::link* a)
|
bool Foam::DLListBase::swapDown(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
if (last_ != a)
|
if (last_ != a)
|
||||||
{
|
{
|
||||||
@ -173,7 +168,7 @@ bool DLListBase::swapDown(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::removeHead()
|
Foam::DLListBase::link* Foam::DLListBase::removeHead()
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -197,7 +192,7 @@ DLListBase::link* DLListBase::removeHead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
Foam::DLListBase::link* Foam::DLListBase::remove(DLListBase::link* l)
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -229,7 +224,7 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::replace
|
Foam::DLListBase::link* Foam::DLListBase::replace
|
||||||
(
|
(
|
||||||
DLListBase::link* oldLink,
|
DLListBase::link* oldLink,
|
||||||
DLListBase::link* newLink
|
DLListBase::link* newLink
|
||||||
@ -266,8 +261,4 @@ DLListBase::link* DLListBase::replace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -167,6 +167,9 @@ public:
|
|||||||
//- Clear the list
|
//- Clear the list
|
||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this List
|
||||||
|
// and annull the argument list.
|
||||||
|
inline void transfer(DLListBase&);
|
||||||
|
|
||||||
// STL iterator
|
// STL iterator
|
||||||
|
|
||||||
|
|||||||
@ -26,21 +26,16 @@ License
|
|||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::link::link()
|
inline Foam::DLListBase::link::link()
|
||||||
:
|
:
|
||||||
prev_(0),
|
prev_(0),
|
||||||
next_(0)
|
next_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::DLListBase()
|
inline Foam::DLListBase::DLListBase()
|
||||||
:
|
:
|
||||||
first_(0),
|
first_(0),
|
||||||
last_(0),
|
last_(0),
|
||||||
@ -48,7 +43,7 @@ inline DLListBase::DLListBase()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::DLListBase(link* a)
|
inline Foam::DLListBase::DLListBase(link* a)
|
||||||
:
|
:
|
||||||
first_(a),
|
first_(a),
|
||||||
last_(a),
|
last_(a),
|
||||||
@ -61,32 +56,33 @@ inline DLListBase::DLListBase(link* a)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::~DLListBase()
|
inline Foam::DLListBase::~DLListBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool DLListBase::link::registered() const
|
inline bool Foam::DLListBase::link::registered() const
|
||||||
{
|
{
|
||||||
return prev_ != 0 && next_ != 0;
|
return prev_ != 0 && next_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::link::deregister()
|
inline void Foam::DLListBase::link::deregister()
|
||||||
{
|
{
|
||||||
prev_ = 0;
|
prev_ = 0;
|
||||||
next_ = 0;
|
next_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline label DLListBase::size() const
|
inline Foam::label Foam::DLListBase::size() const
|
||||||
{
|
{
|
||||||
return nElmts_;
|
return nElmts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::first()
|
inline Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::first()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -98,7 +94,8 @@ inline DLListBase::link* DLListBase::first()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link* DLListBase::first() const
|
inline const Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::first() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -110,7 +107,8 @@ inline const DLListBase::link* DLListBase::first() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::last()
|
inline Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::last()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -122,7 +120,8 @@ inline DLListBase::link* DLListBase::last()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link* DLListBase::last() const
|
inline const Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::last() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -134,21 +133,36 @@ inline const DLListBase::link* DLListBase::last() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::clear()
|
inline void Foam::DLListBase::clear()
|
||||||
{
|
{
|
||||||
nElmts_ = 0;
|
|
||||||
first_ = 0;
|
first_ = 0;
|
||||||
last_ = 0;
|
last_ = 0;
|
||||||
|
nElmts_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it)
|
inline void Foam::DLListBase::transfer(DLListBase& lst)
|
||||||
|
{
|
||||||
|
first_ = lst.first_;
|
||||||
|
last_ = lst.last_;
|
||||||
|
nElmts_ = lst.nElmts_;
|
||||||
|
|
||||||
|
lst.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::remove
|
||||||
|
(
|
||||||
|
DLListBase::iterator& it
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return remove(it.curElmt_);
|
return remove(it.curElmt_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::replace
|
inline Foam::DLListBase::link*
|
||||||
|
Foam::DLListBase::replace
|
||||||
(
|
(
|
||||||
DLListBase::iterator& oldIter,
|
DLListBase::iterator& oldIter,
|
||||||
DLListBase::link* newLink
|
DLListBase::link* newLink
|
||||||
@ -160,7 +174,7 @@ inline DLListBase::link* DLListBase::replace
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
inline Foam::DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(elmt),
|
curElmt_(elmt),
|
||||||
@ -168,7 +182,7 @@ inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator::iterator(DLListBase& s)
|
inline Foam::DLListBase::iterator::iterator(DLListBase& s)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(NULL),
|
curElmt_(NULL),
|
||||||
@ -176,32 +190,34 @@ inline DLListBase::iterator::iterator(DLListBase& s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::iterator::operator=(const iterator& iter)
|
inline void Foam::DLListBase::iterator::operator=(const iterator& iter)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
curLink_ = iter.curLink_;
|
curLink_ = iter.curLink_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::iterator::operator==(const iterator& iter) const
|
inline bool Foam::DLListBase::iterator::operator==(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ == iter.curElmt_;
|
return curElmt_ == iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::iterator::operator!=(const iterator& iter) const
|
inline bool Foam::DLListBase::iterator::operator!=(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ != iter.curElmt_;
|
return curElmt_ != iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link& DLListBase::iterator::operator*()
|
inline Foam::DLListBase::link&
|
||||||
|
Foam::DLListBase::iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator& DLListBase::iterator::operator++()
|
inline Foam::DLListBase::iterator&
|
||||||
|
Foam::DLListBase::iterator::operator++()
|
||||||
{
|
{
|
||||||
// Check if the curElmt_ is the last element (if it points to itself)
|
// Check if the curElmt_ is the last element (if it points to itself)
|
||||||
// or if the list is empty because the last element may have been removed
|
// or if the list is empty because the last element may have been removed
|
||||||
@ -219,7 +235,8 @@ inline DLListBase::iterator& DLListBase::iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
inline Foam::DLListBase::iterator
|
||||||
|
Foam::DLListBase::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp = *this;
|
iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -227,7 +244,8 @@ inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator DLListBase::begin()
|
inline Foam::DLListBase::iterator
|
||||||
|
Foam::DLListBase::begin()
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -240,7 +258,7 @@ inline DLListBase::iterator DLListBase::begin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::iterator& DLListBase::end()
|
inline const Foam::DLListBase::iterator& Foam::DLListBase::end()
|
||||||
{
|
{
|
||||||
return endIter;
|
return endIter;
|
||||||
}
|
}
|
||||||
@ -248,7 +266,7 @@ inline const DLListBase::iterator& DLListBase::end()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::const_iterator::const_iterator
|
inline Foam::DLListBase::const_iterator::const_iterator
|
||||||
(
|
(
|
||||||
const DLListBase& s,
|
const DLListBase& s,
|
||||||
const link* elmt
|
const link* elmt
|
||||||
@ -259,20 +277,23 @@ inline DLListBase::const_iterator::const_iterator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator::const_iterator(const iterator& iter)
|
inline Foam::DLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||||
:
|
:
|
||||||
curList_(iter.curList_),
|
curList_(iter.curList_),
|
||||||
curElmt_(iter.curElmt_)
|
curElmt_(iter.curElmt_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::const_iterator::operator=(const const_iterator& iter)
|
inline void Foam::DLListBase::const_iterator::operator=
|
||||||
|
(
|
||||||
|
const const_iterator& iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::const_iterator::operator==
|
inline bool Foam::DLListBase::const_iterator::operator==
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -281,7 +302,7 @@ inline bool DLListBase::const_iterator::operator==
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::const_iterator::operator!=
|
inline bool Foam::DLListBase::const_iterator::operator!=
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -290,13 +311,15 @@ inline bool DLListBase::const_iterator::operator!=
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link& DLListBase::const_iterator::operator*()
|
inline const Foam::DLListBase::link&
|
||||||
|
Foam::DLListBase::const_iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
inline Foam::DLListBase::const_iterator&
|
||||||
|
Foam::DLListBase::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_)
|
if (curElmt_ == curList_.last_)
|
||||||
{
|
{
|
||||||
@ -311,7 +334,8 @@ inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
inline Foam::DLListBase::const_iterator
|
||||||
|
Foam::DLListBase::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp = *this;
|
const_iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -319,7 +343,8 @@ inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator DLListBase::begin() const
|
inline Foam::DLListBase::const_iterator
|
||||||
|
Foam::DLListBase::begin() const
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -332,14 +357,11 @@ inline DLListBase::const_iterator DLListBase::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::const_iterator& DLListBase::end() const
|
inline const Foam::DLListBase::const_iterator&
|
||||||
|
Foam::DLListBase::end() const
|
||||||
{
|
{
|
||||||
return endConstIter;
|
return endConstIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -25,22 +25,16 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
#include "SLListBase.H"
|
#include "SLListBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
Foam::SLListBase::iterator Foam::SLListBase::endIter
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
SLListBase::iterator SLListBase::endIter
|
|
||||||
(
|
(
|
||||||
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
||||||
);
|
);
|
||||||
|
|
||||||
SLListBase::const_iterator SLListBase::endConstIter
|
Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter
|
||||||
(
|
(
|
||||||
static_cast<const SLListBase&>(SLListBase()),
|
static_cast<const SLListBase&>(SLListBase()),
|
||||||
reinterpret_cast<const link*>(NULL)
|
reinterpret_cast<const link*>(NULL)
|
||||||
@ -49,7 +43,7 @@ SLListBase::const_iterator SLListBase::endConstIter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void SLListBase::insert(SLListBase::link* a)
|
void Foam::SLListBase::insert(SLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -66,7 +60,7 @@ void SLListBase::insert(SLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SLListBase::append(SLListBase::link* a)
|
void Foam::SLListBase::append(SLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -82,7 +76,7 @@ void SLListBase::append(SLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SLListBase::link* SLListBase::removeHead()
|
Foam::SLListBase::link* Foam::SLListBase::removeHead()
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -108,7 +102,7 @@ SLListBase::link* SLListBase::removeHead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
Foam::SLListBase::link* Foam::SLListBase::remove(SLListBase::link* it)
|
||||||
{
|
{
|
||||||
SLListBase::iterator iter = begin();
|
SLListBase::iterator iter = begin();
|
||||||
SLListBase::link *prev = &(*iter);
|
SLListBase::link *prev = &(*iter);
|
||||||
@ -143,8 +137,4 @@ SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -152,6 +152,9 @@ public:
|
|||||||
//- Clear the list
|
//- Clear the list
|
||||||
inline void clear();
|
inline void clear();
|
||||||
|
|
||||||
|
//- Transfer the contents of the argument into this List
|
||||||
|
// and annull the argument list.
|
||||||
|
inline void transfer(SLListBase&);
|
||||||
|
|
||||||
// STL iterator
|
// STL iterator
|
||||||
|
|
||||||
|
|||||||
@ -29,33 +29,28 @@ Description
|
|||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::link::link()
|
inline Foam::SLListBase::link::link()
|
||||||
:
|
:
|
||||||
next_(0)
|
next_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link::link(link* p)
|
inline Foam::SLListBase::link::link(link* p)
|
||||||
:
|
:
|
||||||
next_(p)
|
next_(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::SLListBase()
|
inline Foam::SLListBase::SLListBase()
|
||||||
:
|
:
|
||||||
last_(0),
|
last_(0),
|
||||||
nElmts_(0)
|
nElmts_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::SLListBase(link* a)
|
inline Foam::SLListBase::SLListBase(link* a)
|
||||||
:
|
:
|
||||||
last_(a->next_ = a),
|
last_(a->next_ = a),
|
||||||
nElmts_(1)
|
nElmts_(1)
|
||||||
@ -64,19 +59,20 @@ inline SLListBase::SLListBase(link* a)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::~SLListBase()
|
inline Foam::SLListBase::~SLListBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline label SLListBase::size() const
|
inline Foam::label Foam::SLListBase::size() const
|
||||||
{
|
{
|
||||||
return nElmts_;
|
return nElmts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::first()
|
inline Foam::SLListBase::link*
|
||||||
|
Foam::SLListBase::first()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -88,7 +84,8 @@ inline SLListBase::link* SLListBase::first()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link* SLListBase::first() const
|
inline const Foam::SLListBase::link*
|
||||||
|
Foam::SLListBase::first() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -100,7 +97,8 @@ inline const SLListBase::link* SLListBase::first() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::last()
|
inline Foam::SLListBase::link*
|
||||||
|
Foam::SLListBase::last()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -112,7 +110,8 @@ inline SLListBase::link* SLListBase::last()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link* SLListBase::last() const
|
inline const Foam::SLListBase::link*
|
||||||
|
Foam::SLListBase::last() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -124,14 +123,26 @@ inline const SLListBase::link* SLListBase::last() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::clear()
|
inline void Foam::SLListBase::clear()
|
||||||
{
|
{
|
||||||
nElmts_ = 0;
|
|
||||||
last_ = 0;
|
last_ = 0;
|
||||||
|
nElmts_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
inline void Foam::SLListBase::transfer(SLListBase& lst)
|
||||||
|
{
|
||||||
|
last_ = lst.last_;
|
||||||
|
nElmts_ = lst.nElmts_;
|
||||||
|
|
||||||
|
lst.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::SLListBase::link* Foam::SLListBase::remove
|
||||||
|
(
|
||||||
|
SLListBase::iterator& it
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return remove(it.curElmt_);
|
return remove(it.curElmt_);
|
||||||
}
|
}
|
||||||
@ -139,7 +150,7 @@ inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
inline Foam::SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(elmt),
|
curElmt_(elmt),
|
||||||
@ -147,7 +158,7 @@ inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator::iterator(SLListBase& s)
|
inline Foam::SLListBase::iterator::iterator(SLListBase& s)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(NULL),
|
curElmt_(NULL),
|
||||||
@ -155,32 +166,32 @@ inline SLListBase::iterator::iterator(SLListBase& s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::iterator::operator=(const iterator& iter)
|
inline void Foam::SLListBase::iterator::operator=(const iterator& iter)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
curLink_ = iter.curLink_;
|
curLink_ = iter.curLink_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::iterator::operator==(const iterator& iter) const
|
inline bool Foam::SLListBase::iterator::operator==(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ == iter.curElmt_;
|
return curElmt_ == iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::iterator::operator!=(const iterator& iter) const
|
inline bool Foam::SLListBase::iterator::operator!=(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ != iter.curElmt_;
|
return curElmt_ != iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link& SLListBase::iterator::operator*()
|
inline Foam::SLListBase::link& Foam::SLListBase::iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator& SLListBase::iterator::operator++()
|
inline Foam::SLListBase::iterator& Foam::SLListBase::iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_ || curList_.last_ == 0)
|
if (curElmt_ == curList_.last_ || curList_.last_ == 0)
|
||||||
{
|
{
|
||||||
@ -196,7 +207,8 @@ inline SLListBase::iterator& SLListBase::iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
inline Foam::SLListBase::iterator
|
||||||
|
Foam::SLListBase::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp = *this;
|
iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -204,7 +216,8 @@ inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator SLListBase::begin()
|
inline Foam::SLListBase::iterator
|
||||||
|
Foam::SLListBase::begin()
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -217,7 +230,8 @@ inline SLListBase::iterator SLListBase::begin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::iterator& SLListBase::end()
|
inline const Foam::SLListBase::iterator&
|
||||||
|
Foam::SLListBase::end()
|
||||||
{
|
{
|
||||||
return endIter;
|
return endIter;
|
||||||
}
|
}
|
||||||
@ -225,7 +239,7 @@ inline const SLListBase::iterator& SLListBase::end()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::const_iterator::const_iterator
|
inline Foam::SLListBase::const_iterator::const_iterator
|
||||||
(
|
(
|
||||||
const SLListBase& s,
|
const SLListBase& s,
|
||||||
const link* elmt
|
const link* elmt
|
||||||
@ -236,20 +250,23 @@ inline SLListBase::const_iterator::const_iterator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator::const_iterator(const iterator& iter)
|
inline Foam::SLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||||
:
|
:
|
||||||
curList_(iter.curList_),
|
curList_(iter.curList_),
|
||||||
curElmt_(iter.curElmt_)
|
curElmt_(iter.curElmt_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::const_iterator::operator=(const const_iterator& iter)
|
inline void Foam::SLListBase::const_iterator::operator=
|
||||||
|
(
|
||||||
|
const const_iterator& iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::const_iterator::operator==
|
inline bool Foam::SLListBase::const_iterator::operator==
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -258,7 +275,7 @@ inline bool SLListBase::const_iterator::operator==
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::const_iterator::operator!=
|
inline bool Foam::SLListBase::const_iterator::operator!=
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -267,13 +284,15 @@ inline bool SLListBase::const_iterator::operator!=
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link& SLListBase::const_iterator::operator*()
|
inline const Foam::SLListBase::link&
|
||||||
|
Foam::SLListBase::const_iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
inline Foam::SLListBase::const_iterator&
|
||||||
|
Foam::SLListBase::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_)
|
if (curElmt_ == curList_.last_)
|
||||||
{
|
{
|
||||||
@ -288,7 +307,8 @@ inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
inline Foam::SLListBase::const_iterator
|
||||||
|
Foam::SLListBase::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp = *this;
|
const_iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -296,7 +316,8 @@ inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator SLListBase::begin() const
|
inline Foam::SLListBase::const_iterator
|
||||||
|
Foam::SLListBase::begin() const
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -309,14 +330,11 @@ inline SLListBase::const_iterator SLListBase::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::const_iterator& SLListBase::end() const
|
inline const Foam::SLListBase::const_iterator&
|
||||||
|
Foam::SLListBase::end() const
|
||||||
{
|
{
|
||||||
return endConstIter;
|
return endConstIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,13 +31,22 @@ License
|
|||||||
template<class Stream>
|
template<class Stream>
|
||||||
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||||
{
|
{
|
||||||
static bool spacesSet = false;
|
static bool spacesSet(false);
|
||||||
static char spaces[40];
|
static char spaces[40];
|
||||||
|
|
||||||
if (!spacesSet)
|
if (!spacesSet)
|
||||||
{
|
{
|
||||||
memset(spaces, ' ', 40);
|
memset(spaces, ' ', 40);
|
||||||
spaces[38 - strlen(Foam::FOAMversion)] = '\0';
|
|
||||||
|
size_t len = strlen(Foam::FOAMversion);
|
||||||
|
if (len < 38)
|
||||||
|
{
|
||||||
|
spaces[38 - len] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spaces[0] = '\0';
|
||||||
|
}
|
||||||
spacesSet = true;
|
spacesSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +65,8 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
|||||||
"| ========= | |\n"
|
"| ========= | |\n"
|
||||||
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
|
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||||
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
|
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
|
||||||
"| \\\\ / A nd | Web: http://www.OpenFOAM.org |\n"
|
"| \\\\ / A nd | |\n"
|
||||||
"| \\\\/ M anipulation | |\n"
|
"| \\\\/ M anipulation | www.OpenFOAM.org |\n"
|
||||||
"\\*---------------------------------------------------------------------------*/\n";
|
"\\*---------------------------------------------------------------------------*/\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,22 +32,22 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Write keyType
|
// Write keyType
|
||||||
Foam::Ostream& Foam::Ostream::write(const keyType& s)
|
Foam::Ostream& Foam::Ostream::write(const keyType& kw)
|
||||||
{
|
{
|
||||||
// Write as word?
|
// Write as word or string
|
||||||
if (s.isWildCard())
|
if (kw.isPattern())
|
||||||
{
|
{
|
||||||
return write(static_cast<const string&>(s));
|
return write(static_cast<const string&>(kw));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return write(static_cast<const word&>(s));
|
return write(static_cast<const word&>(kw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Decrememt the indent level
|
// Decrement the indent level
|
||||||
void Foam::Ostream::decrIndent()
|
void Foam::Ostream::decrIndent()
|
||||||
{
|
{
|
||||||
if (indentLevel_ == 0)
|
if (indentLevel_ == 0)
|
||||||
@ -62,15 +62,26 @@ void Foam::Ostream::decrIndent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write the keyword to the Ostream followed by appropriate indentation
|
// Write the keyword followed by appropriate indentation
|
||||||
Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword)
|
Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw)
|
||||||
{
|
{
|
||||||
indent();
|
indent();
|
||||||
write(keyword);
|
write(kw);
|
||||||
|
|
||||||
label nSpaces = max(entryIndentation_ - label(keyword.size()), 1);
|
label nSpaces = entryIndentation_ - label(kw.size());
|
||||||
|
|
||||||
for (label i=0; i<nSpaces; i++)
|
// pattern is surrounded by quotes
|
||||||
|
if (kw.isPattern())
|
||||||
|
{
|
||||||
|
nSpaces -= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nSpaces < 1)
|
||||||
|
{
|
||||||
|
nSpaces = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (nSpaces--)
|
||||||
{
|
{
|
||||||
write(char(token::SPACE));
|
write(char(token::SPACE));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,12 +60,11 @@ protected:
|
|||||||
//- Number of spaces per indent level
|
//- Number of spaces per indent level
|
||||||
static const unsigned short indentSize_ = 4;
|
static const unsigned short indentSize_ = 4;
|
||||||
|
|
||||||
//- Current indent level
|
|
||||||
unsigned short indentLevel_;
|
|
||||||
|
|
||||||
//- Indentation of the entry from the start of the keyword
|
//- Indentation of the entry from the start of the keyword
|
||||||
static const unsigned short entryIndentation_ = 16;
|
static const unsigned short entryIndentation_ = 16;
|
||||||
|
|
||||||
|
//- Current indent level
|
||||||
|
unsigned short indentLevel_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -148,9 +147,8 @@ public:
|
|||||||
//- Decrememt the indent level
|
//- Decrememt the indent level
|
||||||
void decrIndent();
|
void decrIndent();
|
||||||
|
|
||||||
//- Write the keyword to the Ostream followed by
|
//- Write the keyword followed by an appropriate indentation
|
||||||
// appropriate indentation
|
Ostream& writeKeyword(const keyType&);
|
||||||
Ostream& writeKeyword(const keyType& keyword);
|
|
||||||
|
|
||||||
|
|
||||||
// Stream state functions
|
// Stream state functions
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class OPstream Declaration
|
Class OPstream Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class OPstream
|
class OPstream
|
||||||
@ -160,7 +160,7 @@ public:
|
|||||||
void flush()
|
void flush()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Add '\n' and flush stream
|
//- Add newline and flush stream
|
||||||
void endl()
|
void endl()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class OSstream Declaration
|
Class OSstream Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class OSstream
|
class OSstream
|
||||||
@ -162,20 +162,20 @@ public:
|
|||||||
//- Flush stream
|
//- Flush stream
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
//- Add '\n' and flush stream
|
//- Add newline and flush stream
|
||||||
virtual void endl();
|
virtual void endl();
|
||||||
|
|
||||||
//- Get width of output field
|
//- Get width of output field
|
||||||
virtual int width() const;
|
virtual int width() const;
|
||||||
|
|
||||||
//- Set width of output field (and return old width)
|
//- Set width of output field (and return old width)
|
||||||
virtual int width(const int w);
|
virtual int width(const int);
|
||||||
|
|
||||||
//- Get precision of output field
|
//- Get precision of output field
|
||||||
virtual int precision() const;
|
virtual int precision() const;
|
||||||
|
|
||||||
//- Set precision of output field (and return old precision)
|
//- Set precision of output field (and return old precision)
|
||||||
virtual int precision(const int p);
|
virtual int precision(const int);
|
||||||
|
|
||||||
|
|
||||||
// Print
|
// Print
|
||||||
|
|||||||
@ -38,23 +38,23 @@ const Foam::dictionary Foam::dictionary::null;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::dictionary::findInWildcards
|
bool Foam::dictionary::findInPatterns
|
||||||
(
|
(
|
||||||
const bool wildCardMatch,
|
const bool patternMatch,
|
||||||
const word& Keyword,
|
const word& Keyword,
|
||||||
DLList<entry*>::const_iterator& wcLink,
|
DLList<entry*>::const_iterator& wcLink,
|
||||||
DLList<autoPtr<regExp> >::const_iterator& reLink
|
DLList<autoPtr<regExp> >::const_iterator& reLink
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
while (wcLink != wildCardEntries_.end())
|
while (wcLink != patternEntries_.end())
|
||||||
{
|
{
|
||||||
if (!wildCardMatch && wcLink()->keyword() == Keyword)
|
if
|
||||||
{
|
(
|
||||||
return true;
|
patternMatch ? reLink()->match(Keyword)
|
||||||
}
|
: wcLink()->keyword() == Keyword
|
||||||
else if (wildCardMatch && reLink()->match(Keyword))
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -68,23 +68,23 @@ bool Foam::dictionary::findInWildcards
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::dictionary::findInWildcards
|
bool Foam::dictionary::findInPatterns
|
||||||
(
|
(
|
||||||
const bool wildCardMatch,
|
const bool patternMatch,
|
||||||
const word& Keyword,
|
const word& Keyword,
|
||||||
DLList<entry*>::iterator& wcLink,
|
DLList<entry*>::iterator& wcLink,
|
||||||
DLList<autoPtr<regExp> >::iterator& reLink
|
DLList<autoPtr<regExp> >::iterator& reLink
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
while (wcLink != wildCardEntries_.end())
|
while (wcLink != patternEntries_.end())
|
||||||
{
|
{
|
||||||
if (!wildCardMatch && wcLink()->keyword() == Keyword)
|
if
|
||||||
{
|
(
|
||||||
return true;
|
patternMatch ? reLink()->match(Keyword)
|
||||||
}
|
: wcLink()->keyword() == Keyword
|
||||||
else if (wildCardMatch && reLink()->match(Keyword))
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -125,10 +125,10 @@ Foam::dictionary::dictionary
|
|||||||
{
|
{
|
||||||
hashedEntries_.insert(iter().keyword(), &iter());
|
hashedEntries_.insert(iter().keyword(), &iter());
|
||||||
|
|
||||||
if (iter().keyword().isWildCard())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(&iter());
|
patternEntries_.insert(&iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -155,10 +155,10 @@ Foam::dictionary::dictionary
|
|||||||
{
|
{
|
||||||
hashedEntries_.insert(iter().keyword(), &iter());
|
hashedEntries_.insert(iter().keyword(), &iter());
|
||||||
|
|
||||||
if (iter().keyword().isWildCard())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(&iter());
|
patternEntries_.insert(&iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
autoPtr<regExp>(new regExp(iter().keyword()))
|
||||||
);
|
);
|
||||||
@ -217,14 +217,14 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wildCardEntries_.size() > 0)
|
if (patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::const_iterator wcLink = wildCardEntries_.begin();
|
DLList<entry*>::const_iterator wcLink = patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in wildcards using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInWildcards(true, keyword, wcLink, reLink))
|
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -246,22 +246,22 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
|
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
|
||||||
|
|
||||||
if (iter == hashedEntries_.end())
|
if (iter == hashedEntries_.end())
|
||||||
{
|
{
|
||||||
if (wildCardMatch && wildCardEntries_.size() > 0)
|
if (patternMatch && patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::const_iterator wcLink =
|
DLList<entry*>::const_iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::const_iterator reLink =
|
DLList<autoPtr<regExp> >::const_iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in wildcards using regular expressions only
|
// Find in patterns using regular expressions only
|
||||||
if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return wcLink();
|
return wcLink();
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
|
|
||||||
if (recursive && &parent_ != &dictionary::null)
|
if (recursive && &parent_ != &dictionary::null)
|
||||||
{
|
{
|
||||||
return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch);
|
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -285,21 +285,22 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
|
||||||
|
|
||||||
if (iter == hashedEntries_.end())
|
if (iter == hashedEntries_.end())
|
||||||
{
|
{
|
||||||
if (wildCardMatch && wildCardEntries_.size() > 0)
|
if (patternMatch && patternEntries_.size() > 0)
|
||||||
{
|
{
|
||||||
DLList<entry*>::iterator wcLink =
|
DLList<entry*>::iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink =
|
DLList<autoPtr<regExp> >::iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
// Find in wildcards using regular expressions only
|
|
||||||
if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
|
// Find in patterns using regular expressions only
|
||||||
|
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
return wcLink();
|
return wcLink();
|
||||||
}
|
}
|
||||||
@ -311,7 +312,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
|
|||||||
(
|
(
|
||||||
keyword,
|
keyword,
|
||||||
recursive,
|
recursive,
|
||||||
wildCardMatch
|
patternMatch
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -328,10 +329,10 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||||
|
|
||||||
if (entryPtr == NULL)
|
if (entryPtr == NULL)
|
||||||
{
|
{
|
||||||
@ -352,16 +353,16 @@ Foam::ITstream& Foam::dictionary::lookup
|
|||||||
(
|
(
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return lookupEntry(keyword, recursive, wildCardMatch).stream();
|
return lookupEntry(keyword, recursive, patternMatch).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::dictionary::isDict(const word& keyword) const
|
bool Foam::dictionary::isDict(const word& keyword) const
|
||||||
{
|
{
|
||||||
// Find non-recursive with wildcards
|
// Find non-recursive with patterns
|
||||||
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
|
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
|
||||||
|
|
||||||
if (entryPtr)
|
if (entryPtr)
|
||||||
@ -430,7 +431,7 @@ Foam::wordList Foam::dictionary::toc() const
|
|||||||
{
|
{
|
||||||
wordList keys(size());
|
wordList keys(size());
|
||||||
|
|
||||||
label i = 0;
|
label nKeys = 0;
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
IDLList<entry>::const_iterator iter = begin();
|
IDLList<entry>::const_iterator iter = begin();
|
||||||
@ -438,13 +439,36 @@ Foam::wordList Foam::dictionary::toc() const
|
|||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
keys[i++] = iter().keyword();
|
keys[nKeys++] = iter().keyword();
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
|
||||||
|
{
|
||||||
|
List<keyType> keys(size());
|
||||||
|
|
||||||
|
label nKeys = 0;
|
||||||
|
for
|
||||||
|
(
|
||||||
|
IDLList<entry>::const_iterator iter = begin();
|
||||||
|
iter != end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (iter().keyword().isPattern() ? patterns : !patterns)
|
||||||
|
{
|
||||||
|
keys[nKeys++] = iter().keyword();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keys.setSize(nKeys);
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||||
{
|
{
|
||||||
HashTable<entry*>::iterator iter = hashedEntries_.find
|
HashTable<entry*>::iterator iter = hashedEntries_.find
|
||||||
@ -473,10 +497,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
{
|
{
|
||||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||||
|
|
||||||
if (entryPtr->keyword().isWildCard())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(entryPtr);
|
patternEntries_.insert(entryPtr);
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
);
|
);
|
||||||
@ -502,10 +526,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||||
IDLList<entry>::append(entryPtr);
|
IDLList<entry>::append(entryPtr);
|
||||||
|
|
||||||
if (entryPtr->keyword().isWildCard())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(entryPtr);
|
patternEntries_.insert(entryPtr);
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
||||||
);
|
);
|
||||||
@ -597,16 +621,15 @@ bool Foam::dictionary::remove(const word& Keyword)
|
|||||||
|
|
||||||
if (iter != hashedEntries_.end())
|
if (iter != hashedEntries_.end())
|
||||||
{
|
{
|
||||||
// Delete from wildcards first
|
// Delete from patterns first
|
||||||
DLList<entry*>::iterator wcLink =
|
DLList<entry*>::iterator wcLink = patternEntries_.begin();
|
||||||
wildCardEntries_.begin();
|
DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink = wildCardRegexps_.begin();
|
|
||||||
|
|
||||||
// Find in wildcards using exact match only
|
// Find in pattern using exact match only
|
||||||
if (findInWildcards(false, Keyword, wcLink, reLink))
|
if (findInPatterns(false, Keyword, wcLink, reLink))
|
||||||
{
|
{
|
||||||
wildCardEntries_.remove(wcLink);
|
patternEntries_.remove(wcLink);
|
||||||
wildCardRegexps_.remove(reLink);
|
patternRegexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDLList<entry>::remove(iter());
|
IDLList<entry>::remove(iter());
|
||||||
@ -643,14 +666,14 @@ bool Foam::dictionary::changeKeyword
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter()->keyword().isWildCard())
|
if (iter()->keyword().isPattern())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"dictionary::changeKeyword(const word&, const word&, bool)"
|
"dictionary::changeKeyword(const word&, const word&, bool)"
|
||||||
) << "Old keyword "<< oldKeyword
|
) << "Old keyword "<< oldKeyword
|
||||||
<< " is a wildcard."
|
<< " is a pattern."
|
||||||
<< "Wildcard replacement not yet implemented."
|
<< "Pattern replacement not yet implemented."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,19 +685,19 @@ bool Foam::dictionary::changeKeyword
|
|||||||
{
|
{
|
||||||
if (forceOverwrite)
|
if (forceOverwrite)
|
||||||
{
|
{
|
||||||
if (iter2()->keyword().isWildCard())
|
if (iter2()->keyword().isPattern())
|
||||||
{
|
{
|
||||||
// Delete from wildcards first
|
// Delete from patterns first
|
||||||
DLList<entry*>::iterator wcLink =
|
DLList<entry*>::iterator wcLink =
|
||||||
wildCardEntries_.begin();
|
patternEntries_.begin();
|
||||||
DLList<autoPtr<regExp> >::iterator reLink =
|
DLList<autoPtr<regExp> >::iterator reLink =
|
||||||
wildCardRegexps_.begin();
|
patternRegexps_.begin();
|
||||||
|
|
||||||
// Find in wildcards using exact match only
|
// Find in patterns using exact match only
|
||||||
if (findInWildcards(false, iter2()->keyword(), wcLink, reLink))
|
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
|
||||||
{
|
{
|
||||||
wildCardEntries_.remove(wcLink);
|
patternEntries_.remove(wcLink);
|
||||||
wildCardRegexps_.remove(reLink);
|
patternRegexps_.remove(reLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,10 +724,10 @@ bool Foam::dictionary::changeKeyword
|
|||||||
hashedEntries_.erase(oldKeyword);
|
hashedEntries_.erase(oldKeyword);
|
||||||
hashedEntries_.insert(newKeyword, iter());
|
hashedEntries_.insert(newKeyword, iter());
|
||||||
|
|
||||||
if (newKeyword.isWildCard())
|
if (newKeyword.isPattern())
|
||||||
{
|
{
|
||||||
wildCardEntries_.insert(iter());
|
patternEntries_.insert(iter());
|
||||||
wildCardRegexps_.insert
|
patternRegexps_.insert
|
||||||
(
|
(
|
||||||
autoPtr<regExp>(new regExp(newKeyword))
|
autoPtr<regExp>(new regExp(newKeyword))
|
||||||
);
|
);
|
||||||
@ -770,8 +793,8 @@ void Foam::dictionary::clear()
|
|||||||
{
|
{
|
||||||
IDLList<entry>::clear();
|
IDLList<entry>::clear();
|
||||||
hashedEntries_.clear();
|
hashedEntries_.clear();
|
||||||
wildCardEntries_.clear();
|
patternEntries_.clear();
|
||||||
wildCardRegexps_.clear();
|
patternRegexps_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,12 +27,12 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
A list of keyword definitions, which are a keyword followed by any number
|
A list of keyword definitions, which are a keyword followed by any number
|
||||||
of values (e.g. words and numbers). The keywords can represent wildcards
|
of values (e.g. words and numbers). The keywords can represent patterns
|
||||||
which are matched using Posix regular expressions. The general order for
|
which are matched using Posix regular expressions. The general order for
|
||||||
searching is
|
searching is as follows:
|
||||||
- exact match
|
- exact match
|
||||||
- wildcard match (in reverse order)
|
- pattern match (in reverse order)
|
||||||
- optional recursion into subdictionaries
|
- optional recursion into the enclosing (parent) dictionaries
|
||||||
|
|
||||||
The dictionary class is the base class for IOdictionary.
|
The dictionary class is the base class for IOdictionary.
|
||||||
It also serves as a bootstrap dictionary for the objectRegistry data
|
It also serves as a bootstrap dictionary for the objectRegistry data
|
||||||
@ -92,29 +92,27 @@ class dictionary
|
|||||||
//- Parent dictionary
|
//- Parent dictionary
|
||||||
const dictionary& parent_;
|
const dictionary& parent_;
|
||||||
|
|
||||||
//- Wildcard entries
|
//- Entries of matching patterns
|
||||||
DLList<entry*> wildCardEntries_;
|
DLList<entry*> patternEntries_;
|
||||||
|
|
||||||
//- Wildcard precompiled regular expressions
|
//- Patterns as precompiled regular expressions
|
||||||
DLList<autoPtr<regExp> > wildCardRegexps_;
|
DLList<autoPtr<regExp> > patternRegexps_;
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Search wildcard table either for exact match or for regular
|
//- Search patterns table for exact match or regular expression match
|
||||||
// expression match.
|
bool findInPatterns
|
||||||
bool findInWildcards
|
|
||||||
(
|
(
|
||||||
const bool wildCardMatch,
|
const bool patternMatch,
|
||||||
const word& Keyword,
|
const word& Keyword,
|
||||||
DLList<entry*>::const_iterator& wcLink,
|
DLList<entry*>::const_iterator& wcLink,
|
||||||
DLList<autoPtr<regExp> >::const_iterator& reLink
|
DLList<autoPtr<regExp> >::const_iterator& reLink
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search wildcard table either for exact match or for regular
|
//- Search patterns table for exact match or regular expression match
|
||||||
// expression match.
|
bool findInPatterns
|
||||||
bool findInWildcards
|
|
||||||
(
|
(
|
||||||
const bool wildCardMatch,
|
const bool patternMatch,
|
||||||
const word& Keyword,
|
const word& Keyword,
|
||||||
DLList<entry*>::iterator& wcLink,
|
DLList<entry*>::iterator& wcLink,
|
||||||
DLList<autoPtr<regExp> >::iterator& reLink
|
DLList<autoPtr<regExp> >::iterator& reLink
|
||||||
@ -210,83 +208,88 @@ public:
|
|||||||
// Search and lookup
|
// Search and lookup
|
||||||
|
|
||||||
//- Search dictionary for given keyword
|
//- Search dictionary for given keyword
|
||||||
// If recursive search parent dictionaries
|
// If recursive, search parent dictionaries
|
||||||
bool found(const word&, bool recursive=false) const;
|
bool found(const word&, bool recursive=false) const;
|
||||||
|
|
||||||
//- Find and return an entry data stream pointer if present
|
//- Find and return an entry data stream pointer if present
|
||||||
// otherwise return NULL.
|
// otherwise return NULL.
|
||||||
// If recursive search parent dictionaries.
|
// If recursive, search parent dictionaries.
|
||||||
// If wildCardMatch use wildcards.
|
// If patternMatch, use regular expressions
|
||||||
const entry* lookupEntryPtr
|
const entry* lookupEntryPtr
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry data stream pointer for manipulation
|
//- Find and return an entry data stream pointer for manipulation
|
||||||
// if present otherwise return NULL.
|
// if present otherwise return NULL.
|
||||||
// If recursive search parent dictionaries.
|
// If recursive, search parent dictionaries.
|
||||||
// If wildCardMatch use wildcards.
|
// If patternMatch, use regular expressions.
|
||||||
entry* lookupEntryPtr
|
entry* lookupEntryPtr
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find and return an entry data stream if present otherwise error.
|
//- Find and return an entry data stream if present otherwise error.
|
||||||
// If recursive search parent dictionaries.
|
// If recursive, search parent dictionaries.
|
||||||
// If wildCardMatch use wildcards.
|
// If patternMatch, use regular expressions.
|
||||||
const entry& lookupEntry
|
const entry& lookupEntry
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry data stream
|
//- Find and return an entry data stream
|
||||||
// If recursive search parent dictionaries
|
// If recursive, search parent dictionaries.
|
||||||
|
// If patternMatch, use regular expressions.
|
||||||
ITstream& lookup
|
ITstream& lookup
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
bool recursive=false,
|
bool recursive=false,
|
||||||
bool wildCardMatch=true
|
bool patternMatch=true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T,
|
//- Find and return a T,
|
||||||
// if not found return the given default value
|
// if not found return the given default value
|
||||||
// If recursive search parent dictionaries
|
// If recursive, search parent dictionaries.
|
||||||
|
// If patternMatch, use regular expressions.
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrDefault
|
T lookupOrDefault
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
const T&,
|
const T&,
|
||||||
bool recursive=false,
|
bool recursive=false,
|
||||||
bool wildCardMatch=true
|
bool patternMatch=true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T, if not found return the given
|
//- Find and return a T, if not found return the given
|
||||||
// default value, and add to dictionary.
|
// default value, and add to dictionary.
|
||||||
// If recursive search parent dictionaries
|
// If recursive, search parent dictionaries.
|
||||||
|
// If patternMatch, use regular expressions.
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupOrAddDefault
|
T lookupOrAddDefault
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
const T&,
|
const T&,
|
||||||
bool recursive=false,
|
bool recursive=false,
|
||||||
bool wildCardMatch=true
|
bool patternMatch=true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Find an entry if present, and assign to T
|
//- Find an entry if present, and assign to T
|
||||||
// Returns true if the entry was found
|
// Returns true if the entry was found.
|
||||||
|
// If recursive, search parent dictionaries.
|
||||||
|
// If patternMatch, use regular expressions.
|
||||||
template<class T>
|
template<class T>
|
||||||
bool readIfPresent
|
bool readIfPresent
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
T&,
|
T&,
|
||||||
bool recursive=false,
|
bool recursive=false,
|
||||||
bool wildCardMatch=true
|
bool patternMatch=true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Check if entry is a sub-dictionary
|
//- Check if entry is a sub-dictionary
|
||||||
@ -305,6 +308,9 @@ public:
|
|||||||
//- Return the table of contents
|
//- Return the table of contents
|
||||||
wordList toc() const;
|
wordList toc() const;
|
||||||
|
|
||||||
|
//- Return the list of available keys or patterns
|
||||||
|
List<keyType> keys(bool patterns=false) const;
|
||||||
|
|
||||||
// Editing
|
// Editing
|
||||||
|
|
||||||
//- Add a new entry
|
//- Add a new entry
|
||||||
@ -393,7 +399,7 @@ public:
|
|||||||
void operator=(const dictionary&);
|
void operator=(const dictionary&);
|
||||||
|
|
||||||
//- Include entries from the given dictionary.
|
//- Include entries from the given dictionary.
|
||||||
// Warn, but do not overwrite existing entries
|
// Warn, but do not overwrite existing entries.
|
||||||
void operator+=(const dictionary&);
|
void operator+=(const dictionary&);
|
||||||
|
|
||||||
//- Conditionally include entries from the given dictionary.
|
//- Conditionally include entries from the given dictionary.
|
||||||
@ -417,13 +423,13 @@ public:
|
|||||||
|
|
||||||
// Global Operators
|
// Global Operators
|
||||||
|
|
||||||
//- Combine dictionaries starting from the entries in dict1 and then including
|
//- Combine dictionaries.
|
||||||
// those from dict2.
|
// Starting from the entries in dict1 and then including those from dict2.
|
||||||
// Warn, but do not overwrite the entries from dict1.
|
// Warn, but do not overwrite the entries from dict1.
|
||||||
dictionary operator+(const dictionary& dict1, const dictionary& dict2);
|
dictionary operator+(const dictionary& dict1, const dictionary& dict2);
|
||||||
|
|
||||||
//- Combine dictionaries starting from the entries in dict1 and then including
|
//- Combine dictionaries.
|
||||||
// those from dict2.
|
// Starting from the entries in dict1 and then including those from dict2.
|
||||||
// Do not overwrite the entries from dict1.
|
// Do not overwrite the entries from dict1.
|
||||||
dictionary operator|(const dictionary& dict1, const dictionary& dict2);
|
dictionary operator|(const dictionary& dict1, const dictionary& dict2);
|
||||||
|
|
||||||
|
|||||||
@ -74,20 +74,20 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from the parent dictionary and Istream
|
//- Construct from the parent dictionary and Istream
|
||||||
dictionaryEntry(const dictionary& parentDict, Istream& is);
|
dictionaryEntry(const dictionary& parentDict, Istream&);
|
||||||
|
|
||||||
//- Construct from the keyword, parent dictionary and a Istream
|
//- Construct from the keyword, parent dictionary and a Istream
|
||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const keyType& keyword,
|
const keyType&,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
Istream& is
|
Istream&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from the keyword, parent dictionary and a dictionary
|
//- Construct from the keyword, parent dictionary and a dictionary
|
||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const keyType& keyword,
|
const keyType&,
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
dictionaryEntry
|
dictionaryEntry
|
||||||
(
|
(
|
||||||
const dictionary& parentDict,
|
const dictionary& parentDict,
|
||||||
const dictionaryEntry& dictEnt
|
const dictionaryEntry&
|
||||||
);
|
);
|
||||||
|
|
||||||
autoPtr<entry> clone(const dictionary& parentDict) const
|
autoPtr<entry> clone(const dictionary& parentDict) const
|
||||||
@ -158,10 +158,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined (__GNUC__)
|
|
||||||
template<>
|
template<>
|
||||||
#endif
|
Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&);
|
||||||
Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -35,18 +35,18 @@ T Foam::dictionary::lookupOrDefault
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||||
|
|
||||||
if (entryPtr == NULL)
|
if (entryPtr)
|
||||||
{
|
{
|
||||||
return deflt;
|
return pTraits<T>(entryPtr->stream());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return pTraits<T>(entryPtr->stream());
|
return deflt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,19 +57,19 @@ T Foam::dictionary::lookupOrAddDefault
|
|||||||
const word& keyword,
|
const word& keyword,
|
||||||
const T& deflt,
|
const T& deflt,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
|
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||||
|
|
||||||
if (entryPtr == NULL)
|
if (entryPtr)
|
||||||
{
|
{
|
||||||
add(new primitiveEntry(keyword, deflt));
|
return pTraits<T>(entryPtr->stream());
|
||||||
return deflt;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return pTraits<T>(entryPtr->stream());
|
add(new primitiveEntry(keyword, deflt));
|
||||||
|
return deflt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,20 +80,20 @@ bool Foam::dictionary::readIfPresent
|
|||||||
const word& k,
|
const word& k,
|
||||||
T& val,
|
T& val,
|
||||||
bool recursive,
|
bool recursive,
|
||||||
bool wildCardMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch);
|
const entry* entryPtr = lookupEntryPtr(k, recursive, patternMatch);
|
||||||
|
|
||||||
if (entryPtr == NULL)
|
if (entryPtr)
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
entryPtr->stream() >> val;
|
entryPtr->stream() >> val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -92,20 +92,20 @@ public:
|
|||||||
|
|
||||||
//- Construct on freestore as copy with reference to the
|
//- Construct on freestore as copy with reference to the
|
||||||
// dictionary the copy belongs to
|
// dictionary the copy belongs to
|
||||||
virtual Foam::autoPtr<entry> clone
|
virtual autoPtr<entry> clone
|
||||||
(
|
(
|
||||||
const dictionary& parentDict
|
const dictionary& parentDict
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Construct on freestore as copy
|
//- Construct on freestore as copy
|
||||||
// Note: the parent directory is set to dictionary::null
|
// Note: the parent directory is set to dictionary::null
|
||||||
virtual Foam::autoPtr<entry> clone() const;
|
virtual autoPtr<entry> clone() const;
|
||||||
|
|
||||||
//- Construct from Istream and insert into dictionary
|
//- Construct from Istream and insert into dictionary
|
||||||
static bool New(dictionary& parentDict, Istream& is);
|
static bool New(dictionary& parentDict, Istream& is);
|
||||||
|
|
||||||
//- Construct on freestore from Istream and return
|
//- Construct on freestore from Istream and return
|
||||||
static Foam::autoPtr<entry> New(Istream& is);
|
static autoPtr<entry> New(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user