BoundaryElementDist.h 2.05 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
#ifndef BOUNDARYELEMENTDIST_H
#define BOUNDARYELEMENTDIST_H

#include "ElInfo.h"
#include "FixVec.h"

#include "ElementLevelSet.h"

using namespace AMDiS;

class BoundaryElementDist {
 public:
  MEMORY_MANAGED(BoundaryElementDist);

  /**
   * Constructor.
   */
  BoundaryElementDist(ElementLevelSet *elLS_, int dim_)
    : dim(dim_),
    elLS(elLS_)
  {
    FUNCNAME("BoundaryElementDist::BoundaryElementDist()");

    TEST_EXIT(dim == 2 || dim == 3)
      ("function only works for dimension 2 !\n");
  };

  /**
   * Virtual destructor.
   */
  virtual ~BoundaryElementDist() {};

  /**
   * Calculates distance from the interface for all vertices of a boundary 
   * element.
   *
   * Pure virtual: Realizations in
   *               BoundaryElementLevelSetDist - boundary value initialization
   *                                             by level set function
   *               BoundaryElementTopDist      - topological distance
   *                                             (distance within element)
   *               BoundaryElementEdgeDist     - distance along edges
   *               BoundaryElementNormalDist   - normal distance to 
   *                                             intersection plane
   */
  virtual int calcDistOnBoundaryElement(ElInfo *elInfo,
					FixVec<double, VERTEX> &dVec) = 0;

 protected:
  /**
   * Calculate the (unit) normal for the plane defined by the world vectors in
   * vecs.
   */
  void calcNormal(const FixVec<WorldVector<double>, DIMEN> &vecs, 
		  WorldVector<double> &normalVec);

  /**
   * Normal calculation: 2-dimensional case.
   */
  void calcNormal_2d(const FixVec<WorldVector<double>, DIMEN> &vecs, 
		     WorldVector<double> &normalVec);

  /**
   * Normal calculation: 3-dimensional case.
   */
  void calcNormal_3d(const FixVec<WorldVector<double>, DIMEN> &vecs, 
		     WorldVector<double> &normalVec);

 protected:
  /**
   * Dimension.
   */
  int dim;

  /**
   * Holds level set function and functionalities for intersection point
   * calculation.
   */
  ElementLevelSet *elLS;
};

#endif  // BOUNDARYELEMENTDIST_H