-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1.cc
More file actions
154 lines (122 loc) · 2.27 KB
/
test1.cc
File metadata and controls
154 lines (122 loc) · 2.27 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#define NN 1000
/**
* @file test1.cc
* @brief 测试函数
* @author hh
* @version 1
* @date 2018-06-06
*/
//
#include "Mymat.h"
int main(int argc, char** argv)
{
MPI::Init(argc, argv);
int n,Max,myid,totalsize,size;
myid = MPI::COMM_WORLD.Get_rank();
totalsize = MPI::COMM_WORLD.Get_size();
double tau=1, nu=1;
int N=pow(2,2);
if(argc>1)
{
N = atoi(argv[1]);
}
int aaa =1;
if(myid==0)
{
aaa=0;
}
// std::cout<<myid<<aaa<<std::endl;
// while(aaa==0)
// {
// }
size = pow(totalsize+1.0, 1.0/3);
n = N/size;
Max = 1;
Mymat U(n,n,n);
Mymat V(n,n,n);
Mymat W(n,n,n);
U.rank(myid,size);
V.rank(myid,size);
W.rank(myid,size);
U.createtype(n);
V.createtype(n);
W.createtype(n);
U.outposition();
V.outposition();
W.outposition();
U.createfactor();
V.createfactor();
Mymat Omega1(n,n,n,0);
Omega1.rank(myid,size);
Omega1.createtype(n);
Omega1.outposition();
Mymat Omega2(n,n,n,0);
Omega2.rank(myid,size);
Omega2.createtype(n);
Omega2.outposition();
Mymat Omega3(n,n,n,0);
Omega3.rank(myid,size);
Omega3.createtype(n);
Omega3.outposition();
Mymat mat1(N,n,n/size);
mat1.rank(myid,size);
mat1.inposition();
mat1.getplan();
// U.getF(N);
// U.myprint(0,0);
// int num = U.norm_inf();
// double norm = fabs(U.ele[num]);
// std::cout << num << ' ' << norm << std::endl;
//// Nabla \times u
// U.getF(N);
// U.NablaTimes(V,W,mat1,-1,-1);
// W.myprint(0,1);
//// omega times u
// Omega1.getF(N);
// U.getF1(N);
// U.Times(V,W,Omega1,Omega2,Omega3);
// V.getF3(N);
// U.myprint(0,1);
// V.myprint(0,2);
//f= cosx*siny*sinz laplace(f)=-3f
// U.getF(N);
// V = U*(-3);
// U.Laplace(mat1,1,-1,-1);
// U.myprint(0,1);
// V.myprint(0,2);
////f= cosx*siny*sinz inverselaplace(f)=-f/3
// U.getF(N);
// V = U*(-1.0/3);
// V.myprint(0,2);
// U.InverseLaplace(mat1,1,-1,-1);
// U.myprint(0,1);
////i=1,-1 u=cosx,sinx 求导
// int i =2;
// if(i==1)
// {
// Omega1.getF2(N);
// V.getF1(N);
// }
// else
// {
// Omega1.getF1(N);
// V.getF2(N);
// }
// Omega1.myprint(0,0);
// W=Omega1;
// W.trans_x(mat1);
// mat1.fft(i);
// mat1.multipfactorx(i);
// mat1.ifft(-i);
// W.retrans_x(mat1);
// W.myprint(0,1);
// V=V*(-i);
// W.myprint(0,2);
U.typefree();
V.typefree();
W.typefree();
Omega1.typefree();
Omega2.typefree();
Omega3.typefree();
MPI::Finalize();
}