Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4a2a23a7
Commit
4a2a23a7
authored
May 25, 2008
by
henry
Browse files
Lots of changes from Mark and my changes to ddtPhiCorr all mixed together
because I failed to work out how to merge Mark's stuff -- HELP!!!
parent
a016fa31
Changes
60
Hide whitespace changes
Inline
Side-by-side
applications/Allwmake
View file @
4a2a23a7
#!/bin/sh
set
-x
(
cd
solvers
;
wmake all
)
(
cd
utilities
;
wmake all
)
(
cd
solvers
&&
wmake all
)
(
cd
utilities
&&
wmake all
)
applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C
View file @
4a2a23a7
...
...
@@ -56,32 +56,35 @@ int main(int argc, char *argv[])
{
# include "readControls.H"
# include "CourantNo.H"
p
.
storePrevIter
();
// Make the fluxes absolute
fvc
::
makeAbsolute
(
phi
,
U
);
# include "setDeltaT.H"
runTime
++
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
bool
meshChanged
=
mesh
.
update
();
// Make the fluxes absolute
if
(
mesh
.
changing
())
{
phi
=
fvc
::
interpolate
(
U
)
&
mesh
.
Sf
();
}
mesh
.
update
();
if
(
correctPhi
&&
meshChanged
)
if
(
mesh
.
changing
()
&&
correctPhi
)
{
# include "correctPhi.H"
}
// Keep the absolute fluxes for use in ddtPhiCorr
surfaceScalarField
phiAbs
(
"phiAbs"
,
phi
);
surfaceScalarField
phiAbs
0
(
"phiAbs
0
"
,
phi
);
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
if
(
mesh
.
changing
())
{
fvc
::
makeRelative
(
phi
,
U
);
}
if
(
mesh
C
hang
ed
&&
checkMeshCourantNo
)
if
(
mesh
.
c
hang
ing
()
&&
checkMeshCourantNo
)
{
# include "meshCourantNo.H"
}
...
...
@@ -89,6 +92,8 @@ int main(int argc, char *argv[])
// --- PIMPLE loop
for
(
int
ocorr
=
0
;
ocorr
<
nOuterCorr
;
ocorr
++
)
{
p
.
storePrevIter
();
# include "UEqn.H"
// --- PISO loop
...
...
@@ -101,10 +106,50 @@ int main(int argc, char *argv[])
if
(
ddtPhiCorr
)
{
phi
+=
fvc
::
ddtPhiCorr
(
rAU
,
U
,
phiAbs
);
if
(
mesh
.
changing
())
{
dimensionedScalar
rDeltaT
=
1
.
0
/
mesh
.
time
().
deltaT
();
volScalarField
V0byV
(
IOobject
(
"V0byV"
,
mesh
.
time
().
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
"V0byV"
,
dimless
,
1
),
zeroGradientFvPatchScalarField
::
typeName
);
V0byV
.
dimensionedInternalField
()
=
mesh
.
V0
()
/
mesh
.
V
();
V0byV
.
correctBoundaryConditions
();
phi
+=
rDeltaT
*
(
fvc
::
interpolate
(
rAU
*
V0byV
)
*
phiAbs0
-
(
fvc
::
interpolate
(
rAU
*
V0byV
*
U
.
oldTime
())
&
mesh
.
Sf
())
);
}
else
{
phi
+=
fvc
::
ddtPhiCorr
(
rAU
,
U
,
phiAbs0
);
}
}
adjustPhi
(
phi
,
U
,
p
);
if
(
p
.
needReference
())
{
if
(
mesh
.
changing
())
{
fvc
::
makeRelative
(
phi
,
U
);
adjustPhi
(
phi
,
U
,
p
);
fvc
::
makeAbsolute
(
phi
,
U
);
}
else
{
adjustPhi
(
phi
,
U
,
p
);
}
}
for
(
int
nonOrth
=
0
;
nonOrth
<=
nNonOrthCorr
;
nonOrth
++
)
{
...
...
@@ -138,11 +183,11 @@ int main(int argc, char *argv[])
p
.
relax
();
}
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
U
-=
rAU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
}
}
...
...
applications/solvers/multiphase/interDyMFoam/interDyMFoam.C
View file @
4a2a23a7
...
...
@@ -41,6 +41,7 @@ Description
#include
"twoPhaseMixture.H"
#include
"incompressible/turbulenceModel/turbulenceModel.H"
#include
"probes.H"
#include
"EulerDdtScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -66,7 +67,6 @@ int main(int argc, char *argv[])
{
#include
"readControls.H"
#include
"CourantNo.H"
#include
"setDeltaT.H"
runTime
++
;
...
...
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
// Make the fluxes absolute
if
(
mesh
.
changing
())
{
fvc
::
makeAbs
ol
u
te
(
phi
,
U
);
phi
=
fvc
::
interp
ol
a
te
(
U
)
&
mesh
.
Sf
(
);
}
scalar
timeBeforeMeshUpdate
=
runTime
.
elapsedCpuTime
();
...
...
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
}
// Keep the absolute fluxes for use in ddtPhiCorr
surfaceScalarField
phiAbs
(
"phiAbs"
,
phi
);
surfaceScalarField
phiAbs
0
(
"phiAbs
0
"
,
phi
);
// Make the fluxes relative to the mesh motion
if
(
mesh
.
changing
())
...
...
@@ -125,8 +125,6 @@ int main(int argc, char *argv[])
#include
"pEqn.H"
}
#include
"continuityErrs.H"
p
=
pd
+
rho
*
gh
;
if
(
pd
.
needReference
())
...
...
applications/solvers/multiphase/interDyMFoam/pEqn.H
View file @
4a2a23a7
...
...
@@ -2,21 +2,42 @@
volScalarField
rAU
=
1
.
0
/
UEqn
.
A
();
surfaceScalarField
rAUf
=
fvc
::
interpolate
(
rAU
);
volVectorField
HU
=
UEqn
.
H
();
U
=
rAU
*
HU
;
U
=
rAU
*
UEqn
.
H
();
surfaceScalarField
phiU
(
"phiU"
,
(
fvc
::
interpolate
(
U
)
&
mesh
.
Sf
()));
if
(
ddtPhiCorr
)
{
phiU
+=
fvc
::
ddtPhiCorr
(
rAU
,
rho
,
U
,
phiAbs
);
//phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0);
dimensionedScalar
rDeltaT
=
1
.
0
/
mesh
.
time
().
deltaT
();
volScalarField
V0byV
(
IOobject
(
"V0byV"
,
mesh
.
time
().
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
"V0byV"
,
dimless
,
1
),
zeroGradientFvPatchScalarField
::
typeName
);
V0byV
.
dimensionedInternalField
()
=
mesh
.
V0
()
/
mesh
.
V
();
V0byV
.
correctBoundaryConditions
();
phiU
+=
rDeltaT
*
(
fvc
::
interpolate
(
rAU
*
rho
.
oldTime
()
*
V0byV
)
*
phiAbs0
-
(
fvc
::
interpolate
(
rAU
*
rho
.
oldTime
()
*
V0byV
*
U
.
oldTime
())
&
mesh
.
Sf
())
);
}
phi
=
phiU
+
(
fvc
::
interpolate
(
interface
.
sigmaK
())
*
fvc
::
snGrad
(
gamma
)
-
ghf
*
fvc
::
snGrad
(
rho
)
)
*
rAUf
*
mesh
.
magSf
();
(
fvc
::
interpolate
(
interface
.
sigmaK
())
*
fvc
::
snGrad
(
gamma
)
-
ghf
*
fvc
::
snGrad
(
rho
)
)
*
rAUf
*
mesh
.
magSf
();
if
(
pd
.
needReference
())
{
...
...
@@ -59,6 +80,8 @@
U
+=
rAU
*
fvc
::
reconstruct
((
phi
-
phiU
)
/
rAUf
);
U
.
correctBoundaryConditions
();
#include
"continuityErrs.H"
// Make the fluxes relative to the mesh motion
fvc
::
makeRelative
(
phi
,
U
);
}
applications/utilities/mesh/conversion/ccm26ToFoam/Allwmake
View file @
4a2a23a7
#!/bin/sh
set
-x
# Some fun: prostar uses ccmio2.3, Star-ccm+ uses ccmio2.4
# compile cd-adapco's CCM library
wmake libso libccmio/libadf
wmake libso libccmio/libccmio
wmake libso libccmio/libcgns
(
cd
libccmio
;
wmake libso libadf
)
(
cd
libccmio
;
wmake libso libccmio
)
(
cd
libccmio
;
wmake libso libcgns
)
(
cd
ccm26ToFoam
;
wmake
)
wmake ccm26ToFoam
bin/foamDiffSourceList
View file @
4a2a23a7
...
...
@@ -72,6 +72,7 @@ find -H $newDir \
!
-type
d
-type
f
\
!
-name
"*~"
\
-a
!
-name
".*~"
\
-a
!
-name
".#*"
\
-a
!
-name
"*.orig"
\
-a
!
-name
"*.dep"
\
-a
!
-name
"*.o"
\
...
...
@@ -83,10 +84,11 @@ find -H $newDir \
-a
!
-name
"log[0-9]*"
\
|
sed
\
-e
"
\@
$newDir
/lib/@d"
\
-e
"
\@
$newDir
/src/mico-[0-9.]*/platforms@d"
\
-e
"
\@
$newDir
/src/mpich-[0-9.]*/platforms@d"
\
-e
"
\@
$newDir
/src/mpich-[0-9.]*/lib@d"
\
-e
"
\@
$newDir
/src/lam-[0-9.]*/platforms@d"
\
-e
"
\@
$newDir
/src/other/mico-*/platforms@d"
\
-e
"
\@
$newDir
/src/other/mpich-*/platforms@d"
\
-e
"
\@
$newDir
/src/other/mpich-*/lib@d"
\
-e
"
\@
$newDir
/src/other/lam-*/platforms@d"
\
-e
"
\@
$newDir
/src/other/openmpi-*/platforms@d"
\
-e
'\@applications/bin/@d'
\
-e
'\@/t/@d'
\
-e
'\@Make[.A-Za-z]*/[^/]*/@d'
\
...
...
@@ -118,7 +120,7 @@ find -H $newDir \
done
)
# file fileCount
# file fileCount
fileCount
=
$(
cat
$tmpFile
|
wc
-l
)
echo
"----------------------------------------------------------------------"
echo
"pack
$fileCount
changed/new files"
...
...
bin/foamPack
View file @
4a2a23a7
...
...
@@ -86,10 +86,11 @@ find -H $packDir \
-a
!
-name
"so_locations"
\
|
sed
\
-e
"
\@
$packDir
/lib/@d"
\
-e
"
\@
$packDir
/src/mico-[0-9.]*/platforms@d"
\
-e
"
\@
$packDir
/src/mpich-[0-9.]*/platforms@d"
\
-e
"
\@
$packDir
/src/mpich-[0-9.]*/lib@d"
\
-e
"
\@
$packDir
/src/lam-[0-9.]*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mico-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-*/lib@d"
\
-e
"
\@
$packDir
/src/other/lam-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/openmpi-*/platforms@d"
\
-e
'\@applications/bin/@d'
\
-e
'\@/t/@d'
\
-e
'\@Make[.A-Za-z]*/[^/]*/@d'
\
...
...
bin/foamPackSource
View file @
4a2a23a7
...
...
@@ -75,11 +75,11 @@ find -H $packDir \
-a
!
-name
"log[0-9]*"
\
|
sed
\
-e
"
\@
$packDir
/lib/@d"
\
-e
"
\@
$packDir
/src/other/mico-
[0-9.]
*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-
[0-9.]
*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-
[0-9.]
*/lib@d"
\
-e
"
\@
$packDir
/src/other/lam-
[0-9.]
*/platforms@d"
\
-e
"
\@
$packDir
/src/other/openmpi-
[0-9.]
*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mico-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/mpich-*/lib@d"
\
-e
"
\@
$packDir
/src/other/lam-*/platforms@d"
\
-e
"
\@
$packDir
/src/other/openmpi-*/platforms@d"
\
-e
'\@applications/bin/@d'
\
-e
'\@/t/@d'
\
-e
'\@Make[.A-Za-z]*/[^/]*/@d'
\
...
...
bin/paraFoam
View file @
4a2a23a7
...
...
@@ -33,33 +33,33 @@
Script
=
${
0
##*/
}
usage
()
{
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
cat
<<
USAGE
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
cat
<<
USAGE
usage:
$Script
[-case dir]
* start paraview
$ParaView_VERSION
with the OpenFOAM libraries
USAGE
exit
1
exit
1
}
# parse options
if
[
"$#"
-gt
0
]
;
then
case
"
$1
"
in
-h
|
-help
)
usage
;;
-case
)
shift
caseDir
=
$1
[
"$#"
-ge
1
]
||
usage
"'-case' option requires an argument"
cd
"
$caseDir
"
2>/dev/null
||
usage
"directory does not exist: '
$caseDir
'"
;;
*
)
usage
"unknown option/argument: '
$*
'"
;;
esac
case
"
$1
"
in
-h
|
-help
)
usage
;;
-case
)
shift
caseDir
=
$1
[
"$#"
-ge
1
]
||
usage
"'-case' option requires an argument"
cd
"
$caseDir
"
2>/dev/null
||
usage
"directory does not exist: '
$caseDir
'"
;;
*
)
usage
"unknown option/argument: '
$*
'"
;;
esac
fi
# get a sensible caseName
...
...
@@ -67,41 +67,38 @@ caseName=${PWD##*/}
# parent directory for normal or parallel results
case
"
$caseName
"
in
processor
*
)
parentDir
=
".."
;;
*
)
parentDir
=
"."
;;
processor
*
)
parentDir
=
".."
;;
*
)
parentDir
=
"."
;;
esac
# check existence of essential files
for
check
in
system/controlDict system/fvSchemes system/fvSolution
do
[
-s
"
$parentDir
/
$check
"
]
||
usage
"file does not exist: '
$parentDir
/
$check
'"
[
-s
"
$parentDir
/
$check
"
]
||
usage
"file does not exist: '
$parentDir
/
$check
'"
done
OpenFoamExt
=
"
foam"
#
OpenFoamExt="
OpenFOAM"
caseFile
=
"
$caseName
.
foam"
#
caseFile="$caseName.
OpenFOAM"
if
[
"
$ParaView_VERSION
"
=
"3"
]
;
then
case
"
$ParaView_VERSION
"
in
2
*
)
# Clean up on termination and on Ctrl-C
trap
"rm -f paraFoam.pvs
$caseFile
2>/dev/null; exit 0"
EXIT TERM INT
touch
$caseFile
# check existence of essential files
for
check
in
system/controlDict system/fvSchemes system/fvSolution
do
[
-s
"
$parentDir
/
$check
"
]
||
usage
"file does not exist: '
$parentDir
/
$check
'"
done
# 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
touch
$caseName
.
$OpenFoamExt
paraview
--data
=
$caseName
.
$OpenFoamExt
rm
$caseName
.
$OpenFoamExt
2>/dev/null
paraview paraFoam.pvs
;;
else
# since we are now in the cwd, FOAM_ROOT/FOAM_CASE is '$PWD'
sed
-e
s%FOAM_ROOT/FOAM_CASE%
$PWD
%g
\
-e
s%FOAM_CASE%
$caseName
%g
$WM_PROJECT_DIR
/bin/paraFoam.pvs
>
paraFoam.pvs
touch
$caseName
.
$OpenFoamExt
paraview paraFoam.pvs
rm
paraFoam.pvs
$caseName
.
$OpenFoamExt
2>/dev/null
fi
*
)
# Clean up on termination and on Ctrl-C
trap
"rm -f
$caseFile
2>/dev/null; exit 0"
EXIT TERM INT
touch
$caseFile
paraview
--data
=
$caseFile
;;
esac
#------------------------------------------------------------------------------
etc/apps/paraview3/bashrc
View file @
4a2a23a7
...
...
@@ -41,18 +41,26 @@ export CMAKE_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6
if
[
-r
$CMAKE_HOME
]
;
then
export
PATH
=
$CMAKE_HOME
/bin:
$PATH
else
unset
CMAKE_HOME
fi
export
ParaView_VERSION
=
3
# export ParaView_VERSION="3.3-cvs"
export
ParaView_VERSION
=
3.3
export
ParaView_INST_DIR
=
$WM_PROJECT_INST_DIR
/
ParaView3.3-cvs
export
ParaView_INST_DIR
=
$WM_PROJECT_INST_DIR
/
paraview-
$ParaView_VERSION
export
ParaView_DIR
=
$ParaView_INST_DIR
/platforms/
$WM_OPTIONS
export
PYTHONPATH
=
$PYTHONPATH
:
$ParaView_DIR
/bin:
$ParaView_DIR
/Utilities/VTKPythonWrapping
if
[
"
$PYTHONPATH
"
]
;
then
export
PYTHONPATH
=
$PYTHONPATH
:
$ParaView_DIR
/Utilities/VTKPythonWrapping
else
export
PYTHONPATH
=
$ParaView_DIR
/Utilities/VTKPythonWrapping
fi
if
[
-r
$ParaView_DIR
]
;
then
export
PATH
=
$ParaView_DIR
/bin:
$PATH
export
LD_LIBRARY_PATH
=
$
{
ParaView_DIR
}
/bin
:
$
{
LD_LIBRARY_PATH
}
export
LD_LIBRARY_PATH
=
$ParaView_DIR
/lib/paraview-
$ParaView_VERSION
:
$LD_LIBRARY_PATH
export
PV_PLUGIN_PATH
=
$FOAM_LIBBIN
fi
...
...
etc/apps/paraview3/cshrc
View file @
4a2a23a7
...
...
@@ -41,11 +41,14 @@ setenv CMAKE_HOME $WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6
if
(
-r
$CMAKE_HOME
)
then
set
path
=(
$CMAKE_HOME
/bin
$path
)
else
unset
CMAKE_HOME
endif
setenv ParaView_VERSION 3
# setenv ParaView_VERSION 3.3-cvs
setenv ParaView_VERSION 3.3
setenv
ParaView_INST_DIR
$WM_PROJECT_INST_DIR
/
ParaView3.3-cvs
export
ParaView_INST_DIR
=
$WM_PROJECT_INST_DIR
/
paraview-
$ParaView_VERSION
setenv ParaView_DIR
$ParaView_INST_DIR
/platforms/
$WM_OPTIONS
if
(
$?
PYTHONPATH
)
then
...
...
@@ -56,7 +59,7 @@ endif
if
(
-r
$ParaView_INST_DIR
)
then
set
path
=(
$ParaView_DIR
/bin
$path
)
setenv LD_LIBRARY_PATH
$
{
ParaView_DIR
}
/bin
:
$
{
LD_LIBRARY_PATH
}
setenv LD_LIBRARY_PATH
$ParaView_DIR
/lib/paraview-
$ParaView_VERSION
:
$LD_LIBRARY_PATH
setenv PV_PLUGIN_PATH
$FOAM_LIBBIN
endif
...
...
etc/bashrc
View file @
4a2a23a7
...
...
@@ -63,7 +63,7 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Compiler (if set to "" use the system compiler)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export
WM_COMPILER
=
Gcc
export
WM_COMPILER
=
Gcc
43
export
WM_COMPILER_ARCH
=
export
WM_COMPILER_LIB_ARCH
=
...
...
etc/settings.sh
View file @
4a2a23a7
...
...
@@ -97,7 +97,14 @@ WM_COMPILER_INST=OpenFOAM
case
"
$WM_COMPILER_INST
"
in
OpenFOAM
)
export
WM_COMPILER_DIR
=
$FOAM_INST_DIR
/
$WM_ARCH
/gcc-4.2.2
$WM_COMPILER_ARCH
case
"
$WM_COMPILER
"
in
Gcc43
)
export
WM_COMPILER_DIR
=
$FOAM_INST_DIR
/
$WM_ARCH
/gcc-4.3.0
$WM_COMPILER_ARCH
;;
Gcc
)
export
WM_COMPILER_DIR
=
$FOAM_INST_DIR
/
$WM_ARCH
/gcc-4.2.2
$WM_COMPILER_ARCH
;;
esac
# Check that the compiler directory can be found
if
[
!
-d
"
$WM_COMPILER_DIR
"
]
...
...
src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
View file @
4a2a23a7
...
...
@@ -202,7 +202,12 @@ List<Key> HashTable<T, Key, Hash>::toc() const
template
<
class
T
,
class
Key
,
class
Hash
>
bool
HashTable
<
T
,
Key
,
Hash
>::
insert
(
const
Key
&
key
,
const
T
&
newEntry
)
bool
HashTable
<
T
,
Key
,
Hash
>::
set
(
const
Key
&
key
,
const
T
&
newEntry
,
const
bool
protect
)
{
if
(
tableSize_
==
0
)
{
...
...
@@ -210,40 +215,70 @@ bool HashTable<T, Key, Hash>::insert(const Key& key, const T& newEntry)
}
label
ii
=
Hash
()(
key
,
tableSize_
);
hashedEntry
*
existing
=
0
;
hashedEntry
*
prev
=
0
;
for
(
hashedEntry
*
n
=
table_
[
ii
];
n
;
n
=
n
->
next_
)
for
(
hashedEntry
*
curr
=
table_
[
ii
];
curr
;
curr
=
curr
->
next_
)
{
if
(
key
==
n
->
key_
)
if
(
key
==
curr
->
key_
)
{
existing
=
curr
;
break
;
}
prev
=
curr
;
}
// not found, insert it at the head
if
(
!
existing
)
{
table_
[
ii
]
=
new
hashedEntry
(
key
,
table_
[
ii
],
newEntry
);
nElmts_
++
;
if
(
double
(
nElmts_
)
/
tableSize_
>
0
.
8
)
{
# ifdef FULLDEBUG
if
(
debug
)
{
Info
<<
"HashTable<T, Key, Hash>::
in
se
r
t"
"(const Key& key, T newEntry) : "
"Cannot insert "
<<
key
<<
" already in hash tabl
e
\n
"
;
Info
<<
"HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry) : "
"Doubling table siz
e
\n
"
;
}
# endif
re
turn
false
;
re
size
(
2
*
tableSize_
)
;
}
}
table_
[
ii
]
=
new
hashedEntry
(
key
,
table_
[
ii
],
newEntry
);
nElmts_
++
;
if
(
double
(
nElmts_
)
/
tableSize_
>
0
.
8
)
else
if
(
protect
)
{
// found - but protected from overwriting
// this corresponds to the STL 'insert' convention
# ifdef FULLDEBUG
if
(
debug
)
{
Info
<<
"HashTable<T, Key, Hash>::
in
se
r
t"
"(const Key& key, T newEntry) : "
"Doubling table siz
e
\n
"
;
Info
<<
"HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry
, false
) : "
"Cannot insert "
<<
key
<<
" already in hash tabl
e
\n
"
;
}
# endif
return
false
;
}
else
{
// found - overwrite existing entry
// this corresponds to the Perl convention
hashedEntry
*
elemPtr
=
new
hashedEntry
(
key
,
existing
->
next_
,
newEntry
);
// replace existing element - within list or insert at the head
if
(
prev
)
{
prev
->
next_
=
elemPtr
;
}
else
{
table_
[
ii
]
=
elemPtr
;
}
resize
(
2
*
tableSize_
)
;