Page MenuHomec4science

element_class_tetrahedron_4.cc
No OneTemporary

File Metadata

Created
Thu, May 30, 17:43

element_class_tetrahedron_4.cc

/**
* @file element_class_tetrahedron_4.cc
* @author Guillaume ANCIAUX <anciaux@epfl.ch>
* @date Mon Aug 16 18:09:53 2010
*
* @brief Specialization of the element_class class for the type _tetrahedron_4
*
* @section LICENSE
*
* \<insert license here\>
*
* @section DESCRIPTION
*
* @verbatim
\eta
^
|
x (0,0,1,0)
|`
| ` ° \xi
| ` ° -
| ` x (0,0,0,1)
| q.` - '
| -` '
| - ` '
| - ` '
x------------------x-----> \zeta
(1,0,0,0) (0,1,0,0)
@endverbatim
*
* @subsection shapes Shape functions
* @f{eqnarray*}{
* N1 &=& 1 - \xi - \eta - \zeta \\
* N2 &=& \xi \\
* N3 &=& \eta \\
* N4 &=& \zeta
* @f}
*
* @subsection quad_points Position of quadrature points
* @f[
* \xi_{q0} = 1/4 \qquad \eta_{q0} = 1/4 \qquad \zeta_{q0} = 1/4
* @f]
*/
/* -------------------------------------------------------------------------- */
// /// shape functions
// shape[0] = 1./4.; /// N1(q_0)
// shape[1] = 1./4.; /// N2(q_0)
// shape[2] = 1./4.; /// N3(q_0)
// shape[3] = 1./4.; /// N4(q_0)
/* -------------------------------------------------------------------------- */
template<> UInt ElementClass<_tetrahedron_4>::nb_nodes_per_element;
template<> UInt ElementClass<_tetrahedron_4>::nb_quadrature_points;
template<> UInt ElementClass<_tetrahedron_4>::spatial_dimension;
/* -------------------------------------------------------------------------- */
template <> inline void ElementClass<_tetrahedron_4>::computeShapes(const Real * natural_coords,
Real * shapes){
Real c0 = natural_coords[1]; /// @f$ c0 = \eta @f$
Real c1 = natural_coords[2]; /// @f$ c1 = \zeta @f$
Real c2 = 1 - natural_coords[0] - natural_coords[1] - natural_coords[2];/// @f$ c2 = 1 - \xi - \eta - \zeta @f$
Real c3 = natural_coords[0]; /// @f$ c2 = \xi @f$
shapes[0] = c0;
shapes[1] = c1;
shapes[2] = c2;
shapes[3] = c3;
}
/* -------------------------------------------------------------------------- */
template <> inline void ElementClass<_tetrahedron_4>::computeDNDS(__attribute__ ((unused)) const Real * natural_coords,
Real * dnds) {
/**
* @f[
* dnds = \left(
* \begin{array}{cccccc}
* \frac{\partial N1}{\partial \xi} & \frac{\partial N2}{\partial \xi}
* & \frac{\partial N3}{\partial \xi} & \frac{\partial N4}{\partial \xi} \\
* \frac{\partial N1}{\partial \eta} & \frac{\partial N2}{\partial \eta}
* & \frac{\partial N3}{\partial \eta} & \frac{\partial N4}{\partial \eta} \\
* \frac{\partial N1}{\partial \zeta} & \frac{\partial N2}{\partial \zeta}
* & \frac{\partial N3}{\partial \zeta} & \frac{\partial N4}{\partial \zeta}
* \end{array}
* \right)
* @f]
*/
dnds[0] = -1.; dnds[1] = 1.; dnds[2] = 0.; dnds[3] = 0.;
dnds[4] = -1.; dnds[5] = 0.; dnds[6] = 1.; dnds[7] = 0.;
dnds[8] = -1.; dnds[9] = 0.; dnds[10] = 0.; dnds[11] = 1.;
}
/* -------------------------------------------------------------------------- */
template <> inline void ElementClass<_tetrahedron_4>::computeJacobian(const Real * dxds,
const UInt dimension,
Real & jac) {
if (dimension == spatial_dimension){
Real weight = 1./6.;
Real det_dxds = Math::det3(dxds);
jac = det_dxds * weight;
}
else {
AKANTU_DEBUG_ERROR("to be implemented");
}
}
/* -------------------------------------------------------------------------- */
template<> inline Real ElementClass<_tetrahedron_4>::getInradius(const Real * coord) {
return Math::tetrahedron_inradius(coord, coord+3, coord+6, coord+9);
}

Event Timeline