SurfaceQuadrature.cc 1.38 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <algorithm>

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

namespace AMDiS {

  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)
  {
Thomas Witkowski's avatar
Thomas Witkowski committed
19
    lambda = new VectorOfFixVecs<DimVec<double> >(dim, n_points, NO_INIT);
20
21

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

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

29
30
      for (int j = 0; j < dim; j++)
	for (int k = 0; k < dim + 1; k++)
31
32
33
34
	  (*lambda)[i][k] += origin[j] * coords_[j][k];
    }
  }

35
  void SurfaceQuadrature::scaleSurfaceQuadrature(VectorOfFixVecs<DimVec<double> >&coords)
36
37
  {
    // copy coords
38
    for (int i = 0; i < dim; i++)
39
40
41
      coords_[i] = coords[i];
  
    // for each integration point
42
    for (int i = 0; i < n_points; i++) {
43
44
45
      // get coords of quadrature point in dim-1
      DimVec<double> origin = quad_->getLambda(i);

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

49
50
      for (int j = 0; j < dim; j++)
	for (int k = 0; k < dim+1; k++)
51
52
53
54
55
	  (*lambda)[i][k] += origin[j] * coords_[j][k];
    }
  }

}