H1FETransformation< T > Class Template Reference
#include <fe_transformation_base.h>
Public Member Functions | |
| template<> | |
| void | map_curl (const unsigned int, const Elem *const, const std::vector< Point > &, const FEGenericBase< Real > &, std::vector< std::vector< Real > > &) const |
| template<> | |
| void | map_curl (const unsigned int dim, const Elem *const, const std::vector< Point > &, const FEGenericBase< RealGradient > &fe, std::vector< std::vector< RealGradient > > &curl_phi) const |
| template<> | |
| void | map_div (const unsigned int, const Elem *const, const std::vector< Point > &, const FEGenericBase< Real > &, std::vector< std::vector< FEGenericBase< Real >::OutputDivergence > > &) const |
| template<> | |
| void | map_div (const unsigned int dim, const Elem *const, const std::vector< Point > &, const FEGenericBase< RealGradient > &fe, std::vector< std::vector< FEGenericBase< RealGradient >::OutputDivergence > > &div_phi) const |
Detailed Description
template<typename T>
class H1FETransformation< T >
Definition at line 29 of file fe_transformation_base.h.
Member Function Documentation
template<>
| void H1FETransformation< Real >::map_curl | ( | const unsigned | int, |
| const Elem * | const, | ||
| const std::vector< Point > & | , | ||
| const FEGenericBase< Real > & | , | ||
| std::vector< std::vector< Real > > & | |||
| ) | const |
Definition at line 456 of file h1_fe_transformation.C.
References libMesh::err.
{
libMesh::err << "Computing the curl of a shape function only\n"
<< "makes sense for vector-valued elements." << std::endl;
libmesh_error();
}
template<>
| void H1FETransformation< RealGradient >::map_curl | ( | const unsigned int | dim, |
| const Elem * | const, | ||
| const std::vector< Point > & | , | ||
| const FEGenericBase< RealGradient > & | fe, | ||
| std::vector< std::vector< RealGradient > > & | curl_phi | ||
| ) | const |
Definition at line 468 of file h1_fe_transformation.C.
References libMesh::Real.
{
switch(dim)
{
// The curl only make sense in 2D and 3D
case 0:
case 1:
{
libmesh_error();
}
case 2:
{
const std::vector<std::vector<RealGradient> >& dphidxi = fe.get_dphidxi();
const std::vector<std::vector<RealGradient> >& dphideta = fe.get_dphideta();
const std::vector<Real>& dxidx_map = fe.get_fe_map().get_dxidx();
const std::vector<Real>& dxidy_map = fe.get_fe_map().get_dxidy();
#if LIBMESH_DIM > 2
const std::vector<Real>& dxidz_map = fe.get_fe_map().get_dxidz();
#endif
const std::vector<Real>& detadx_map = fe.get_fe_map().get_detadx();
const std::vector<Real>& detady_map = fe.get_fe_map().get_detady();
#if LIBMESH_DIM > 2
const std::vector<Real>& detadz_map = fe.get_fe_map().get_detadz();
#endif
/*
For 2D elements in 3D space:
curl = ( -dphi_y/dz, dphi_x/dz, dphi_y/dx - dphi_x/dy )
*/
for (unsigned int i=0; i<curl_phi.size(); i++)
for (unsigned int p=0; p<curl_phi[i].size(); p++)
{
Real dphiy_dx = (dphidxi[i][p].slice(1))*dxidx_map[p]
+ (dphideta[i][p].slice(1))*detadx_map[p];
Real dphix_dy = (dphidxi[i][p].slice(0))*dxidy_map[p]
+ (dphideta[i][p].slice(0))*detady_map[p];
curl_phi[i][p].slice(2) = dphiy_dx - dphix_dy;
#if LIBMESH_DIM > 2
Real dphiy_dz = (dphidxi[i][p].slice(1))*dxidz_map[p]
+ (dphideta[i][p].slice(1))*detadz_map[p];
Real dphix_dz = (dphidxi[i][p].slice(0))*dxidz_map[p]
+ (dphideta[i][p].slice(0))*detadz_map[p];
curl_phi[i][p].slice(0) = -dphiy_dz;
curl_phi[i][p].slice(1) = dphix_dz;
#endif
}
break;
}
case 3:
{
const std::vector<std::vector<RealGradient> >& dphidxi = fe.get_dphidxi();
const std::vector<std::vector<RealGradient> >& dphideta = fe.get_dphideta();
const std::vector<std::vector<RealGradient> >& dphidzeta = fe.get_dphidzeta();
const std::vector<Real>& dxidx_map = fe.get_fe_map().get_dxidx();
const std::vector<Real>& dxidy_map = fe.get_fe_map().get_dxidy();
const std::vector<Real>& dxidz_map = fe.get_fe_map().get_dxidz();
const std::vector<Real>& detadx_map = fe.get_fe_map().get_detadx();
const std::vector<Real>& detady_map = fe.get_fe_map().get_detady();
const std::vector<Real>& detadz_map = fe.get_fe_map().get_detadz();
const std::vector<Real>& dzetadx_map = fe.get_fe_map().get_dzetadx();
const std::vector<Real>& dzetady_map = fe.get_fe_map().get_dzetady();
const std::vector<Real>& dzetadz_map = fe.get_fe_map().get_dzetadz();
/*
In 3D: curl = ( dphi_z/dy - dphi_y/dz, dphi_x/dz - dphi_z/dx, dphi_y/dx - dphi_x/dy )
*/
for (unsigned int i=0; i<curl_phi.size(); i++)
for (unsigned int p=0; p<curl_phi[i].size(); p++)
{
Real dphiz_dy = (dphidxi[i][p].slice(2))*dxidy_map[p]
+ (dphideta[i][p].slice(2))*detady_map[p]
+ (dphidzeta[i][p].slice(2))*dzetady_map[p];
Real dphiy_dz = (dphidxi[i][p].slice(1))*dxidz_map[p]
+ (dphideta[i][p].slice(1))*detadz_map[p]
+ (dphidzeta[i][p].slice(1))*dzetadz_map[p];
Real dphix_dz = (dphidxi[i][p].slice(0))*dxidz_map[p]
+ (dphideta[i][p].slice(0))*detadz_map[p]
+ (dphidzeta[i][p].slice(0))*dzetadz_map[p];
Real dphiz_dx = (dphidxi[i][p].slice(2))*dxidx_map[p]
+ (dphideta[i][p].slice(2))*detadx_map[p]
+ (dphidzeta[i][p].slice(2))*dzetadx_map[p];
Real dphiy_dx = (dphidxi[i][p].slice(1))*dxidx_map[p]
+ (dphideta[i][p].slice(1))*detadx_map[p]
+ (dphidzeta[i][p].slice(1))*dzetadx_map[p];
Real dphix_dy = (dphidxi[i][p].slice(0))*dxidy_map[p]
+ (dphideta[i][p].slice(0))*detady_map[p]
+ (dphidzeta[i][p].slice(0))*dzetady_map[p];
curl_phi[i][p].slice(0) = dphiz_dy - dphiy_dz;
curl_phi[i][p].slice(1) = dphix_dz - dphiz_dx;
curl_phi[i][p].slice(2) = dphiy_dx - dphix_dy;
}
break;
}
default:
libmesh_error();
}
return;
}
template<>
| void H1FETransformation< Real >::map_div | ( | const unsigned | int, |
| const Elem * | const, | ||
| const std::vector< Point > & | , | ||
| const FEGenericBase< Real > & | , | ||
| std::vector< std::vector< FEGenericBase< Real >::OutputDivergence > > & | |||
| ) | const |
Definition at line 597 of file h1_fe_transformation.C.
References libMesh::err.
{
libMesh::err << "Computing the divergence of a shape function only\n"
<< "makes sense for vector-valued elements." << std::endl;
libmesh_error();
}
template<>
| void H1FETransformation< RealGradient >::map_div | ( | const unsigned int | dim, |
| const Elem * | const, | ||
| const std::vector< Point > & | , | ||
| const FEGenericBase< RealGradient > & | fe, | ||
| std::vector< std::vector< FEGenericBase< RealGradient >::OutputDivergence > > & | div_phi | ||
| ) | const |
Definition at line 611 of file h1_fe_transformation.C.
References libMesh::Real.
{
switch(dim)
{
// The divergence only make sense in 2D and 3D
case 0:
case 1:
{
libmesh_error();
}
case 2:
{
const std::vector<std::vector<RealGradient> >& dphidxi = fe.get_dphidxi();
const std::vector<std::vector<RealGradient> >& dphideta = fe.get_dphideta();
const std::vector<Real>& dxidx_map = fe.get_fe_map().get_dxidx();
const std::vector<Real>& dxidy_map = fe.get_fe_map().get_dxidy();
const std::vector<Real>& detadx_map = fe.get_fe_map().get_detadx();
const std::vector<Real>& detady_map = fe.get_fe_map().get_detady();
/*
In 2D: div = dphi_x/dx + dphi_y/dy
*/
for (unsigned int i=0; i<div_phi.size(); i++)
for (unsigned int p=0; p<div_phi[i].size(); p++)
{
Real dphix_dx = (dphidxi[i][p].slice(0))*dxidx_map[p]
+ (dphideta[i][p].slice(0))*detadx_map[p];
Real dphiy_dy = (dphidxi[i][p].slice(1))*dxidy_map[p]
+ (dphideta[i][p].slice(1))*detady_map[p];
div_phi[i][p] = dphix_dx + dphiy_dy;
}
break;
}
case 3:
{
const std::vector<std::vector<RealGradient> >& dphidxi = fe.get_dphidxi();
const std::vector<std::vector<RealGradient> >& dphideta = fe.get_dphideta();
const std::vector<std::vector<RealGradient> >& dphidzeta = fe.get_dphidzeta();
const std::vector<Real>& dxidx_map = fe.get_fe_map().get_dxidx();
const std::vector<Real>& dxidy_map = fe.get_fe_map().get_dxidy();
const std::vector<Real>& dxidz_map = fe.get_fe_map().get_dxidz();
const std::vector<Real>& detadx_map = fe.get_fe_map().get_detadx();
const std::vector<Real>& detady_map = fe.get_fe_map().get_detady();
const std::vector<Real>& detadz_map = fe.get_fe_map().get_detadz();
const std::vector<Real>& dzetadx_map = fe.get_fe_map().get_dzetadx();
const std::vector<Real>& dzetady_map = fe.get_fe_map().get_dzetady();
const std::vector<Real>& dzetadz_map = fe.get_fe_map().get_dzetadz();
/*
In 3D: div = dphi_x/dx + dphi_y/dy + dphi_z/dz
*/
for (unsigned int i=0; i<div_phi.size(); i++)
for (unsigned int p=0; p<div_phi[i].size(); p++)
{
Real dphix_dx = (dphidxi[i][p].slice(0))*dxidx_map[p]
+ (dphideta[i][p].slice(0))*detadx_map[p]
+ (dphidzeta[i][p].slice(0))*dzetadx_map[p];
Real dphiy_dy = (dphidxi[i][p].slice(1))*dxidy_map[p]
+ (dphideta[i][p].slice(1))*detady_map[p]
+ (dphidzeta[i][p].slice(1))*dzetady_map[p];
Real dphiz_dz = (dphidxi[i][p].slice(2))*dxidz_map[p]
+ (dphideta[i][p].slice(2))*detadz_map[p]
+ (dphidzeta[i][p].slice(2))*dzetadz_map[p];
div_phi[i][p] = dphix_dx + dphiy_dy + dphiz_dz;
}
break;
}
} // switch(dim)
return;
}
The documentation for this class was generated from the following file: