Commit 619f7838 authored by mattijs's avatar mattijs
Browse files

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

parents dab67ba5 c2dd9825
......@@ -33,9 +33,13 @@ Description
#include "IOstreams.H"
#include "IStringStream.H"
#include "labelList.H"
#include "DynamicList.H"
#include "face.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
......@@ -43,12 +47,12 @@ int main(int argc, char *argv[])
{
List<label> lstA(10);
List<label> lstC(IStringStream("(1 2 3 4)")());
forAll(lstA, i)
{
lstA[i] = i;
}
Info<< "lstA: " << lstA << endl;
Info<< "lstC: " << lstC << endl;
......@@ -72,10 +76,10 @@ int main(int argc, char *argv[])
Info<< "lstC: " << lstC << endl;
xB = xA;
List<label> lstD(xferCopy(lstC));
List<label> lstE(xferMove(lstC));
// this must be empty
List<label> lstF = xferCopy(lstC);
......@@ -88,12 +92,30 @@ int main(int argc, char *argv[])
Info<< "lstE: " << lstE << endl;
Info<< "lstF: " << lstF << endl;
Info<< "xB size: " << xB->size() << endl;
Info<< "xB[" << xB->size() << "]\n";
// clear the underlying List
xB->clear();
Info<< "xB size: " << xB->size() << endl;
Info<< "xB[" << xB->size() << "]\n";
DynamicList<label> dl(10);
for (label i = 0; i < 5; i++)
{
dl.append(i);
}
face f1(dl);
face f2(xferCopy<labelList>(dl));
Info<< "dl[" << dl.size() << "/" << dl.allocSize() << "] " << 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<< "f3: " << f3 << endl;
return 0;
}
......
......@@ -316,11 +316,10 @@ autoPtr<mapPolyMesh> reorderMesh
mesh.resetPrimitives
(
mesh.nFaces(),
mesh.points(),
newFaces,
newOwner,
newNeighbour,
xfer<pointField>::null(),
xferMove(newFaces),
xferMove(newOwner),
xferMove(newNeighbour),
patchSizes,
patchStarts
);
......
09/01/04
2008-10-23
Contents:
surfaceAdd
adds to surface files. (but does not intersect or anything)
- adds to surface files. (but does not intersect or anything)
surfaceBooleanOp
Boolean operations (add, or, xor) on closed surfaces. Probably not working.
- Boolean operations (add, or, xor) on closed surfaces. Probably not working.
surfaceCheck
checks surface for incorrect topology. Checks normals of neighbouring faces.
- checks surface for incorrect topology. Checks normals of neighbouring faces.
surfaceCoarsen
Stan Melax coarsening algorithm
- Stan Melax coarsening algorithm
surfaceConvert
Converts surfaces to/from various formats
- Converts surfaces to/from various formats
surfaceFind
Finds nearest vertex and face to given point.
- Finds nearest vertex and face to given point.
surfaceMeshTriangulate
Triangulate external facses of mesh and write as surface.
- Triangulate external facses of mesh and write as surface.
surfacePointMerge
Explicit point merge of surface.
- Explicit point merge of surface.
surfaceSetOutside
Orient normals on (closed) surface.
- Orient normals on (closed) surface.
surfaceSmooth
Laplacian smoothing on surface vertices
- Laplacian smoothing on surface vertices
surfaceSubset
Subsets surface
- Subsets surface
surfaceToPatch
Applies region information of surfaces to mesh. Each external face of mesh
gets region number of nearest surface triangle.
- Applies region information of surfaces to mesh.
Each external face of mesh gets region number of nearest surface triangle.
-------------------------------------------------------------------------------
surfaceMeshConvert
- Similar to surfaceConvert, but uses surfMesh library
surfaceMeshConvert.C
EXE = $(FOAM_APPBIN)/surfaceMeshConvert
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = -lsurfMesh
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
surfaceMeshConvert
Description
Converts from one surface mesh format to another
Usage
- surfaceMeshConvert inputFile outputFile [OPTION]
@param -clean \n
Perform some surface checking/cleanup on the input surface
@param -scale \<scale\> \n
Specify a scaling factor for writing the files
@param -triSurface \n
Use triSurface library for input/output
Note
The filename extensions are used to determine the file format type.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "meshedSurface.H"
#include "triSurface.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("clean", "");
argList::validOptions.insert("triSurface", "");
# include "setRootCase.H"
const stringList& params = args.additionalArgs();
scalar scaleFactor = 0;
if (args.options().found("scale"))
{
IStringStream(args.options()["scale"])() >> scaleFactor;
}
fileName importName(params[0]);
fileName exportName(params[1]);
if
(
!meshedSurface::canRead(importName.ext(), true)
|| !meshedSurface::canWrite(exportName.ext(), true)
)
{
return 1;
}
if (args.options().found("triSurface"))
{
// # include "createTime.H"
// instantList timeDirs = timeSelector::select0(runTime, args);
// # include "createPolyMesh.H"
triSurface surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
Info << "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " triSurface does not yet support scaling "
<< scaleFactor << endl;
// surf.scalePoints(scaleFactor);
}
surf.write(exportName);
}
else
{
meshedSurface surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
surf.scalePoints(scaleFactor);
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " with scaling " << scaleFactor << endl;
}
surf.write(exportName);
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //
......@@ -36,7 +36,7 @@ usage() {
usage: ${0##*/} <type> {args}
* create a new standard OpenFOAM source file
* create a new standard OpenFOAM source or template file
type: (source|template)
......@@ -46,25 +46,24 @@ USAGE
if [ "$#" -lt 2 ]
then
usage "wrong number of arguments, expected 2 (or more)"
usage "wrong number of arguments, expected 2 (or more)"
fi
case "$1" in
-h | -help)
usage
;;
usage
;;
source)
shift
$WM_PROJECT_DIR/bin/foamTemplates/source/newSource $*
;;
shift
$WM_PROJECT_DIR/bin/foamTemplates/source/newSource $*
;;
template)
shift
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $*
;;
shift
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $*
;;
*)
usage "unknown type"
;;
usage "unknown type"
;;
esac
#------------------------------------------------------------------------------
......@@ -38,20 +38,20 @@ packFile=${packDir}_${timeStamp}.gtgz
if [ ! -d $packDir ]
then
echo "Error: directory $packDir does not exist"
exit 1
echo "Error: directory $packDir does not exist" 1>&2
exit 1
fi
# add optional output directory
if [ -d "$1" ]
then
packFile="$1/$packFile"
packFile="$1/$packFile"
fi
if [ -f $packFile ]
then
echo "Error: $packFile already exists"
exit 1
echo "Error: $packFile already exists" 1>&2
exit 1
fi
# Create time stamp file
......@@ -102,10 +102,10 @@ tar czpf $packFile --files-from $tmpFile
if [ $? = 0 ]
then
echo "Finished packing and compressing $packDir into file $packFile"
echo "Finished packing and compressing $packDir into file $packFile"
else
echo "Error: failure packing $packDir into file $packFile"
rm -f $packFile 2>/dev/null
echo "Error: failure packing $packDir into file $packFile" 1>&2
rm -f $packFile 2>/dev/null
fi
#------------------------------------------------------------------------------
......@@ -34,6 +34,7 @@ packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packTag=_Doxygen.gtgz
usage() {
while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done
cat <<USAGE 1>&2
Usage: ${0##*/} [-prefix DIR] [-o outputDir]
......@@ -47,38 +48,38 @@ unset prefix outputDir
while [ "$#" -gt 0 ]
do
case $1 in
-prefix | --prefix )
prefix=${2%%/}
shift 2
;;
-o | -output )
outputDir=${2%%/}
shift 2
;;
-h | -help )
usage
;;
-*)
usage "unknown option: '$*'"
;;
esac
case $1 in
-prefix | --prefix )
prefix=${2%%/}
shift 2
;;
-o | -output )
outputDir=${2%%/}
shift 2
;;
-h | -help )
usage
;;
-*)
usage "unknown option: '$*'"
;;
esac
done
# if packing from within the directory, use -prefix form
if [ "${PWD##*/}" = "$packDir" ]
then
: ${prefix:=$packDir}
: ${prefix:=$packDir}
fi
# pack the directories directly and add prefix afterwards
if [ -n "$prefix" ]
then
packDir="$prefix"
packDir="$prefix"
elif [ ! -d $packDir ]
then
echo "Error: directory $packDir does not exist"
exit 1
echo "Error: directory $packDir does not exist" 1>&2
exit 1
fi
#
......
......@@ -36,26 +36,25 @@
foamVersion=$WM_PROJECT_VERSION
usage() {
cat<<USAGE
cat<<USAGE
usage: ${0##*/} [OPTION] <file1> ... <fileN>
options:
-v "<version>" specifies the version to be written in the header
-h help
-v VER specifies the version to be written in the header
-h help
Updates the header of application files.
Updates the header of application files and removes consecutive blank lines.
By default, writes current version in the header.
Alternatively version can be specified with -v option.
Also removes consecutive blank lines from file.
An alternative version can be specified with -v option.
USAGE
exit 1
exit 1
}
printHeader() {
cat<<HEADER
cat<<HEADER
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
......@@ -78,7 +77,7 @@ HEADER
# extract attribute '$1' from file '$2'
#
FoamFileAttribute() {
sed -n -e 's/[ ;]*$//' -e "s/^ *$1 *//p" $2
sed -n -e 's/[ ;]*$//' -e "s/^ *$1 *//p" $2
}
......@@ -88,22 +87,22 @@ FoamFileAttribute() {
OPTS=`getopt hv: $*`
if [ $? -ne 0 ]
then
echo "Aborting due to invalid option"
usage
echo "Aborting due to invalid option"
usage
fi
eval set -- '$OPTS'
while [ "$1" != "--" ]
do
case $1 in
-v)
foamVersion=$2
shift
;;
-h)
usage
;;
esac
shift
case $1 in
-v)
foamVersion=$2
shift
;;
-h)
usage
;;
esac
shift
done
shift
......@@ -118,24 +117,24 @@ foamVersion=`printf %-36s $foamVersion`
#
for caseFile
do
if grep FoamFile $caseFile >/dev/null 2>&1
then
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`
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
else
echo " Invalid case file: $caseFile"
fi
if grep FoamFile $caseFile >/dev/null 2>&1
then
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`
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
else
echo " Invalid case file: $caseFile" 1>&2
fi
done
#------------------------------------------------------------------------------
......@@ -37,7 +37,7 @@
#------------------------------------------------------------------------------
usage() {
cat<<USAGE
cat<<USAGE
usage: ${0##*/} <turbulenceProperties>
......@@ -57,42 +57,42 @@ USAGE
#
convertDict()
{
echo "Identified $1 turbulence model in '$3'"
outputPath=`dirname $3`
echo "Identified $1 turbulence model in '$3'"
outputPath=`dirname $3`
if [ -e "$outputPath/$1Properties" ]
then
echo "Error: file already exists $outputPath/$1Properties'"
else
sed -e "s/turbulenceProperties/$1Properties/" \
-e "s/$2/$1Model/" \
-e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \
$3 > "$outputPath/$1Properties"
if [ -e "$outputPath/$1Properties" ]
then
echo "Error: file already exists $outputPath/$1Properties'" 1>&2
else
sed -e "s/turbulenceProperties/$1Properties/" \
-e "s/$2/$1Model/" \
-e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \
$3 > "$outputPath/$1Properties"
echo " wrote $outputPath/$1Properties"
fi
echo " wrote $outputPath/$1Properties"
fi
}
[ $# -ge 1 ] || usage
for turbDict
do