MRG: merged develop line back into integration branch

This commit is contained in:
Andrew Heather
2017-05-18 11:11:12 +01:00
514 changed files with 12134 additions and 16093 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,7 +62,6 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
argList::noParallel();
argList::validArgs.append("patches");
argList::validArgs.append("edgeFraction");

View File

@ -22,8 +22,11 @@ fi
# Build libccmio (.a|.so) - use static linkage for fewer issues
$WM_THIRD_PARTY_DIR/makeCCMIO lib
: ${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH} # Extra safety
export FOAM_EXT_LIBBIN
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ]
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o -e $FOAM_EXT_LIBBIN/libccmio.so \) ]
then
wmake $targetType ccm26ToFoam
else

View File

@ -512,7 +512,7 @@ void readCells
{
label meshPti;
lineStr >> meshPti >> meshPti;
}
}
else if (elmType == MSHTRI)
{
lineStr >> triPoints[0] >> triPoints[1] >> triPoints[2];

View File

@ -925,8 +925,8 @@ int main(int argc, char *argv[])
}
}
HashTable<labelList,word> cellZones;
HashTable<labelList,word> faceZones;
HashTable<labelList> cellZones;
HashTable<labelList> faceZones;
List<bool> isAPatch(patchNames.size(),true);
if (dofVertIndices.size())

View File

