Skip to content
Snippets Groups Projects
ElInfo3d.h 3.95 KiB
Newer Older
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file ElInfo3d.h */

#ifndef AMDIS_ELINFO3D_H
#define AMDIS_ELINFO3D_H

#include "ElInfo.h"
#include "MemoryManager.h"
#include "OpenMP.h"

namespace AMDiS {

  /** \ingroup Traverse
   * \brief
   * ElInfo class for 3-dimensional elements (\ref Tetrahedron).
   */
  class ElInfo3d : public ElInfo
  {
  public:
    MEMORY_MANAGED(ElInfo3d);

    /// Constructor. Calls ElInfo's protected Constructor.
    ElInfo3d(Mesh* aMesh) 
      : ElInfo(aMesh) 
    {
Thomas Witkowski's avatar
Thomas Witkowski committed
      tmpWorldVecs.resize(4);
    ElInfo3d& operator=(const ElInfo3d& rhs) {
      ElInfo::operator=(rhs);
      el_type = rhs.el_type;
      orientation = rhs.orientation;
      return *this;
    } 

    /// 3-dimensional realisation of ElInfo's fillElInfo method.
    void fillElInfo(int ichild, const ElInfo *elinfo_old);

    /// 3-dimensional realisation of ElInfo's fillMacroInfo method.
    void fillMacroInfo(const MacroElement *);

    /// 3-dimensional realisation of ElInfo's worldToCoord method.
    const int worldToCoord(const WorldVector<double>& w, DimVec<double>* l) const;

    /// 3-dimensional realisation of ElInfo's calcGrdLambda method.
    double calcGrdLambda(DimVec<WorldVector<double> >& grd_lam);
    /// 3-dimensional realisation of ElInfo's getNormal method.
    double getNormal(int side, WorldVector<double> &normal);
    /// update ElInfo after refinement (of some neighbours). Only in 3d!
    /// get ElInfo's \ref el_type
    inline unsigned char getType() const { 
      return el_type; 
    /// get ElInfo's \ref orientation
    inline signed char getOrientation() const { 
      return orientation; 
    /// set ElInfo's \ref el_type to t
    /// set ElInfo's \ref orientation to o
    inline void setOrientation(signed char o) { 
      orientation = o; 
    void getRefSimplexCoords(const BasisFunction *basisFcts,
			     DimMat<double> *coords) const;
    void getSubElementCoords(const BasisFunction *basisFcts,
			     int iChild, 
			     DimMat<double> *coords) const;
    /// \ref el 's type. Is Filled automatically by the traversal routines.
    unsigned char el_type;

    /** \brief
     * +/- 1: sign of the determinant of the transformation to the reference
     * element with vertices (0,0,0), (1,1,1), (1,1,0), (1,0,0).
     */
    signed char orientation;
    /// Tmp vectors used for calculations in calcGrdLambda and getNormal().
    std::vector< WorldVector<double> > tmpWorldVecs;