ElInfo3d.h 4.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
// ============================================================================
// ==                                                                        ==
// == 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"
Thomas Witkowski's avatar
Thomas Witkowski committed
27
#include "OpenMP.h"
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

namespace AMDiS {

  // ============================================================================
  // ===== class ElInfo3d =======================================================
  // ============================================================================


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

    /** \brief
     * Constructor. Calls ElInfo's protected Constructor.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
48 49 50 51 52 53 54 55 56
    ElInfo3d(Mesh* aMesh) 
      : ElInfo(aMesh) 
    {
      tmpWorldVecs.resize(omp_get_max_threads());

      for (int i = 0; i < static_cast<int>(tmpWorldVecs.size()); i++) {
	tmpWorldVecs[i].resize(4);
      }
    };
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85

    /** \brief
     * Assignment operator
     */
    ElInfo3d& operator=(const ElInfo3d& rhs) {
      ElInfo::operator=(rhs);
      el_type = rhs.el_type;
      orientation = rhs.orientation;
      return *this;
    } 

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

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

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

    /** \brief
     * 3-dimensional realisation of ElInfo's calcGrdLambda method.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
86
    double calcGrdLambda(DimVec<WorldVector<double> >& grd_lam);
87 88 89 90

    /** \brief
     * 3-dimensional realisation of ElInfo's getNormal method.
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
91
    double getNormal(int side, WorldVector<double> &normal);
92 93 94 95 96 97 98 99 100

    /** \brief
     * update ElInfo after refinement (of some neighbours). Only in 3d!
     */
    void update();

    /** \brief
     * get ElInfo's \ref el_type
     */
101 102 103
    inline unsigned char getType() const { 
      return el_type; 
    };
104 105 106 107

    /** \brief
     * get ElInfo's \ref orientation
     */
108 109 110
    inline signed char getOrientation() const { 
      return orientation; 
    };
111 112 113 114

    /** \brief
     * set ElInfo's \ref el_type to t
     */
115 116 117
    inline void setType(unsigned char t) { 
      el_type = t; 
    };
118 119 120 121

    /** \brief
     * set ElInfo's \ref orientation to o
     */
122 123 124
    inline void setOrientation(signed char o) { 
      orientation = o; 
    };
125 126 127 128 129 130 131 132 133 134 135 136 137

  protected:

    /** \brief
     * \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;
Thomas Witkowski's avatar
Thomas Witkowski committed
138 139 140 141 142 143

    /** \brief
     * Tmp vectors used for calculations in calcGrdLambda and getNormal().
     * Thread safe!
     */
    ::std::vector< ::std::vector< WorldVector<double> > > tmpWorldVecs;
144 145 146 147 148
  };

}

#endif // AMDIS_ELINFO3D_H