# Untitled

a guest
Nov 17th, 2019
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. const double fac_lin[] = {0.5,0.5,0.5,1.0/24.0,1.0/6.0};
2. const double ms1_lin[] = {1,-1,0,-1,1,0,0,0,0};
3. const double ms2_lin[] = {2,-1,-1,-1,0,1,-1,1,0};
4. const double ms3_lin[] = {1,0,-1,0,0,0,-1,0,1};
5. const double ms4_lin[] = {2,1,1,1,2,1,1,1,2};
6. const double vs1_lin[] = {1,1,1};
7.
8. const double fac_quad[] = {1.0/6.0,1.0/6.0,1.0/6.0,1.0/360.0,1.0/6.0};
9. const double ms1_quad[] = {3,1,0,-4,0,0,1,3,0,-4,0,0,0,0,0,0,0,0,-4,-4,0,8,0,0,0,0,0,0,8,-8,0,0,0,0,-8,8};
10. const double ms2_quad[] = {6,1,1,-4,0,-4,1,0,-1,-4,4,0,1,-1,0,0,4,-4,-4,-4,0,8,-8,8,0,4,4,-8,8,-8,-4,0,-4,8,-8,8};
11. const double ms3_quad[] = {3,0,1,0,0,-4,0,0,0,0,0,0,1,0,3,0,0,-4,0,0,0,8,-8,0,0,0,0,-8,8,0,-4,0,-4,0,0,8};
12. const double ms4_quad[] = {6,-1,-1,0,-4,0,-1,6,-1,0,0,-4,-1,-1,6,-4,0,0,0,0,-4,32,16,16,-4,0,0,16,32,16,0,-4,0,16,16,32};
13. const double vs1_quad[] = {0,0,0,1,1,1};
14.
15. for(int y=0; y<MSize; y++) {
16. for(int x=0; x<MSize; x++) {
17. gsl_matrix_set(S1,x,y,ms1[y*MSize+x]);
18. gsl_matrix_set(S2,x,y,ms2[y*MSize+x]);
19. gsl_matrix_set(S3,x,y,ms3[y*MSize+x]);
20. gsl_matrix_set(S4,x,y,ms4[y*MSize+x]);
21. }
22. gsl_vector_set(s1,y,vs1[y]);
23. }
24.
25. gsl_matrix_scale(S1,fac[0]);
26. gsl_matrix_scale(S2,fac[1]);
27. gsl_matrix_scale(S3,fac[2]);
28. gsl_matrix_scale(S4,fac[3]);
29. gsl_vector_scale(s1,fac[4]);
30.
31. gsl_matrix_memcpy(Me,S4);
32. Stot = gsl_matrix_calloc(numMeshVertices,numMeshVertices);
33. Mtot = gsl_matrix_calloc(numMeshVertices,numMeshVertices);
34.
35. gsl_matrix_set(S5l,0,0,1.0/3.0); gsl_matrix_set(S5l,0,1,1.0/6.0);
36. gsl_matrix_set(S5l,1,1,1.0/3.0); gsl_matrix_set(S5l,1,0,1.0/6.0);
37.
38. gsl_matrix_set(S5q,0,0,2.0); gsl_matrix_set(S5q,0,1,1.0); gsl_matrix_set(S5q,0,2,-0.5);
39. gsl_matrix_set(S5q,1,0,1.0); gsl_matrix_set(S5q,1,1,8.0); gsl_matrix_set(S5q,1,2,1.0);
40. gsl_matrix_set(S5q,2,0,-0.5); gsl_matrix_set(S5q,2,1,1.0); gsl_matrix_set(S5q,2,2,2.0);
41.
42. gsl_matrix_scale(S5q,1.0/15.0);
RAW Paste Data