Commit d8a7b8fd authored by Henry's avatar Henry
Browse files

Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

parents 511083a7 52aa94c9
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -66,16 +66,31 @@ Foam::PatchTools::sortedEdgeFaces
vector e2 = e.vec(localPoints);
e2 /= mag(e2) + VSMALL;
// Get opposite vertex for 0th face
const Face& f = localFaces[faceNbs[0]];
// Get the vertex on 0th face that forms a vector with the first
// edge point that has the largest angle with the edge
const Face& f0 = localFaces[faceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
scalar maxAngle = GREAT;
vector maxAngleEdgeDir(vector::max);
forAll(f0, fpI)
{
if (f0[fpI] != e.start())
{
const vector faceEdgeDir = localPoints[f0[fpI]] - edgePt;
const scalar angle = faceEdgeDir & e2;
if (angle < maxAngle)
{
maxAngle = angle;
maxAngleEdgeDir = faceEdgeDir;
}
}
}
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
vector e0 = e2 ^ (localPoints[vertI] - edgePt);
vector e0 = e2 ^ maxAngleEdgeDir;
e0 /= mag(e0) + VSMALL;
// Get y-axis of coordinate system
......@@ -88,13 +103,29 @@ Foam::PatchTools::sortedEdgeFaces
for (label nbI = 1; nbI < faceNbs.size(); nbI++)
{
// Get opposite vertex
// Get the vertex on face that forms a vector with the first
// edge point that has the largest angle with the edge
const Face& f = localFaces[faceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
vector vec = e2 ^ (localPoints[vertI] - edgePt);
maxAngle = GREAT;
maxAngleEdgeDir = vector::max;
forAll(f, fpI)
{
if (f[fpI] != e.start())
{
const vector faceEdgeDir = localPoints[f[fpI]] - edgePt;
const scalar angle = faceEdgeDir & e2;
if (angle < maxAngle)
{
maxAngle = angle;
maxAngleEdgeDir = faceEdgeDir;
}
}
}
vector vec = e2 ^ maxAngleEdgeDir;
vec /= mag(vec) + VSMALL;
faceAngles[nbI] = pseudoAngle
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -82,7 +82,8 @@ void Foam::fvPatchMapper::calcAddressing() const
}
else
{
addr[faceI] = 0;
//addr[faceI] = 0;
addr[faceI] = -1;
}
}
......@@ -90,12 +91,14 @@ void Foam::fvPatchMapper::calcAddressing() const
{
if (min(addr) < 0)
{
FatalErrorIn
//FatalErrorIn
WarningIn
(
"void fvPatchMapper::calcAddressing() const"
) << "Error in patch mapping for patch "
) << "Unmapped entry in patch mapping for patch "
<< patch_.index() << " named " << patch_.name()
<< abort(FatalError);
//<< abort(FatalError);
<< endl;
}
}
}
......@@ -156,19 +159,22 @@ void Foam::fvPatchMapper::calcAddressing() const
}
}
// Cater for bad mapping
if (nActive == 0)
{
newAddr[nActive] = 0;
newWeights[nActive] = 1;
nActive++;
}
//// Cater for bad mapping
//if (nActive == 0)
//{
// newAddr[nActive] = 0;
// newWeights[nActive] = 1;
// nActive++;
//}
newAddr.setSize(nActive);
newWeights.setSize(nActive);
// Re-scale the weights
newWeights /= sum(newWeights);
if (nActive > 0)
{
newWeights /= sum(newWeights);
}
// Reset addressing and weights
curAddr = newAddr;
......
......@@ -1287,7 +1287,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
+ ".obj"
)
);
Info<< "Writing points with too large a extrusion distance to "
Info<< "Writing points with too large an extrusion distance to "
<< str().name() << endl;
}
......@@ -1304,7 +1304,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
+ ".obj"
)
);
Info<< "Writing points with too large a extrusion distance to "
Info<< "Writing points with too large an extrusion distance to "
<< medialVecStr().name() << endl;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -1360,6 +1360,19 @@ void Foam::autoSnapDriver::doSnap
regionSide
);
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
if (debug&meshRefinement::MESH)
{
const_cast<Time&>(mesh.time())++;
Pout<< "Writing duplicatedPoints mesh to time "
<< meshRefiner_.timeName()
<< endl;
meshRefiner_.write
(
debug, mesh.time().path()
/"duplicatedPoints"
);
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -31,7 +31,7 @@ Description
#include "HashTable.H"
#include "SortableList.H"
#include "transform.H"
#include "PatchTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -46,79 +46,10 @@ void Foam::triSurface::calcSortedEdgeFaces() const
const labelListList& eFaces = edgeFaces();
// create the lists for the various results. (resized on completion)
sortedEdgeFacesPtr_ = new labelListList(eFaces.size());
labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_;
forAll(eFaces, edgeI)
{
const labelList& myFaceNbs = eFaces[edgeI];
if (myFaceNbs.size() > 2)
{
// Get point on edge and normalized direction of edge (= e2 base
// of our coordinate system)
const edge& e = edges()[edgeI];
const point& edgePt = localPoints()[e.start()];
vector e2 = e.vec(localPoints());
e2 /= mag(e2) + VSMALL;
// Get opposite vertex for 0th face
const labelledTri& f = localFaces()[myFaceNbs[0]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
vector e0 = e2 ^ (localPoints()[vertI] - edgePt);
e0 /= mag(e0) + VSMALL;
// Get y-axis of coordinate system
vector e1 = e2 ^ e0;
SortableList<scalar> faceAngles(myFaceNbs.size());
// e0 is reference so angle is 0
faceAngles[0] = 0;
for (label nbI = 1; nbI < myFaceNbs.size(); nbI++)
{
// Get opposite vertex
const labelledTri& f = localFaces()[myFaceNbs[nbI]];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
vector vec = e2 ^ (localPoints()[vertI] - edgePt);
vec /= mag(vec) + VSMALL;
faceAngles[nbI] = pseudoAngle
(
e0,
e1,
vec
);
}
faceAngles.sort();
sortedEdgeFaces[edgeI] = UIndirectList<label>
(
myFaceNbs,
faceAngles.indices()
);
}
else
{
// No need to sort. Just copy.
sortedEdgeFaces[edgeI] = myFaceNbs;
}
}
sortedEdgeFaces = PatchTools::sortedEdgeFaces(*this);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment