Skip to content
Snippets Groups Projects
Commit fd2eee54 authored by Jonathan Youett's avatar Jonathan Youett
Browse files

bugfix: there is an inconsistency between using global indices or local boundarypatch indices

this lead to computing the coordinate system for zero normals
parent 20f832f4
No related branches found
No related tags found
No related merge requests found
...@@ -42,33 +42,36 @@ void ContactAssembler<dim,field_type>::computeLocalCoordinateSystems(const Bound ...@@ -42,33 +42,36 @@ void ContactAssembler<dim,field_type>::computeLocalCoordinateSystems(const Bound
std::vector<CoordinateType> vertexNormals(contactBoundary.numVertices(), CoordinateType(0.0)); std::vector<CoordinateType> vertexNormals(contactBoundary.numVertices(), CoordinateType(0.0));
std::vector<int> globalToLocal;
contactBoundary.makeGlobalToLocal(globalToLocal);
if (!obsDirections) { if (!obsDirections) {
contactBoundary.getNormals(vertexNormals); std::vector<CoordinateType> globalNormals;
contactBoundary.getNormals(globalNormals);
// copy normals in local vector for the boundary nodes
for (size_t i=0; i<globalToLocal.size(); i++)
if (globalToLocal[i]>-1)
vertexNormals[globalToLocal[i]]=globalNormals[i];
} else { } else {
std::vector<int> globalToLocal;
contactBoundary.makeGlobalToLocal(globalToLocal);
auto vIt = contactBoundary.gridView().template begin<dim>(); auto vIt = contactBoundary.gridView().template begin<dim>();
auto vEndIt = contactBoundary.gridView().template end<dim>(); auto vEndIt = contactBoundary.gridView().template end<dim>();
for (; vIt!=vEndIt; ++vIt) { for (; vIt!=vEndIt; ++vIt) {
if (globalToLocal[indexSet.index(*vIt)]<0) int localIndex = globalToLocal[indexSet.index(*vIt)];
if (localIndex<0)
continue; continue;
// Evaluate analytical normal field // Evaluate analytical normal field
vertexNormals[globalToLocal[indexSet.index(*vIt)]] = (*obsDirections)(vIt->geometry().corner(0)); vertexNormals[localIndex] = (*obsDirections)(vIt->geometry().corner(0));
// make sure it has length one
vertexNormals[localIndex] /= vertexNormals[localIndex].two_norm();
} }
} }
// ///////////////////////////////
// Normalize vertex normals
// ////////////////////////////////
for (size_t i=0; i<vertexNormals.size(); i++)
vertexNormals[i] /= vertexNormals[i].two_norm();
computeLocalCoordinateSystems(contactBoundary, coordSystems, vertexNormals); computeLocalCoordinateSystems(contactBoundary, coordSystems, vertexNormals);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment