Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2008-12-30 22:00:52 +00:00
311 changed files with 5001 additions and 2541 deletions

3
.gitignore vendored
View File

@ -49,6 +49,9 @@ doc/[Dd]oxygen/man
*.tar.gz
*.tgz
# ignore the persistent .build tag in the main directory
/.build
# ignore .timeStamp in the main directory
/.timeStamp

View File

@ -70,6 +70,8 @@ int main(int argc, char *argv[])
+ turbulence->divDevReff(U)
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));

View File

@ -37,7 +37,14 @@
- 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)
{

View File

@ -1,13 +1,16 @@
surfaceScalarField muf =
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut());
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muf*(mesh.Sf() & fvc::interpolate(fvc::grad(U)().T())))
);

View File

@ -12,7 +12,9 @@
surfaceScalarField phic = mag(phi/mesh.magSf());
phic = min(interface.cAlpha()*phic, max(phic));
fvc::makeAbsolute(phi, U);
volScalarField divU = fvc::div(phi);
fvc::makeRelative(phi, U);
if (nAlphaSubCycles > 1)
{

View File

@ -30,7 +30,7 @@
- ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf();
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pdEqnIncomp
(
@ -38,6 +38,26 @@
- fvm::laplacian(rUAf, pd)
);
if
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
solve
(
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pdEqnComp()
+ pdEqnIncomp,
mesh.solver(pd.name() + "Final")
);
}
else
{
solve
(
(
@ -47,6 +67,7 @@
*pdEqnComp()
+ pdEqnIncomp
);
}
if (nonOrth == nNonOrthCorr)
{
@ -62,7 +83,8 @@
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
);

View File

@ -1,15 +1,18 @@
surfaceScalarField muf =
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties->muf()
+ fvc::interpolate(rho*turbulence->nut());
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
//- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
);
UEqn.relax();

View File

@ -48,7 +48,6 @@ int main(int argc, char *argv[])
}
myList.append(100.3);
myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl;
@ -120,7 +119,18 @@ int main(int argc, char *argv[])
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;
}

View File

@ -30,8 +30,11 @@ Description
#include "OSspecific.H"
#include "scalar.H"
#include "IOstreams.H"
#include "Dictionary.H"
#include "PtrDictionary.H"
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:
@ -92,12 +125,11 @@ int main(int argc, char *argv[])
Info<< "element : " << *iter;
}
Info<< dict.toc() << endl;
Info<< "keys: " << dict.toc() << endl;
delete dictPtr;
dictPtr = new Dictionary<ent>;
Dictionary<ent>& dict2 = *dictPtr;
Dictionary<ent> dict2;
for (int i = 0; i<10; i++)
{
@ -106,9 +138,79 @@ int main(int argc, char *argv[])
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;
}

View File

@ -52,6 +52,13 @@ public:
:
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(500.3));
Info<< nl << "And again using STL iterator: " << nl << endl;
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;
return 0;
}

View File

@ -0,0 +1,3 @@
PtrListTest.C
EXE = $(FOAM_USER_APPBIN)/PtrListTest

View 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;
}
// ************************************************************************* //

View File

@ -48,10 +48,8 @@ int main(int argc, char *argv[])
}
myList.append(100.3);
myList.append(500.3);
Info<< nl << "And again using STL iterator: " << nl << endl;
for
@ -99,7 +97,27 @@ int main(int argc, char *argv[])
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;
}

View File

@ -113,7 +113,20 @@ int main(int argc, char *argv[])
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;
}

View File

@ -41,34 +41,44 @@ using namespace Foam;
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);
{
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<< "Wildcard find \"abc\" in top directory : "
Info<< "Pattern find \"abc\" in top directory : "
<< dict.lookup("abc") << endl;
Info<< "Wildcard find \"abc\" in sub directory : "
Info<< "Pattern find \"abc\" in sub directory : "
<< dict.subDict("someDict").lookup("abc")
<< endl;
Info<< "Recursive wildcard find \"def\" in sub directory : "
Info<< "Recursive pattern find \"def\" in sub directory : "
<< dict.subDict("someDict").lookup("def", true)
<< endl;
Info<< "Recursive wildcard find \"foo\" in sub directory : "
Info<< "Recursive pattern find \"foo\" in sub directory : "
<< dict.subDict("someDict").lookup("foo", true)
<< endl;
Info<< "Recursive wildcard find \"fooz\" in sub directory : "
Info<< "Recursive pattern find \"fooz\" in sub directory : "
<< dict.subDict("someDict").lookup("fooz", true)
<< endl;
Info<< "Recursive wildcard find \"bar\" in sub directory : "
Info<< "Recursive pattern find \"bar\" in sub directory : "
<< dict.subDict("someDict").lookup("bar", true)
<< endl;
Info<< "Recursive wildcard find \"xxx\" in sub directory : "
Info<< "Recursive pattern find \"xxx\" in sub directory : "
<< dict.subDict("someDict").lookup("xxx", true)
<< endl;
}

View File

@ -18,8 +18,10 @@ FoamFile
".*" parentValue1;
"[n-z].*" parentValue2;
"f.*" parentValue3;
keyX parentValue4;
keyY parentValue5;
someDict
"(.*)Dict"
{
foo subdictValue0;
bar $f.*; // should this really match 'foo'?
@ -28,7 +30,7 @@ someDict
"a.*c" subdictValue3;
"ab.*" subdictValue2;
"a.*" subdictValue1;
abcd subdictValue4;
abcd \1;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -32,6 +32,7 @@ Description
#include "fileName.H"
#include "IOstreams.H"
#include "OSspecific.H"
using namespace Foam;
@ -57,7 +58,16 @@ int main()
Info<< "pathName.components() = " << pathName.components() << 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;
}

View File

@ -1,2 +0,0 @@
getRoots.C
EXE = $(FOAM_USER_APPBIN)/getRoots

View File

@ -1,2 +0,0 @@
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */

View File

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

View File

@ -1,4 +0,0 @@
calcEntry/calcEntry.C
dictionaryTest.C
EXE = $(FOAM_USER_APPBIN)/dictionaryTest

View File

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

View File

@ -1,6 +0,0 @@
inlet_4
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}

View File

@ -1 +0,0 @@
uniform 2

View File

@ -1,3 +0,0 @@
EXE_LIBS = \
$(FOAM_LIBBIN)/libOSspecific.o

View File

@ -76,6 +76,36 @@ int main(int argc, char *argv[])
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;
return 0;

View File

@ -59,23 +59,24 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
// Receive data
for
(
int slave=Pstream::firstSlave(), procIndex = 1;
slave<=Pstream::lastSlave();
int slave = Pstream::firstSlave(), procIndex = 1;
slave <= Pstream::lastSlave();
slave++, procIndex++
)
{
IPstream fromSlave(slave);
IPstream fromSlave(Pstream::scheduled, slave);
fromSlave >> this->operator[](procIndex);
}
// Send data
for
(
int slave=Pstream::firstSlave(), procIndex = 1;
slave<=Pstream::lastSlave();
int slave = Pstream::firstSlave(), procIndex = 1;
slave <= Pstream::lastSlave();
slave++, procIndex++
)
{
OPstream toSlave(slave);
OPstream toSlave(Pstream::scheduled, slave);
if (redistribute)
{
@ -92,12 +93,13 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
{
// Slave: send my local data to master
{
OPstream toMaster(Pstream::masterNo());
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << localData;
}
// Receive data from master
{
IPstream fromMaster(Pstream::masterNo());
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
if (redistribute)
{
fromMaster >> *this;

View File

@ -289,9 +289,7 @@ int main(int argc, char *argv[])
<< patchNames[patchI] << "\t\t"
<< allPatchFaces[patchI].size() << endl;
allPatchFaces[patchI].shrink();
patchFaces[patchI].transfer(allPatchFaces[patchI]);
allPatchFaces[patchI].clear();
}
Info<< endl;

View File

@ -515,7 +515,7 @@ int main(int argc, char *argv[])
Info<< " " << patchNames[patchI] << " : "
<< allPatchFaces[patchI].size() << endl;
patchFaces[patchI].transfer(allPatchFaces[patchI].shrink());
patchFaces[patchI].transfer(allPatchFaces[patchI]);
}
Info<< endl;
@ -548,7 +548,6 @@ int main(int argc, char *argv[])
meshPtr().write();
Info<< "End\n" << endl;
return 0;

View File

@ -7,6 +7,8 @@
# the pqReader.xml file contains xml defining readers with their
# file extensions and descriptions.
cmake_minimum_required(VERSION 2.4)
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

View File

@ -74,10 +74,7 @@ void Foam::readerDatabase::getPolyHedra()
}
}
polys.shrink();
Info<< "Found " << polys.size() << " polyhedral cells " << endl;
polys_.transfer(polys);
}

View File