@ -62,7 +62,7 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints
)
{
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField();
Field<Type>& newField = tNewField.ref();
label added = 0;
label count = 0;
@ -160,7 +160,7 @@ Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
(
new triadField(mesh.vertexCount(), triad::unset)
);
triadField& alignments = tAlignments();
triadField& alignments = tAlignments.ref();
for
(
@ -188,7 +188,7 @@ Foam::tmp<Foam::pointField> buildPointField(const T& mesh)
(
new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT))
);
pointField& points = tPoints();
pointField& points = tPoints.ref();
for
(

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "DelaunayMesh.H"
#include "labelPair.H"
#include "polyMesh.H"
#include "labelPairHashes.H"
#include "PrintTable.H"
#include "pointIOField.H"
#include "scalarIOField.H"

View File

@ -37,9 +37,7 @@ SourceFiles
#ifndef DelaunayMesh_H
#define DelaunayMesh_H
#include "Pair.H"
#include "HashSet.H"
#include "FixedList.H"
#include "labelPairHashes.H"
#include "boundBox.H"
#include "indexedVertex.H"
#include "CGALTriangulation3Ddefs.H"
@ -77,20 +75,6 @@ public:
typedef typename Triangulation::Finite_facets_iterator
Finite_facets_iterator;
typedef HashSet
<
Pair<label>,
FixedList<label, 2>::Hash<>
> labelPairHashSet;
typedef HashTable
<
label,
labelPair,
FixedList<label, 2>::Hash<>
> labelTolabelPairHashTable;
private:
// Private data
@ -263,7 +247,7 @@ public:
autoPtr<polyMesh> createMesh
(
const fileName& name,
labelTolabelPairHashTable& vertexMap,
labelPairLookup& vertexMap,
labelList& cellMap,
const bool writeDelaunayData = true
) const;

View File

@ -337,7 +337,7 @@ Foam::autoPtr<Foam::polyMesh>
Foam::DelaunayMesh<Triangulation>::createMesh
(
const fileName& name,
labelTolabelPairHashTable& vertexMap,
labelPairLookup& vertexMap,
labelList& cellMap,
const bool writeDelaunayData
) const

View File

@ -31,9 +31,6 @@ License
#include "indexedVertexEnum.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class Triangulation>
@ -539,13 +536,7 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
if (!pointsNotInserted.empty())
{
for
(
typename labelPairHashSet::const_iterator iter
= pointsNotInserted.begin();
iter != pointsNotInserted.end();
++iter
)
forAllConstIters(pointsNotInserted, iter)
{
if (receivedVertices.found(iter.key()))
{
@ -863,7 +854,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::sync(const boundBox& bb)
template<class Triangulation>
template<class PointIterator>
typename Foam::DistributedDelaunayMesh<Triangulation>::labelPairHashSet
Foam::labelPairHashSet
Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
(
PointIterator begin,

View File

@ -71,10 +71,6 @@ public:
typedef typename Triangulation::All_cells_iterator
All_cells_iterator;
typedef typename DelaunayMesh<Triangulation>::labelPairHashSet
labelPairHashSet;
private:
autoPtr<List<boundBox>> allBackgroundMeshBounds_;
@ -193,12 +189,6 @@ public:
bool printErrors = true
);
// distributeField();
// Queries
};

View File

@ -635,7 +635,7 @@ void Foam::cellShapeControlMesh::write() const
}
}
DelaunayMesh<CellSizeDelaunay>::labelTolabelPairHashTable vertexMap;
labelPairLookup vertexMap;
labelList cellMap;
autoPtr<polyMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh

View File

@ -35,7 +35,7 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints
)
{
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField();
Field<Type>& newField = tNewField.ref();
label added = 0;
label count = 0;

View File

@ -105,7 +105,7 @@ public:
typedef Delaunay::Facet Facet;
typedef Delaunay::Point Point;
typedef List<DynamicList<Pair<labelPair>>> labelPairPairDynListList;
typedef List<DynamicList<labelPairPair>> labelPairPairDynListList;
typedef Tuple2<pointIndexHit, label> pointIndexHitAndFeature;
typedef List<pointIndexHitAndFeature> pointIndexHitAndFeatureList;
@ -706,7 +706,7 @@ private:
(
labelList& owner,
labelList& neighbour,
const HashSet<labelPair, labelPair::Hash<>>& deferredCollapseFaces
const labelPairHashSet& deferredCollapseFaces
) const;
//- Check whether the cell sizes are fine enough. Creates a polyMesh.

View File

@ -673,7 +673,7 @@ void Foam::conformalVoronoiMesh::deferredCollapseFaceSet
(
labelList& owner,
labelList& neighbour,
const HashSet<labelPair, labelPair::Hash<>>& deferredCollapseFaces
const labelPairHashSet& deferredCollapseFaces
) const
{
DynamicList<label> faceLabels;
@ -2131,14 +2131,14 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Use this processor's vertex index as the master
// for sorting
DynamicList<Pair<labelPair>>& sortingIndex =
DynamicList<labelPairPair>& sortingIndex =
procPatchSortingIndex[patchIndex];
if (vB->internalOrBoundaryPoint() && vB->referred())
{
sortingIndex.append
(
Pair<labelPair>
labelPairPair
(
labelPair(vA->index(), vA->procIndex()),
labelPair(vB->index(), vB->procIndex())
@ -2149,7 +2149,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{
sortingIndex.append
(
Pair<labelPair>
labelPairPair
(
labelPair(vB->index(), vB->procIndex()),
labelPair(vA->index(), vA->procIndex())
@ -2162,14 +2162,14 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
// Use the other processor's vertex index as the
// master for sorting
DynamicList<Pair<labelPair>>& sortingIndex =
DynamicList<labelPairPair>& sortingIndex =
procPatchSortingIndex[patchIndex];
if (vA->internalOrBoundaryPoint() && vA->referred())
{
sortingIndex.append
(
Pair<labelPair>
labelPairPair
(
labelPair(vA->index(), vA->procIndex()),
labelPair(vB->index(), vB->procIndex())
@ -2180,7 +2180,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{
sortingIndex.append
(
Pair<labelPair>
labelPairPair
(
labelPair(vB->index(), vB->procIndex()),
labelPair(vA->index(), vA->procIndex())
@ -2463,7 +2463,7 @@ void Foam::conformalVoronoiMesh::sortProcPatches
faceList& faces = patchFaces[patchi];
labelList& owner = patchOwners[patchi];
DynamicList<label>& slaves = patchPointPairSlaves[patchi];
DynamicList<Pair<labelPair>>& sortingIndices
DynamicList<labelPairPair>& sortingIndices
= patchSortingIndices[patchi];
if (!sortingIndices.empty())

View File

@ -293,9 +293,9 @@ inline Foam::point Foam::conformalVoronoiMesh::perturbPoint
scalar pert = 1e-12*defaultCellSize();
perturbedPt.x() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.y() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.z() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.x() += pert*(rndGen_.sample01<scalar>() - 0.5);
perturbedPt.y() += pert*(rndGen_.sample01<scalar>() - 0.5);
perturbedPt.z() += pert*(rndGen_.sample01<scalar>() - 0.5);
return perturbedPt;
}

View File

@ -199,7 +199,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
Info<< nl << "Writing " << "tetDualMesh" << endl;
DistributedDelaunayMesh<Delaunay>::labelTolabelPairHashTable vertexMap;
labelPairLookup vertexMap;
labelList cellMap;
autoPtr<polyMesh> tetMesh =
createMesh("tetDualMesh", vertexMap, cellMap);

View File

@ -553,11 +553,11 @@ bool Foam::autoDensity::fillBox
+ vector
(
delta.x()
*(i + 0.5 + 0.1*(rndGen().scalar01() - 0.5)),
*(i + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5)),
delta.y()
*(j + 0.5 + 0.1*(rndGen().scalar01() - 0.5)),
*(j + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5)),
delta.z()
*(k + 0.5 + 0.1*(rndGen().scalar01() - 0.5))
*(k + 0.5 + 0.1*(rndGen().sample01<scalar>() - 0.5))
);
}
}
@ -662,7 +662,7 @@ bool Foam::autoDensity::fillBox
// TODO - is there a lot of cost in the 1/density calc? Could
// assess on
// (1/maxDensity)/(1/localDensity) = minVolume/localVolume
if (localDensity/maxDensity > rndGen().scalar01())
if (localDensity/maxDensity > rndGen().sample01<scalar>())
{
scalar localVolume = 1/localDensity;
@ -675,7 +675,7 @@ bool Foam::autoDensity::fillBox
scalar addProbability =
(totalVolume - volumeAdded)/localVolume;
scalar r = rndGen().scalar01();
scalar r = rndGen().sample01<scalar>();
if (debug)
{
@ -729,7 +729,7 @@ bool Foam::autoDensity::fillBox
{
trialPoints++;
point p = min + cmptMultiply(span, rndGen().vector01());
point p = min + cmptMultiply(span, rndGen().sample01<vector>());
scalar localSize = cellShapeControls().cellSize(p);
@ -785,7 +785,7 @@ bool Foam::autoDensity::fillBox
// Accept possible placements proportional to the relative local
// density
if (localDensity/maxDensity > rndGen().scalar01())
if (localDensity/maxDensity > rndGen().sample01<scalar>())
{
scalar localVolume = 1/localDensity;
@ -798,7 +798,7 @@ bool Foam::autoDensity::fillBox
scalar addProbability =
(totalVolume - volumeAdded)/localVolume;
scalar r = rndGen().scalar01();
scalar r = rndGen().sample01<scalar>();
if (debug)
{

View File

@ -129,9 +129,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
pA.x() += pert*(rndGen().scalar01() - 0.5);
pA.y() += pert*(rndGen().scalar01() - 0.5);
pA.z() += pert*(rndGen().scalar01() - 0.5);
pA.x() += pert*(rndGen().sample01<scalar>() - 0.5);
pA.y() += pert*(rndGen().sample01<scalar>() - 0.5);
pA.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())
@ -150,9 +150,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
pB.x() += pert*(rndGen().scalar01() - 0.5);
pB.y() += pert*(rndGen().scalar01() - 0.5);
pB.z() += pert*(rndGen().scalar01() - 0.5);
pB.x() += pert*(rndGen().sample01<scalar>() - 0.5);
pB.y() += pert*(rndGen().sample01<scalar>() - 0.5);
pB.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())

View File

@ -127,9 +127,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += pert*(rndGen().scalar01() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5);
p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())
@ -155,9 +155,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += pert*(rndGen().scalar01() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5);
p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())
@ -183,9 +183,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += pert*(rndGen().scalar01() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5);
p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())
@ -211,9 +211,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += pert*(rndGen().scalar01() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5);
p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if (Pstream::parRun())

View File

@ -198,9 +198,15 @@ List<Vb::Point> pointFile::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
p.y() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
p.z() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
p.x() +=
randomPerturbationCoeff_
*(rndGen().sample01<scalar>() - 0.5);
p.y() +=
randomPerturbationCoeff_
*(rndGen().sample01<scalar>() - 0.5);
p.z() +=
randomPerturbationCoeff_
*(rndGen().sample01<scalar>() - 0.5);
}
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));

View File

@ -86,9 +86,9 @@ void rayShooting::splitLine
{
Foam::point newPt
(
midPoint.x() + pert*(rndGen().scalar01() - 0.5),
midPoint.y() + pert*(rndGen().scalar01() - 0.5),
midPoint.z() + pert*(rndGen().scalar01() - 0.5)
midPoint.x() + pert*(rndGen().sample01<scalar>() - 0.5),
midPoint.y() + pert*(rndGen().sample01<scalar>() - 0.5),
midPoint.z() + pert*(rndGen().sample01<scalar>() - 0.5)
);
if

View File

@ -128,9 +128,9 @@ List<Vb::Point> uniformGrid::initialPoints() const
if (randomiseInitialGrid_)
{
p.x() += pert*(rndGen().scalar01() - 0.5);
p.y() += pert*(rndGen().scalar01() - 0.5);
p.z() += pert*(rndGen().scalar01() - 0.5);
p.x() += pert*(rndGen().sample01<scalar>() - 0.5);
p.y() += pert*(rndGen().sample01<scalar>() - 0.5);
p.z() += pert*(rndGen().sample01<scalar>() - 0.5);
}
if

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class Triangulation>
inline Foam::Pair<Foam::labelPair>
inline Foam::labelPairPair
Foam::pointPairs<Triangulation>::orderPointPair
(
const labelPair& vA,
@ -38,8 +38,8 @@ Foam::pointPairs<Triangulation>::orderPointPair
return
(
(vA < vB)
? Pair<labelPair>(vA, vB)
: Pair<labelPair>(vB, vA)
? labelPairPair(vA, vB)
: labelPairPair(vB, vA)
);
}
@ -85,7 +85,7 @@ inline bool Foam::pointPairs<Triangulation>::insertPointPair
template<class Triangulation>
Foam::pointPairs<Triangulation>::pointPairs(const Triangulation& triangulation)
:
ptPairTable(),
StorageContainer(),
triangulation_(triangulation)
{}
@ -181,7 +181,7 @@ void Foam::pointPairs<Triangulation>::reIndex(const Map<label>& oldToNewIndices)
forAllConstIter(pointPairs, *this, iter)
{
Pair<labelPair> e = iter.key();
labelPairPair e = iter.key();
labelPair& start = e.first();
labelPair& end = e.second();

View File

@ -39,20 +39,13 @@ Description
#ifndef pointPairs_H
#define pointPairs_H
#include "labelPair.H"
#include "HashSet.H"
#include "labelPairHashes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef HashSet
<
Pair<labelPair>,
FixedList<labelPair, 2>::Hash<>
> ptPairTable;
/*---------------------------------------------------------------------------*\
Class pointPairs Declaration
\*---------------------------------------------------------------------------*/
@ -60,11 +53,12 @@ typedef HashSet
template<class Triangulation>
class pointPairs
:
public ptPairTable
public HashSet<labelPairPair, labelPairPair::Hash<>>
{
// Private typedefs
typedef typename Triangulation::Vertex_handle Vertex_handle;
typedef HashSet<labelPairPair, labelPairPair::Hash<>> StorageContainer;
typedef typename Triangulation::Vertex_handle Vertex_handle;
// Private data
@ -74,7 +68,7 @@ class pointPairs
// Private Member Functions
inline Pair<labelPair> orderPointPair
inline labelPairPair orderPointPair
(
const labelPair& vA,
const labelPair& vB

View File

@ -264,8 +264,8 @@ void Foam::CV2D::insertGrid()
if (meshControls().randomiseInitialGrid())
{
p.x() += pert*(rndGen.scalar01() - 0.5);
p.y() += pert*(rndGen.scalar01() - 0.5);
p.x() += pert*(rndGen.sample01<scalar>() - 0.5);
p.y() += pert*(rndGen.sample01<scalar>() - 0.5);
}
if (qSurf_.wellInside(p, 0.5*meshControls().minCellSize2()))

View File

@ -8,7 +8,7 @@ EXE_INC = \
${EXE_NDEBUG} \
${CGAL_INC} \
${c++LESSWARN} \
-I$(FOAM_APP)/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
-I$(FOAM_UTILITIES)/mesh/generation/extrude2DMesh/extrude2DMesh/lnInclude \
-I../conformalVoronoi2DMesh/lnInclude \
-I../conformalVoronoiMesh/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \

View File

@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -660,7 +660,7 @@ void writeMesh
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
processorMeshes::removeFiles(mesh);
if (!debugLevel)
if (!debugLevel && !(writeLevel&meshRefinement::WRITELAYERSETS))
{
topoSet::removeFiles(mesh);
}

View File

@ -1,3 +1,4 @@
writeFields.C
checkTools.C
checkTopology.C
checkGeometry.C

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,12 +57,18 @@ Usage
Reconstruct all cellSets and faceSets geometry and write to postProcessing/
directory according to surfaceFormat (e.g. vtk or ensight)
\param -writeAllFields \n
Writes all mesh quality measures as fields.
\param -writeFields '(\<fieldName\>)' \n
Writes selected mesh quality measures as fields.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "fvMesh.H"
#include "globalMeshData.H"
#include "surfaceWriter.H"
#include "vtkSetWriter.H"
@ -71,6 +77,7 @@ Usage
#include "checkTopology.H"
#include "checkGeometry.H"
#include "checkMeshQuality.H"
#include "writeFields.H"
using namespace Foam;
@ -96,6 +103,17 @@ int main(int argc, char *argv[])
"include extra topology checks"
);
argList::addBoolOption
(
"writeAllFields",
"write volFields with mesh quality parameters"
);
argList::addOption
(
"writeFields",
"wordList",
"write volFields with selected mesh quality parameters"
);
argList::addBoolOption
(
"meshQuality",
"read user-defined mesh quality criterions from system/meshQualityDict"
@ -110,7 +128,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedPolyMesh.H"
#include "createNamedMesh.H"
const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.optionFound("allGeometry");
@ -119,6 +137,24 @@ int main(int argc, char *argv[])
word surfaceFormat;
const bool writeSets = args.optionReadIfPresent("writeSets", surfaceFormat);
HashSet<word> selectedFields;
bool writeFields = args.optionReadIfPresent
(
"writeFields",
selectedFields
);
if (!writeFields && args.optionFound("writeAllFields"))
{
selectedFields.insert("nonOrthoAngle");
selectedFields.insert("faceWeight");
selectedFields.insert("skewness");
selectedFields.insert("cellDeterminant");
selectedFields.insert("aspectRatio");
selectedFields.insert("cellShapes");
selectedFields.insert("cellVolume");
selectedFields.insert("cellVolumeRatio");
}
if (noTopology)
{
@ -143,6 +179,11 @@ int main(int argc, char *argv[])
<< " representation"
<< " of all faceSets and cellSets." << nl << endl;
}
if (selectedFields.size())
{
Info<< "Writing mesh quality as fields " << selectedFields << nl
<< endl;
}
autoPtr<IOdictionary> qualDict;
@ -234,6 +275,10 @@ int main(int argc, char *argv[])
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
<< endl;
}
// Write selected fields
Foam::writeFields(mesh, selectedFields);
}
else if (state == polyMesh::POINTS_MOVED)
{
@ -262,6 +307,10 @@ int main(int argc, char *argv[])
{
Info<< "\nMesh OK.\n" << endl;
}
// Write selected fields
Foam::writeFields(mesh, selectedFields);
}
}

View File

@ -0,0 +1,360 @@
#include "writeFields.H"
#include "volFields.H"
#include "polyMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
using namespace Foam;
void maxFaceToCell
(
const scalarField& faceData,
volScalarField& cellData
)
{
const cellList& cells = cellData.mesh().cells();
scalarField& cellFld = cellData.ref();
cellFld = -GREAT;
forAll(cells, cellI)
{
const cell& cFaces = cells[cellI];
forAll(cFaces, i)
{
cellFld[cellI] = max(cellFld[cellI], faceData[cFaces[i]]);
}
}
forAll(cellData.boundaryField(), patchI)
{
fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI];
fvp = fvp.patch().patchSlice(faceData);
}
cellData.correctBoundaryConditions();
}
void minFaceToCell
(
const scalarField& faceData,
volScalarField& cellData
)
{
const cellList& cells = cellData.mesh().cells();
scalarField& cellFld = cellData.ref();
cellFld = GREAT;
forAll(cells, cellI)
{
const cell& cFaces = cells[cellI];
forAll(cFaces, i)
{
cellFld[cellI] = min(cellFld[cellI], faceData[cFaces[i]]);
}
}
forAll(cellData.boundaryField(), patchI)
{
fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI];
fvp = fvp.patch().patchSlice(faceData);
}
cellData.correctBoundaryConditions();
}
void Foam::writeFields
(
const fvMesh& mesh,
const HashSet<word>& selectedFields
)
{
if (selectedFields.empty())
{
return;
}
Info<< "Writing fields with mesh quality parameters" << endl;
if (selectedFields.found("nonOrthoAngle"))
{
//- Face based orthogonality
const scalarField faceOrthogonality
(
polyMeshTools::faceOrthogonality
(
mesh,
mesh.faceAreas(),
mesh.cellCentres()
)
);
//- Face based angle
const scalarField nonOrthoAngle
(
radToDeg
(
Foam::acos(min(1.0, faceOrthogonality))
)
);
//- Cell field - max of either face
volScalarField cellNonOrthoAngle
(
IOobject
(
"nonOrthoAngle",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("angle", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take max
maxFaceToCell(nonOrthoAngle, cellNonOrthoAngle);
Info<< " Writing non-orthogonality (angle) to "
<< cellNonOrthoAngle.name() << endl;
cellNonOrthoAngle.write();
}
if (selectedFields.found("faceWeight"))
{
const scalarField faceWeights
(
polyMeshTools::faceWeights
(
mesh,
mesh.faceCentres(),
mesh.faceAreas(),
mesh.cellCentres()
)
);
volScalarField cellWeights
(
IOobject
(
"faceWeight",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("weight", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take min
minFaceToCell(faceWeights, cellWeights);
Info<< " Writing face interpolation weights (0..0.5) to "
<< cellWeights.name() << endl;
cellWeights.write();
}
// Skewness
// ~~~~~~~~
if (selectedFields.found("skewness"))
{
//- Face based skewness
const scalarField faceSkewness
(
polyMeshTools::faceSkewness
(
mesh,
mesh.points(),
mesh.faceCentres(),
mesh.faceAreas(),
mesh.cellCentres()
)
);
//- Cell field - max of either face
volScalarField cellSkewness
(
IOobject
(
"skewness",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("skewness", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take max
maxFaceToCell(faceSkewness, cellSkewness);
Info<< " Writing face skewness to " << cellSkewness.name() << endl;
cellSkewness.write();
}
// cellDeterminant
// ~~~~~~~~~~~~~~~
if (selectedFields.found("cellDeterminant"))
{
volScalarField cellDeterminant
(
IOobject
(
"cellDeterminant",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellDeterminant", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
cellDeterminant.primitiveFieldRef() =
primitiveMeshTools::cellDeterminant
(
mesh,
mesh.geometricD(),
mesh.faceAreas(),
syncTools::getInternalOrCoupledFaces(mesh)
);
cellDeterminant.correctBoundaryConditions();
Info<< " Writing cell determinant to "
<< cellDeterminant.name() << endl;
cellDeterminant.write();
}
// Aspect ratio
// ~~~~~~~~~~~~
if (selectedFields.found("aspectRatio"))
{
volScalarField aspectRatio
(
IOobject
(
"aspectRatio",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("aspectRatio", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
scalarField cellOpenness;
polyMeshTools::cellClosedness
(
mesh,
mesh.geometricD(),
mesh.faceAreas(),
mesh.cellVolumes(),
cellOpenness,
aspectRatio.ref()
);
aspectRatio.correctBoundaryConditions();
Info<< " Writing aspect ratio to " << aspectRatio.name() << endl;
aspectRatio.write();
}
// cell type
// ~~~~~~~~~
if (selectedFields.found("cellShapes"))
{
volScalarField shape
(
IOobject
(
"cellShapes",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellShapes", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
const cellShapeList& cellShapes = mesh.cellShapes();
forAll(cellShapes, cellI)
{
const cellModel& model = cellShapes[cellI].model();
shape[cellI] = model.index();
}
shape.correctBoundaryConditions();
Info<< " Writing cell shape (hex, tet etc.) to " << shape.name()
<< endl;
shape.write();
}
if (selectedFields.found("cellVolume"))
{
volScalarField V
(
IOobject
(
"cellVolume",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("cellVolume", dimVolume, 0),
calculatedFvPatchScalarField::typeName
);
V.ref() = mesh.V();
Info<< " Writing cell volume to " << V.name() << endl;
V.write();
}
if (selectedFields.found("cellVolumeRatio"))
{
const scalarField faceVolumeRatio
(
polyMeshTools::volRatio
(
mesh,
mesh.V()
)
);
volScalarField cellVolumeRatio
(
IOobject
(
"cellVolumeRatio",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("cellVolumeRatio", dimless, 0),
calculatedFvPatchScalarField::typeName
);
//- Take min
minFaceToCell(faceVolumeRatio, cellVolumeRatio);
Info<< " Writing cell volume ratio to "
<< cellVolumeRatio.name() << endl;
cellVolumeRatio.write();
}
Info<< endl;
}

View File

@ -0,0 +1,10 @@
#include "fvMesh.H"
namespace Foam
{
void writeFields
(
const fvMesh&,
const HashSet<word>& selectedFields
);
}

View File

@ -12,11 +12,27 @@ then
export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber"
fi
if [ -f "${ZOLTAN_ARCH_PATH}/lib/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
if [ -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
then
echo " found libzoltanRenumber -- enabling sloan renumbering support."
export COMP_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
if [ -z "$ZOLTAN_ARCH_PATH" ]
then
# Optional: get ZOLTAN_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
then
. $settings
fi
fi
for libdir in lib "lib${WM_COMPILER_LIB_ARCH}"
do
if [ -f "$ZOLTAN_ARCH_PATH/$libdir/libzoltan.a" ]
then
echo " found libzoltanRenumber -- enabling zoltan renumbering support."
export COMP_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L$ZOLTAN_ARCH_PATH/$libdir -lzoltan"
break
fi
done
fi
wmake $targetType

View File

@ -15,7 +15,7 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// For complete details on what this dictionary file should provide, see
// $FOAM_SRC/src/dynamicMesh/slidingInterface/slidingInterface.C
// src/dynamicMesh/slidingInterface/slidingInterface.C
// method: Foam::slidingInterface::setTolerances
//- Point merge tolerance

View File

@ -53,9 +53,9 @@ Usage
it will also read & transform vector & tensor fields.
Note:
yaw (rotation about z)
pitch (rotation about y)
roll (rotation about x)
pitch (rotation about y)
yaw (rotation about z)
\*---------------------------------------------------------------------------*/
@ -143,6 +143,12 @@ void rotateFields(const argList& args, const Time& runTime, const tensor& T)
int main(int argc, char *argv[])
{
argList::addNote
(
"Transform (translate/rotate/scale) mesh points.\n"
"Note: roll=rotation about x, pitch=rotation about y, "
"yaw=rotation about z"
);
argList::addOption
(
"translate",
@ -160,13 +166,13 @@ int main(int argc, char *argv[])
(
"rollPitchYaw",
"vector",
"transform in terms of '(roll pitch yaw)' in degrees"
"rotate by '(roll pitch yaw)' in degrees"
);
argList::addOption
(
"yawPitchRoll",
"vector",
"transform in terms of '(yaw pitch roll)' in degrees"
"rotate by '(yaw pitch roll)' in degrees"
);
argList::addBoolOption
(