Merge branch 'master' into cvm

Conflicts:
	applications/test/momentOfInertia/Make/options
This commit is contained in:
graham
2009-12-04 18:00:52 +00:00
81 changed files with 1451 additions and 1018 deletions

2
.gitignore vendored
View File

@ -51,7 +51,9 @@ doc/[Dd]oxygen/latex
doc/[Dd]oxygen/man
# generated files in the main directory (e.g. ReleaseNotes-?.?.html)
# and in the doc directory
/*.html
/doc/*.html
# source packages - anywhere
*.tar.bz2

View File

@ -92,6 +92,8 @@ int main(int argc, char *argv[])
labelHashSet setD(1);
setD.insert(11);
setD.insert(100);
setD.insert(49);
setD.insert(36);
setD.insert(2008);
Info<< "setD : " << setD << endl;
@ -138,6 +140,17 @@ int main(int argc, char *argv[])
// this doesn't work (yet?)
// setD[12] = true;
List<label> someLst(10);
forAll(someLst, elemI)
{
someLst[elemI] = elemI*elemI;
}
label added = setD.set(someLst);
Info<< "added " << added << " from " << someLst.size() << endl;
Info<< "setD : " << setD << endl;
return 0;
}

View File

@ -2,4 +2,4 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume
-lmeshTools

View File

@ -89,7 +89,7 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~~~
scalar minRange = GREAT;
direction extrudeDir = -1;
direction extrudeDir = 4; //illegal value.
for (direction dir = 0; dir < 3; dir++)
{

View File

@ -274,7 +274,7 @@ addLayersControls
maxThicknessToMedialRatio 0.3;
// Angle used to pick up medial axis points
minMedianAxisAngle 130;
minMedianAxisAngle 90;
// Create buffer region for new layer terminations
nBufferCellsNoExtrude 0;

View File

@ -36,9 +36,10 @@ Description
- mesh with cells put into cellZones (-makeCellZones)
Note:
- Should work in parallel but cellZone interfaces cannot align with
processor boundaries so use the correct option in decomposition to
preserve those interfaces.
- Should work in parallel.
cellZones can differ on either side of processor boundaries in which case
the faces get moved from processor patch to directMapped patch. Not
ery well tested.
- If a cell zone gets split into more than one region it can detect
the largest matching region (-sloppyCellZones). This will accept any
region that covers more than 50% of the zone. It has to be a subset
@ -514,6 +515,10 @@ void getInterfaceSizes
EdgeMap<label>& interfaceSizes
)
{
// Internal faces
// ~~~~~~~~~~~~~~
forAll(mesh.faceNeighbour(), faceI)
{
label ownRegion = cellRegion[mesh.faceOwner()[faceI]];
@ -540,6 +545,47 @@ void getInterfaceSizes
}
}
// Boundary faces
// ~~~~~~~~~~~~~~
// Neighbour cellRegion.
labelList coupledRegion(mesh.nFaces()-mesh.nInternalFaces());
forAll(coupledRegion, i)
{
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
coupledRegion[i] = cellRegion[cellI];
}
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false);
forAll(coupledRegion, i)
{
label faceI = i+mesh.nInternalFaces();
label ownRegion = cellRegion[mesh.faceOwner()[faceI]];
label neiRegion = coupledRegion[i];
if (ownRegion != neiRegion)
{
edge interface
(
min(ownRegion, neiRegion),
max(ownRegion, neiRegion)
);
EdgeMap<label>::iterator iter = interfaceSizes.find(interface);
if (iter != interfaceSizes.end())
{
iter()++;
}
else
{
interfaceSizes.insert(interface, 1);
}
}
}
if (sumParallel && Pstream::parRun())
{
if (Pstream::master())
@ -672,6 +718,17 @@ autoPtr<mapPolyMesh> createRegionMesh
}
// Neighbour cellRegion.
labelList coupledRegion(mesh.nFaces()-mesh.nInternalFaces());
forAll(coupledRegion, i)
{
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
coupledRegion[i] = cellRegion[cellI];
}
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false);
// Topology change container. Start off from existing mesh.
polyTopoChange meshMod(mesh);
@ -691,16 +748,17 @@ autoPtr<mapPolyMesh> createRegionMesh
{
label faceI = exposedFaces[i];
if (!mesh.isInternalFace(faceI))
{
FatalErrorIn("createRegionMesh(..)")
<< "Exposed face:" << faceI << " is not an internal face."
<< " fc:" << mesh.faceCentres()[faceI]
<< exit(FatalError);
}
label ownRegion = cellRegion[mesh.faceOwner()[faceI]];
label neiRegion = cellRegion[mesh.faceNeighbour()[faceI]];
label neiRegion = -1;
if (mesh.isInternalFace(faceI))
{
neiRegion = cellRegion[mesh.faceNeighbour()[faceI]];
}
else
{
neiRegion = coupledRegion[faceI-mesh.nInternalFaces()];
}
label otherRegion = -1;
@ -1357,22 +1415,14 @@ int main(int argc, char *argv[])
}
}
// Different cellZones on either side of processor patch are not
// allowed for now. Convert to processorPatches or what?
// Different cellZones on either side of processor patch.
forAll(neiZoneID, i)
{
label faceI = i+mesh.nInternalFaces();
if (zoneID[mesh.faceOwner()[faceI]] != neiZoneID[i])
{
//blockedFace[faceI] = true;
FatalErrorIn(args.executable())
<< "Coupled face " << faceI
<< " fc:" << mesh.faceCentres()[faceI]
<< " has cellZone " << zoneID[mesh.faceOwner()[faceI]]
<< " on owner side but cellZone " << neiZoneID[i]
<< " on other side. This is not allowed."
<< exit(FatalError);
blockedFace[faceI] = true;
}
}
}

View File

@ -1,43 +1,59 @@
EXE_LIBS = \
-lautoMesh \
-lbarotropicCompressibilityModel \
-lbasicThermophysicalModels \
-lblockMesh \
-lchemistryModel \
-lreactionThermophysicalModels \
-lcoalCombustion \
-lcompressibleLESModels \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lconversion \
-ldecompositionMethods \
-ldieselSpray \
-ldsmc \
-ldynamicFvMesh \
-ldynamicMesh \
-ledgeMesh \
-lengine \
-lerrorEstimation \
-lfieldFunctionObjects \
-lfiniteVolume \
-lforces \
-lfvMotionSolvers \
-lgenericPatchFields \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lcompressibleRASModels \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-linterfaceProperties \
-llagrangianIntermediate \
-lIOFunctionObjects \
-llagrangian \
-llagrangianIntermediate \
-llaminarFlameSpeedModels \
-lLESdeltas \
-lLESfilters \
-lliquidMixture \
-lliquids \
-lmeshTools \
-lmolecularMeasurements \
-lmolecule \
-lODE \
-lOpenFOAM \
-lpdf \
-lphaseModel \
-lpotential \
-lradiation \
-lrandomProcesses \
-lreactionThermophysicalModels \
-lsampling \
-lsolidMixture \
-lsolidParticle \
-lsolids \
-lspecie \
-lsurfMesh \
-lsystemCall \
-lthermalPorousZone \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \
-ltriSurface \
-lautoMesh \
-lblockMesh
-lutilityFunctionObjects

View File

@ -57,6 +57,7 @@ class argList;
class ensightMesh
{
public:
class nFacePrimitives
{
public:
@ -75,6 +76,7 @@ class ensightMesh
{}
};
private:
// Private data

View File

@ -1,9 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
if [ "$TEC_360_2009" ]
then
wmake
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -1,14 +1,12 @@
EXE_INC = \
-I$(TEC_360_2009)/include \
/* -I../tecio/tecsrc/lnInclude/ */ \
-I$(WM_THIRD_PARTY_DIR)/tecio/tecsrc/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
$(TEC_360_2009)/lib/tecio64.a \
/* -L$(FOAM_USER_LIBBIN) -ltecio */ \
-ltecio \
-llagrangian \
-lfiniteVolume \
-lmeshTools

View File

@ -65,6 +65,9 @@ Usage
information as a single argument. The double quotes denote a regular
expression.
@param -useTimeName \n
use the time index in the VTK file name instead of the time index
\*---------------------------------------------------------------------------*/
#include "pointMesh.H"
@ -240,7 +243,7 @@ int main(int argc, char *argv[])
# include "createNamedMesh.H"
// TecplotData/ directory in the case
fileName fvPath(runTime.path()/"TecplotData-bin");
fileName fvPath(runTime.path()/"Tecplot360");
// Directory of mesh (region0 gets filtered out)
fileName regionPrefix = "";
@ -536,7 +539,8 @@ int main(int argc, char *argv[])
varLocation
);
// strandID (= some zone id)
// strandID (= piece id. Gets incremented for every piece of geometry
// that is output)
INTEGER4 strandID = 1;
@ -647,7 +651,7 @@ int main(int argc, char *argv[])
writer.writePolyhedralZone
(
mesh.name(), // regionName
1, //strandID, // strandID
strandID, // strandID
mesh,
List<INTEGER4>(3, ValueLocation_Nodal),
nFaceNodes
@ -684,7 +688,7 @@ int main(int argc, char *argv[])
writer.writePolyhedralZone
(
mesh.name(), // regionName
1, //strandID, // strandID
strandID++, // strandID
mesh,
varLocation,
0
@ -776,7 +780,7 @@ int main(int argc, char *argv[])
writer.writePolygonalZone
(
setName,
1, //strandID,
strandID++,
ipp,
allVarLocation
);
@ -793,7 +797,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vsf[i])(),
linearInterpolate(vsf[i])(),
faceLabels
)()
);
@ -804,7 +808,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vvf[i])(),
linearInterpolate(vvf[i])(),
faceLabels
)()
);
@ -815,7 +819,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vSpheretf[i])(),
linearInterpolate(vSpheretf[i])(),
faceLabels
)()
);
@ -826,7 +830,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vSymmtf[i])(),
linearInterpolate(vSymmtf[i])(),
faceLabels
)()
);
@ -837,7 +841,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vtf[i])(),
linearInterpolate(vtf[i])(),
faceLabels
)()
);
@ -903,7 +907,7 @@ int main(int argc, char *argv[])
{
label patchID = patchIDs[i];
const polyPatch& pp = patches[patchID];
INTEGER4 strandID = 1 + i;
//INTEGER4 strandID = 1 + i;
Info<< " Writing patch " << patchID << "\t" << pp.name()
<< "\tstrand:" << strandID << nl << endl;
@ -917,7 +921,7 @@ int main(int argc, char *argv[])
writer.writePolygonalZone
(
pp.name(),
strandID,
strandID++, //strandID,
ipp,
allVarLocation
);
@ -1073,7 +1077,7 @@ int main(int argc, char *argv[])
writer.writePolygonalZone
(
pp.name(),
1+patchIDs.size()+zoneI, //strandID,
strandID++, //1+patchIDs.size()+zoneI, //strandID,
ipp,
allVarLocation
);
@ -1090,7 +1094,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vsf[i])(),
linearInterpolate(vsf[i])(),
pp
)()
);
@ -1101,7 +1105,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vvf[i])(),
linearInterpolate(vvf[i])(),
pp
)()
);
@ -1112,7 +1116,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vSpheretf[i])(),
linearInterpolate(vSpheretf[i])(),
pp
)()
);
@ -1123,7 +1127,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vSymmtf[i])(),
linearInterpolate(vSymmtf[i])(),
pp
)()
);
@ -1134,7 +1138,7 @@ int main(int argc, char *argv[])
(
writer.getFaceField
(
fvc::interpolate(vtf[i])(),
linearInterpolate(vtf[i])(),
pp
)()
);
@ -1196,29 +1200,29 @@ int main(int argc, char *argv[])
Info<< " vectors :";
print(Info, vectorNames);
wordList sphereNames
(
sprayObjs.names
(
sphericalTensorIOField::typeName
)
);
Info<< " spherical tensors :";
print(Info, sphereNames);
wordList symmNames
(
sprayObjs.names
(
symmTensorIOField::typeName
)
);
Info<< " symm tensors :";
print(Info, symmNames);
wordList tensorNames(sprayObjs.names(tensorIOField::typeName));
Info<< " tensors :";
print(Info, tensorNames);
//wordList sphereNames
//(
// sprayObjs.names
// (
// sphericalTensorIOField::typeName
// )
//);
//Info<< " spherical tensors :";
//print(Info, sphereNames);
//
//wordList symmNames
//(
// sprayObjs.names
// (
// symmTensorIOField::typeName
// )
//);
//Info<< " symm tensors :";
//print(Info, symmNames);
//
//wordList tensorNames(sprayObjs.names(tensorIOField::typeName));
//Info<< " tensors :";
//print(Info, tensorNames);
// Load cloud positions
@ -1277,7 +1281,7 @@ int main(int argc, char *argv[])
writer.writeOrderedZone
(
cloudDirs[cloudI],
strandID,
strandID++, //strandID,
parcels.size(),
allVarLocation
);