@ -101,8 +101,23 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
IOsampledSets sSets(mesh, "sampleDict", IOobject::MUST_READ, true);
IOsampledSurfaces sSurfs(mesh, "sampleDict", IOobject::MUST_READ, true);
IOsampledSets sSets
(
sampledSets::typeName,
mesh,
"sampleDict",
IOobject::MUST_READ,
true
);
IOsampledSurfaces sSurfs
(
sampledSurfaces::typeName,
mesh,
"sampleDict",
IOobject::MUST_READ,
true
);
forAll(timeDirs, timeI)
{

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
Info<< nl << "Reading Burcat data dictionary" << endl;
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
// Construct control dictionary
IFstream BurcatCpDataFile(BurcatCpDataFileName);

View File

@ -79,7 +79,7 @@ int main(int argc, char *argv[])
Info<< nl << "Reading Burcat data dictionary" << endl;
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
// Construct control dictionary
IFstream BurcatCpDataFile(BurcatCpDataFileName);

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[])
Info<< nl << "Reading Burcat data dictionary" << endl;
fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
// Construct control dictionary
IFstream BurcatCpDataFile(BurcatCpDataFileName);

View File

@ -1 +0,0 @@
buildParaView3.3-cvs

192
bin/buildParaView3.5-cvs Executable file
View 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"
#------------------------------------------------------------------------------

View File

@ -0,0 +1 @@
buildParaView3.5-cvs

View File

@ -45,8 +45,8 @@ options:
-h help
Updates the header of application files and removes consecutive blank lines.
By default, writes current version in the header.
An alternative version can be specified with -v option.
By default, writes current OpenFOAM version in the header.
An alternative version can be specified with the -v option.
USAGE
exit 1
@ -59,8 +59,8 @@ printHeader() {
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${foamVersion} |
| \\\\ / A nd | Web: http://www.OpenFOAM.org |
| \\\\/ M anipulation | |
| \\\\ / A nd | |
| \\\\/ M anipulation | www.OpenFOAM.org |
\\*---------------------------------------------------------------------------*/
FoamFile
{
@ -84,13 +84,13 @@ FoamFileAttribute() {
#
# OPTIONS
#
OPTS=`getopt hv: $*`
opts=$(getopt hv: $*)
if [ $? -ne 0 ]
then
echo "Aborting due to invalid option"
usage
fi
eval set -- '$OPTS'
eval set -- '$opts'
while [ "$1" != "--" ]
do
case $1 in
@ -110,11 +110,13 @@ shift
# constant width for version
foamVersion=`printf %-36s $foamVersion`
foamVersion=$(printf %-36s $foamVersion)
#
# MAIN
#
unset NOTE
for caseFile
do
if grep FoamFile $caseFile >/dev/null 2>&1
@ -122,16 +124,17 @@ do
echo "Updating case file: $caseFile"
sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp
CLASS=`FoamFileAttribute class FoamFile.tmp`
OBJECT=`FoamFileAttribute object FoamFile.tmp`
FORMAT=`FoamFileAttribute format FoamFile.tmp`
FORMAT=$(FoamFileAttribute format FoamFile.tmp)
CLASS=$(FoamFileAttribute class FoamFile.tmp)
OBJECT=$(FoamFileAttribute object FoamFile.tmp)
# extract NOTE?
printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp
sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
# use cat to avoid removing/replace soft-links
[ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile
rm FoamFile.tmp
rm -f FoamFile.tmp 2>/dev/null
else
echo " Invalid case file: $caseFile" 1>&2
fi

View File

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

View File

@ -34,8 +34,8 @@
#------------------------------------------------------------------------------
. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
PARAVIEW_SRC="ParaView3.3-cvs"
PARAVIEW_MAJOR_VERSION="3.3"
PARAVIEW_SRC=paraview-3.4
PARAVIEW_MAJOR_VERSION=3.4
# User options:
# ~~~~~~~~~~~~~
@ -45,7 +45,7 @@ WITH_MPI=OFF
MPI_MAX_PROCS=32
# 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
WITH_PYTHON=OFF
PYTHON_LIBRARY=""
@ -65,13 +65,21 @@ usage() {
usage: ${0##*/} [OPTION]
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)
-python with python (if not already enabled)
-mesa with mesa (if not already enabled)
-verbose verbose cmake output
-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
@ -80,12 +88,17 @@ USAGE
exit 1
}
# options based on the script name:
case "$Script" in *-fast*) CMAKE_SKIP=ON;; esac
# 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
@ -93,8 +106,47 @@ do
-h | -help)
usage
;;
-fast)
CMAKE_SKIP=YES
-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)
@ -121,16 +173,20 @@ done
# Set configure options
#~~~~~~~~~~~~~~~~~~~~~~
addVerbosity # set CMake verbosity
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
# ~~~~~~~~~~~~~~~~~
buildParaView
installParaView
[ $runCONFIG = true ] && configParaView
[ $runMAKE = true ] && makeParaView
[ $runENVPATH = true ] && fixCMakeFiles
[ $runMAKEDOC = true ] && makeDocs
[ $runINSTALL = true ] && installParaView
echo "done"
#------------------------------------------------------------------------------

View File

@ -31,8 +31,13 @@
#------------------------------------------------------------------------------
# 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()
{
while [ -n "$1" ]
@ -43,19 +48,24 @@ addCMakeVariable()
}
#
# verbose makefiles
#
addVerbosity()
{
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
}
#
# define options for mpi support
#
addMpiSupport()
{
[ "$WITH_MPI" = ON ] || return
OBJ_ADD="$OBJ_ADD-mpi"
addCMakeVariable PARAVIEW_USE_MPI=ON
addCMakeVariable VTK_USE_MPI=ON
addCMakeVariable PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON
addCMakeVariable MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
addCMakeVariable MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
addCMakeVariable VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
@ -63,6 +73,9 @@ addMpiSupport()
}
#
# define options for python support
#
addPythonSupport()
{
[ "$WITH_PYTHON" = ON ] || return
@ -134,6 +147,9 @@ addPythonSupport()
}
#
# define options for mesa support
#
addMesaSupport()
{
[ "$WITH_MESA" = ON ] || return
@ -156,7 +172,10 @@ addMesaSupport()
}
buildParaView()
#
# discover where things are or should be put
#
getPaths()
{
# set paraview environment
for i in $PWD $WM_THIRD_PARTY_DIR
@ -179,68 +198,95 @@ buildParaView()
}
fi
# ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
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
#
# 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 "Building $PARAVIEW_SRC"
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 "----"
# make paraview
cmake \
-DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
echo
echo cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_INST_DIR
fi
../..
echo
echo "----"
echo
# change to build folder
# 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
if [ $WM_NCOMPPROCS -gt 8 ]
then
WM_NCOMPPROCS=8
fi
make -j $WM_NCOMPPROCS
time make -j $WM_NCOMPPROCS
else
make
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
#
# adjust hard-links (internal function)
# Note: use loop with grep to avoid touching too many files
fixCMakeHardLinks()
#
fixHardLinks()
{
fileSpec=$1
envName=$1
string=$2
envName=$3
shift 2
echo -n " for \$$envName "
echo "-- Replacing path hard links for \$$envName"
for fileSpec
do
echo -n " $fileSpec: "
for i in $(find . -type f -iname "$fileSpec")
do
if grep -q "$string" $i
@ -250,80 +296,101 @@ fixCMakeHardLinks()
fi
done
echo
done
}
installParaView()
#
# 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()
{
if [ ! -e "$ParaView_DIR/bin/paraview" ]
then
echo " Cannot install - no paraview binary found"
return
fi
echo " Build complete"
cd $ParaView_DIR || exit 1 # change to build folder
cd $ParaView_DIR
# Replace path with env variable: ParaView_DIR
fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake'
echo " Replacing path hard links"
# Replace path with env variable: ParaView_INST_DIR
fixHardLinks ParaView_INST_DIR "$ParaView_INST_DIR" '*.cmake'
# Replace local ParaView_INST_DIR path with ParaView_INST_DIR
# environment variable
fixCMakeHardLinks '*.cmake' "$ParaView_INST_DIR" ParaView_INST_DIR
# Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH
# environment variable
# Replace path with env variable: MPI_ARCH_PATH
if [ "$WITH_MPI" = ON ]
then
fixCMakeHardLinks '*.cmake' "$MPI_ARCH_PATH" MPI_ARCH_PATH
fixHardLinks MPI_ARCH_PATH "$MPI_ARCH_PATH" '*.cmake'
fi
# Replace local CMAKE_HOME path with CMAKE_HOME
# environment variable
# Replace path with env variable: CMAKE_HOME
if [ -r "$CMAKE_HOME" ]
then
fixCMakeHardLinks '*cmake*' "$CMAKE_HOME" CMAKE_HOME
fixHardLinks CMAKE_HOME "$CMAKE_HOME" '*cmake*'
fi
# Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR
# environment variable
fixCMakeHardLinks '*cmake*' "$WM_COMPILER_DIR" WM_COMPILER_DIR
# 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*'
}
# 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 " ---"
#
# 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()
{
cd $ParaView_DIR || exit 1 # change to build folder
echo " Installing ParaView to $ParaView_DIR"
echo "disabled 'make install' for now, just use 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
cat<< INFO
---
Installation complete
Set environment variables:
export ParaView_INST_DIR=$ParaView_INST_DIR
export ParaView_DIR=$ParaView_DIR
export PV_PLUGIN_PATH=$FOAM_LIBBIN
export PATH=\$ParaView_DIR/bin:\$PATH
---
INFO
}
# clear all the variables used before using any of the functions
unset VERBOSE
unset WITH_MPI
unset WITH_MESA
unset WITH_PYTHON
unset PYTHON_LIBRARY
unset WITH_MPI WITH_MESA
unset WITH_PYTHON PYTHON_LIBRARY
unset CMAKE_VARIABLES
unset CMAKE_SKIP
unset OBJ_ADD
# start with these general settings
addCMakeVariable VTK_USE_TK=FALSE
addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON
addCMakeVariable VTK_USE_RPATH:BOOL=OFF
addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF
addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release
# include development files in "make install"
addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON
# ----------------------------------------------------------------- end-of-file

