Commit 928a283a authored by mattijs's avatar mattijs
Browse files

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

parents 5722298f a2c058d5
......@@ -29,7 +29,7 @@ Description
Basic sub-grid obstacle flame-wrinking enhancement factor model.
Details supplied by J Puttock 2/7/06.
<b> Sub-grid flame area generation <\b>
<b> Sub-grid flame area generation </b>
\f$ n = N - \hat{\dwea{\vec{U}}}.n_{s}.\hat{\dwea{\vec{U}}} \f$
\f$ n_{r} = \sqrt{n} \f$
......
......@@ -29,7 +29,7 @@ Description
Basic sub-grid obstacle drag model.
Details supplied by J Puttock 2/7/06.
<b> Sub-grid drag term <\b>
<b> Sub-grid drag term </b>
The resistance term (force per unit of volume) is given by:
......@@ -43,7 +43,7 @@ Description
This is term is treated implicitly in UEqn.H
<b> Sub-grid turbulence generation <\b>
<b> Sub-grid turbulence generation </b>
The turbulence source term \f$ G_{R} \f$ occurring in the
\f$ \kappa-\epsilon \f$ equations for the generation of turbulence due
......
......@@ -43,16 +43,21 @@ int main(int argc, char *argv[])
ldl[0](3) = 3;
ldl[0](1) = 1;
ldl[0].setSize(5); // increase allocated size
ldl[1].setSize(10); // increase allocated size
ldl[1](2) = 2;
ldl[0].setCapacity(5); // increase allocated size
ldl[1].setCapacity(10); // increase allocated size
ldl[0].reserve(15); // should increase allocated size
ldl[1].reserve(5); // should not decrease allocated size
ldl[1](3) = 2; // allocates space and sets value
// this works without a segfault, but doesn't change the list size
ldl[0][4] = 4;
ldl[1] = 3;
Info<< "<ldl>" << ldl << "</ldl>" << nl << "sizes: ";
forAll(ldl, i)
{
Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize();
Info<< " " << ldl[i].size() << "/" << ldl[i].capacity();
}
Info<< endl;
......@@ -63,7 +68,7 @@ int main(int argc, char *argv[])
Info<< "<ldl>" << ldl << "</ldl>" << nl << "sizes: ";
forAll(ldl, i)
{
Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize();
Info<< " " << ldl[i].size() << "/" << ldl[i].capacity();
}
Info<< endl;
......@@ -78,10 +83,10 @@ int main(int argc, char *argv[])
{
dlA.append(i);
}
dlA.setSize(10);
dlA.setCapacity(10);
Info<< "<dlA>" << dlA << "</dlA>" << nl << "sizes: "
<< " " << dlA.size() << "/" << dlA.allocSize() << endl;
<< " " << dlA.size() << "/" << dlA.capacity() << endl;
dlB.transfer(dlA);
......@@ -91,10 +96,54 @@ int main(int argc, char *argv[])
Info<< "Transferred to dlB" << endl;
Info<< "<dlA>" << dlA << "</dlA>" << nl << "sizes: "
<< " " << dlA.size() << "/" << dlA.allocSize() << endl;
<< " " << dlA.size() << "/" << dlA.capacity() << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// try with a normal list:
List<label> lstA;
lstA.transfer(dlB);
Info<< "Transferred to normal list" << endl;
Info<< "<lstA>" << lstA << "</lstA>" << nl << "sizes: "
<< " " << lstA.size() << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// Copy back and append a few time
for (label i=0; i < 3; i++)
{
dlB.append(lstA);
}
Info<< "appended list a few times" << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// assign the list (should maintain allocated space)
dlB = lstA;
Info<< "assigned list" << endl;
Info<< "<dlB>" << dlB << "</dlB>" << nl << "sizes: "
<< " " << dlB.size() << "/" << dlB.allocSize() << endl;
<< " " << dlB.size() << "/" << dlB.capacity() << endl;
// Copy back and append a few time
for (label i=0; i < 3; i++)
{
dlB.append(lstA);
}
// check allocation granularity
DynamicList<label, 6, 0> dlC;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
dlC.reserve(dlB.size());
dlC = dlB;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl;
return 0;
}
......
......@@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "SortableList.H"
#include "ListOps.H"
using namespace Foam;
......@@ -35,42 +36,101 @@ using namespace Foam;
int main(int argc, char *argv[])
{
labelList orig(5);
labelList orig(8);
orig[0] = 7;
orig[1] = 4;
orig[1] = 9;
orig[2] = 1;
orig[3] = 2;
orig[4] = 9;
orig[4] = 4;
orig[5] = 7;
orig[6] = 4;
orig[7] = 0;
labelList order;
labelList a(orig);
Info << "before: " << a << endl;
sortedOrder(a, order);
Info<< "unsorted: " << a << endl;
sort(a);
Info << "after: " << a << endl;
Info<< "sorted: " << a << endl;
Info<< "indices: " << order << endl;
SortableList<label> b(orig);
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
Info<< "unsorted: " << orig << endl;
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
Info << "shrunk: " << b.shrink() << endl;
Info << "indices: " << b.indices() << endl;
Info<< "shrunk: " << b.shrink() << endl;
Info<< "indices: " << b.indices() << endl;
// repeat by assignment
b = orig;
Info << "unsorted: " << b << endl;
Info<< "unsorted: " << b << endl;
b.sort();
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
// find unique/duplicate values
b = orig;
Info<< "unsorted: " << b << endl;
uniqueOrder(b, order);
Info<< "unique: " << order << endl;
duplicateOrder(b, order);
Info<< "duplicate:" << order << endl;
// sort reverse
Info<< "unsorted: " << b << endl;
b.reverseSort();
Info<< "rsort: " << b << endl;
Info<< "indices: " << b.indices() << endl;
// transfer assignment
b.transfer(orig);
Info << "unsorted: " << b << endl;
a = orig;
b.transfer(a);
Info<< "unsorted: " << b << endl;
b.sort();
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
a.transfer(b);
Info<< "plain: " << a << endl;
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
// sort/duplicate/unique with identical values
b.setSize(8);
b = 5;
Info<< "unsorted: " << b << endl;
uniqueOrder(b, order);
Info<< "unique: " << order << endl;
duplicateOrder(b, order);
Info<< "duplicate:" << order << endl;
b.sort();
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
// with a single value
b.setSize(1);
Info<< "unsorted: " << b << endl;
uniqueOrder(b, order);
Info<< "unique: " << order << endl;
duplicateOrder(b, order);
Info<< "duplicate:" << order << endl;
b.sort();
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
Info<< "sorted: " << b << endl;
Info<< "indices: " << b.indices() << endl;
Info << "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -108,13 +108,13 @@ int main(int argc, char *argv[])
face f1(dl);
face f2(xferCopy<labelList>(dl));
Info<< "dl[" << dl.size() << "/" << dl.allocSize() << "] " << dl << endl;
Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
Info<< "f1: " << f1 << endl;
Info<< "f2: " << f2 << endl;
// note: using xferMoveTo to ensure the correct transfer() method is called
face f3( xferMoveTo<labelList>(dl) );
Info<< "dl[" << dl.size() << "/" << dl.allocSize() << "] " << dl << endl;
Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
Info<< "f3: " << f3 << endl;
return 0;
......
......@@ -109,7 +109,7 @@ Foam::label Foam::checkTopology
{
Info<< " Number of regions: " << rs.nRegions() << " (OK)."
<< endl;
}
else
{
......@@ -214,7 +214,7 @@ Foam::label Foam::checkTopology
const pointField& pts = pp.points();
const labelList& mp = pp.meshPoints();
boundBox bb(vector::zero, vector::zero);
boundBox bb; // zero-sized
if (returnReduce(mp.size(), sumOp<label>()) > 0)
{
bb.min() = pts[mp[0]];
......
......@@ -144,7 +144,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
wordList curPointZoneNames = pointZones().names();
if (curPointZoneNames.size() > 0)
{
pointZoneNames_.setSize(2*curPointZoneNames.size());
pointZoneNames_.setCapacity(2*curPointZoneNames.size());
}
forAll (curPointZoneNames, zoneI)
......@@ -157,7 +157,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
if (curFaceZoneNames.size() > 0)
{
faceZoneNames_.setSize(2*curFaceZoneNames.size());
faceZoneNames_.setCapacity(2*curFaceZoneNames.size());
}
forAll (curFaceZoneNames, zoneI)
{
......@@ -169,7 +169,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
if (curCellZoneNames.size() > 0)
{
cellZoneNames_.setSize(2*curCellZoneNames.size());
cellZoneNames_.setCapacity(2*curCellZoneNames.size());
}
forAll (curCellZoneNames, zoneI)
{
......
......@@ -354,7 +354,7 @@ bool domainDecomposition::writeDecomposition()
// Estimate size
forAll(zonePoints, zoneI)
{
zonePoints[zoneI].setSize(pz[zoneI].size() / nProcs_);
zonePoints[zoneI].setCapacity(pz[zoneI].size() / nProcs_);
}
// Use the pointToZone map to find out the single zone (if any),
......@@ -423,8 +423,8 @@ bool domainDecomposition::writeDecomposition()
{
label procSize = fz[zoneI].size() / nProcs_;
zoneFaces[zoneI].setSize(procSize);
zoneFaceFlips[zoneI].setSize(procSize);
zoneFaces[zoneI].setCapacity(procSize);
zoneFaceFlips[zoneI].setCapacity(procSize);
}
// Go through all the zoned faces and find out if they
......@@ -514,7 +514,7 @@ bool domainDecomposition::writeDecomposition()
// Estimate size
forAll(zoneCells, zoneI)
{
zoneCells[zoneI].setSize(cz[zoneI].size() / nProcs_);
zoneCells[zoneI].setCapacity(cz[zoneI].size() / nProcs_);
}
forAll (curCellLabels, celli)
......
......@@ -273,7 +273,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
}
}
return map;
return map;
}
......@@ -418,11 +418,7 @@ int main(int argc, char *argv[])
// Read point on individual processors to determine merge tolerance
// (otherwise single cell domains might give problems)
boundBox bb
(
point(GREAT, GREAT, GREAT),
point(-GREAT, -GREAT, -GREAT)
);
boundBox bb = boundBox::invertedBox;
for (label procI = 0; procI < nProcs; procI++)
{
......
......@@ -29,7 +29,6 @@ License
#include "GeometricField.H"
#include "meshToMesh.H"
#include "cuttingPlane.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -199,7 +199,6 @@ int main(int argc, char *argv[])
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
if (fromCsys.valid())
......
......@@ -104,13 +104,19 @@ int main(int argc, char *argv[])
{
triSurface surf(importName);
Info<< "Read surface:" << endl;
surf.writeStats(Info);
Info<< endl;
if (args.options().found("clean"))
{
Info<< "Cleaning up surface" << endl;
surf.cleanup(true);
surf.checkOrientation(true);
surf.writeStats(Info);
Info<< endl;
}
Info << "writing " << exportName;
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
......@@ -119,6 +125,8 @@ int main(int argc, char *argv[])
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
surf.writeStats(Info);
Info<< endl;
}
// write sorted by region
......@@ -128,13 +136,19 @@ int main(int argc, char *argv[])
{
UnsortedMeshedSurface<face> surf(importName);
Info<< "Read surface:" << endl;
surf.writeStats(Info);
Info<< endl;
if (args.options().found("clean"))
{
Info<< "Cleaning up surface" << endl;
surf.cleanup(true);
surf.checkOrientation(true);
surf.writeStats(Info);
Info<< endl;
}
Info << "writing " << exportName;
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
......@@ -143,8 +157,9 @@ int main(int argc, char *argv[])
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
surf.writeStats(Info);
Info<< endl;
}
surf.write(exportName);
}
#if 1
......@@ -152,10 +167,16 @@ int main(int argc, char *argv[])
{
MeshedSurface<triFace> surf(importName);
Info<< "Read surface:" << endl;
surf.writeStats(Info);
Info<< endl;
if (args.options().found("clean"))
{
Info<< "Cleaning up surface" << endl;
surf.cleanup(true);
surf.checkOrientation(true);
surf.writeStats(Info);
Info<< endl;
}
Info<< "writing " << exportName;
......@@ -167,6 +188,8 @@ int main(int argc, char *argv[])
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
surf.writeStats(Info);
Info<< endl;
}
surf.write(exportName);
}
......@@ -175,10 +198,16 @@ int main(int argc, char *argv[])
{
MeshedSurface<face> surf(importName);
Info<< "Read surface:" << endl;
surf.writeStats(Info);
Info<< endl;
if (args.options().found("clean"))
{
Info<< "Cleaning up surface" << endl;
surf.cleanup(true);
surf.checkOrientation(true);
surf.writeStats(Info);
Info<< endl;
}
Info<< "writing " << exportName;
......@@ -190,6 +219,8 @@ int main(int argc, char *argv[])
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
surf.writeStats(Info);
Info<< endl;
}
surf.write(exportName);
}
......
......@@ -24,47 +24,86 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# foamCheckSourceDeps
# rmdepold
#
# Description
# Usage: foamCheckSourceDeps [dir1 .. dirN]
# Usage: rmdepold [dir1 .. dirN]
#
# Search for *.dep files that are without a corresponding .C or .L file.
# These could indicate a directory that has been moved.
# - print questionable directory and dep file
# Remove *.dep files that are without a corresponding .C or .L file.
# This often occurs when a directory has been moved.
# - print questionable directory and the *.dep file
# - optionally remove empty directories
#------------------------------------------------------------------------------
if [ "$1" = "-h" -o "$1" = "-help" ]
then
cat <<USAGE 1>&2
Usage: ${0##*/} [dir1 .. dirN]
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE 1>&2
Usage: ${0##*/} [OPTION] [dir1 .. dirN]
options:
-rmdir find and remove empty directories (recursively)
Remove *.dep files that are without a corresponding .C or .L file.
This often occurs when a directory has been moved.
- print questionable directory and file
- optionally remove empty directories
Search for .dep files that are without a corresponding .C or .L file.
This could indicate a directory that has been moved.
- print questionable directory and file
USAGE
exit 1
fi
exit 1
}
if [ "$#" -eq 0 ]
then
set -- .
fi
unset optRmdir
for checkDir
# parse options
while [ "$#" -gt 0 ]
do
if [ -d $checkDir ]
then
find $checkDir -name '*.dep' -print | while read depFile;
do
Cfile=$(echo $depFile | sed -e 's/\.dep$/.C/')
# also check flex files
Lfile=$(echo $depFile | sed -e 's/\.C$/.L/')
if [ ! -f $Cfile -a ! -f $Lfile ]
then
echo "$(dirname $Cfile) ${depFile##*/}"
fi
done
fi
case "$1" in
-h | -help)
usage
;;
-rmdir)
optRmdir=true
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# default is the current directory
[ "$#" -gt 0 ] || set -- .
for checkDir
do
if [ -d $checkDir ]
then
echo "searching: $checkDir"
else