View File

@ -79,7 +79,7 @@ Pout<< endl
void Foam::tecplotWriter::writePolyhedralZone
(
const word& zoneName,
const INTEGER4 strandID,
INTEGER4 strandID,
const fvMesh& mesh,
const List<INTEGER4>& varLocArray,
INTEGER4 nFaceNodes
@ -95,7 +95,6 @@ void Foam::tecplotWriter::writePolyhedralZone
INTEGER4 KCellMax = 0; /* Not Used, set to zero */
double SolTime = runTime_.value(); /* solution time */
INTEGER4 StrandID = 1; /* static zone */
INTEGER4 ParentZone = 0; /* no parent zone */
INTEGER4 IsBlock = 1; /* block format */
@ -135,7 +134,7 @@ Pout<< "zoneName:" << zoneName
&JCellMax,
&KCellMax,
&SolTime,
&StrandID,
&strandID,
&ParentZone,
&IsBlock,
&NFConns,

View File

@ -26,11 +26,11 @@ License
#include "tecplotWriter.H"
extern "C"
{
//extern "C"
//{
#include "MASTER.h"
#include "GLOBAL.h"
}
//}
#include "fvc.H"

View File

@ -1,9 +1,9 @@
#!/bin/sh
#------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -36,7 +36,7 @@
# Note
# The foamCopySettings.rc (found with the ~OpenFOAM expansion) can be used
# to add any custom rsync options.
#------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
Script=${0##*/}
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ]
then
@ -48,8 +48,8 @@ Usage: $Script srcDir dstDir
- requires rsync
Note
The $Script.rc (found with the ~OpenFOAM expansion) can be used
to add any custom rsync options.
The $Script.rc (found via the ~OpenFOAM expansion - see foamEtcFile)
can be used to add any custom rsync options.
USAGE
exit 1
@ -78,7 +78,6 @@ done
# avoid processor directories here too to make for cleaner output
fileList=$(find -H $srcDir -mindepth 1 -maxdepth 1 -not -name "processor*")
# avoid polyMesh and processor* directories
rsync="rsync --exclude polyMesh --exclude processor*"
@ -108,15 +107,20 @@ do
# skip numerical (results) directories (except 0)
# and things that look like log files or queuing system output
case "$name" in
[1-9] | [0-9]?* | log | *.log | foam.[eo][1-9]* )
( [1-9] | [0-9]?* | log | *.log | foam.[eo][1-9]* )
echo "$i [skipped]"
continue
;;
*)
# skip things that look sampled directories and converted data
( probes | sets | surfaces | En[Ss]ight )
echo "$i [skipped]"
continue
;;
(*)
echo "$i -> $dstDir/$name"
$rsync -a $i $dstDir
;;
esac
done
# --------------------------------------------------------------- end-of-file
# ------------------------------------------------------------------ end-of-file

108
bin/tools/org-batch Executable file
View File

@ -0,0 +1,108 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2009-2009 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
# org-batch
#
# Description
# Batch process emacs org-mode files to create html/LaTeX etc.
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTIONS] file1 [.. fileN]
options:
-html create html (default)
-latex create LaTeX
* Batch process emacs org-mode files to create html/LaTeX etc.
USAGE
exit 1
}
# default is html export:
mode=html
case $Script in
*latex)
mode=latex
;;
*html)
mode=html
;;
esac
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-html)
mode=html
shift
;;
-latex)
mode=latex
shift
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
# default is the current directory
[ "$#" -gt 0 ] || usage "No files specified"
type emacs >/dev/null 2>&1 || usage "No emacs found in PATH"
for org
do
echo "Processing: $org"
echo "----------"
if [ -f "$org" ]
then
emacs --batch -l org --visit=$org \
--funcall org-export-as-$mode-batch
else
echo "File not found"
fi
echo "----------"
done
#------------------------------------------------------------------------------

1
bin/tools/org-html Symbolic link
View File

@ -0,0 +1 @@
org-batch

1
bin/tools/org-latex Symbolic link
View File

@ -0,0 +1 @@
org-batch

View File

@ -132,7 +132,7 @@ unset MPI_ARCH_PATH
switch ("$WM_MPLIB")
case OPENMPI:
set mpi_version=openmpi-1.3.3
set mpi_version=openmpi-1.3.4
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version
setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS

View File

@ -163,7 +163,7 @@ unset MPI_ARCH_PATH
case "$WM_MPLIB" in
OPENMPI)
mpi_version=openmpi-1.3.3
mpi_version=openmpi-1.3.4
export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS

View File

@ -32,14 +32,30 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Key, class Hash>
template<class AnyType>
Foam::HashSet<Key, Hash>::HashSet(const HashTable<AnyType, Key, Hash>& h)
Foam::HashSet<Key, Hash>::HashSet(const UList<Key>& lst)
:
HashTable<nil, Key, Hash>(2*lst.size())
{
forAll(lst, elemI)
{
insert(lst[elemI]);
}
}
template<class Key, class Hash>
template<class AnyType, class AnyHash>
Foam::HashSet<Key, Hash>::HashSet
(
const HashTable<AnyType, Key, AnyHash>& h
)
:
HashTable<nil, Key, Hash>(h.size())
{
for
(
typename HashTable<AnyType, Key, Hash>::const_iterator cit = h.cbegin();
typename HashTable<AnyType, Key, AnyHash>::const_iterator
cit = h.cbegin();
cit != h.cend();
++cit
)
@ -49,6 +65,24 @@ Foam::HashSet<Key, Hash>::HashSet(const HashTable<AnyType, Key, Hash>& h)
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Key, class Hash>
Foam::label Foam::HashSet<Key, Hash>::insert(const UList<Key>& lst)
{
label count = 0;
forAll(lst, elemI)
{
if (insert(lst[elemI]))
{
++count;
}
}
return count;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Key, class Hash>

View File

@ -84,15 +84,7 @@ public:
{}
//- Construct from UList of Key
HashSet(const UList<Key>& lst)
:
HashTable<nil, Key, Hash>(2*lst.size())
{
forAll(lst, i)
{
insert(lst[i]);
}
}
HashSet(const UList<Key>&);
//- Construct as copy
HashSet(const HashSet<Key, Hash>& hs)
@ -114,8 +106,9 @@ public:
//- Construct from the keys of another HashTable,
// the type of values held is arbitrary.
template<class AnyType>
HashSet(const HashTable<AnyType, Key, Hash>&);
template<class AnyType, class AnyHash>
HashSet(const HashTable<AnyType, Key, AnyHash>&);
// Member Functions
@ -127,12 +120,23 @@ public:
return HashTable<nil, Key, Hash>::insert(key, nil());
}
//- Insert keys from a UList of Key
// Return the number of new elements inserted
label insert(const UList<Key>&);
//- Same as insert (cannot overwrite nil content)
bool set(const Key& key)
{
return HashTable<nil, Key, Hash>::insert(key, nil());
return insert(key);
}
//- Same as insert (cannot overwrite nil content)
label set(const UList<Key>& lst)
{
return insert(lst);
}
// Member Operators
//- Return true if the entry exists, same as found()
@ -163,7 +167,6 @@ public:
//- Remove entries listed in the given HashSet from this HashSet
void operator-=(const HashSet<Key, Hash>&);
};

View File

@ -172,7 +172,7 @@ template<class ListType>
ListType createWithValues
(
const label sz,
const typename ListType::const_reference initValue,
typename ListType::const_reference initValue,
const UList<label>& indices,
typename ListType::const_reference setValue
);

View File

@ -58,7 +58,7 @@ Foam::IOobjectList::IOobjectList
}
}
// Create list file names in directory
// Create a list of file names in this directory
fileNameList ObjectNames =
readDir(db.path(newInstance, db.dbDir()/local), fileName::FILE);
@ -130,8 +130,8 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
{
if (IOobject::debug)
{
Info<< "IOobjectList::lookup : found " << name
<< endl;
Info<< "IOobjectList::lookup : found "
<< name << endl;
}
return const_cast<IOobject*>(*iter);
@ -140,8 +140,8 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
{
if (IOobject::debug)
{
Info<< "IOobjectList::lookup : could not find " << name
<< endl;
Info<< "IOobjectList::lookup : could not find "
<< name << endl;
}
return NULL;
@ -151,7 +151,7 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& ClassName) const
{
IOobjectList IOobjectsOfClass(size());
IOobjectList objectsOfClass(size());
for
(
@ -165,34 +165,26 @@ Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& ClassName) const
if (IOobject::debug)
{
Info<< "IOobjectList::lookupClass : found "
<< iter()->name()
<< endl;
<< iter.key() << endl;
}
IOobjectsOfClass.insert(iter()->name(), new IOobject(*iter()));
objectsOfClass.insert(iter.key(), new IOobject(*iter()));
}
}
return IOobjectsOfClass;
return objectsOfClass;
}
Foam::wordList Foam::IOobjectList::names() const
{
wordList objectNames(size());
return HashPtrTable<IOobject>::toc();
}
label count = 0;
for
(
HashPtrTable<IOobject>::const_iterator iter = begin();
iter != end();
++iter
)
{
objectNames[count++] = iter()->name();
}
return objectNames;
Foam::wordList Foam::IOobjectList::sortedNames() const
{
return HashPtrTable<IOobject>::sortedToc();
}
@ -210,7 +202,7 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const
{
if (iter()->headerClassName() == ClassName)
{
objectNames[count++] = iter()->name();
objectNames[count++] = iter.key();
}
}
@ -220,4 +212,13 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const
}
Foam::wordList Foam::IOobjectList::sortedNames(const word& ClassName) const
{
wordList sortedLst = names(ClassName);
sort(sortedLst);
return sortedLst;
}
// ************************************************************************* //

