Skip to content

Commit

Permalink
Merge branch 'fix_tangent_bbnd' into 'master'
Browse files Browse the repository at this point in the history
fix tangential vector for BBND elements

See merge request !215
  • Loading branch information
JSchoeberl committed Aug 9, 2017
2 parents df5493b + 1fb555c commit 0703290
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 44 deletions.
42 changes: 0 additions & 42 deletions fem/intrule.cpp
Expand Up @@ -136,48 +136,6 @@ namespace ngfem
return eltrans->VB(); return eltrans->VB();
} }



template <int S, int R, typename SCAL>
MappedIntegrationPoint<S,R,SCAL> ::
MappedIntegrationPoint (const IntegrationPoint & aip,
const ElementTransformation & aeltrans)
: DimMappedIntegrationPoint<R,SCAL> (aip, aeltrans)
{
this->eltrans->CalcPointJacobian(this->IP(), this->point, dxdxi);

if (S == R)
{
det = Det (dxdxi);
if(det == 0)
{
throw Exception ("Jacobi-det is zero");
}
if (det < 0 && 0)
{
throw Exception ("Jacobi-det is negative");
}
// dxidx = Inv (dxdxi);
}
else
{
if (R == 3)
{
normalvec = Cross (Vec<3,SCAL> (dxdxi.Col(0)),
Vec<3,SCAL> (dxdxi.Col(1)));
det = L2Norm (normalvec);
normalvec /= det;
}
else
{
det = sqrt ( sqr (dxdxi(0,0)) + sqr (dxdxi(1,0)));

normalvec(0) = -dxdxi(1,0) / det;
normalvec(1) = dxdxi(0,0) / det;
}
}
this->measure = fabs (det);
}



template <int S, int R, typename SCAL> template <int S, int R, typename SCAL>
void MappedIntegrationPoint<S,R,SCAL> :: void MappedIntegrationPoint<S,R,SCAL> ::
Expand Down
11 changes: 9 additions & 2 deletions fem/intrule.hpp
Expand Up @@ -368,7 +368,12 @@ namespace ngfem
NGS_DLL_HEADER MappedIntegrationPoint () = default; NGS_DLL_HEADER MappedIntegrationPoint () = default;
/// ///
NGS_DLL_HEADER MappedIntegrationPoint (const IntegrationPoint & aip, NGS_DLL_HEADER MappedIntegrationPoint (const IntegrationPoint & aip,
const ElementTransformation & aeltrans); const ElementTransformation & aeltrans)
: DimMappedIntegrationPoint<DIMR,SCAL> (aip, aeltrans)
{
this->eltrans->CalcPointJacobian(this->IP(), this->point, dxdxi);
this->Compute();
}


INLINE MappedIntegrationPoint (const IntegrationPoint & aip, INLINE MappedIntegrationPoint (const IntegrationPoint & aip,
const ElementTransformation & aeltrans, const ElementTransformation & aeltrans,
Expand Down Expand Up @@ -406,6 +411,7 @@ namespace ngfem
Vec<3,SCAL> (dxdxi.Col(1))); Vec<3,SCAL> (dxdxi.Col(1)));
det = L2Norm (normalvec); det = L2Norm (normalvec);
normalvec /= det; normalvec /= det;
tangentialvec = TSCAL(0.0);
} }
else else
{ {
Expand All @@ -422,13 +428,14 @@ namespace ngfem


normalvec(0) = -dxdxi(1,0) / det; normalvec(0) = -dxdxi(1,0) / det;
normalvec(1) = dxdxi(0,0) / det; normalvec(1) = dxdxi(0,0) / det;
tangentialvec = TSCAL(0.0);
} }
else else
{ {
det = 1.0; det = 1.0;
normalvec = 1.0; normalvec = 1.0;
tangentialvec = TSCAL(0.0);
} }
tangentialvec = TSCAL(0.0);
} }
this->measure = fabs (det); this->measure = fabs (det);
} }
Expand Down

0 comments on commit 0703290

Please sign in to comment.