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