SurfaceQuadrature.cc 2.04 KB
Newer Older
1
2
3
4
5
6
7
#include <algorithm>

#include "SurfaceQuadrature.h"
#include "Quadrature.h"

namespace AMDiS {

8
  //std::list<SurfaceQuadrature*> SurfaceQuadrature::surfaceQuadratureList;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

  SurfaceQuadrature::SurfaceQuadrature(Quadrature *quad,
				       VectorOfFixVecs<DimVec<double> > &coords)
    : Quadrature((quad->getName() + " surface").c_str(),
		 quad->getDegree(),
		 quad->getDim() + 1,
		 quad->getNumPoints(),
		 NULL,
		 quad->getWeight()), 
      quad_(quad),
      coords_(coords)
  {
    int i, j, k;

    // copy coords
Thomas Witkowski's avatar
Thomas Witkowski committed
24
    // coords_ = new DimVec<double>[dim](dim, NO_INIT);
25
26
27
28
    //   for(i = 0; i < dim; i++) {
    //     coords_[i] = coords[i];
    //   }
  
Thomas Witkowski's avatar
Thomas Witkowski committed
29
    lambda = new VectorOfFixVecs<DimVec<double> >(dim, n_points, NO_INIT);
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
83
84
85
86
87

    // for each integration point
    for(i=0; i < n_points; i++) {
      // get coords of quadrature point in dim-1
      DimVec<double> origin = quad->getLambda(i);

      for(j=0; j < dim+1; j++)
	(*lambda)[i][j] = 0.0;

      for(j = 0; j < dim; j++) {
	for(k = 0; k < dim+1; k++) {
	  (*lambda)[i][k] += origin[j] * coords_[j][k];
	}
      }
    
      //     // create barycentric coords for dim
      //     if(dim > 1) {
      //       for (j = 0; j < side; j++)
      // 	(*lambda)[i][j] = origin[j];

      //       (*lambda)[i][side] = 0.0;
      
      //       for (j = side+1; j <= dim; j++)
      // 	(*lambda)[i][j] = origin[j-1];
      //     } else {
      //       (*lambda)[i][side] = 1.0;
      //       (*lambda)[i][1-side] = 0.0;
      //     }
    }
  }

  void
  SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
  {
    int i, j, k;

    // copy coords
    for(i = 0; i < dim; i++) {
      coords_[i] = coords[i];
    }
  
    // for each integration point
    for(i=0; i < n_points; i++) {
      // get coords of quadrature point in dim-1
      DimVec<double> origin = quad_->getLambda(i);

      for(j=0; j < dim+1; j++)
	(*lambda)[i][j] = 0.0;

      for(j = 0; j < dim; j++) {
	for(k = 0; k < dim+1; k++) {
	  (*lambda)[i][k] += origin[j] * coords_[j][k];
	}
      }
    }
  }

}