View File

@ -84,23 +84,29 @@ public:
// Member functions
//- Add an IOobject to list
//- Add an IOobject to the list
bool add(IOobject&);
//- Remove an IOobject from list
//- Remove an IOobject from the list
bool remove(IOobject&);
//- Lookup a given name and return IOobject ptr if found else NULL
IOobject* lookup(const word& name) const;
//- Return the list for all IOobjects of given class
//- Return the list for all IOobjects of a given class
IOobjectList lookupClass(const word& className) const;
//- Return the list of names of the IOobjects
wordList names() const;
//- Return the sorted list of names of the IOobjects
wordList sortedNames() const;
//- Return the list of names of the IOobjects of given class
wordList names(const word& className) const;
//- Return the sorted list of names of the IOobjects of given class
wordList sortedNames(const word& className) const;
};

View File

@ -678,83 +678,89 @@ Foam::Time& Foam::Time::operator++()
deltaTSave_ = deltaT_;
setTime(value() + deltaT_, timeIndex_ + 1);
// If the time is very close to zero reset to zero
if (mag(value()) < 10*SMALL*deltaT_)
if (!subCycling_)
{
setTime(0.0, timeIndex_);
}
switch (writeControl_)
{
case wcTimeStep:
outputTime_ = !(timeIndex_ % label(writeInterval_));
break;
case wcRunTime:
case wcAdjustableRunTime:
// If the time is very close to zero reset to zero
if (mag(value()) < 10*SMALL*deltaT_)
{
label outputIndex =
label(((value() - startTime_) + 0.5*deltaT_)/writeInterval_);
setTime(0.0, timeIndex_);
}
if (outputIndex > outputTimeIndex_)
switch (writeControl_)
{
case wcTimeStep:
outputTime_ = !(timeIndex_ % label(writeInterval_));
break;
case wcRunTime:
case wcAdjustableRunTime:
{
label outputIndex = label
(
((value() - startTime_) + 0.5*deltaT_)
/ writeInterval_
);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
case wcCpuTime:
{
label outputIndex = label(elapsedCpuTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
case wcClockTime:
{
label outputIndex = label(elapsedClockTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
}
// see if endTime needs adjustment to stop at the next run()/end() check
if (!end())
{
if (stopAt_ == saNoWriteNow)
{
endTime_ = value();
}
else if (stopAt_ == saWriteNow)
{
endTime_ = value();
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
else if (stopAt_ == saNextWrite && outputTime_ == true)
{
outputTime_ = false;
endTime_ = value();
}
}
break;
case wcCpuTime:
{
label outputIndex = label(elapsedCpuTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
case wcClockTime:
{
label outputIndex = label(elapsedClockTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
}
// see if endTime needs adjustment to stop at the next run()/end() check
if (!end())
{
if (stopAt_ == saNoWriteNow)
{
endTime_ = value();
}
else if (stopAt_ == saWriteNow)
{
endTime_ = value();
outputTime_ = true;
}
else if (stopAt_ == saNextWrite && outputTime_ == true)
{
endTime_ = value();
}
}
return *this;

View File

@ -109,14 +109,21 @@ Foam::dictionary::dictionary()
{}
Foam::dictionary::dictionary(const fileName& name)
:
dictionaryName(name),
parent_(dictionary::null)
{}
Foam::dictionary::dictionary
(
const dictionary& parentDict,
const dictionary& dict
)
:
dictionaryName(parentDict.name() + "::" + dict.name()),
IDLList<entry>(dict, *this),
name_(dict.name()),
parent_(parentDict)
{
forAllIter(IDLList<entry>, *this, iter)
@ -140,8 +147,8 @@ Foam::dictionary::dictionary
const dictionary& dict
)
:
dictionaryName(dict.name()),
IDLList<entry>(dict, *this),
name_(dict.name()),
parent_(dictionary::null)
{
forAllIter(IDLList<entry>, *this, iter)
@ -183,6 +190,7 @@ Foam::dictionary::dictionary
parent_(parentDict)
{
transfer(dict());
name() = parentDict.name() + "::" + name();
}
@ -472,6 +480,24 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
}
Foam::dictionary Foam::dictionary::subOrEmptyDict
(
const word& keyword
) const
{
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
if (entryPtr == NULL)
{
return dictionary(*this, dictionary(keyword));
}
else
{
return entryPtr->dict();
}
}
Foam::wordList Foam::dictionary::toc() const
{
wordList keys(size());
@ -530,7 +556,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
{
entryPtr->name() = name_ + "::" + entryPtr->keyword();
entryPtr->name() = name() + "::" + entryPtr->keyword();
if (entryPtr->keyword().isPattern())
{
@ -558,7 +584,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
{
entryPtr->name() = name_ + "::" + entryPtr->keyword();
entryPtr->name() = name() + "::" + entryPtr->keyword();
IDLList<entry>::append(entryPtr);
if (entryPtr->keyword().isPattern())
@ -763,7 +789,7 @@ bool Foam::dictionary::changeKeyword
// change name and HashTable, but leave DL-List untouched
iter()->keyword() = newKeyword;
iter()->name() = name_ + "::" + newKeyword;
iter()->name() = name() + "::" + newKeyword;
hashedEntries_.erase(oldKeyword);
hashedEntries_.insert(newKeyword, iter());
@ -838,7 +864,7 @@ void Foam::dictionary::transfer(dictionary& dict)
{
// changing parents probably doesn't make much sense,
// but what about the names?
name_ = dict.name_;
name() = dict.name();
IDLList<entry>::transfer(dict);
hashedEntries_.transfer(dict.hashedEntries_);
@ -871,7 +897,7 @@ void Foam::dictionary::operator=(const dictionary& rhs)
<< abort(FatalError);
}
name_ = rhs.name();
name() = rhs.name();
clear();
// Create clones of the entries in the given dictionary

View File

@ -41,7 +41,7 @@ Description
ToDo
A merge() member function with a non-const dictionary parameter.
This would avoid unnecessary cloning in the add(entry*,bool) method
This would avoid unnecessary cloning in the add(entry*, bool) method.
SourceFiles
dictionary.C
@ -74,6 +74,47 @@ class SHA1Digest;
Istream& operator>>(Istream&, dictionary&);
Ostream& operator<<(Ostream&, const dictionary&);
/*---------------------------------------------------------------------------*\
Class dictionaryName Declaration
\*---------------------------------------------------------------------------*/
class dictionaryName
{
// Private data
fileName name_;
public:
// Constructors
//- Construct dictionaryName null
dictionaryName()
{}
//- Construct dictionaryName as copy of the given fileName
dictionaryName(const fileName& name)
:
name_(name)
{}
// Member functions
//- Return the dictionary name
const fileName& name() const
{
return name_;
}
//- Return the dictionary name
fileName& name()
{
return name_;
}
};
/*---------------------------------------------------------------------------*\
Class dictionary Declaration
@ -81,13 +122,11 @@ Ostream& operator<<(Ostream&, const dictionary&);
class dictionary
:
public dictionaryName,
public IDLList<entry>
{
// Private data
//- Dictionary name
fileName name_;
//- HashTable of the entries held on the DL-list for quick lookup
HashTable<entry*> hashedEntries_;
@ -100,6 +139,7 @@ class dictionary
//- Patterns as precompiled regular expressions
DLList<autoPtr<regExp> > patternRegexps_;
// Private Member Functions
//- Search patterns table for exact match or regular expression match
@ -121,16 +161,6 @@ class dictionary
);
public:
//- Read dictionary from Istream
bool read(Istream&);
//- Substitute the given keyword prepended by '$' with the
// corresponding sub-dictionary entries
bool substituteKeyword(const word& keyword);
public:
//- Declare friendship with the entry class for IO
@ -150,10 +180,14 @@ public:
//- Construct top-level dictionary null
dictionary();
//- Construct from the parent dictionary and Istream, reading entries
// until lastEntry or EOF
//- Construct top-level empty dictionary with given name
dictionary(const fileName& name);
//- Construct given the entry name, parent dictionary and Istream,
// reading entries until lastEntry or EOF
dictionary
(
const fileName& name,
const dictionary& parentDict,
Istream&
);
@ -192,18 +226,6 @@ public:
// Member functions
//- Return the dictionary name
const fileName& name() const
{
return name_;
}
//- Return the dictionary name
fileName& name()
{
return name_;
}
//- Return the parent dictionary
const dictionary& parent() const
{
@ -320,14 +342,23 @@ public:
//- Find and return a sub-dictionary for manipulation
dictionary& subDict(const word&);
//- Find and return a sub-dictionary as a copy, or
// return an empty dictionary if the sub-dictionary does not exist
dictionary subOrEmptyDict(const word&) const;
//- Return the table of contents
wordList toc() const;
//- Return the list of available keys or patterns
List<keyType> keys(bool patterns=false) const;
// Editing
//- Substitute the given keyword prepended by '$' with the
// corresponding sub-dictionary entries
bool substituteKeyword(const word& keyword);
//- Add a new entry
// With the merge option, dictionaries are interwoven and
// primitive entries are overwritten
@ -407,6 +438,12 @@ public:
Xfer<dictionary> xfer();
// Read
//- Read dictionary from Istream
bool read(Istream&);
// Write
void write(Ostream&, bool subDict=true) const;

View File

@ -58,10 +58,8 @@ Foam::dictionaryEntry::dictionaryEntry
)
:
entry(key),
dictionary(parentDict, is)
dictionary(key, parentDict, is)
{
name() += "::" + key;
is.fatalCheck
(
"dictionaryEntry::dictionaryEntry"

View File

@ -95,11 +95,12 @@ bool Foam::dictionary::substituteKeyword(const word& keyword)
Foam::dictionary::dictionary
(
const fileName& name,
const dictionary& parentDict,
Istream& is
)
:
name_(is.name()),
dictionaryName(parentDict.name() + "::" + name),
parent_(parentDict)
{
read(is);
@ -108,7 +109,7 @@ Foam::dictionary::dictionary
Foam::dictionary::dictionary(Istream& is)
:
name_(is.name()),
dictionaryName(is.name()),
parent_(dictionary::null)
{
// Reset input mode as this is a "top-level" dictionary
@ -132,6 +133,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict)
functionEntries::inputModeEntry::clear();
dict.clear();
dict.name() = is.name();
dict.read(is);
return is;

View File

@ -108,10 +108,9 @@ public:
static autoPtr<entry> New(Istream& is);
// Destructor
virtual ~entry()
{}
//- Destructor
virtual ~entry()
{}
// Member functions

View File

@ -65,8 +65,8 @@ bool Foam::functionEntries::removeEntry::execute
Istream& is
)
{
wordList dictKeys = parentDict.toc();
wordReList patterns(is);
wordList dictKeys = parentDict.toc();
wordReList patterns = readList<wordRe>(is);
labelList indices = findStrings(patterns, dictKeys);

View File

@ -29,6 +29,19 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class OutputFilter>
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(
const word& outputFilterName,
const IOobject& ioDict,
const bool readFromFiles
)
:
IOdictionary(ioDict),
OutputFilter(outputFilterName, ioDict.db(), *this, readFromFiles)
{}
template<class OutputFilter>
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(

View File

@ -29,6 +29,11 @@ Description
IOdictionary wrapper around OutputFilter to allow them to read from
their associated dictionaries.
Note
The IOobject or the objectRegistry will normally have to be
derived from a fvMesh for a subsequent cast (within OutputFilter)
to work correctly.
SourceFiles
IOOutputFilter.C
@ -69,6 +74,15 @@ public:
// Constructors
//- Construct from an IOobject for IOdictionary
// Allow the possibility to load fields from files
IOOutputFilter
(
const word& outputFilterName,
const IOobject& ioDict,
const bool loadFromFile = false
);
//- Construct for given objectRegistry and dictionary
// Allow dictionary to be optional
// Allow the possibility to load fields from files

View File

@ -93,7 +93,7 @@ Foam::objectRegistry::~objectRegistry()
}
}
for (label i=0; i<nMyObjects; i++)
for (label i=0; i < nMyObjects; i++)
{
checkOut(*myObjects[i]);
}
@ -104,15 +104,13 @@ Foam::objectRegistry::~objectRegistry()
Foam::wordList Foam::objectRegistry::names() const
{
wordList objectNames(size());
return HashTable<regIOobject*>::toc();
}
label count=0;
for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{
objectNames[count++] = iter()->name();
}
return objectNames;
Foam::wordList Foam::objectRegistry::sortedNames() const
{
return HashTable<regIOobject*>::sortedToc();
}
@ -125,7 +123,7 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
{
if (iter()->type() == ClassName)
{
objectNames[count++] = iter()->name();
objectNames[count++] = iter.key();
}
}
@ -135,6 +133,15 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
}
Foam::wordList Foam::objectRegistry::sortedNames(const word& ClassName) const
{
wordList sortedLst = names(ClassName);
sort(sortedLst);
return sortedLst;
}
const Foam::objectRegistry& Foam::objectRegistry::subRegistry
(
const word& name
@ -151,8 +158,8 @@ Foam::label Foam::objectRegistry::getEvent() const
if (event_ == labelMax)
{
WarningIn("objectRegistry::getEvent() const")
<< "Event counter has overflowed. Resetting counter on all"
<< " dependent objects." << endl
<< "Event counter has overflowed. "
<< "Resetting counter on all dependent objects." << nl
<< "This might cause extra evaluations." << endl;
// Reset event counter
@ -202,7 +209,7 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if (objectRegistry::debug)
{
Pout<< "objectRegistry::checkOut(regIOobject&) : "
<< name() << " : checking out " << io.name()
<< name() << " : checking out " << iter.key()
<< endl;
}
@ -211,7 +218,8 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
if (objectRegistry::debug)
{
WarningIn("objectRegistry::checkOut(regIOobject&)")
<< name() << " : attempt to checkOut copy of " << io.name()
<< name() << " : attempt to checkOut copy of "
<< iter.key()
<< endl;
}
@ -286,8 +294,7 @@ void Foam::objectRegistry::readModifiedObjects()
{
Pout<< "objectRegistry::readModifiedObjects() : "
<< name() << " : Considering reading object "
<< iter()->name()
<< endl;
<< iter.key() << endl;
}
iter()->readIfModified();
@ -317,7 +324,7 @@ bool Foam::objectRegistry::writeObject
{
Pout<< "objectRegistry::write() : "
<< name() << " : Considering writing object "
<< iter()->name()
<< iter.key()
<< " with writeOpt " << iter()->writeOpt()
<< " to file " << iter()->objectPath()
<< endl;

View File

@ -132,9 +132,15 @@ public:
//- Return the list of names of the IOobjects
wordList names() const;
//- Return the list of names of the IOobjects of given class name
//- Return the sorted list of names of the IOobjects
wordList sortedNames() const;
//- Return the list of names of IOobjects of given class name
wordList names(const word& className) const;
//- Return the sorted list of names of IOobjects of given class name
wordList sortedNames(const word& className) const;
//- Return the list of names of the IOobjects of given type
template<class Type>
wordList names() const;
@ -142,11 +148,11 @@ public:
//- Lookup and return a const sub-objectRegistry
const objectRegistry& subRegistry(const word& name) const;
//- Lookup and return all the object of the given Type
//- Lookup and return all objects of the given Type
template<class Type>
HashTable<const Type*> lookupClass() const;
//- Is the named Type
//- Is the named Type found?
template<class Type>
bool foundObject(const word& name) const;

View File

@ -234,35 +234,16 @@ public:
//- Read a value from the named option
template<class T>
T optionRead(const word& opt) const
{
T val;
optionLookup(opt)() >> val;
return val;
}
T optionRead(const word& opt) const;
//- Read a value from the named option if present.
// Return true if the named option was found.
template<class T>
bool optionReadIfPresent(const word& opt, T& val) const
{
if (optionFound(opt))
{
optionLookup(opt)() >> val;
return true;
}
else
{
return false;
}
}
bool optionReadIfPresent(const word& opt, T& val) const;
//- Read a List of values from the named option
template<class T>
List<T> optionReadList(const word& opt) const
{
return readList<T>(optionLookup(opt)());
}
List<T> optionReadList(const word& opt) const;
// Edit
@ -300,6 +281,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "argListTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 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 "argList.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
T Foam::argList::optionRead(const word& opt) const
{
T val;
optionLookup(opt)() >> val;
return val;
}
template<class T>
bool Foam::argList::optionReadIfPresent(const word& opt, T& val) const
{
if (optionFound(opt))
{
val = optionRead<T>(opt);
return true;
}
else
{
return false;
}
}
template<class T>
Foam::List<T> Foam::argList::optionReadList(const word& opt) const
{
return readList<T>(optionLookup(opt)());
}
// ************************************************************************* //

View File

@ -34,7 +34,6 @@ Description
SourceFiles
processorPolyPatch.C
processorPolyPatchMorph.C
\*---------------------------------------------------------------------------*/

View File

@ -1837,19 +1837,21 @@ bool Foam::primitiveMesh::checkFaceFaces
if (nErrorDuplicate > 0 || nErrorOrder > 0)
{
// These are actually warnings, not errors.
if (nErrorDuplicate > 0)
{
Info<< " ***Number of duplicate (not baffle) faces found: "
<< nErrorDuplicate << endl;
Info<< " <<Number of duplicate (not baffle) faces found: "
<< nErrorDuplicate
<< ". This might indicate a problem." << endl;
}
if (nErrorOrder > 0)
{
Info<< " ***Number of faces with non-consecutive shared points: "
<< nErrorOrder << endl;
Info<< " <<Number of faces with non-consecutive shared points: "
<< nErrorOrder << ". This might indicate a problem." << endl;
}
return true;
return false; //return true;
}
else
{

View File

@ -130,7 +130,7 @@ public:
// Member Operators
//- Construct given SphericalTensor2D
//- Copy SphericalTensor2D
inline void operator=(const SphericalTensor2D<Cmpt>&);
};

View File

@ -474,6 +474,14 @@ public:
};
template<class Cmpt>
class innerProduct<Tensor2D<Cmpt>, Tensor2D<Cmpt> >
{
public:
typedef Tensor2D<Cmpt> type;
};
template<class Cmpt>
class innerProduct<SphericalTensor2D<Cmpt>, Tensor2D<Cmpt> >
{
@ -490,6 +498,23 @@ public:
typedef Tensor2D<Cmpt> type;
};
template<class Cmpt>
class innerProduct<Tensor2D<Cmpt>, Vector2D<Cmpt> >
{
public:
typedef Vector2D<Cmpt> type;
};
template<class Cmpt>
class innerProduct<Vector2D<Cmpt>, Tensor2D<Cmpt> >
{
public:
typedef Vector2D<Cmpt> type;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -129,28 +129,29 @@ void Foam::SHA1::processBytes(const void *data, size_t len)
}
// Process available complete blocks
if (len >= 64)
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
if (UNALIGNED_P (data))
{
while (len > 64)
// if (len >= 64)
// {
//#if !_STRING_ARCH_unaligned
//# define alignof(type) offsetof (struct { char c; type x; }, x)
//# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
// if (UNALIGNED_P (data))
// {
// while (len > 64)
while (len >= 64)
{
processBlock(memcpy (buffer_, data, 64), 64);
data = reinterpret_cast<const unsigned char*>(data) + 64;
len -= 64;
}
}
else
#endif
{
processBlock(data, len & ~63);
data = reinterpret_cast<const unsigned char*>(data) + (len & ~63);
len &= 63;
}
}
// }
// else
//#endif
// {
// processBlock(data, len & ~63);
// data = reinterpret_cast<const unsigned char*>(data) + (len & ~63);
// len &= 63;
// }
// }
// Move remaining bytes in internal buffer.
if (len > 0)

View File

@ -142,8 +142,7 @@ void Foam::MULES::implicitSolve
{
const fvMesh& mesh = psi.mesh();
const dictionary& MULEScontrols =
mesh.solverDict(psi.name()).subDict("MULESImplicit");
const dictionary& MULEScontrols = mesh.solverDict(psi.name());
label maxIter
(
@ -255,7 +254,7 @@ void Foam::MULES::implicitSolve
solve
(
psiConvectionDiffusion + fvc::div(lambda*phiCorr),
MULEScontrols.lookup("solver")
MULEScontrols
);
scalar maxPsiM1 = gMax(psi.internalField()) - 1.0;

View File

@ -51,15 +51,6 @@ class CECCellToFaceStencil
:
public cellToFaceStencil
{
// Private Member Functions
//- Disallow default bitwise copy construct
CECCellToFaceStencil(const CECCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const CECCellToFaceStencil&);
public:
// Constructors

View File

@ -51,14 +51,6 @@ class CFCCellToFaceStencil
:
public cellToFaceStencil
{
// Private Member Functions
//- Disallow default bitwise copy construct
CFCCellToFaceStencil(const CFCCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const CFCCellToFaceStencil&);
public:
// Constructors

View File

@ -51,15 +51,6 @@ class CPCCellToFaceStencil
:
public cellToFaceStencil
{
// Private Member Functions
//- Disallow default bitwise copy construct
CPCCellToFaceStencil(const CPCCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const CPCCellToFaceStencil&);
public:
// Constructors

View File

@ -65,13 +65,6 @@ class FECCellToFaceStencil
void calcFaceStencil(labelListList& faceStencil) const;
//- Disallow default bitwise copy construct
FECCellToFaceStencil(const FECCellToFaceStencil&);
//- Disallow default bitwise assignment
void operator=(const FECCellToFaceStencil&);
public:
// Constructors

View File

@ -56,11 +56,6 @@ class CFCFaceToCellStencil
void calcCellStencil(labelListList& globalCellFaces) const;
//- Disallow default bitwise copy construct
CFCFaceToCellStencil(const CFCFaceToCellStencil&);
//- Disallow default bitwise assignment
void operator=(const CFCFaceToCellStencil&);
public:

View File

@ -157,14 +157,14 @@ namespace fvc
);
//- Interpolate tmp field onto faces using central differencing
//- Interpolate tmp field onto faces using 'interpolate(<name>)'
template<class Type>
static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > interpolate
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
);
//- Interpolate field onto faces using central differencing
//- Interpolate tmp field onto faces using 'interpolate(<name>)'
template<class Type>
static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > interpolate
(

View File

@ -67,6 +67,10 @@ Foam::word Foam::PatchInteractionModel<CloudType>::interactionTypeToWord
return "other";
}
}
#ifdef __ICC
// Prevent Icc complaining about missing return statement.
return word::null;
#endif
}

View File

@ -1,5 +1,6 @@
probes/probes.C
probes/probesFunctionObject.C
probes/probesGrouping.C
probes/probesFunctionObject/probesFunctionObject.C
sampledSet/cloud/cloudSet.C
sampledSet/coordSet/coordSet.C
@ -9,6 +10,7 @@ sampledSet/midPoint/midPointSet.C
sampledSet/midPointAndFace/midPointAndFaceSet.C
sampledSet/sampledSet/sampledSet.C
sampledSet/sampledSets/sampledSets.C
sampledSet/sampledSets/sampledSetsGrouping.C
sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C
sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C
sampledSet/uniform/uniformSet.C
@ -34,6 +36,7 @@ sampledSurface/distanceSurface/distanceSurface.C
sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C
sampledSurface/sampledSurface/sampledSurface.C
sampledSurface/sampledSurfaces/sampledSurfaces.C
sampledSurface/sampledSurfaces/sampledSurfacesGrouping.C
sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C
sampledSurface/thresholdCellFaces/thresholdCellFaces.C
sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C

View File

@ -36,14 +36,9 @@ Description
#include "octreeDataCell.H"
#include "octreeDataFace.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void meshToMesh::calcAddressing()
void Foam::meshToMesh::calcAddressing()
{
if (debug)
{
@ -225,7 +220,7 @@ void meshToMesh::calcAddressing()
}
void meshToMesh::cellAddresses
void Foam::meshToMesh::cellAddresses
(
labelList& cellAddressing_,
const pointField& points,
@ -356,8 +351,4 @@ void meshToMesh::cellAddresses
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,9 @@ License
#include "meshToMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void meshToMesh::calculateInverseDistanceWeights() const
void Foam::meshToMesh::calculateInverseDistanceWeights() const
{
if (debug)
{
@ -93,7 +88,7 @@ void meshToMesh::calculateInverseDistanceWeights() const
invDistCoeffs[celli][ni + 1] = invDist;
sumInvDist += invDist;
}
// divide by the total inverse-distance
forAll (invDistCoeffs[celli], i)
{
@ -107,19 +102,15 @@ void meshToMesh::calculateInverseDistanceWeights() const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const scalarListList& meshToMesh::inverseDistanceWeights() const
const Foam::scalarListList& Foam::meshToMesh::inverseDistanceWeights() const
{
if (!inverseDistanceWeightsPtr_)
{
calculateInverseDistanceWeights();
}
return *inverseDistanceWeightsPtr_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,20 +28,15 @@ License
#include "processorFvPatch.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(meshToMesh, 0);
const scalar meshToMesh::directHitTol = 1e-5;
defineTypeNameAndDebug(Foam::meshToMesh, 0);
const Foam::scalar Foam::meshToMesh::directHitTol = 1e-5;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
meshToMesh::meshToMesh
Foam::meshToMesh::meshToMesh
(
const fvMesh& meshFrom,
const fvMesh& meshTo,
@ -114,7 +109,7 @@ meshToMesh::meshToMesh
}
meshToMesh::meshToMesh
Foam::meshToMesh::meshToMesh
(
const fvMesh& meshFrom,
const fvMesh& meshTo
@ -159,7 +154,7 @@ meshToMesh::meshToMesh
<< exit(FatalError);
}
if
if
(
fromMesh_.boundaryMesh()[patchi].type()
!= toMesh_.boundaryMesh()[patchi].type()
@ -201,14 +196,10 @@ meshToMesh::meshToMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
meshToMesh::~meshToMesh()
Foam::meshToMesh::~meshToMesh()
{
deleteDemandDrivenData(inverseDistanceWeightsPtr_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -56,7 +56,7 @@ class octree;
class octreeDataCell;
/*---------------------------------------------------------------------------*\
Class meshToMesh Declaration
Class meshToMesh Declaration
\*---------------------------------------------------------------------------*/
class meshToMesh
@ -207,7 +207,7 @@ public:
{
return fromMesh_;
}
const fvMesh& toMesh() const
{
return toMesh_;

View File

@ -30,15 +30,10 @@ License
#include "SubField.H"
#include "mixedFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void meshToMesh::mapField
void Foam::meshToMesh::mapField
(
Field<Type>& toF,
const Field<Type>& fromVf,
@ -60,7 +55,7 @@ void meshToMesh::mapField
template<class Type>
void meshToMesh::interpolateField
void Foam::meshToMesh::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
@ -79,7 +74,7 @@ void meshToMesh::interpolateField
{
const labelList& neighbours = cc[adr[celli]];
const scalarList& w = weights[celli];
toF[celli] = fromVf[adr[celli]]*w[0];
for (label ni = 1; ni < w.size(); ni++)
@ -92,7 +87,7 @@ void meshToMesh::interpolateField
template<class Type>
void meshToMesh::interpolateField
void Foam::meshToMesh::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
@ -118,7 +113,7 @@ void meshToMesh::interpolateField
template<class Type>
void meshToMesh::interpolateInternalField
void Foam::meshToMesh::interpolateInternalField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
@ -160,7 +155,7 @@ void meshToMesh::interpolateInternalField
case INTERPOLATE:
interpolateField
(
toF,
toF,
fromVf,
cellAddressing_,
inverseDistanceWeights()
@ -170,7 +165,7 @@ void meshToMesh::interpolateInternalField
case CELL_POINT_INTERPOLATE:
interpolateField
(
toF,
toF,
fromVf,
cellAddressing_,
toMesh_.cellCentres()
@ -190,7 +185,7 @@ void meshToMesh::interpolateInternalField
template<class Type>
void meshToMesh::interpolateInternalField
void Foam::meshToMesh::interpolateInternalField
(
Field<Type>& toF,
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
@ -203,7 +198,7 @@ void meshToMesh::interpolateInternalField
template<class Type>
void meshToMesh::interpolate
void Foam::meshToMesh::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
@ -268,7 +263,7 @@ void meshToMesh::interpolate
).refValue() = toVf.boundaryField()[patchi];
}
}
else if
else if
(
patchMap_.found(toPatch.name())
&& fromMeshPatches_.found(patchMap_.find(toPatch.name())())
@ -300,7 +295,7 @@ void meshToMesh::interpolate
template<class Type>
void meshToMesh::interpolate
void Foam::meshToMesh::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
@ -313,7 +308,8 @@ void meshToMesh::interpolate
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > meshToMesh::interpolate
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::meshToMesh::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
meshToMesh::order ord
@ -387,7 +383,8 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > meshToMesh::interpolate
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > meshToMesh::interpolate
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::meshToMesh::interpolate
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
meshToMesh::order ord
@ -401,8 +398,4 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > meshToMesh::interpolate
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -32,243 +32,163 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(probes, 0);
}
defineTypeNameAndDebug(Foam::probes, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::probes::findCells(const fvMesh& mesh)
{
if (cellList_.empty())
cellList_.clear();
cellList_.setSize(size());
forAll(*this, probeI)
{
cellList_.setSize(probeLocations_.size());
const vector& location = operator[](probeI);
forAll(probeLocations_, probeI)
cellList_[probeI] = mesh.findCell(location);
if (debug && cellList_[probeI] != -1)
{
cellList_[probeI] = mesh.findCell(probeLocations_[probeI]);
Pout<< "probes : found point " << location
<< " in cell " << cellList_[probeI] << endl;
}
}
if (debug && cellList_[probeI] != -1)
// Check if all probes have been found.
forAll(cellList_, probeI)
{
const vector& location = operator[](probeI);
label cellI = cellList_[probeI];
// Check at least one processor with cell.
reduce(cellI, maxOp<label>());
if (cellI == -1)
{
if (Pstream::master())
{
Pout<< "probes : found point " << probeLocations_[probeI]
<< " in cell " << cellList_[probeI] << endl;
WarningIn("probes::read()")
<< "Did not find location " << location
<< " in any cell. Skipping location." << endl;
}
}
// Check if all probes have been found.
forAll(cellList_, probeI)
else
{
label cellI = cellList_[probeI];
// Check at least one processor with cell.
reduce(cellI, maxOp<label>());
if (cellI == -1)
// Make sure location not on two domains.
if (cellList_[probeI] != -1 && cellList_[probeI] != cellI)
{
if (Pstream::master())
{
WarningIn("probes::read()")
<< "Did not find location " << probeLocations_[probeI]
<< " in any cell. Skipping location." << endl;
}
}
else
{
// Make sure location not on two domains.
if (cellList_[probeI] != -1 && cellList_[probeI] != cellI)
{
WarningIn("probes::read()")
<< "Location " << probeLocations_[probeI]
<< " seems to be on multiple domains:"
<< " cell " << cellList_[probeI]
<< " on my domain " << Pstream::myProcNo()
WarningIn("probes::read()")
<< "Location " << location
<< " seems to be on multiple domains:"
<< " cell " << cellList_[probeI]
<< " on my domain " << Pstream::myProcNo()
<< " and cell " << cellI << " on some other domain."
<< endl
<< "This might happen if the probe location is on"
<< " a processor patch. Change the location slightly"
<< " to prevent this." << endl;
}
<< endl
<< "This might happen if the probe location is on"
<< " a processor patch. Change the location slightly"
<< " to prevent this." << endl;
}
}
}
}
bool Foam::probes::checkFieldTypes()
Foam::label Foam::probes::prepare()
{
wordList fieldTypes(fieldNames_.size());
// check files for a particular time
if (loadFromFiles_)
{
forAll(fieldNames_, fieldI)
{
IOobject io
(
fieldNames_[fieldI],
obr_.time().timeName(),
refCast<const polyMesh>(obr_),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
fieldTypes[fieldI] = io.headerClassName();
}
else
{
fieldTypes[fieldI] = "(notFound)";
}
}
}
else
{
// check objectRegistry
forAll(fieldNames_, fieldI)
{
objectRegistry::const_iterator iter =
obr_.find(fieldNames_[fieldI]);
if (iter != obr_.end())
{
fieldTypes[fieldI] = iter()->type();
}
else
{
fieldTypes[fieldI] = "(notFound)";
}
}
}
label nFields = 0;
// classify fieldTypes
nFields += countFields(scalarFields_, fieldTypes);
nFields += countFields(vectorFields_, fieldTypes);
nFields += countFields(sphericalTensorFields_, fieldTypes);
nFields += countFields(symmTensorFields_, fieldTypes);
nFields += countFields(tensorFields_, fieldTypes);
// concatenate all the lists into foundFields
wordList foundFields(nFields);
label fieldI = 0;
forAll(scalarFields_, i)
{
foundFields[fieldI++] = scalarFields_[i];
}
forAll(vectorFields_, i)
{
foundFields[fieldI++] = vectorFields_[i];
}
forAll(sphericalTensorFields_, i)
{
foundFields[fieldI++] = sphericalTensorFields_[i];
}
forAll(symmTensorFields_, i)
{
foundFields[fieldI++] = symmTensorFields_[i];
}
forAll(tensorFields_, i)
{
foundFields[fieldI++] = tensorFields_[i];
}
const label nFields = classifyFields();
// adjust file streams
if (Pstream::master())
{
fileName probeDir;
wordHashSet currentFields;
currentFields.insert(scalarFields_);
currentFields.insert(vectorFields_);
currentFields.insert(sphericalTensorFields_);
currentFields.insert(symmTensorFields_);
currentFields.insert(tensorFields_);
if (debug)
{
Info<< "Probing fields:" << currentFields << nl
<< "Probing locations:" << *this << nl
<< endl;
}
fileName probeDir;
fileName probeSubDir = name_;
if (obr_.name() != polyMesh::defaultRegion)
if (mesh_.name() != polyMesh::defaultRegion)
{
probeSubDir = probeSubDir/obr_.name();
probeSubDir = probeSubDir/mesh_.name();
}
probeSubDir = probeSubDir/obr_.time().timeName();
probeSubDir = probeSubDir/mesh_.time().timeName();
if (Pstream::parRun())
{
// Put in undecomposed case
// (Note: gives problems for distributed data running)
probeDir = obr_.time().path()/".."/probeSubDir;
probeDir = mesh_.time().path()/".."/probeSubDir;
}
else
{
probeDir = obr_.time().path()/probeSubDir;
probeDir = mesh_.time().path()/probeSubDir;
}
// Close the file if any fields have been removed.
// ignore known fields, close streams for fields that no longer exist
forAllIter(HashPtrTable<OFstream>, probeFilePtrs_, iter)
{
if (findIndex(foundFields, iter.key()) == -1)
if (!currentFields.erase(iter.key()))
{
if (debug)
{
Pout<< "close stream: " << iter()->name() << endl;
Info<< "close probe stream: " << iter()->name() << endl;
}
delete probeFilePtrs_.remove(iter);
}
}
// Open new files for new fields. Keep existing files.
probeFilePtrs_.resize(2*foundFields.size());
forAll(foundFields, fieldI)
// currentFields now just has the new fields - open streams for them
forAllConstIter(wordHashSet, currentFields, iter)
{
const word& fldName = foundFields[fieldI];
const word& fieldName = iter.key();
// Check if added field. If so open a stream for it.
// Create directory if does not exist.
mkDir(probeDir);
if (!probeFilePtrs_.found(fldName))
OFstream* sPtr = new OFstream(probeDir/fieldName);
if (debug)
{
// Create directory if does not exist.
mkDir(probeDir);
OFstream* sPtr = new OFstream(probeDir/fldName);
if (debug)
{
Pout<< "open stream: " << sPtr->name() << endl;
}
probeFilePtrs_.insert(fldName, sPtr);
unsigned int w = IOstream::defaultPrecision() + 7;
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
{
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
<< vector::componentNames[cmpt];
forAll(probeLocations_, probeI)
{
*sPtr<< ' ' << setw(w) << probeLocations_[probeI][cmpt];
}
*sPtr << endl;
}
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
<< "Time" << endl;
Info<< "open probe stream: " << sPtr->name() << endl;
}
}
if (debug)
{
Pout<< "Probing fields:" << foundFields << nl
<< "Probing locations:" << probeLocations_ << nl
<< endl;
probeFilePtrs_.insert(fieldName, sPtr);
unsigned int w = IOstream::defaultPrecision() + 7;
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
{
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
<< vector::componentNames[cmpt];
forAll(*this, probeI)
{
*sPtr<< ' ' << setw(w) << operator[](probeI)[cmpt];
}
*sPtr << endl;
}
*sPtr<< '#' << setw(IOstream::defaultPrecision() + 6)
<< "Time" << endl;
}
}
return nFields > 0;
return nFields;
}
@ -282,18 +202,10 @@ Foam::probes::probes
const bool loadFromFiles
)
:
pointField(0),
name_(name),
obr_(obr),
loadFromFiles_(loadFromFiles),
fieldNames_(0),
probeLocations_(0),
scalarFields_(),
vectorFields_(),
sphericalTensorFields_(),
symmTensorFields_(),
tensorFields_(),
cellList_(0),
probeFilePtrs_(0)
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles)
{
read(dict);
}
@ -321,7 +233,7 @@ void Foam::probes::end()
void Foam::probes::write()
{
if (probeLocations_.size() && checkFieldTypes())
if (size() && prepare())
{
sampleAndWrite(scalarFields_);
sampleAndWrite(vectorFields_);
@ -334,13 +246,12 @@ void Foam::probes::write()
void Foam::probes::read(const dictionary& dict)
{
dict.lookup("fields") >> fieldNames_;
dict.lookup("probeLocations") >> probeLocations_;
dict.lookup("probeLocations") >> *this;
dict.lookup("fields") >> fieldSelection_;
// Force all cell locations to be redetermined
cellList_.clear();
findCells(refCast<const fvMesh>(obr_));
checkFieldTypes();
// redetermined all cell locations
findCells(mesh_);
prepare();
}

View File

@ -44,6 +44,8 @@ SourceFiles
#include "pointField.H"
#include "volFieldsFwd.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -60,6 +62,8 @@ class mapPolyMesh;
\*---------------------------------------------------------------------------*/
class probes
:
public pointField
{
// Private classes
@ -67,20 +71,15 @@ class probes
template<class Type>
class fieldGroup
:
public wordList
public DynamicList<word>
{
public:
//- Construct null
fieldGroup()
:
wordList()
DynamicList<word>(0)
{}
//- Construct for a list of field names
fieldGroup(const wordList& fieldNames)
:
wordList(fieldNames)
{}
};
@ -90,8 +89,8 @@ class probes
// Also used as the name of the probes directory.
word name_;
//- Const reference to objectRegistry
const objectRegistry& obr_;
//- Const reference to fvMesh
const fvMesh& mesh_;
//- Load fields from files (not from objectRegistry)
bool loadFromFiles_;
@ -100,11 +99,7 @@ class probes
// Read from dictonary
//- Names of fields to probe
wordList fieldNames_;
//- Locations to probe
vectorField probeLocations_;
wordReList fieldSelection_;
// Calculated
@ -124,19 +119,21 @@ class probes
// Private Member Functions
//- Clear old field groups
void clearFieldGroups();
//- Append fieldName to the appropriate group
label appendFieldGroup(const word& fieldName, const word& fieldType);
//- Classify field types, returns the number of fields
label classifyFields();
//- Find cells containing probes
void findCells(const fvMesh&);
//- classify field types, return true if nFields > 0
bool checkFieldTypes();
//- Find the fields in the list of the given type, return count
template<class Type>
label countFields
(
fieldGroup<Type>& fieldList,
const wordList& fieldTypes
) const;
//- Classify field type and Open/close file streams,
// returns number of fields
label prepare();
//- Sample and write a particular volume field
template<class Type>
@ -146,7 +143,7 @@ class probes
);
//- Sample and write all the fields of the given type
template <class Type>
template<class Type>
void sampleAndWrite(const fieldGroup<Type>&);
//- Disallow default bitwise copy construct
@ -188,15 +185,21 @@ public:
}
//- Return names of fields to probe
virtual const wordList& fieldNames() const
virtual const wordReList& fieldNames() const
{
return fieldNames_;
return fieldSelection_;
}
//- Return locations to probe
virtual const vectorField& probeLocations() const
virtual const pointField& probeLocations() const
{
return probeLocations_;
return *this;
}
//- Return location for probe i
virtual const point& probe(const label i) const
{
return operator[](i);
}
//- Cells to be probed (obtained from the locations)

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "probes.H"
#include "volFields.H"
#include "IOobjectList.H"
#include "stringListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::probes::clearFieldGroups()
{
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
}
Foam::label Foam::probes::appendFieldGroup
(
const word& fieldName,
const word& fieldType
)
{
if (fieldType == volScalarField::typeName)
{
scalarFields_.append(fieldName);
return 1;
}
else if (fieldType == volVectorField::typeName)
{
vectorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSphericalTensorField::typeName)
{
sphericalTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSymmTensorField::typeName)
{
symmTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volTensorField::typeName)
{
tensorFields_.append(fieldName);
return 1;
}
return 0;
}
Foam::label Foam::probes::classifyFields()
{
label nFields = 0;
clearFieldGroups();
if (loadFromFiles_)
{
// check files for a particular time
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
}
else
{
// check currently available fields
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
mesh_.find(fieldName)()->type()
);
}
}
return nFields;
}
// ************************************************************************* //

View File

@ -63,35 +63,6 @@ public:
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Foam::label Foam::probes::countFields
(
fieldGroup<Type>& fieldList,
const wordList& fieldTypes
) const
{
fieldList.setSize(fieldNames_.size());
label nFields = 0;
forAll(fieldNames_, fieldI)
{
if
(
fieldTypes[fieldI]
== GeometricField<Type, fvPatchField, volMesh>::typeName
)
{
fieldList[nFields] = fieldNames_[fieldI];
nFields++;
}
}
fieldList.setSize(nFields);
return nFields;
}
template<class Type>
void Foam::probes::sampleAndWrite
(
@ -103,15 +74,15 @@ void Foam::probes::sampleAndWrite
if (Pstream::master())
{
unsigned int w = IOstream::defaultPrecision() + 7;
OFstream& probeStream = *probeFilePtrs_[vField.name()];
OFstream& os = *probeFilePtrs_[vField.name()];
probeStream << setw(w) << vField.time().value();
os << setw(w) << vField.time().value();
forAll(values, probeI)
{
probeStream << ' ' << setw(w) << values[probeI];
os << ' ' << setw(w) << values[probeI];
}
probeStream << endl;
os << endl;
}
}
@ -133,30 +104,30 @@ void Foam::probes::sampleAndWrite
IOobject
(
fields[fieldI],
obr_.time().timeName(),
refCast<const polyMesh>(obr_),
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
refCast<const fvMesh>(obr_)
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter = obr_.find(fields[fieldI]);
objectRegistry::const_iterator iter = mesh_.find(fields[fieldI]);
if
(
iter != obr_.end()
iter != objectRegistry::end()
&& iter()->type()
== GeometricField<Type, fvPatchField, volMesh>::typeName
)
{
sampleAndWrite
(
obr_.lookupObject
mesh_.lookupObject
<GeometricField<Type, fvPatchField, volMesh> >
(
fields[fieldI]
@ -181,12 +152,12 @@ Foam::probes::sample
tmp<Field<Type> > tValues
(
new Field<Type>(probeLocations_.size(), unsetVal)
new Field<Type>(this->size(), unsetVal)
);
Field<Type>& values = tValues();
forAll(probeLocations_, probeI)
forAll(*this, probeI)
{
if (cellList_[probeI] >= 0)
{
@ -207,7 +178,7 @@ Foam::probes::sample(const word& fieldName) const
{
return sample
(
obr_.lookupObject<GeometricField<Type, fvPatchField, volMesh> >
mesh_.lookupObject<GeometricField<Type, fvPatchField, volMesh> >
(
fieldName
)

View File

@ -34,103 +34,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(sampledSets, 0);
}
defineTypeNameAndDebug(Foam::sampledSets, 0);
bool Foam::sampledSets::verbose_ = false;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::sampledSets::checkFieldTypes()
{
wordList fieldTypes(fieldNames_.size());
// check files for a particular time
if (loadFromFiles_)
{
forAll(fieldNames_, fieldi)
{
IOobject io
(
fieldNames_[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
fieldTypes[fieldi] = io.headerClassName();
}
else
{
fieldTypes[fieldi] = "(notFound)";
}
}
}
else
{
// check objectRegistry
forAll(fieldNames_, fieldi)
{
objectRegistry::const_iterator iter =
mesh_.find(fieldNames_[fieldi]);
if (iter != mesh_.objectRegistry::end())
{
fieldTypes[fieldi] = iter()->type();
}
else
{
fieldTypes[fieldi] = "(notFound)";
}
}
}
label nFields = 0;
// classify fieldTypes
nFields += grep(scalarFields_, fieldTypes);
nFields += grep(vectorFields_, fieldTypes);
nFields += grep(sphericalTensorFields_, fieldTypes);
nFields += grep(symmTensorFields_, fieldTypes);
nFields += grep(tensorFields_, fieldTypes);
if (Pstream::master())
{
if (debug)
{
Pout<< "timeName = " << mesh_.time().timeName() << nl
<< "scalarFields " << scalarFields_ << nl
<< "vectorFields " << vectorFields_ << nl
<< "sphTensorFields " << sphericalTensorFields_ << nl
<< "symTensorFields " << symmTensorFields_ <<nl
<< "tensorFields " << tensorFields_ <<nl;
}
if (nFields > 0)
{
if (debug)
{
Pout<< "Creating directory "
<< outputPath_/mesh_.time().timeName()
<< nl << endl;
}
mkDir(outputPath_/mesh_.time().timeName());
}
}
return nFields > 0;
}
void Foam::sampledSets::combineSampledSets
(
PtrList<coordSet>& masterSampledSets,
@ -147,9 +56,9 @@ void Foam::sampledSets::combineSampledSets
const PtrList<sampledSet>& sampledSets = *this;
forAll(sampledSets, seti)
forAll(sampledSets, setI)
{
const sampledSet& samplePts = sampledSets[seti];
const sampledSet& samplePts = sampledSets[setI];
// Collect data from all processors
List<List<point> > gatheredPts(Pstream::nProcs());
@ -190,7 +99,7 @@ void Foam::sampledSets::combineSampledSets
// Sort curveDist and use to fill masterSamplePts
SortableList<scalar> sortedDist(allCurveDist);
indexSets[seti] = sortedDist.indices();
indexSets[setI] = sortedDist.indices();
// Get reference point (note: only master has all points)
point refPt;
@ -207,12 +116,12 @@ void Foam::sampledSets::combineSampledSets
masterSampledSets.set
(
seti,
setI,
new coordSet
(
samplePts.name(),
samplePts.axis(),
List<point>(UIndirectList<point>(allPts, indexSets[seti])),
List<point>(UIndirectList<point>(allPts, indexSets[setI])),
refPt
)
);
@ -236,7 +145,6 @@ Foam::sampledSets::sampledSets
loadFromFiles_(loadFromFiles),
outputPath_(fileName::null),
searchEngine_(mesh_, true),
fieldNames_(),
interpolationScheme_(word::null),
writeFormat_(word::null)
{
@ -285,13 +193,43 @@ void Foam::sampledSets::end()
void Foam::sampledSets::write()
{
if (size() && checkFieldTypes())
if (size())
{
sampleAndWrite(scalarFields_);
sampleAndWrite(vectorFields_);
sampleAndWrite(sphericalTensorFields_);
sampleAndWrite(symmTensorFields_);
sampleAndWrite(tensorFields_);
const label nFields = classifyFields();
if (Pstream::master())
{
if (debug)
{
Pout<< "timeName = " << mesh_.time().timeName() << nl
<< "scalarFields " << scalarFields_ << nl
<< "vectorFields " << vectorFields_ << nl
<< "sphTensorFields " << sphericalTensorFields_ << nl
<< "symTensorFields " << symmTensorFields_ <<nl
<< "tensorFields " << tensorFields_ <<nl;
}
if (nFields)
{
if (debug)
{
Pout<< "Creating directory "
<< outputPath_/mesh_.time().timeName()
<< nl << endl;
}
mkDir(outputPath_/mesh_.time().timeName());
}
}
if (nFields)
{
sampleAndWrite(scalarFields_);
sampleAndWrite(vectorFields_);
sampleAndWrite(sphericalTensorFields_);
sampleAndWrite(symmTensorFields_);
sampleAndWrite(tensorFields_);
}
}
}
@ -299,20 +237,20 @@ void Foam::sampledSets::write()
void Foam::sampledSets::read(const dictionary& dict)
{
dict_ = dict;
dict_.lookup("fields") >> fieldSelection_;
clearFieldGroups();
fieldNames_ = wordList(dict_.lookup("fields"));
interpolationScheme_ = dict.lookupOrDefault<word>
(
"interpolationScheme",
"cell"
);
writeFormat_ = dict.lookupOrDefault<word>
(
"setFormat",
"null"
);
interpolationScheme_ = "cell";
dict_.readIfPresent("interpolationScheme", interpolationScheme_);
writeFormat_ = "null";
dict_.readIfPresent("setFormat", writeFormat_);
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
PtrList<sampledSet> newList
(
@ -324,7 +262,7 @@ void Foam::sampledSets::read(const dictionary& dict)
if (Pstream::master() && debug)
{
Pout<< "sample fields:" << fieldNames_ << nl
Pout<< "sample fields:" << fieldSelection_ << nl
<< "sample sets:" << nl << "(" << nl;
forAll(*this, si)

View File

@ -43,6 +43,7 @@ SourceFiles
#include "interpolation.H"
#include "coordSet.H"
#include "writer.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +55,7 @@ class dictionary;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class sampledSets Declaration
Class sampledSets Declaration
\*---------------------------------------------------------------------------*/
class sampledSets
@ -67,25 +68,40 @@ class sampledSets
template<class Type>
class fieldGroup
:
public wordList
public DynamicList<word>
{
public:
//- Set formatter
autoPtr<writer<Type> > formatter;
//- The set formatter
autoPtr< writer<Type> > formatter;
//- Construct null
fieldGroup()
:
wordList(0),
DynamicList<word>(0),
formatter(NULL)
{}
//- Construct for a particular format
fieldGroup(const word& writeFormat)
:
DynamicList<word>(0),
formatter(writer<Type>::New(writeFormat))
{}
//- Reset format and field list
void clear()
{
wordList::clear();
DynamicList<word>::clear();
formatter.clear();
}
//- Assign a new formatter
void operator=(const word& writeFormat)
{
formatter = writer<Type>::New(writeFormat);
}
};
@ -161,7 +177,7 @@ class sampledSets
// Read from dictonary
//- Names of fields to sample
wordList fieldNames_;
wordReList fieldSelection_;
//- Interpolation scheme to use
word interpolationScheme_;
@ -187,16 +203,14 @@ class sampledSets
// Private Member Functions
//- Classify field types, return true if nFields > 0
bool checkFieldTypes();
//- Clear old field groups
void clearFieldGroups();
//- Find the fields in the list of the given type, return count
template<class Type>
label grep
(
fieldGroup<Type>& fieldList,
const wordList& fieldTypes
) const;
//- Append fieldName to the appropriate group
label appendFieldGroup(const word& fieldName, const word& fieldType);
//- Classify field types, returns the number of fields
label classifyFields();
//- Combine points from all processors. Sort by curveDist and produce
// index list. Valid result only on master processor.

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "sampledSets.H"
#include "volFields.H"
#include "IOobjectList.H"
#include "stringListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sampledSets::clearFieldGroups()
{
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
}
Foam::label Foam::sampledSets::appendFieldGroup
(
const word& fieldName,
const word& fieldType
)
{
if (fieldType == volScalarField::typeName)
{
scalarFields_.append(fieldName);
return 1;
}
else if (fieldType == volVectorField::typeName)
{
vectorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSphericalTensorField::typeName)
{
sphericalTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSymmTensorField::typeName)
{
symmTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volTensorField::typeName)
{
tensorFields_.append(fieldName);
return 1;
}
return 0;
}
Foam::label Foam::sampledSets::classifyFields()
{
label nFields = 0;
clearFieldGroups();
if (loadFromFiles_)
{
// check files for a particular time
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
}
else
{
// check currently available fields
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
mesh_.find(fieldName)()->type()
);
}
}
return nFields;
}
// ************************************************************************* //

View File

@ -46,10 +46,10 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
interpolation<Type>::New(interpolationScheme, field)
);
forAll(samplers, seti)
forAll(samplers, setI)
{
Field<Type>& values = this->operator[](seti);
const sampledSet& samples = samplers[seti];
Field<Type>& values = this->operator[](setI);
const sampledSet& samples = samplers[setI];
values.setSize(samples.size());
forAll(samples, samplei)
@ -79,10 +79,10 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
List<Field<Type> >(samplers.size()),
name_(field.name())
{
forAll(samplers, seti)
forAll(samplers, setI)
{
Field<Type>& values = this->operator[](seti);
const sampledSet& samples = samplers[seti];
Field<Type>& values = this->operator[](setI);
const sampledSet& samples = samplers[setI];
values.setSize(samples.size());
forAll(samples, samplei)
@ -105,41 +105,12 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
{}
template<class Type>
Foam::label Foam::sampledSets::grep
(
fieldGroup<Type>& fieldList,
const wordList& fieldTypes
) const
{
fieldList.setSize(fieldNames_.size());
label nFields = 0;
forAll(fieldNames_, fieldi)
{
if
(
fieldTypes[fieldi]
== GeometricField<Type, fvPatchField, volMesh>::typeName
)
{
fieldList[nFields] = fieldNames_[fieldi];
nFields++;
}
}
fieldList.setSize(nFields);
return nFields;
}
template<class Type>
void Foam::sampledSets::writeSampleFile
(
const coordSet& masterSampleSet,
const PtrList<volFieldSampler<Type> >& masterFields,
const label seti,
const label setI,
const fileName& timeDir,
const writer<Type>& formatter
)
@ -150,7 +121,7 @@ void Foam::sampledSets::writeSampleFile
forAll(masterFields, fieldi)
{
valueSetNames[fieldi] = masterFields[fieldi].name();
valueSets[fieldi] = &masterFields[fieldi][seti];
valueSets[fieldi] = &masterFields[fieldi][setI];
}
fileName fName
@ -180,11 +151,11 @@ void Foam::sampledSets::combineSampledValues
{
List<Field<T> > masterValues(indexSets.size());
forAll(indexSets, seti)
forAll(indexSets, setI)
{
// Collect data from all processors
List<Field<T> > gatheredData(Pstream::nProcs());
gatheredData[Pstream::myProcNo()] = sampledFields[fieldi][seti];
gatheredData[Pstream::myProcNo()] = sampledFields[fieldi][setI];
Pstream::gatherList(gatheredData);
if (Pstream::master())
@ -198,10 +169,10 @@ void Foam::sampledSets::combineSampledValues
)
);
masterValues[seti] = UIndirectList<T>
masterValues[setI] = UIndirectList<T>
(
allData,
indexSets[seti]
indexSets[setI]
)();
}
}
@ -232,7 +203,7 @@ void Foam::sampledSets::sampleAndWrite
// Create or use existing writer
if (fields.formatter.empty())
{
fields.formatter = writer<Type>::New(writeFormat_);
fields = writeFormat_;
}
// Storage for interpolated values
@ -326,13 +297,13 @@ void Foam::sampledSets::sampleAndWrite
if (Pstream::master())
{
forAll(masterSampledSets_, seti)
forAll(masterSampledSets_, setI)
{
writeSampleFile
(
masterSampledSets_[seti],
masterSampledSets_[setI],
masterFields,
seti,
setI,
outputPath_/mesh_.time().timeName(),
fields.formatter()
);

View File

@ -153,7 +153,7 @@ void Foam::vtkSetWriter<Type>::write
label globalPtI = 0;
forAll(tracks, trackI)
{
const coordSet& points = tracks[trackI];
const coordSet& points = tracks[trackI];
os << points.size();
forAll(points, i)
@ -164,7 +164,7 @@ void Foam::vtkSetWriter<Type>::write
os << nl;
}
}
os << "POINT_DATA " << nPoints << nl
<< " FIELD attributes " << valueSetNames.size() << nl;

View File

@ -243,7 +243,7 @@ bool Foam::sampledIsoSurfaceCell::expire()
{
return false;
}
// force update
prevTimeIndex_ = -1;
return true;

View File

@ -35,6 +35,10 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::sampledSurfaces, 0);
bool Foam::sampledSurfaces::verbose_ = false;
Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1e-10;
namespace Foam
{
//- Used to offset faces in Pstream::combineOffset
@ -60,101 +64,11 @@ namespace Foam
}
};
defineTypeNameAndDebug(sampledSurfaces, 0);
}
bool Foam::sampledSurfaces::verbose_(false);
Foam::scalar Foam::sampledSurfaces::mergeTol_(1e-10);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label Foam::sampledSurfaces::classifyFieldTypes()
{
label nFields = 0;
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
forAll(fieldNames_, fieldI)
{
const word& fieldName = fieldNames_[fieldI];
word fieldType = "";
// check files for a particular time
if (loadFromFiles_)
{
IOobject io
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
fieldType = io.headerClassName();
}
else
{
continue;
}
}
else
{
// check objectRegistry
objectRegistry::const_iterator iter = mesh_.find(fieldName);
if (iter != mesh_.objectRegistry::end())
{
fieldType = iter()->type();
}
else
{
continue;
}
}
if (fieldType == volScalarField::typeName)
{
scalarFields_.append(fieldName);
nFields++;
}
else if (fieldType == volVectorField::typeName)
{
vectorFields_.append(fieldName);
nFields++;
}
else if (fieldType == volSphericalTensorField::typeName)
{
sphericalTensorFields_.append(fieldName);
nFields++;
}
else if (fieldType == volSymmTensorField::typeName)
{
symmTensorFields_.append(fieldName);
nFields++;
}
else if (fieldType == volTensorField::typeName)
{
tensorFields_.append(fieldName);
nFields++;
}
}
return nFields;
}
void Foam::sampledSurfaces::writeGeometry() const
{
// Write to time directory under outputPath_
@ -208,7 +122,7 @@ Foam::sampledSurfaces::sampledSurfaces
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles),
outputPath_(fileName::null),
fieldNames_(),
fieldSelection_(),
interpolationScheme_(word::null),
writeFormat_(word::null),
mergeList_(),
@ -265,7 +179,7 @@ void Foam::sampledSurfaces::write()
// finalize surfaces, merge points etc.
update();
const label nFields = classifyFieldTypes();
const label nFields = classifyFields();
if (Pstream::master())
{
@ -286,8 +200,8 @@ void Foam::sampledSurfaces::write()
mkDir(outputPath_/mesh_.time().timeName());
}
// write geometry first if required, or when no fields would otherwise
// be written
// write geometry first if required,
// or when no fields would otherwise be written
if (nFields == 0 || genericFormatter_->separateFiles())
{
writeGeometry();
@ -304,15 +218,8 @@ void Foam::sampledSurfaces::write()
void Foam::sampledSurfaces::read(const dictionary& dict)
{
fieldNames_ = wordList(dict.lookup("fields"));
const label nFields = fieldNames_.size();
scalarFields_.reset(nFields);
vectorFields_.reset(nFields);
sphericalTensorFields_.reset(nFields);
symmTensorFields_.reset(nFields);
tensorFields_.reset(nFields);
dict.lookup("fields") >> fieldSelection_;
clearFieldGroups();
interpolationScheme_ = dict.lookupOrDefault<word>
(
@ -335,7 +242,6 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
dict.lookup("surfaces"),
sampledSurface::iNew(mesh_)
);
transfer(newList);
if (Pstream::parRun())
@ -348,7 +254,7 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
if (Pstream::master() && debug)
{
Pout<< "sample fields:" << fieldNames_ << nl
Pout<< "sample fields:" << fieldSelection_ << nl
<< "sample surfaces:" << nl << "(" << nl;
forAll(*this, surfI)

View File

@ -41,6 +41,7 @@ SourceFiles
#include "sampledSurface.H"
#include "surfaceWriter.H"
#include "volFieldsFwd.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,7 +52,7 @@ class fvMesh;
class dictionary;
/*---------------------------------------------------------------------------*\
Class sampledSurfaces Declaration
Class sampledSurfaces Declaration
\*---------------------------------------------------------------------------*/
class sampledSurfaces
@ -68,7 +69,7 @@ class sampledSurfaces
{
public:
//- Surface formatter
//- The surface formatter
autoPtr< surfaceWriter<Type> > formatter;
//- Construct null
@ -85,34 +86,19 @@ class sampledSurfaces
formatter(surfaceWriter<Type>::New(writeFormat))
{}
//- Construct for a particular surface format and a list of field
// names
fieldGroup
(
const word& writeFormat,
const wordList& fieldNames
)
:
DynamicList<word>(fieldNames),
formatter(surfaceWriter<Type>::New(writeFormat))
{}
void reset(const label nElem)
//- Reset format and field list
void clear()
{
DynamicList<word>::clear();
formatter.clear();
DynamicList<word>::setCapacity(nElem);
DynamicList<word>::clear();
}
//- Assign a new formatter
void operator=(const word& writeFormat)
{
formatter = surfaceWriter<Type>::New(writeFormat);
}
void operator=(const wordList& fieldNames)
{
DynamicList<word>::operator=(fieldNames);
}
};
@ -161,7 +147,7 @@ class sampledSurfaces
// Read from dictonary
//- Names of fields to sample
wordList fieldNames_;
wordReList fieldSelection_;
//- Interpolation scheme to use
word interpolationScheme_;
@ -191,8 +177,14 @@ class sampledSurfaces
// Private Member Functions
//- Clear old field groups
void clearFieldGroups();
//- Append fieldName to the appropriate group
label appendFieldGroup(const word& fieldName, const word& fieldType);
//- Classify field types, returns the number of fields
label classifyFieldTypes();
label classifyFields();
//- Write geometry only
void writeGeometry() const;

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "sampledSurfaces.H"
#include "volFields.H"
#include "IOobjectList.H"
#include "stringListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sampledSurfaces::clearFieldGroups()
{
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
}
Foam::label Foam::sampledSurfaces::appendFieldGroup
(
const word& fieldName,
const word& fieldType
)
{
if (fieldType == volScalarField::typeName)
{
scalarFields_.append(fieldName);
return 1;
}
else if (fieldType == volVectorField::typeName)
{
vectorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSphericalTensorField::typeName)
{
sphericalTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSymmTensorField::typeName)
{
symmTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volTensorField::typeName)
{
tensorFields_.append(fieldName);
return 1;
}
return 0;
}
Foam::label Foam::sampledSurfaces::classifyFields()
{
label nFields = 0;
clearFieldGroups();
// check files for a particular time
if (loadFromFiles_)
{
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
}
else
{
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
mesh_.find(fieldName)()->type()
);
}
}
return nFields;
}
// ************************************************************************* //

View File

@ -178,7 +178,7 @@ void Foam::sampledSurfaces::sampleAndWrite
if
(
iter != mesh_.objectRegistry::end()
iter != objectRegistry::end()
&& iter()->type()
== GeometricField<Type, fvPatchField, volMesh>::typeName
)

View File

@ -67,7 +67,7 @@ class thresholdCellFaces
void calculate
(
const scalarField&,
const scalarField&,
const scalar lowerThreshold,
const scalar upperThreshold,
const bool triangulate

View File

@ -918,7 +918,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
// 'face' not '<Face>'
const face& f = faceLst[faceI];
label nTmp;
label nTmp = 0;
f.triangles(this->points(), nTmp, tmpTri);
for (label triI = 0; triI < nTmp; triI++)
{

View File

@ -77,7 +77,7 @@ LESModel::LESModel
),
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subDictPtr(type + "Coeffs")),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),

View File

@ -79,7 +79,7 @@ RASModel::RASModel
turbulence_(lookup("turbulence")),
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subDictPtr(type + "Coeffs")),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL),

View File

@ -76,7 +76,7 @@ LESModel::LESModel
),
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subDictPtr(type + "Coeffs")),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))

View File

@ -78,7 +78,7 @@ RASModel::RASModel
turbulence_(lookup("turbulence")),
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subDictPtr(type + "Coeffs")),
coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL),
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL),

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -wd654,819,1125,1476,1505,1572
c++WARN = -wd327,654,819,1125,1476,1505,1572
CC = icpc

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -wd654,819,1125,1476,1505,1572
c++WARN = -wd327,654,819,1125,1476,1505,1572
CC = icpc

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -wd654,819,1125,1476,1505,1572
c++WARN = -wd327,654,819,1125,1476,1505,1572
#CC = icpc -gcc-version=400
CC = icpc