Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2008-12-19 10:27:39 +00:00
310 changed files with 5886 additions and 3058 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

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
basicSubGrid
Foam::XiEqModels::basicSubGrid
Description
Basic sub-grid obstacle flame-wrinking enhancement factor model.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
basicSubGrid
Foam::XiGModel::basicSubGrid
Description

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
PDRDragModel
Foam::PDRDragModel
Description
Base-class for sub-grid obstacle drag models.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
basic
Foam::PDRDragModels::basic
Description
Basic sub-grid obstacle drag model.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
PDRkEpsilon
Foam::compressible::RASModels::PDRkEpsilon
Description
Standard k-epsilon turbulence model with additional source terms

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Gulder
Foam::XiEqModels::Gulder
Description
Simple Gulder model for XiEq based on Gulders correlation

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
SCOPEBlend
Foam::XiEqModels::SCOPEBlend
Description

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
SCOPEXiEq
Foam::XiEqModel::SCOPEXiEq
Description
Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
XiEqModel
Foam::XiEqModel
Description
Base-class for all XiEq models used by the b-XiEq combustion model.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
instability
Foam::XiEqModels::instability
Description

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
KTS
Foam::XiGModels::KTS
Description
Simple Kolmogorov time-scale model for the flame-wrinling generation rate.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
XiGModel
Foam::XiGModel
Description
Base-class for all Xi generation models used by the b-Xi combustion model.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
instabilityG
Foam::XiGModels::instabilityG
Description
Flame-surface instabilityG flame-wrinking generation rate coefficient model.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
XiModel
Foam::XiModel
Description
Base-class for all Xi models used by the b-Xi combustion model.
@ -102,8 +102,6 @@ namespace Foam
Class XiModel Declaration
\*---------------------------------------------------------------------------*/
class XiModel
{

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
algebraic
Foam::XiModels::algebraic
Description
Simple algebraic model for Xi based on Gulders correlation

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
fixed
Foam::XiModels::fixed
Description
Fixed value model for Xi.

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
transport
Foam::XiModels::transport
Description
Simple transport model for Xi based on Gulders correlation

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
SCOPE
Foam::laminarFlameSpeedModels::SCOPE
Description
Laminar flame speed obtained from the SCOPE correlation.

View File

@ -74,6 +74,10 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
{
// Store divU from the previous mesh for the correctPhi
volScalarField divU = fvc::div(phi);
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
// Do any mesh changes
@ -84,14 +88,12 @@ int main(int argc, char *argv[])
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
if (mesh.changing() && correctPhi)
{
//***HGW#include "correctPhi.H"
#include "correctPhi.H"
}
}
// Make the fluxes relative to the mesh motion
@ -102,6 +104,12 @@ int main(int argc, char *argv[])
#include "meshCourantNo.H"
}
if (mesh.changing())
{
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
turbulence->correct();
// --- Outer-corrector loop

View File

@ -0,0 +1,39 @@
{
#include "continuityErrs.H"
volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", pd.dimensions(), 0.0),
pcorrTypes
);
dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
adjustPhi(phi, U, pcorr);
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pcorrEqn.flux();
}
}
#include "continuityErrs.H"
}

View File