View File

@ -26,38 +26,49 @@
# paraview3/bashrc
#
# Description
# Setup file for ParaView3.
# Setup file for paraview-3.x
# 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
if [ -r $CMAKE_HOME ]
then
# 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
else
unset CMAKE_HOME
fi
break
fi
done
export ParaView_VERSION="3.3-cvs"
paraviewMajor=paraview-3.5
export ParaView_VERSION=3.5-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
if [ "$PYTHONPATH" ]
# add in python libraries if required
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if [ -r $paraviewPython ]
then
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
else
export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
if [ "$PYTHONPATH" ]
then
export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
else
export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
fi
fi
if [ -r $ParaView_DIR ]
then
export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=$ParaView_DIR/bin:$LD_LIBRARY_PATH
export PV_PLUGIN_PATH=$FOAM_LIBBIN
fi
unset cmake paraviewMajor paraviewPython
# -----------------------------------------------------------------------------

View File

@ -26,34 +26,44 @@
# paraview3/cshrc
#
# Description
# Startup File for Paraview3
# Startup File for paraview-3.x
# 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
if ( -r $CMAKE_HOME ) then
# 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)
else
unsetenv CMAKE_HOME
endif
break
endif
end
setenv ParaView_VERSION 3.3-cvs
set paraviewMajor=paraview-3.5
setenv ParaView_VERSION 3.5-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
if ($?PYTHONPATH) then
setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
else
setenv PYTHONPATH $ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
# add in python libraries if required
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if ( -r $paraviewPython ) then
if ($?PYTHONPATH) then
setenv PYTHONPATH ${PYTHONPATH}:$paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
else
setenv PYTHONPATH $paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
endif
endif
if ( -r $ParaView_INST_DIR ) then
set path=($ParaView_DIR/bin $path)
setenv LD_LIBRARY_PATH $ParaView_DIR/bin:$LD_LIBRARY_PATH
setenv PV_PLUGIN_PATH $FOAM_LIBBIN
endif
unset cmake paraviewMajor paraviewPython
# -----------------------------------------------------------------------------

View File

@ -91,7 +91,7 @@ export WM_COMPILER_LIB_ARCH=
# WM_JAVAC_OPTION = Opt | Debug
: ${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

View File

@ -2,11 +2,8 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
# update version string if under Git
git describe 2> /dev/null | \
(read project_string \
&& sed -e 's/WM_PROJECT_VERSION/\"'"${project_string}"'"/' \
OpenFOAM/global/global_raw.C >OpenFOAM/global/global.C)
# update Foam::FOAMversion string if required
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS

View File

@ -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:
// ~~~~~~~~~~~~~~~~~~
@ -268,6 +268,15 @@ Foam::fileName Foam::dotFoam(const fileName& name)
}
// 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;
}

View File

@ -37,6 +37,10 @@ License
void Foam::regExp::compile(const char* pat) const
{
clear();
// avoid NULL and zero-length patterns
if (pat && *pat)
{
preg_ = new regex_t;
if (regcomp(preg_, pat, REG_EXTENDED) != 0)
@ -47,6 +51,7 @@ void Foam::regExp::compile(const char* pat) const
) << "Failed to compile regular expression '" << pat << "'"
<< exit(FatalError);
}
}
}
@ -60,6 +65,7 @@ void Foam::regExp::clear() const
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regExp::regExp()
@ -83,6 +89,7 @@ Foam::regExp::regExp(const char* pat)
compile(pat);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regExp::~regExp()
@ -90,6 +97,7 @@ Foam::regExp::~regExp()
clear();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
int Foam::regExp::ngroups() const
@ -110,6 +118,7 @@ bool Foam::regExp::match
regmatch_t pmatch[1];
// match and also verify that the entire string was matched
// pmatch[0] is the entire match
if
(
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
@ -141,6 +150,8 @@ bool Foam::regExp::match
regmatch_t pmatch[nmatch];
// match and also verify that the entire string was matched
// pmatch[0] is the entire match
// pmatch[1..] are the (...) sub-groups
if
(
regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
@ -179,8 +190,8 @@ bool Foam::regExp::match
return false;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::regExp::operator=(const string& pat)
{
@ -193,4 +204,5 @@ void Foam::regExp::operator=(const char* pat)
compile(pat);
}
// ************************************************************************* //

View File

@ -1,5 +1,4 @@
global/global.C
global/global.Cver
global/dimensionedConstants/dimensionedConstants.C
global/argList/argList.C
global/clock/clock.C
@ -290,7 +289,6 @@ $(tetCell)/tetCell.C
cellModeller = $(meshShapes)/cellModeller
$(cellModeller)/cellModeller.C
$(cellModeller)/cellModellerIO.C
cellModel = $(meshShapes)/cellModel
$(cellModel)/cellModel.C

View File

@ -28,22 +28,15 @@ Description
#include "Dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
template<class T>
Dictionary<T>::Dictionary()
Foam::Dictionary<T>::Dictionary()
{}
// Copy constructor
template<class T>
Dictionary<T>::Dictionary(const Dictionary& dict)
Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
:
DictionaryBase<IDLList<T>, T>(dict)
{}
@ -52,10 +45,10 @@ Dictionary<T>::Dictionary(const Dictionary& dict)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
bool Dictionary<T>::erase(const word& Keyword)
bool Foam::Dictionary<T>::erase(const word& keyword)
{
T* tPtr;
if ((tPtr = this->remove(Keyword)))
if (tPtr = this->remove(keyword))
{
delete tPtr;
return true;
@ -69,6 +62,4 @@ bool Dictionary<T>::erase(const word& Keyword)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,8 +27,10 @@ Class
Description
Gerneral purpose template dictionary class which manages the storage
associated with it. It is derived from DictionaryBase instantiated on
a memory managed form of intrusive doubly-linked list of \<T\>.
associated with it.
It is derived from DictionaryBase instantiated on a memory managed form
of intrusive doubly-linked list of \<T\>.
SourceFiles
Dictionary.C
@ -69,10 +71,8 @@ public:
// Member functions
// Editing
//- Remove an entry specified by keyword from the dictionary
// and delete it
//- Remove an entry specified by keyword and delete the pointer.
// Returns true if the keyword was found
bool erase(const word& keyword);
};

View File

@ -26,15 +26,10 @@ License
#include "DictionaryBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class IDLListType, class T>
void DictionaryBase<IDLListType, T>::addEntries()
void Foam::DictionaryBase<IDLListType, T>::addEntries()
{
for
(
@ -51,12 +46,15 @@ void DictionaryBase<IDLListType, T>::addEntries()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class IDLListType, class T>
DictionaryBase<IDLListType, T>::DictionaryBase()
Foam::DictionaryBase<IDLListType, T>::DictionaryBase()
{}
template<class IDLListType, class T>
DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
Foam::DictionaryBase<IDLListType, T>::DictionaryBase
(
const DictionaryBase& dict
)
:
IDLListType(dict)
{
@ -66,17 +64,20 @@ DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
template<class IDLListType, class T>
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();
}
// Istream constructor
template<class IDLListType, class T>
DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
Foam::DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
:
IDLListType(is)
{
@ -88,25 +89,60 @@ DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
// Find and return 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);
}
// Find and return T*
// Find and return T*, return NULL if not found
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);
if (iter == hashedTs_.end())
{
// If keyword not found print error message ...
FatalErrorIn
(
"DictionaryBase<IDLListType, T>::"
"lookup(const word& keyword) const"
"DictionaryBase<IDLListType, T>::lookup(const word&) const"
) << keyword << " is undefined"
<< 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>
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);
if (iter == hashedTs_.end())
{
// If keyword not found print error message ...
FatalErrorIn
(
"DictionaryBase<IDLListType, T>::lookup(const word& keyword)"
"DictionaryBase<IDLListType, T>::lookup(const word&)"
) << keyword << " is undefined"
<< exit(FatalError);
}
@ -137,7 +172,7 @@ T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
// Return the table of contents
template<class IDLListType, class T>
wordList DictionaryBase<IDLListType, T>::toc() const
Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
{
wordList keywords(this->size());
@ -158,26 +193,28 @@ wordList DictionaryBase<IDLListType, T>::toc() const
// Add at head of dictionary
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);
IDLListType::insert(tPtr);
}
// Add at tail of dictionary
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);
IDLListType::append(tPtr);
}
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())
{
@ -192,19 +229,29 @@ T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
}
//- Clear the dictionary
template<class IDLListType, class T>
void DictionaryBase<IDLListType, T>::clear()
void Foam::DictionaryBase<IDLListType, T>::clear()
{
IDLListType::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 * * * * * * * * * * * * * //
template<class IDLListType, class T>
void DictionaryBase<IDLListType, T>::operator=
void Foam::DictionaryBase<IDLListType, T>::operator=
(
const DictionaryBase<IDLListType, T>& dict
)
@ -218,25 +265,11 @@ void DictionaryBase<IDLListType, T>::operator=
}
IDLListType::operator=(dict);
this->hashedTs_.clear();
for
(
typename IDLListType::iterator iter = this->begin();
iter != this->end();
++iter
)
{
this->hashedTs_.insert((*iter).keyword(), &(*iter));
}
this->addEntries();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DictionaryBaseIO.C"

