~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to lib/atc/Quadrature.h

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2013-11-20 22:41:36 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20131120224136-tzx7leh606fqnckm
Tags: 0~20131119.git7162cf0-1
* [e65b919] Imported Upstream version 0~20131119.git7162cf0
* [f7bddd4] Fix some problems, introduced by upstream recently.
* [3616dfc] Use wrap-and-sort script.
* [7e92030] Ignore quilt dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/** Quadrature : creat Gaussian quadrature lists  */
2
1
#ifndef QUADRATURE_H
3
2
#define QUADRATURE_H
4
3
 
5
 
using namespace std;
6
 
 
7
 
static const int line_ngauss = 10;
8
 
static double line_xg[line_ngauss], line_wg[line_ngauss];
9
 
/** domain of integration is -1 to 1 */
10
 
static void set_line_quadrature(int ng, double* xg, double* wg)
11
 
{
12
 
  /** integration schemes : 3, 4, 5, 10 point Gauss */
13
 
    
14
 
  if (ng == 3) {
15
 
    xg[0] = 0.0; wg[0] = 8.0/9.0;
16
 
    xg[1] = -sqrt(3.0/5.0); wg[1] = 5.0/9.0;
17
 
    xg[2] =  sqrt(3.0/5.0); wg[2] = 5.0/9.0;
18
 
  }
19
 
  else if (ng == 4) {
20
 
    xg[0] = -sqrt((3.0/7.0)-(sqrt(120.0)/35.0)); wg[0] = (1.0/2.0)+(5.0/(3.0*sqrt(120.0)));
21
 
    xg[1] =  sqrt((3.0/7.0)-(sqrt(120.0)/35.0)); wg[1] = (1.0/2.0)+(5.0/(3.0*sqrt(120.0)));
22
 
    xg[2] = -sqrt((3.0/7.0)+(sqrt(120.0)/35.0)); wg[2] = (1.0/2.0)-(5.0/(3.0*sqrt(120.0)));
23
 
    xg[3] =  sqrt((3.0/7.0)+(sqrt(120.0)/35.0)); wg[3] = (1.0/2.0)-(5.0/(3.0*sqrt(120.0)));
24
 
  }
25
 
  else if (ng == 5) {
26
 
    xg[0] = 0.0; wg[0] = 0.5688888888888889;
27
 
    xg[1] = -sqrt((35.0-sqrt(280.0))/63.0); wg[1] = 0.4786286704993658;
28
 
    xg[2] =  sqrt((35.0-sqrt(280.0))/63.0); wg[2] = 0.4786286704993658;
29
 
    xg[3] = -sqrt((35.0+sqrt(280.0))/63.0); wg[3] = 0.2369268850561891;
30
 
    xg[4] =  sqrt((35.0+sqrt(280.0))/63.0); wg[4] = 0.2369268850561891;
31
 
  }
32
 
  else if (ng == 10) {
33
 
    xg[0] = -0.14887434; wg[0] = 0.29552422;
34
 
    xg[1] =  0.14887434; wg[1] = 0.29552422;
35
 
    xg[2] = -0.43339539; wg[2] = 0.26926672;
36
 
    xg[3] =  0.43339539; wg[3] = 0.26926672;
37
 
    xg[4] = -0.67940957; wg[4] = 0.21908636;
38
 
    xg[5] =  0.67940957; wg[5] = 0.21908636;
39
 
    xg[6] = -0.86506337; wg[6] = 0.14945135;
40
 
    xg[7] =  0.86506337; wg[7] = 0.14945135;
41
 
    xg[8] = -0.97390653; wg[8] = 0.06667134;
42
 
    xg[9] =  0.97390653; wg[9] = 0.06667134;
43
 
  }
44
 
  else { cout << "Invalid choice of number of Gauss points for Quadrature" << endl; }
45
 
  //else { throw ATC_Error(0,"Invalid choice of number of Gauss points for Quadrature"); }
46
 
 
47
 
  return;
 
4
namespace ATC {
 
5
/** 
 
6
  *  @class Quadrature 
 
7
  *  @brief create quadrature lists  
 
8
*/
 
9
class Quadrature {
 
10
  public:
 
11
  /** Static instance of this class */
 
12
  static Quadrature * instance();
 
13
 
 
14
  /** Destroy */
 
15
  static void Destroy();
 
16
 
 
17
  /** domain of integration is -1 to 1 */
 
18
  void set_line_quadrature(const int ng, double* xg, double* wg);
 
19
 
 
20
  protected:
 
21
    Quadrature();
 
22
  private:
 
23
    static Quadrature * myInstance_;
48
24
};
49
 
 
 
25
}
50
26
#endif