Merge branch 'cvm' of ssh://hunt//home/noisy3/OpenFOAM/OpenFOAM-dev into cvm

This commit is contained in:
graham
2011-06-20 21:28:06 +01:00
17 changed files with 1091 additions and 245 deletions

View File

@ -37,7 +37,6 @@ SourceFiles
#include "searchableSurfaces.H"
#include "searchableSurfacesQueries.H"
#include "triSurface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -52,7 +52,6 @@ SourceFiles
#include "plane.H"
#include "SortableList.H"
#include "meshTools.H"
#include "triSurfaceTools.H"
#include "indexedOctree.H"
#include "treeDataPoint.H"
#include "unitConversion.H"
@ -683,17 +682,18 @@ private:
bool filterFaces
);
// //- Tet mesh calculation
// void calcTetMesh
// (
// pointField& points,
// faceList& faces,
// labelList& owner,
// labelList& neighbour,
// wordList& patchNames,
// labelList& patchSizes,
// labelList& patchStarts
// );
//- Tet mesh calculation
void calcTetMesh
(
pointField& points,
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
labelList& patchSizes,
labelList& patchStarts
);
//- Determines if the dual face constructed by the Delaunay
// edge is a boundary face

View File

@ -38,7 +38,7 @@ SourceFiles
#include "searchableSurfaces.H"
#include "searchableSurfacesQueries.H"
#include "extendedFeatureEdgeMesh.H"
#include "triSurface.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -331,6 +331,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
),
triSurface(s),
tolerance_(indexedOctree<treeDataTriSurface>::perturbTol()),
minQuality_(-1),
maxTreeDepth_(10),
surfaceClosed_(-1)
{
@ -377,6 +378,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
)
),
tolerance_(indexedOctree<treeDataTriSurface>::perturbTol()),
minQuality_(-1),
maxTreeDepth_(10),
surfaceClosed_(-1)
{
@ -426,6 +428,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
)
),
tolerance_(indexedOctree<treeDataTriSurface>::perturbTol()),
minQuality_(-1),
maxTreeDepth_(10),
surfaceClosed_(-1)
{
@ -449,6 +452,13 @@ Foam::triSurfaceMesh::triSurfaceMesh
<< tolerance_ << endl;
}
// Have optional minimum quality for normal calculation
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
{
Info<< searchableSurface::name()
<< " : ignoring triangles with quality < "
<< minQuality_ << " for normals calculation." << endl;
}
// Have optional non-standard tree-depth to limit storage.
if (dict.readIfPresent("maxTreeDepth", maxTreeDepth_) && maxTreeDepth_ > 0)
@ -820,22 +830,70 @@ void Foam::triSurfaceMesh::getNormal
{
normal.setSize(info.size());
forAll(info, i)
if (minQuality_ >= 0)
{
if (info[i].hit())
{
label faceI = info[i].index();
//- Cached:
//normal[i] = faceNormals()[faceI];
// Make sure we don't use triangles with low quality since
// normal is not reliable.
//- Uncached
normal[i] = triSurface::operator[](faceI).normal(points());
normal[i] /= mag(normal[i]) + VSMALL;
}
else
const triSurface& s = static_cast<const triSurface&>(*this);
const labelListList& faceFaces = s.faceFaces();
forAll(info, i)
{
// Set to what?
normal[i] = vector::zero;
if (info[i].hit())
{
label faceI = info[i].index();
scalar qual = s[faceI].tri(points()).quality();
if (qual < minQuality_)
{
// Search neighbouring triangles
const labelList& fFaces = faceFaces[faceI];
forAll(fFaces, j)
{
label nbrI = fFaces[j];
scalar nbrQual = s[nbrI].tri(points()).quality();
if (nbrQual > qual)
{
qual = nbrQual;
normal[i] = s[nbrI].normal(points());
}
}
}
else
{
normal[i] = s[faceI].normal(points());
}
normal[i] /= mag(normal[i]);
}
else
{
// Set to what?
normal[i] = vector::zero;
}
}
}
else
{
forAll(info, i)
{
if (info[i].hit())
{
label faceI = info[i].index();
//- Cached:
//normal[i] = faceNormals()[faceI];
//- Uncached
normal[i] = triSurface::operator[](faceI).normal(points());
normal[i] /= mag(normal[i]) + VSMALL;
}
else
{
// Set to what?
normal[i] = vector::zero;
}
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,7 @@ Description
- scale : scaling factor.
- tolerance : relative tolerance for doing intersections
(see triangle::intersection)
- minQuality: discard triangles with low quality when getting normal
SourceFiles
triSurfaceMesh.C
@ -70,6 +71,10 @@ private:
//- Optional tolerance to use in searches
scalar tolerance_;
//- Optional min triangle quality. Triangles below this get
// ignored for normal calculation
scalar minQuality_;
//- Optional max tree depth of octree
label maxTreeDepth_;