View File

@ -29,12 +29,12 @@ Description
Base dictionary class templated on both the form of doubly-linked list
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.
Note
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
See Also
@ -77,7 +77,7 @@ class DictionaryBase
{
// 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_;
@ -99,10 +99,10 @@ public:
//- Construct from Istream using given Istream constructor class
template<class INew>
DictionaryBase(Istream& is, const INew& inewt);
DictionaryBase(Istream&, const INew&);
//- Construct from Istream
DictionaryBase(Istream& is);
//- Construct from Istream using default Istream constructor class
DictionaryBase(Istream&);
// Member functions
@ -110,7 +110,13 @@ public:
// Search and lookup
//- 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
const T* lookup(const word&) const;
@ -125,17 +131,21 @@ public:
// Editing
//- Add at head of dictionary
void insert(const word& keyword, T*);
void insert(const word&, T*);
//- Add at tail of dictionary
void append(const word& keyword, T*);
void append(const word&, T*);
//- Remove and return entry specified by keyword
T* remove(const word& keyword);
//- Remove and return entry specified by keyword.
// Return NULL if the keyword was not found.
T* remove(const word&);
//- Clear the dictionary
void clear();
//- Transfer the contents of the argument into this DictionaryBase
// and annull the argument.
void transfer(DictionaryBase<IDLListType, T>&);
// Member operators

View File

@ -30,15 +30,13 @@ Description
#include "DictionaryBase.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
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
(
@ -53,7 +51,7 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
if (!os.good())
{
Info
<< "operator<<(Ostream& os, const DictionaryBase&) : "
<< "operator<<(Ostream&, const DictionaryBase&) : "
<< "Can't write entry for DictionaryBase"
<< endl;
@ -67,6 +65,4 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,20 +26,15 @@ License
#include "PtrDictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
PtrDictionary<T>::PtrDictionary()
Foam::PtrDictionary<T>::PtrDictionary()
{}
template<class T>
PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
:
DictionaryBase<DLPtrList<T>, T>(dict)
{}
@ -47,14 +42,14 @@ PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
template<class T>
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)
{}
template<class T>
PtrDictionary<T>::PtrDictionary(Istream& is)
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
:
DictionaryBase<DLPtrList<T>, T>(is)
{}
@ -62,6 +57,4 @@ PtrDictionary<T>::PtrDictionary(Istream& is)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,8 +27,10 @@ Class
Description
Template dictionary class which does not manages the storage
associated with it. It is derived from DictionaryBase instantiated on
a non-memory managed form of intrusive doubly-linked list of T.
associated with it.
It is derived from DictionaryBase instantiated on a non-memory managed
form of intrusive doubly-linked list of T.
SourceFiles
PtrDictionary.C

View File

@ -26,22 +26,15 @@ License
#include "UDictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
template<class T>
UDictionary<T>::UDictionary()
Foam::UDictionary<T>::UDictionary()
{}
// Copy constructor
template<class T>
UDictionary<T>::UDictionary(const UDictionary& dict)
Foam::UDictionary<T>::UDictionary(const UDictionary& dict)
:
DictionaryBase<UIDLList<T>, T>(dict)
{}
@ -49,6 +42,4 @@ UDictionary<T>::UDictionary(const UDictionary& dict)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,22 +26,15 @@ License
#include "UPtrDictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
template<class T>
UPtrDictionary<T>::UPtrDictionary()
Foam::UPtrDictionary<T>::UPtrDictionary()
{}
// Copy constructor
template<class T>
UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
:
DictionaryBase<DLList<T*>, T>(dict)
{}
@ -49,6 +42,4 @@ UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,8 +27,10 @@ Class
Description
Template dictionary class which does not manages the storage
associated with it. It is derived from DictionaryBase instantiated on
a non-memory managed form of intrusive doubly-linked list of \<T\>.
associated with it.
It is derived from DictionaryBase instantiated on a non-memory managed
form of intrusive doubly-linked list of \<T\>.
SourceFiles
UPtrDictionary.C

View File

@ -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>
void HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
{

View File

@ -54,6 +54,7 @@ template<class T>
class List;
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>>
(
@ -102,7 +103,7 @@ class HashTable
//- Construct given key, next pointer and object
inline hashedEntry
(
const Key& key,
const Key&,
hashedEntry* next,
const T& newEntry
);
@ -127,7 +128,7 @@ class HashTable
// Private Member Functions
//- 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:
@ -173,15 +174,15 @@ public:
inline label size() const;
//- 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
// If not found iterator = end()
iterator find(const Key& key);
iterator find(const Key&);
//- Find and return an const_iterator set at the hashedEntry
// If not found iterator = end()
const_iterator find(const Key& key) const;
const_iterator find(const Key&) const;
//- Return the table of contents
List<Key> toc() const;
@ -190,16 +191,16 @@ public:
// Edit
//- 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
inline bool set(const Key& key, const T& newElmt);
inline bool set(const Key&, const T& newElmt);
//- 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
bool erase(const Key& key);
bool erase(const Key&);
//- Resize the hash table for efficiency
void resize(const label newSize);
@ -207,6 +208,10 @@ public:
//- Clear all entries from table
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
// and annull the argument table.
void transfer(HashTable<T, Key, Hash>&);
@ -215,14 +220,14 @@ public:
// Member Operators
//- Find and return an hashedEntry
inline T& operator[](const Key& key);
inline T& operator[](const Key&);
//- 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
// if it is not present create it null.
inline T& operator()(const Key& key);
inline T& operator()(const Key&);
//- Assignment
void operator=(const HashTable<T, Key, Hash>&);
@ -290,13 +295,13 @@ public:
// 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& iter) const;
inline bool operator==(const iterator&) const;
inline bool operator!=(const iterator&) const;
inline bool operator==(const const_iterator& iter) const;
inline bool operator!=(const const_iterator& iter) const;
inline bool operator==(const const_iterator&) const;
inline bool operator!=(const const_iterator&) const;
inline T& operator*();
inline T& operator()();
@ -352,13 +357,13 @@ public:
// 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& iter) const;
inline bool operator==(const const_iterator&) const;
inline bool operator!=(const const_iterator&) const;
inline bool operator==(const iterator& iter) const;
inline bool operator!=(const iterator& iter) const;
inline bool operator==(const iterator&) const;
inline bool operator!=(const iterator&) const;
inline const T& operator*();
inline const T& operator()();

View File

@ -26,22 +26,17 @@ License
#include "ILList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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>()
{
for
(
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
iter != slpl.end();
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -53,9 +48,9 @@ ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
#ifndef __INTEL_COMPILER
template<class LListBase, class T>
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
)
:
@ -63,8 +58,8 @@ ILList<LListBase, T>::ILList
{
for
(
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
iter != slpl.end();
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -77,7 +72,7 @@ ILList<LListBase, T>::ILList
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class LListBase, class T>
ILList<LListBase, T>::~ILList()
Foam::ILList<LListBase, T>::~ILList()
{
this->clear();
}
@ -85,9 +80,8 @@ ILList<LListBase, T>::~ILList()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return and remove head
template<class LListBase, class T>
bool ILList<LListBase, T>::eraseHead()
bool Foam::ILList<LListBase, T>::eraseHead()
{
T* tPtr;
if ((tPtr = this->removeHead()))
@ -101,9 +95,8 @@ bool ILList<LListBase, T>::eraseHead()
}
}
//- Return and remove element
template<class LListBase, class T>
bool ILList<LListBase, T>::erase(T* p)
bool Foam::ILList<LListBase, T>::erase(T* p)
{
T* tPtr;
if ((tPtr = remove(p)))
@ -119,7 +112,7 @@ bool ILList<LListBase, T>::erase(T* p)
template<class LListBase, class T>
void ILList<LListBase, T>::clear()
void Foam::ILList<LListBase, T>::clear()
{
label oldSize = this->size();
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 * * * * * * * * * * * * * //
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();
for
(
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
iter != slpl.end();
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -149,11 +150,6 @@ void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
#include "ILListIO.C"

View File

@ -71,7 +71,7 @@ class ILList
//- Read from Istream using given Istream constructor class
template<class INew>
void read(Istream&, const INew& inewt);
void read(Istream&, const INew&);
public:
@ -96,7 +96,7 @@ public:
//- Copy constructor with additional argument for clone
template<class CloneArg>
ILList(const ILList<LListBase, T>& slpl, const CloneArg& cloneArg)
ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg)
#ifdef __INTEL_COMPILER
:
UILList<LListBase, T>()
@ -104,8 +104,8 @@ public:
for
(
typename UILList<LListBase, T>::const_iterator iter =
slpl.begin();
iter != slpl.end();
lst.begin();
iter != lst.end();
++iter
)
{
@ -118,7 +118,7 @@ public:
//- Construct from Istream using given Istream constructor class
template<class INew>
ILList(Istream&, const INew& inewt);
ILList(Istream&, const INew&);
// Destructor
@ -139,6 +139,10 @@ public:
//- Clear the contents of the list
void clear();
//- Transfer the contents of the argument into this List
// and annull the argument list.
void transfer(ILList<LListBase, T>&);
// Member operators

View File

@ -30,24 +30,19 @@ Description
#include "Istream.H"
#include "INew.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class LListBase, class T>
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);
is.fatalCheck
(
"operator>>(Istream& is, ILList<LListBase, T>& L) : reading first token"
"operator>>(Istream&, ILList<LListBase, T>&) : reading first token"
);
if (firstToken.isLabel())
@ -63,23 +58,23 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
{
for (label i=0; i<s; i++)
{
append(inewt(is).ptr());
append(iNew(is).ptr());
is.fatalCheck
(
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
"operator>>(Istream&, ILList<LListBase, T>&) : "
"reading entry"
);
}
}
else
{
T* tPtr = inewt(is).ptr();
T* tPtr = iNew(is).ptr();
append(tPtr);
is.fatalCheck
(
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
"operator>>(Istream&, ILList<LListBase, T>&) : "
"reading entry"
);
@ -99,14 +94,14 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
{
FatalIOErrorIn
(
"operator>>(Istream& is, ILList<LListBase, T>& L)",
"operator>>(Istream&, ILList<LListBase, T>&)",
is
) << "incorrect first token, '(', found " << firstToken.info()
<< exit(FatalIOError);
}
token lastToken(is);
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
while
(
@ -117,36 +112,34 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
)
{
is.putBack(lastToken);
append(inewt(is).ptr());
append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
}
}
else
{
FatalIOErrorIn("operator>>(Istream& is, ILList<LListBase, T>& L)", is)
FatalIOErrorIn("operator>>(Istream&, ILList<LListBase, T>&)", is)
<< "incorrect first token, expected <int> or '(', found "
<< firstToken.info()
<< 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 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>
ILList<LListBase, T>::ILList(Istream& is)
Foam::ILList<LListBase, T>::ILList(Istream& is)
{
read(is, INew<T>());
}
@ -155,7 +148,7 @@ ILList<LListBase, T>::ILList(Istream& is)
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
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.read(is, INew<T>());
@ -166,6 +159,4 @@ Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,22 +27,16 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "LList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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()
{
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter());
}
@ -50,7 +44,7 @@ LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
template<class LListBase, class T>
LList<LListBase, T>::~LList()
Foam::LList<LListBase, T>::~LList()
{
this->clear();
}
@ -59,7 +53,7 @@ LList<LListBase, T>::~LList()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class LListBase, class T>
void LList<LListBase, T>::clear()
void Foam::LList<LListBase, T>::clear()
{
label oldSize = this->size();
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 * * * * * * * * * * * * * //
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();
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter());
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
#include "LListIO.C"

View File

@ -200,6 +200,9 @@ public:
//- Delete contents of list
void clear();
//- Transfer the contents of the argument into this List
// and annull the argument list.
void transfer(LList<LListBase, T>&);
// Member operators

View File

@ -30,16 +30,10 @@ Description
#include "Istream.H"
#include "Ostream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from Istream
template<class LListBase, class T>
LList<LListBase, T>::LList(Istream& is)
Foam::LList<LListBase, T>::LList(Istream& is)
{
operator>>(is, *this);
}
@ -48,18 +42,18 @@ LList<LListBase, T>::LList(Istream& is)
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
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
L.clear();
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
token firstToken(is);
is.fatalCheck
(
" operator>>(Istream& is, LList<LListBase, T>& L) : reading first token"
" operator>>(Istream&, LList<LListBase, T>&) : reading first token"
);
if (firstToken.isLabel())
@ -101,14 +95,14 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
{
FatalIOErrorIn
(
" operator>>(Istream& is, LList<LListBase, T>& L)",
" operator>>(Istream&, LList<LListBase, T>&)",
is
) << "incorrect first token, '(', found " << firstToken.info()
<< exit(FatalIOError);
}
token lastToken(is);
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
while
(
@ -124,19 +118,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
L.append(element);
is >> lastToken;
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
}
}
else
{
FatalIOErrorIn(" operator>>(Istream& is, LList<LListBase, T>& L)", is)
FatalIOErrorIn(" operator>>(Istream&, LList<LListBase, T>&)", is)
<< "incorrect first token, expected <int> or '(', found "
<< firstToken.info()
<< exit(FatalIOError);
}
// Check state of IOstream
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
return is;
}
@ -145,19 +139,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
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
os << nl << ll.size();
// Write size
os << nl << lst.size();
// Write beginning of contents
os << nl << token::BEGIN_LIST << nl;
// Write LList contents
// Write contents
for
(
typename LList<LListBase, T>::const_iterator iter = ll.begin();
iter != ll.end();
typename LList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -168,14 +162,10 @@ Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const LList&)");
os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,19 +26,14 @@ License
#include "LPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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*>()
{
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter().clone().ptr());
}
@ -48,7 +43,7 @@ LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class LListBase, class T>
LPtrList<LListBase, T>::~LPtrList()
Foam::LPtrList<LListBase, T>::~LPtrList()
{
clear();
}
@ -56,9 +51,8 @@ LPtrList<LListBase, T>::~LPtrList()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return and remove head
template<class LListBase, class T>
bool LPtrList<LListBase, T>::eraseHead()
bool Foam::LPtrList<LListBase, T>::eraseHead()
{
T* tPtr;
if ((tPtr = this->removeHead()))
@ -74,7 +68,7 @@ bool LPtrList<LListBase, T>::eraseHead()
template<class LListBase, class T>
void LPtrList<LListBase, T>::clear()
void Foam::LPtrList<LListBase, T>::clear()
{
label oldSize = this->size();
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 * * * * * * * * * * * * * //
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();
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
{
append(iter().clone().ptr());
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
#include "LPtrListIO.C"

View File

@ -149,12 +149,16 @@ public:
// 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();
//- Remove the specified element from the list and delete it
//- Clear the contents of the list
void clear();
//- Transfer the contents of the argument into this List
// and annull the argument list.
void transfer(LPtrList<LListBase, T>&);
// Member operators

View File

@ -29,16 +29,11 @@ License
#include "Ostream.H"
#include "INew.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class LListBase, class T>
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
(
@ -66,7 +61,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
{
for (label i=0; i<s; i++)
{
append(inewt(is).ptr());
append(iNew(is).ptr());
is.fatalCheck
(
@ -77,7 +72,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
}
else
{
T* tPtr = inewt(is).ptr();
T* tPtr = iNew(is).ptr();
append(tPtr);
is.fatalCheck
@ -120,7 +115,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
)
{
is.putBack(lastToken);
append(inewt(is).ptr());
append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck
@ -148,14 +143,14 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
template<class LListBase, class T>
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>
LPtrList<LListBase, T>::LPtrList(Istream& is)
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
{
read(is, INew<T>());
}
@ -164,11 +159,10 @@ LPtrList<LListBase, T>::LPtrList(Istream& is)
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
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.read(is, INew<T>());
return is;
}
@ -177,19 +171,19 @@ Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
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
os << nl << slpl.size();
// Write size
os << nl << lst.size();
// Write beginning of contents
os << nl << token::BEGIN_LIST << nl;
// Write LPtrList contents
// Write contents
for
(
typename LPtrList<LListBase, T>::const_iterator iter = slpl.begin();
iter != slpl.end();
typename LPtrList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -200,14 +194,9 @@ Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const LPtrList&)");
os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,17 +28,12 @@ Description
#include "UILList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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());
}
@ -48,22 +43,24 @@ UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
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();
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
append(&iter());
}
}
// Comparison for equality
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;
}
@ -71,7 +68,7 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
bool equal = true;
const_iterator iter1 = this->begin();
const_iterator iter2 = slpl.begin();
const_iterator iter2 = rhs.begin();
for (; iter1 != this->end(); ++iter1, ++iter2)
{
@ -84,16 +81,15 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
// Comparison for inequality
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 * * * * * * * * * * * * * //
#include "UILListIO.C"

View File

@ -266,7 +266,7 @@ public:
// STL member operators
//- 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.
bool operator==(const UILList<LListBase, T>&) const;

View File

@ -30,27 +30,22 @@ Description
#include "Ostream.H"
#include "token.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
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
os << nl << ill.size();
// Write size
os << nl << lst.size();
// Write beginning of contents
os << nl << token::BEGIN_LIST << nl;
// Write UILList contents
// Write contents
for
(
typename UILList<LListBase, T>::const_iterator iter = ill.begin();
iter != ill.end();
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -61,14 +56,9 @@ Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const UILList&)");
os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -32,17 +32,12 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DLListBase::iterator DLListBase::endIter
Foam::DLListBase::iterator Foam::DLListBase::endIter
(
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()),
reinterpret_cast<const link*>(NULL)
@ -51,7 +46,7 @@ DLListBase::const_iterator DLListBase::endConstIter
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void DLListBase::insert(DLListBase::link* a)
void Foam::DLListBase::insert(DLListBase::link* a)
{
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_++;
@ -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)
{
@ -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)
{
@ -173,7 +168,7 @@ bool DLListBase::swapDown(DLListBase::link* a)
}
DLListBase::link* DLListBase::removeHead()
Foam::DLListBase::link* Foam::DLListBase::removeHead()
{
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_--;
@ -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* newLink
@ -266,8 +261,4 @@ DLListBase::link* DLListBase::replace
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -167,6 +167,9 @@ public:
//- Clear the list
inline void clear();
//- Transfer the contents of the argument into this List
// and annull the argument list.
inline void transfer(DLListBase&);
// STL iterator

View File

@ -26,21 +26,16 @@ License
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
inline DLListBase::link::link()
inline Foam::DLListBase::link::link()
:
prev_(0),
next_(0)
{}
inline DLListBase::DLListBase()
inline Foam::DLListBase::DLListBase()
:
first_(0),
last_(0),
@ -48,7 +43,7 @@ inline DLListBase::DLListBase()
{}
inline DLListBase::DLListBase(link* a)
inline Foam::DLListBase::DLListBase(link* a)
:
first_(a),
last_(a),
@ -61,32 +56,33 @@ inline DLListBase::DLListBase(link* a)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
inline DLListBase::~DLListBase()
inline Foam::DLListBase::~DLListBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool DLListBase::link::registered() const
inline bool Foam::DLListBase::link::registered() const
{
return prev_ != 0 && next_ != 0;
}
inline void DLListBase::link::deregister()
inline void Foam::DLListBase::link::deregister()
{
prev_ = 0;
next_ = 0;
}
inline label DLListBase::size() const
inline Foam::label Foam::DLListBase::size() const
{
return nElmts_;
}
inline DLListBase::link* DLListBase::first()
inline Foam::DLListBase::link*
Foam::DLListBase::first()
{
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_)
{
@ -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_)
{
@ -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_)
{
@ -134,21 +133,36 @@ inline const DLListBase::link* DLListBase::last() const
}
inline void DLListBase::clear()
inline void Foam::DLListBase::clear()
{
nElmts_ = 0;
first_ = 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_);
}
inline DLListBase::link* DLListBase::replace
inline Foam::DLListBase::link*
Foam::DLListBase::replace
(
DLListBase::iterator& oldIter,
DLListBase::link* newLink
@ -160,7 +174,7 @@ inline DLListBase::link* DLListBase::replace
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
inline Foam::DLListBase::iterator::iterator(DLListBase& s, link* elmt)
:
curList_(s),
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),
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_;
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_;
}
inline bool DLListBase::iterator::operator!=(const iterator& iter) const
inline bool Foam::DLListBase::iterator::operator!=(const iterator& iter) const
{
return curElmt_ != iter.curElmt_;
}
inline DLListBase::link& DLListBase::iterator::operator*()
inline Foam::DLListBase::link&
Foam::DLListBase::iterator::operator*()
{
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)
// 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;
++*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())
{
@ -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;
}
@ -248,7 +266,7 @@ inline const DLListBase::iterator& DLListBase::end()
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
inline DLListBase::const_iterator::const_iterator
inline Foam::DLListBase::const_iterator::const_iterator
(
const DLListBase& s,
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_),
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_;
}
inline bool DLListBase::const_iterator::operator==
inline bool Foam::DLListBase::const_iterator::operator==
(
const const_iterator& iter
) 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
@ -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_;
}
inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
inline Foam::DLListBase::const_iterator&
Foam::DLListBase::const_iterator::operator++()
{
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;
++*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())
{
@ -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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -25,22 +25,16 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "SLListBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SLListBase::iterator SLListBase::endIter
Foam::SLListBase::iterator Foam::SLListBase::endIter
(
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()),
reinterpret_cast<const link*>(NULL)
@ -49,7 +43,7 @@ SLListBase::const_iterator SLListBase::endConstIter
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void SLListBase::insert(SLListBase::link* a)
void Foam::SLListBase::insert(SLListBase::link* a)
{
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_++;
@ -82,7 +76,7 @@ void SLListBase::append(SLListBase::link* a)
}
SLListBase::link* SLListBase::removeHead()
Foam::SLListBase::link* Foam::SLListBase::removeHead()
{
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::link *prev = &(*iter);
@ -143,8 +137,4 @@ SLListBase::link* SLListBase::remove(SLListBase::link* it)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -152,6 +152,9 @@ public:
//- Clear the list
inline void clear();
//- Transfer the contents of the argument into this List
// and annull the argument list.
inline void transfer(SLListBase&);
// STL iterator

View File

@ -29,33 +29,28 @@ Description
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
inline SLListBase::link::link()
inline Foam::SLListBase::link::link()
:
next_(0)
{}
inline SLListBase::link::link(link* p)
inline Foam::SLListBase::link::link(link* p)
:
next_(p)
{}
inline SLListBase::SLListBase()
inline Foam::SLListBase::SLListBase()
:
last_(0),
nElmts_(0)
{}
inline SLListBase::SLListBase(link* a)
inline Foam::SLListBase::SLListBase(link* a)
:
last_(a->next_ = a),
nElmts_(1)
@ -64,19 +59,20 @@ inline SLListBase::SLListBase(link* a)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
inline SLListBase::~SLListBase()
inline Foam::SLListBase::~SLListBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline label SLListBase::size() const
inline Foam::label Foam::SLListBase::size() const
{
return nElmts_;
}
inline SLListBase::link* SLListBase::first()
inline Foam::SLListBase::link*
Foam::SLListBase::first()
{
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_)
{
@ -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_)
{
@ -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_)
{
@ -124,14 +123,26 @@ inline const SLListBase::link* SLListBase::last() const
}
inline void SLListBase::clear()
inline void Foam::SLListBase::clear()
{
nElmts_ = 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_);
}
@ -139,7 +150,7 @@ inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
inline Foam::SLListBase::iterator::iterator(SLListBase& s, link* elmt)
:
curList_(s),
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),
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_;
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_;
}
inline bool SLListBase::iterator::operator!=(const iterator& iter) const
inline bool Foam::SLListBase::iterator::operator!=(const iterator& iter) const
{
return curElmt_ != iter.curElmt_;
}
inline SLListBase::link& SLListBase::iterator::operator*()
inline Foam::SLListBase::link& Foam::SLListBase::iterator::operator*()
{
return *curElmt_;
}
inline SLListBase::iterator& SLListBase::iterator::operator++()
inline Foam::SLListBase::iterator& Foam::SLListBase::iterator::operator++()
{
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;
++*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())
{
@ -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;
}
@ -225,7 +239,7 @@ inline const SLListBase::iterator& SLListBase::end()
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
inline SLListBase::const_iterator::const_iterator
inline Foam::SLListBase::const_iterator::const_iterator
(
const SLListBase& s,
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_),
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_;
}
inline bool SLListBase::const_iterator::operator==
inline bool Foam::SLListBase::const_iterator::operator==
(
const const_iterator& iter
) 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
@ -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_;
}
inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
inline Foam::SLListBase::const_iterator&
Foam::SLListBase::const_iterator::operator++()
{
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;
++*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())
{
@ -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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,13 +31,22 @@ License
template<class Stream>
inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
{
static bool spacesSet = false;
static bool spacesSet(false);
static char spaces[40];
if (!spacesSet)
{
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;
}
@ -56,8 +65,8 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
"| ========= | |\n"
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n"
"| \\\\ / A nd | Web: http://www.OpenFOAM.org |\n"
"| \\\\/ M anipulation | |\n"
"| \\\\ / A nd | |\n"
"| \\\\/ M anipulation | www.OpenFOAM.org |\n"
"\\*---------------------------------------------------------------------------*/\n";
}

View File

@ -32,22 +32,22 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Write keyType
Foam::Ostream& Foam::Ostream::write(const keyType& s)
// Write keyType
Foam::Ostream& Foam::Ostream::write(const keyType& kw)
{
// Write as word?
if (s.isWildCard())
// Write as word or string
if (kw.isPattern())
{
return write(static_cast<const string&>(s));
return write(static_cast<const string&>(kw));
}
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()
{
if (indentLevel_ == 0)
@ -62,15 +62,26 @@ void Foam::Ostream::decrIndent()
}
// Write the keyword to the Ostream followed by appropriate indentation
Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword)
// Write the keyword followed by appropriate indentation
Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw)
{
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));
}

