Skip to content
Snippets Groups Projects
Commit 1a57575c authored by Stefen Guzik's avatar Stefen Guzik
Browse files

2D BC detection tweak

parent 2df4856e
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,7 @@ class BCPatchIndex
* zoneBoVec - (O) updated with domain boundary information for the
* vertex
* patch - (O) record BC patch index for an entity
* warnNormFromElem - (I) wether a warning about obtaining normals from
* warnNormFromElem - (I) whether a warning about obtaining normals from
* elements has already been given.
* (O) set to true if warning given in this call
*
......@@ -202,6 +202,8 @@ void updateBoVec
* and from which the normal will be determined
* faces - (I) All faces on the boundary connected to 'vertex'
* boNormal - (O) The normal to the boundary face (edge in 2D)
* onlyFace - (I) If >= 0, only use this face to determine the
* interior vertex and normal to the mesh plane.
* returns - (O) 0 - success
* 1 - parFromPoint() failed
*
......@@ -210,7 +212,7 @@ void updateBoVec
int edge_normal
(const MVertex *const vertex, const int zoneIndex, const GEdge *const gEdge,
const CCon::FaceVector<MZoneBoundary<2>::GlobalVertexData<MEdge>::FaceDataB>
&faces, SVector3 &boNormal)
&faces, SVector3 &boNormal, const int onlyFace = -1)
{
const double par = gEdge->parFromPoint(vertex->point());
......@@ -225,8 +227,13 @@ int edge_normal
// The interior point and mesh plane normal are computed from all elements in
// the zone.
int cFace = 0;
const int nFace = faces.size();
for(int iFace = 0; iFace != nFace; ++iFace) {
int iFace = 0;
int nFace = faces.size();
if ( onlyFace >= 0 ) {
iFace = onlyFace;
nFace = onlyFace + 1;
}
for(; iFace != nFace; ++iFace) {
if(faces[iFace].zoneIndex == zoneIndex) {
++cFace;
interior += faces[iFace].parentElement->barycenter();
......@@ -288,7 +295,7 @@ void updateBoVec<2, MEdge>
// Get the edge entities that are connected to the vertex
std::list<GEdge*> gEdgeList = ent->edges();
// Find edge entities that are connected to elements in the zone
std::vector<GEdge*> useGEdge;
std::vector<std::pair<GEdge*, int> > useGEdge;
const int nFace = faces.size();
for(int iFace = 0; iFace != nFace; ++iFace) {
if(zoneIndex == faces[iFace].zoneIndex) {
......@@ -302,7 +309,8 @@ void updateBoVec<2, MEdge>
// edge entities that will be used to determine the normal
GEntity *const ent2 = vertex2->onWhat();
if(ent2->dim() == 1) {
useGEdge.push_back(static_cast<GEdge*>(ent2));
useGEdge.push_back(std::pair<GEdge*, int>
(static_cast<GEdge*>(ent2), iFace));
}
}
}
......@@ -321,7 +329,7 @@ void updateBoVec<2, MEdge>
case 1:
{
const GEdge *const gEdge =
static_cast<const GEdge*>(useGEdge[0]);
static_cast<const GEdge*>(useGEdge[0].first);
SVector3 boNormal;
if(edge_normal(vertex, zoneIndex, gEdge, faces, boNormal))
goto getNormalFromElements;
......@@ -337,16 +345,18 @@ void updateBoVec<2, MEdge>
{
// Get the first normal
const GEdge *const gEdge1 =
static_cast<const GEdge*>(useGEdge[0]);
static_cast<const GEdge*>(useGEdge[0].first);
SVector3 boNormal1;
if(edge_normal(vertex, zoneIndex, gEdge1, faces, boNormal1))
if(edge_normal(vertex, zoneIndex, gEdge1, faces, boNormal1,
useGEdge[0].second))
goto getNormalFromElements;
// Get the second normal
const GEdge *const gEdge2 =
static_cast<const GEdge*>(useGEdge[1]);
static_cast<const GEdge*>(useGEdge[1].first);
SVector3 boNormal2;
if(edge_normal(vertex, zoneIndex, gEdge2, faces, boNormal2))
if(edge_normal(vertex, zoneIndex, gEdge2, faces, boNormal2,
useGEdge[1].second))
goto getNormalFromElements;
if(dot(boNormal1, boNormal2) < 0.98) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment