Commit 9c385673 authored by Franjo's avatar Franjo
Browse files

Bug fix in bnd layers

parent 06c36ada
......@@ -133,14 +133,10 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
const labelHashSet& invertedVertices = vertexCheck.invertedVertices();
std::map<std::pair<label, label>, Pair<label> > edgeClassification;
labelLongList procEdges;
forAll(eFaces, eI)
{
if( eFaces.sizeOfRow(eI) != 2 )
{
procEdges.append(eI);
continue;
}
//- check if the any of the face vertices is tangled
const edge& e = edges[eI];
......@@ -185,9 +181,10 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
if( Pstream::parRun() )
{
const labelList& bPoints = mse.boundaryPoints();
//- check faces over processor edges
const labelList& globalEdgeLabel = mse.globalBoundaryEdgeLabel();
const VRWGraph& beAtProcs = mse.beAtProcs();
const Map<label>& globalToLocal = mse.globalToLocalBndEdgeAddressing();
const DynList<label>& neiProcs = mse.beNeiProcs();
......@@ -211,9 +208,10 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
}
//- store faces for sending
forAll(procEdges, eI)
forAllConstIter(Map<label>, otherFaceProc, it)
{
const label beI = procEdges[eI];
const label beI = it.key();
if( eFaces.sizeOfRow(beI) == 0 )
continue;
......@@ -232,30 +230,25 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
const face& f = bFaces[eFaces(beI, 0)];
forAllRow(beAtProcs, beI, procI)
{
const label neiProc = beAtProcs(beI, procI);
if( neiProc == Pstream::myProcNo() )
continue;
const label neiProc = it();
//- each face is sent as follows
//- 1. global edge label
//- 2. number of face nodes
//- 3. faces nodes and vertex coordinates
LongList<labelledPoint>& dps = exchangePoints[neiProc];
dps.append(labelledPoint(globalEdgeLabel[beI], point()));
dps.append(labelledPoint(f.size(), point()));
forAll(f, pI)
{
dps.append
//- each face is sent as follows
//- 1. global edge label
//- 2. number of face nodes
//- 3. faces nodes and vertex coordinates
LongList<labelledPoint>& dps = exchangePoints[neiProc];
dps.append(labelledPoint(globalEdgeLabel[beI], point()));
dps.append(labelledPoint(f.size(), point()));
forAll(f, pI)
{
dps.append
(
labelledPoint
(
labelledPoint
(
globalPointLabel[bp[f[pI]]],
points[f[pI]]
)
);
}
globalPointLabel[bp[f[pI]]],
points[f[pI]]
)
);
}
}
......@@ -270,14 +263,15 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
{
const label beI =
globalToLocal[receivedData[counter++].pointLabel()];
face f(receivedData[counter++].pointLabel());
DynList<label> f(receivedData[counter++].pointLabel());
forAll(f, pI)
{
const labelledPoint& lp = receivedData[counter++];
if( globalPointToLocal.found(lp.pointLabel()) )
{
//- this point already exist on this processor
f[pI] = globalPointToLocal[lp.pointLabel()];
f[pI] = bPoints[globalPointToLocal[lp.pointLabel()]];
}
else
{
......
......@@ -66,19 +66,21 @@ namespace help
bool isinf(const ListType&);
//- check if the faces share a convex edge
template<class Face1, class Face2>
inline bool isSharedEdgeConvex
(
const pointField& points,
const face& f1,
const face& f2
const Face1& f1,
const Face2& f2
);
//- angle between the two faces in radians
template<class Face1, class Face2>
inline scalar angleBetweenFaces
(
const pointField& points,
const face& f1,
const face& f2
const Face1& f1,
const Face2& f2
);
// merge faces which are in the same patch
......
......@@ -70,11 +70,12 @@ bool isinf(const ListType& l)
return false;
}
template<class Face1, class Face2>
inline bool isSharedEdgeConvex
(
const pointField& points,
const face& f1,
const face& f2
const Face1& f1,
const Face2& f2
)
{
DynList<label, 3> triOwn(3);
......@@ -82,17 +83,24 @@ inline bool isSharedEdgeConvex
forAll(f1, pI)
{
label pos = f2.which(f1[pI]);
if( pos == -1 )
label pos(-1);
forAll(f2, pJ)
if( f2[pJ] == f1[pI] )
{
pos = pJ;
break;
}
if( pos < 0 )
continue;
triNei[0] = f2[pos];
triNei[1] = f2.nextLabel(pos);
triNei[2] = f2.prevLabel(pos);
triNei[1] = f2[f2.fcIndex(pos)];
triNei[2] = f2[f2.rcIndex(pos)];
triOwn[0] = f1[pI];
triOwn[1] = f1.nextLabel(pI);
triOwn[2] = f1.prevLabel(pI);
triOwn[1] = f1[f1.fcIndex(pI)];
triOwn[2] = f1[f1.rcIndex(pI)];
scalar vol(0.0);
......@@ -120,11 +128,12 @@ inline bool isSharedEdgeConvex
return true;
}
template<class Face1, class Face2>
inline scalar angleBetweenFaces
(
const pointField& points,
const face& f1,
const face& f2
const Face1& f1,
const Face2& f2
)
{
DynList<label, 3> triOwn(3);
......@@ -135,17 +144,24 @@ inline scalar angleBetweenFaces
forAll(f1, pI)
{
label pos = f2.which(f1[pI]);
if( pos == -1 )
label pos(-1);
forAll(f2, pJ)
if( f2[pJ] == f1[pI] )
{
pos = pJ;
break;
}
if( pos < 0 )
continue;
triNei[0] = f2[pos];
triNei[1] = f2.nextLabel(pos);
triNei[2] = f2.prevLabel(pos);
triNei[1] = f2[f2.fcIndex(pos)];
triNei[2] = f2[f2.rcIndex(pos)];
triOwn[0] = f1[pI];
triOwn[1] = f1.nextLabel(pI);
triOwn[2] = f1.prevLabel(pI);
triOwn[1] = f1[f1.fcIndex(pI)];
triOwn[2] = f1[f1.rcIndex(pI)];
scalar vol(0.0);
......@@ -206,7 +222,8 @@ inline scalar angleBetweenFaces
(
"scalar angleBetweenFaces"
"(const pointField&, const face&, const face&)"
) << "Faces do no share an edge" << abort(FatalError);
) << "Faces " << f1 << " and " << f2
<< " do no share an edge" << abort(FatalError);
}
return angle / counter;
......
Markdown is supported
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