View File

@ -60,12 +60,11 @@ protected:
//- Number of spaces per indent level
static const unsigned short indentSize_ = 4;
//- Current indent level
unsigned short indentLevel_;
//- Indentation of the entry from the start of the keyword
static const unsigned short entryIndentation_ = 16;
//- Current indent level
unsigned short indentLevel_;
public:
@ -148,9 +147,8 @@ public:
//- Decrememt the indent level
void decrIndent();
//- Write the keyword to the Ostream followed by
// appropriate indentation
Ostream& writeKeyword(const keyType& keyword);
//- Write the keyword followed by an appropriate indentation
Ostream& writeKeyword(const keyType&);
// Stream state functions

View File

@ -160,7 +160,7 @@ public:
void flush()
{}
//- Add '\n' and flush stream
//- Add newline and flush stream
void endl()
{}

View File

@ -162,20 +162,20 @@ public:
//- Flush stream
virtual void flush();
//- Add '\n' and flush stream
//- Add newline and flush stream
virtual void endl();
//- Get width of output field
virtual int width() const;
//- 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
virtual int precision() const;
//- Set precision of output field (and return old precision)
virtual int precision(const int p);
virtual int precision(const int);
// Print

View File

@ -38,23 +38,23 @@ const Foam::dictionary Foam::dictionary::null;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::dictionary::findInWildcards
bool Foam::dictionary::findInPatterns
(
const bool wildCardMatch,
const bool patternMatch,
const word& Keyword,
DLList<entry*>::const_iterator& wcLink,
DLList<autoPtr<regExp> >::const_iterator& reLink
) const
{
if (wildCardEntries_.size() > 0)
if (patternEntries_.size() > 0)
{
while (wcLink != wildCardEntries_.end())
while (wcLink != patternEntries_.end())
{
if (!wildCardMatch && wcLink()->keyword() == Keyword)
{
return true;
}
else if (wildCardMatch && reLink()->match(Keyword))
if
(
patternMatch ? reLink()->match(Keyword)
: wcLink()->keyword() == Keyword
)
{
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,
DLList<entry*>::iterator& wcLink,
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)
{
return true;
}
else if (wildCardMatch && reLink()->match(Keyword))
if
(
patternMatch ? reLink()->match(Keyword)
: wcLink()->keyword() == Keyword
)
{
return true;
}
@ -125,10 +125,10 @@ Foam::dictionary::dictionary
{
hashedEntries_.insert(iter().keyword(), &iter());
if (iter().keyword().isWildCard())
if (iter().keyword().isPattern())
{
wildCardEntries_.insert(&iter());
wildCardRegexps_.insert
patternEntries_.insert(&iter());
patternRegexps_.insert
(
autoPtr<regExp>(new regExp(iter().keyword()))
);
@ -155,10 +155,10 @@ Foam::dictionary::dictionary
{
hashedEntries_.insert(iter().keyword(), &iter());
if (iter().keyword().isWildCard())
if (iter().keyword().isPattern())
{
wildCardEntries_.insert(&iter());
wildCardRegexps_.insert
patternEntries_.insert(&iter());
patternRegexps_.insert
(
autoPtr<regExp>(new regExp(iter().keyword()))
);
@ -217,14 +217,14 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
}
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 =
wildCardRegexps_.begin();
patternRegexps_.begin();
// Find in wildcards using regular expressions only
if (findInWildcards(true, keyword, wcLink, reLink))
// Find in patterns using regular expressions only
if (findInPatterns(true, keyword, wcLink, reLink))
{
return true;
}
@ -246,22 +246,22 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
(
const word& keyword,
bool recursive,
bool wildCardMatch
bool patternMatch
) const
{
HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
if (iter == hashedEntries_.end())
{
if (wildCardMatch && wildCardEntries_.size() > 0)
if (patternMatch && patternEntries_.size() > 0)
{
DLList<entry*>::const_iterator wcLink =
wildCardEntries_.begin();
patternEntries_.begin();
DLList<autoPtr<regExp> >::const_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();
}
@ -269,7 +269,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
if (recursive && &parent_ != &dictionary::null)
{
return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch);
return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
}
else
{
@ -285,21 +285,22 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
(
const word& keyword,
bool recursive,
bool wildCardMatch
bool patternMatch
)
{
HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
if (iter == hashedEntries_.end())
{
if (wildCardMatch && wildCardEntries_.size() > 0)
if (patternMatch && patternEntries_.size() > 0)
{
DLList<entry*>::iterator wcLink =
wildCardEntries_.begin();
patternEntries_.begin();
DLList<autoPtr<regExp> >::iterator reLink =
wildCardRegexps_.begin();
// Find in wildcards using regular expressions only
if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
patternRegexps_.begin();
// Find in patterns using regular expressions only
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
{
return wcLink();
}
@ -311,7 +312,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
(
keyword,
recursive,
wildCardMatch
patternMatch
);
}
else
@ -328,10 +329,10 @@ const Foam::entry& Foam::dictionary::lookupEntry
(
const word& keyword,
bool recursive,
bool wildCardMatch
bool patternMatch
) const
{
const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
if (entryPtr == NULL)
{
@ -352,16 +353,16 @@ Foam::ITstream& Foam::dictionary::lookup
(
const word& keyword,
bool recursive,
bool wildCardMatch
bool patternMatch
) const
{
return lookupEntry(keyword, recursive, wildCardMatch).stream();
return lookupEntry(keyword, recursive, patternMatch).stream();
}
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);
if (entryPtr)
@ -430,7 +431,7 @@ Foam::wordList Foam::dictionary::toc() const
{
wordList keys(size());
label i = 0;
label nKeys = 0;
for
(
IDLList<entry>::const_iterator iter = begin();
@ -438,13 +439,36 @@ Foam::wordList Foam::dictionary::toc() const
++iter
)
{
keys[i++] = iter().keyword();
keys[nKeys++] = iter().keyword();
}
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)
{
HashTable<entry*>::iterator iter = hashedEntries_.find
@ -473,10 +497,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
{
entryPtr->name() = name_ + "::" + entryPtr->keyword();
if (entryPtr->keyword().isWildCard())
if (entryPtr->keyword().isPattern())
{
wildCardEntries_.insert(entryPtr);
wildCardRegexps_.insert
patternEntries_.insert(entryPtr);
patternRegexps_.insert
(
autoPtr<regExp>(new regExp(entryPtr->keyword()))
);
@ -502,10 +526,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
entryPtr->name() = name_ + "::" + entryPtr->keyword();
IDLList<entry>::append(entryPtr);
if (entryPtr->keyword().isWildCard())
if (entryPtr->keyword().isPattern())
{
wildCardEntries_.insert(entryPtr);
wildCardRegexps_.insert
patternEntries_.insert(entryPtr);
patternRegexps_.insert
(
autoPtr<regExp>(new regExp(entryPtr->keyword()))
);
@ -597,16 +621,15 @@ bool Foam::dictionary::remove(const word& Keyword)
if (iter != hashedEntries_.end())
{
// Delete from wildcards first
DLList<entry*>::iterator wcLink =
wildCardEntries_.begin();
DLList<autoPtr<regExp> >::iterator reLink = wildCardRegexps_.begin();
// Delete from patterns first
DLList<entry*>::iterator wcLink = patternEntries_.begin();
DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin();
// Find in wildcards using exact match only
if (findInWildcards(false, Keyword, wcLink, reLink))
// Find in pattern using exact match only
if (findInPatterns(false, Keyword, wcLink, reLink))
{
wildCardEntries_.remove(wcLink);
wildCardRegexps_.remove(reLink);
patternEntries_.remove(wcLink);
patternRegexps_.remove(reLink);
}
IDLList<entry>::remove(iter());
@ -643,14 +666,14 @@ bool Foam::dictionary::changeKeyword
return false;
}
if (iter()->keyword().isWildCard())
if (iter()->keyword().isPattern())
{
FatalErrorIn
(
"dictionary::changeKeyword(const word&, const word&, bool)"
) << "Old keyword "<< oldKeyword
<< " is a wildcard."
<< "Wildcard replacement not yet implemented."
<< " is a pattern."
<< "Pattern replacement not yet implemented."
<< exit(FatalError);
}
@ -662,19 +685,19 @@ bool Foam::dictionary::changeKeyword
{
if (forceOverwrite)
{
if (iter2()->keyword().isWildCard())
if (iter2()->keyword().isPattern())
{
// Delete from wildcards first
// Delete from patterns first
DLList<entry*>::iterator wcLink =
wildCardEntries_.begin();
patternEntries_.begin();
DLList<autoPtr<regExp> >::iterator reLink =
wildCardRegexps_.begin();
patternRegexps_.begin();
// Find in wildcards using exact match only
if (findInWildcards(false, iter2()->keyword(), wcLink, reLink))
// Find in patterns using exact match only
if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
{
wildCardEntries_.remove(wcLink);
wildCardRegexps_.remove(reLink);
patternEntries_.remove(wcLink);
patternRegexps_.remove(reLink);
}
}
@ -701,10 +724,10 @@ bool Foam::dictionary::changeKeyword
hashedEntries_.erase(oldKeyword);
hashedEntries_.insert(newKeyword, iter());
if (newKeyword.isWildCard())
if (newKeyword.isPattern())
{
wildCardEntries_.insert(iter());
wildCardRegexps_.insert
patternEntries_.insert(iter());
patternRegexps_.insert
(
autoPtr<regExp>(new regExp(newKeyword))
);
@ -770,8 +793,8 @@ void Foam::dictionary::clear()
{
IDLList<entry>::clear();
hashedEntries_.clear();
wildCardEntries_.clear();
wildCardRegexps_.clear();
patternEntries_.clear();
patternRegexps_.clear();
}

View File

@ -27,12 +27,12 @@ Class
Description
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
searching is
searching is as follows:
- exact match
- wildcard match (in reverse order)
- optional recursion into subdictionaries
- pattern match (in reverse order)
- optional recursion into the enclosing (parent) dictionaries
The dictionary class is the base class for IOdictionary.
It also serves as a bootstrap dictionary for the objectRegistry data
@ -92,29 +92,27 @@ class dictionary
//- Parent dictionary
const dictionary& parent_;
//- Wildcard entries
DLList<entry*> wildCardEntries_;
//- Entries of matching patterns
DLList<entry*> patternEntries_;
//- Wildcard precompiled regular expressions
DLList<autoPtr<regExp> > wildCardRegexps_;
//- Patterns as precompiled regular expressions
DLList<autoPtr<regExp> > patternRegexps_;
// Private Member Functions
//- Search wildcard table either for exact match or for regular
// expression match.
bool findInWildcards
//- Search patterns table for exact match or regular expression match
bool findInPatterns
(
const bool wildCardMatch,
const bool patternMatch,
const word& Keyword,
DLList<entry*>::const_iterator& wcLink,
DLList<autoPtr<regExp> >::const_iterator& reLink
) const;
//- Search wildcard table either for exact match or for regular
// expression match.
bool findInWildcards
//- Search patterns table for exact match or regular expression match
bool findInPatterns
(
const bool wildCardMatch,
const bool patternMatch,
const word& Keyword,
DLList<entry*>::iterator& wcLink,
DLList<autoPtr<regExp> >::iterator& reLink
@ -210,83 +208,88 @@ public:
// Search and lookup
//- Search dictionary for given keyword
// If recursive search parent dictionaries
// If recursive, search parent dictionaries
bool found(const word&, bool recursive=false) const;
//- Find and return an entry data stream pointer if present
// otherwise return NULL.
// If recursive search parent dictionaries.
// If wildCardMatch use wildcards.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions
const entry* lookupEntryPtr
(
const word&,
bool recursive,
bool wildCardMatch
bool patternMatch
) const;
//- Find and return an entry data stream pointer for manipulation
// if present otherwise return NULL.
// If recursive search parent dictionaries.
// If wildCardMatch use wildcards.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
entry* lookupEntryPtr
(
const word&,
bool recursive,
bool wildCardMatch
bool patternMatch
);
//- Find and return an entry data stream if present otherwise error.
// If recursive search parent dictionaries.
// If wildCardMatch use wildcards.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
const entry& lookupEntry
(
const word&,
bool recursive,
bool wildCardMatch
bool patternMatch
) const;
//- Find and return an entry data stream
// If recursive search parent dictionaries
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
ITstream& lookup
(
const word&,
bool recursive=false,
bool wildCardMatch=true
bool patternMatch=true
) const;
//- Find and return a T,
// 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>
T lookupOrDefault
(
const word&,
const T&,
bool recursive=false,
bool wildCardMatch=true
bool patternMatch=true
) const;
//- Find and return a T, if not found return the given
// default value, and add to dictionary.
// If recursive search parent dictionaries
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
template<class T>
T lookupOrAddDefault
(
const word&,
const T&,
bool recursive=false,
bool wildCardMatch=true
bool patternMatch=true
);
//- 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>
bool readIfPresent
(
const word&,
T&,
bool recursive=false,
bool wildCardMatch=true
bool patternMatch=true
) const;
//- Check if entry is a sub-dictionary
@ -305,6 +308,9 @@ public:
//- Return the table of contents
wordList toc() const;
//- Return the list of available keys or patterns
List<keyType> keys(bool patterns=false) const;
// Editing
//- Add a new entry
@ -393,7 +399,7 @@ public:
void operator=(const 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&);
//- Conditionally include entries from the given dictionary.
@ -417,13 +423,13 @@ public:
// Global Operators
//- Combine dictionaries starting from the entries in dict1 and then including
// those from dict2.
//- Combine dictionaries.
// Starting from the entries in dict1 and then including those from dict2.
// Warn, but do not overwrite the entries from dict1.
dictionary operator+(const dictionary& dict1, const dictionary& dict2);
//- Combine dictionaries starting from the entries in dict1 and then including
// those from dict2.
//- Combine dictionaries.
// Starting from the entries in dict1 and then including those from dict2.
// Do not overwrite the entries from dict1.
dictionary operator|(const dictionary& dict1, const dictionary& dict2);

View File

@ -74,20 +74,20 @@ public:
// Constructors
//- 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
dictionaryEntry
(
const keyType& keyword,
const keyType&,
const dictionary& parentDict,
Istream& is
Istream&
);
//- Construct from the keyword, parent dictionary and a dictionary
dictionaryEntry
(
const keyType& keyword,
const keyType&,
const dictionary& parentDict,
const dictionary& dict
);
@ -96,7 +96,7 @@ public:
dictionaryEntry
(
const dictionary& parentDict,
const dictionaryEntry& dictEnt
const dictionaryEntry&
);
autoPtr<entry> clone(const dictionary& parentDict) const
@ -158,10 +158,8 @@ public:
};
#if defined (__GNUC__)
template<>
#endif
Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,18 +35,18 @@ T Foam::dictionary::lookupOrDefault
const word& keyword,
const T& deflt,
bool recursive,
bool wildCardMatch
bool patternMatch
) 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
{
return pTraits<T>(entryPtr->stream());
return deflt;
}
}
@ -57,19 +57,19 @@ T Foam::dictionary::lookupOrAddDefault
const word& keyword,
const T& deflt,
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 deflt;
return pTraits<T>(entryPtr->stream());
}
else
{
return pTraits<T>(entryPtr->stream());
add(new primitiveEntry(keyword, deflt));
return deflt;
}
}
@ -80,20 +80,20 @@ bool Foam::dictionary::readIfPresent
const word& k,
T& val,
bool recursive,
bool wildCardMatch
bool patternMatch
) const
{
const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch);
const entry* entryPtr = lookupEntryPtr(k, recursive, patternMatch);
if (entryPtr == NULL)
{
return false;
}
else
if (entryPtr)
{
entryPtr->stream() >> val;
return true;
}
else
{
return false;
}
}

View File

@ -92,20 +92,20 @@ public:
//- Construct on freestore as copy with reference to the
// dictionary the copy belongs to
virtual Foam::autoPtr<entry> clone
virtual autoPtr<entry> clone
(
const dictionary& parentDict
) const = 0;
//- Construct on freestore as copy
// 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
static bool New(dictionary& parentDict, Istream& is);
//- Construct on freestore from Istream and return
static Foam::autoPtr<entry> New(Istream& is);
static autoPtr<entry> New(Istream& is);
// Destructor

View File

@ -75,32 +75,32 @@ public:
void append
(
const token& currToken,
const dictionary& dict,
Istream& is
const dictionary&,
Istream&
);
//- Append the given tokens starting at the current tokenIndex
void append(const tokenList& varTokens);
void append(const tokenList&);
//- Expand the given variable (keyword starts with $)
bool expandVariable(const word& keyword, const dictionary& dict);
bool expandVariable(const word&, const dictionary&);
//- Expand the given function (keyword starts with #)
bool expandFunction
(
const word& keyword,
const dictionary& dict,
Istream& is
const word&,
const dictionary&,
Istream&
);
//- Read tokens from the given stream
bool read(const dictionary& dict, Istream&);
bool read(const dictionary&, Istream&);
//- Read the complete entry from the given stream
void readEntry(const dictionary& dict, Istream&);
void readEntry(const dictionary&, Istream&);
//- Insert the given tokens at token i
void insert(const tokenList& varTokens, const label i);
void insert(const tokenList&, const label i);
public:
@ -108,13 +108,13 @@ public:
// Constructors
//- Construct from keyword and a Istream
primitiveEntry(const keyType& keyword, Istream&);
primitiveEntry(const keyType&, Istream&);
//- Construct from keyword, parent dictionary and a Istream
primitiveEntry(const keyType& keyword, const dictionary&, Istream&);
//- Construct from keyword, parent dictionary and Istream
primitiveEntry(const keyType&, const dictionary& parentDict, Istream&);
//- Construct from keyword and a ITstream
primitiveEntry(const keyType& keyword, const ITstream&);
primitiveEntry(const keyType&, const ITstream&);
//- Construct from keyword and a token
primitiveEntry(const keyType&, const token&);
@ -182,7 +182,7 @@ public:
template<>
Ostream& operator<<(Ostream& os, const InfoProxy<primitiveEntry>& ip);
Ostream& operator<<(Ostream&, const InfoProxy<primitiveEntry>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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