@ -150,3 +150,14 @@
(
incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
);
wordList pcorrTypes(pd.boundaryField().types());
for (label i=0; i<pd.boundaryField().size(); i++)
{
if (pd.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}

View File

@ -21,7 +21,7 @@
surfaceScalarField phiU
(
"phiU",
(fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, rho, U, phi)
(fvc::interpolate(U) & mesh.Sf())
);
phi = phiU +

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

@ -1,4 +1,3 @@
namedEnumTest.C
EXE = $(FOAM_APPBIN)/NamedEnum
EXE = $(FOAM_USER_APPBIN)/NamedEnum

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

@ -1,3 +1,3 @@
callbackTest.C
EXE = $(FOAM_APPBIN)/callbackTest
EXE = $(FOAM_USER_APPBIN)/callbackTest

View File

@ -1,3 +1,3 @@
testDataEntry.C
EXE = $(FOAM_APPBIN)/testDataEntry
EXE = $(FOAM_USER_APPBIN)/testDataEntry

View File

@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "IOobject.H"
#include "IFstream.H"
#include "dictionary.H"
@ -40,30 +41,46 @@ using namespace Foam;
int main(int argc, char *argv[])
{
IFstream dictStream("testDict");
dictionary testDict(dictStream);
{
dictionary dict(IFstream("testDict")());
Info<< "dict: " << dict << nl
<< "toc: " << dict.toc() << nl
<< "keys: " << dict.keys() << nl
<< "patterns: " << dict.keys(true) << endl;
}
Info<< testDict << endl;
IOobject::writeDivider(Info);
{
dictionary someDict;
someDict.add(keyType("a.*", true), "subdictValue");
dictionary dict(IFstream("testDictRegex")());
dict.add(keyType("fooba[rz]", true), "anything");
dictionary dict;
dict.add("someDict", someDict);
dict.add(keyType(".*", true), "parentValue");
Info<< "dict:" << dict << nl
<< "toc: " << dict.toc() << nl
<< "keys: " << dict.keys() << nl
<< "patterns: " << dict.keys(true) << endl;
Info<< "dict:" << dict << 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 pattern find \"foo\" in sub directory : "
<< dict.subDict("someDict").lookup("foo", true)
<< endl;
Info<< "Recursive pattern find \"fooz\" in sub directory : "
<< dict.subDict("someDict").lookup("fooz", true)
<< endl;
Info<< "Recursive pattern find \"bar\" in sub directory : "
<< dict.subDict("someDict").lookup("bar", true)
<< endl;
Info<< "Recursive pattern find \"xxx\" in sub directory : "
<< dict.subDict("someDict").lookup("xxx", true)
<< endl;
}
return 0;

View File

@ -0,0 +1,36 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDictRegex;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputMode merge
".*" parentValue1;
"[n-z].*" parentValue2;
"f.*" parentValue3;
keyX parentValue4;
keyY parentValue5;
"(.*)Dict"
{
foo subdictValue0;
bar $f.*; // should this really match 'foo'?
// result is dependent on insert order!
"a.*c" subdictValue3;
"ab.*" subdictValue2;
"a.*" subdictValue1;
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

@ -28,6 +28,7 @@ Description
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
using namespace Foam;
@ -36,13 +37,19 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
// timeSelector::addOptions();
timeSelector::addOptions(true, true);
# include "setRootCase.H"
# include "createTime.H"
Info<< runTime.times() << endl;
Info<< "Times found:" << runTime.times() << endl;
Info << "End\n" << endl;
instantList timeDirs = timeSelector::select0(runTime, args);
Info<< "Times selected:" << timeDirs << endl;
Info<< "\nEnd\n" << 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

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

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Description
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "IOobject.H"
#include "IFstream.H"
#include "regExp.H"
#include "List.H"
#include "Tuple2.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
List<Tuple2<string, string> > rawList(IFstream("testRegexps")());
Info<< "input list:" << rawList << endl;
IOobject::writeDivider(Info);
Info<< endl;
List<string> groups;
// report matches:
forAll(rawList, elemI)
{
const string& pat = rawList[elemI].first();
const string& str = rawList[elemI].second();
regExp re(pat);
Info<< str << " =~ m/" << pat.c_str() << "/ == ";
if (re.match(str, groups))
{
Info<< "true";
if (re.ngroups())
{
Info<< groups;
}
}
else
{
Info<< "false";
if (re.match(str, true))
{
Info<< " partial match";
}
}
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

@ -0,0 +1,20 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// pattern, string
(
( "a.*" "abc" )
( "a.*" "bac" )
( "a.*" "abcd" )
( "a.*" "def" )
( "d(.*)f" "def" )
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

@ -26,7 +26,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "stringList.H"
#include "stringListOps.H"
#include "IOstreams.H"
using namespace Foam;

View File

@ -1,4 +1,3 @@
xferListTest.C
/* EXE = $(FOAM_USER_APPBIN)/xferListTest */
EXE = ./xferListTest
EXE = $(FOAM_USER_APPBIN)/xferListTest

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

@ -292,6 +292,7 @@ meshQualityControls
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13;

View File

@ -45,8 +45,10 @@ Description
int main(int argc, char *argv[])
{
// enable -constant ... if someone really wants it
// enable -zeroTime to prevent accidentally trashing the initial fields
timeSelector::addOptions(true, true);
argList::noParallel();
timeSelector::addOptions();
# include "addRegionOption.H"
argList::validOptions.insert("fields", "\"(list of fields)\"");

View File

@ -74,7 +74,9 @@ using namespace Foam;
int main(int argc, char *argv[])
{
// with -constant and -zeroTime
// enable -constant
// probably don't need -zeroTime though, since the fields are vetted
// afterwards anyhow
timeSelector::addOptions(true, false);
argList::noParallel();
argList::validOptions.insert("ascii", "");

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

@ -0,0 +1,3 @@
foamUpgradeFvSolution.C
EXE = $(FOAM_APPBIN)/foamUpgradeFvSolution

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
foamUpgradeFvSolution
Description
Simple tool to upgrade the syntax of system/fvSolution::solvers
Usage
- foamUpgradeFvSolution [OPTION]
@param -test \n
Suppress writing the updated fvSolution file
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "IOdictionary.H"
#include "solution.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("test", "");
# include "setRootCase.H"
# include "createTime.H"
IOdictionary solutionDict
(
IOobject
(
"fvSolution",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
label nChanged = 0;
entry* e = solutionDict.lookupEntryPtr("solvers", false, false);
if (e && e->isDict())
{
nChanged = solution::upgradeSolverDict(e->dict(), true);
}
Info<< nChanged << " solver settings changed" << nl << endl;
if (nChanged)
{
if (args.options().found("test"))
{
Info<< "-test option: no changes made" << nl << endl;
}
else
{
mv
(
solutionDict.objectPath(),
solutionDict.objectPath() + ".old"
);
solutionDict.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
IOstream::UNCOMPRESSED
);
Info<< "Backup to " << (solutionDict.objectPath() + ".old") << nl
<< "Write to " << solutionDict.objectPath() << nl << endl;
}
}
return 0;
}
// ************************************************************************* //

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

@ -38,7 +38,7 @@ usage: ${0##*/} [OPTION]
options:
-case dir specify alternative case directory
-region name specify mesh region name
-touch create the .OpenFOAM file only and exit
-touch only create the .OpenFOAM file
* start paraview $ParaView_VERSION with the OpenFOAM libraries
@ -56,18 +56,17 @@ do
usage
;;
-case)
[ "$#" -ge 2 ] || usage "'-case' option requires an argument"
caseDir=$2
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
shift 2
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'"
;;
-region)
[ "$#" -ge 2 ] || usage "'-region' option requires an argument"
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
regionName=$2
shift 2
;;
-touch)
touchOnly=1
touchOnly=true
shift
;;
*)
@ -79,12 +78,15 @@ done
# get a sensible caseName
caseName=${PWD##*/}
caseFile="$caseName.OpenFOAM"
fvControls="system"
if [ -n "$regionName" ]
then
caseFile="$caseName{$regionName}.OpenFOAM"
fvControls="$fvControls/$regionName"
fi
if [ -n "$touchOnly" ];
if [ -n "$touchOnly" ]
then
touch "$caseFile"
echo "created '$caseFile'"
@ -98,7 +100,7 @@ case "$caseName" in
esac
# check existence of essential files
for check in system/controlDict system/fvSchemes system/fvSolution
for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done
@ -107,17 +109,17 @@ done
case "$ParaView_VERSION" in
2*)
trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
touch $caseFile
touch "$caseFile"
# since we are now in the cwd, %CASE% is '$PWD/$caseFile'
sed -e s@%CASE%@$PWD/$caseFile@g \
$WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs
$WM_PROJECT_DIR/bin/tools/paraFoam.pvs > paraFoam.pvs
paraview paraFoam.pvs
;;
*)
# only create/remove caseFile if it doesn't exist
# only create/remove caseFile if it didn't already exist
[ -e $caseFile ] || {
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
touch "$caseFile"

View File

@ -1,2 +1,2 @@
Misc. tools for building applications, etc that are useful to have
but which don't really need to be in the PATH.
Misc. tools, scripts, templates that are useful (eg, for building applications)
but don't need to be in the PATH.

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,6 +2,9 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
# force update of Foam::FOAMversion string (git tag or $WM_PROJECT_VERSION)
/bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS
Pstream/Allwmake

View File

@ -2,6 +2,7 @@ signals/sigFpe.C
signals/sigSegv.C
signals/sigInt.C
signals/sigQuit.C
regExp.C
timer.C
fileStat.C
Unix.C

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

@ -0,0 +1,208 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\*---------------------------------------------------------------------------*/
#include <sys/types.h>
#include "regExp.H"
#include "label.H"
#include "string.H"
#include "List.H"
#include "IOstreams.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
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)
{
FatalErrorIn
(
"regExp::compile(const char*)"
) << "Failed to compile regular expression '" << pat << "'"
<< exit(FatalError);
}
}
}
void Foam::regExp::clear() const
{
if (preg_)
{
regfree(preg_);
delete preg_;
preg_ = 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regExp::regExp()
:
preg_(0)
{}
Foam::regExp::regExp(const string& pat)
:
preg_(0)
{
compile(pat.c_str());
}
Foam::regExp::regExp(const char* pat)
:
preg_(0)
{
compile(pat);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regExp::~regExp()
{
clear();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
int Foam::regExp::ngroups() const
{
return preg_ ? preg_->re_nsub : 0;
}
bool Foam::regExp::match
(
const string& str,
bool partialMatch
) const
{
if (preg_ && str.size())
{
size_t nmatch = 1;
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
&&
(
partialMatch
|| (pmatch[0].rm_so == 0 && pmatch[0].rm_eo == label(str.size()))
)
)
{
return true;
}
}
return false;
}
bool Foam::regExp::match
(
const string& str,
List<string>& groups,
bool partialMatch
) const
{
if (preg_ && str.size())
{
size_t nmatch = ngroups() + 1;
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
&&
(
partialMatch
|| (pmatch[0].rm_so == 0 && pmatch[0].rm_eo == label(str.size()))
)
)
{
groups.setSize(ngroups());
label groupI = 0;
for (size_t matchI = 1; matchI < nmatch; matchI++)
{
if (pmatch[matchI].rm_so != -1 && pmatch[matchI].rm_eo != -1)
{
groups[groupI] = str.substr
(
pmatch[matchI].rm_so,
pmatch[matchI].rm_eo - pmatch[matchI].rm_so
);
}
else
{
groups[groupI].clear();
}
groupI++;
}
return true;
}
}
groups.clear();
return false;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::regExp::operator=(const string& pat)
{
compile(pat.c_str());
}
void Foam::regExp::operator=(const char* pat)
{
compile(pat);
}
// ************************************************************************* //

View File

@ -23,94 +23,108 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::regularExpression
Foam::regExp
Description
Wrapper around regular expressions.
Wrapper around POSIX extended regular expressions.
The beginning-of-line (^) and the end-of-line ($) anchors are implicit
by default.
SeeAlso
The manpage regex(7) for more information about POSIX regular expressions.
These differ somewhat from @c Perl and @c sed regular expressions.
SourceFiles
regExp.C
\*---------------------------------------------------------------------------*/
#ifndef regularExpression_H
#define regularExpression_H
#ifndef regExp_H
#define regExp_H
#include <sys/types.h>
#include <regex.h>
#include "string.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class string;
template<class T> class List;
/*---------------------------------------------------------------------------*\
Class regularExpression Declaration
Class regExp Declaration
\*---------------------------------------------------------------------------*/
class regularExpression
class regExp
{
// Private data
//- Precompiled regular expression
regex_t* preg_;
mutable regex_t* preg_;
// Private member functions
//- release allocated space
void clear() const;
//- compile into a regular expression
void compile(const char*) const;
//- Disallow default bitwise copy construct
regularExpression(const regularExpression&);
regExp(const regExp&);
//- Disallow default bitwise assignment
void operator=(const regularExpression&);
void operator=(const regExp&);
public:
// Constructors
//- Construct null
regExp();
//- Construct from string
inline regularExpression(const string& s)
{
preg_ = new regex_t;
if (regcomp(preg_, s.c_str(), REG_EXTENDED) != 0)
{
FatalErrorIn
(
"regularExpression::regularExpression(const char*)"
) << "Failed to compile regular expression " << s
<< exit(FatalError);
}
}
regExp(const string&);
//- Construct from character array
regExp(const char*);
// Destructor
//- Construct from string
inline ~regularExpression()
{
if (preg_)
{
regfree(preg_);
delete preg_;
}
}
~regExp();
// Member functions
//- Matches?
inline bool matches(const string& s) const
{
size_t nmatch = 1;
regmatch_t pmatch[1];
//- Return the number of (groups)
int ngroups() const;
int errVal = regexec(preg_, s.c_str(), nmatch, pmatch, 0);
//- Return true if it matches, partial matches are optional
bool match
(
const string&,
bool partialMatch=false
) const;
//- Return true if it matches and sets the sub-groups matched,
// partial matches are optional
bool match
(
const string&,
List<string>& groups,
bool partialMatch=false
) const;
// Member Operators
//- Assign from a string
void operator=(const string&);
//- Assign from a character array
void operator=(const char*);
return (errVal == 0 && pmatch[0].rm_eo == label(s.size()));
}
};

View File

@ -289,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

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