Browse Source

Clean up of KiHa test

master
Trevor Irons 2 years ago
parent
commit
ee7121abcf

+ 3
- 1
Modules/FDEM1D/examples/EMDipEarth1D.cpp View File

68
 		Real oy =    20.;
68
 		Real oy =    20.;
69
 		Real depth = 18.10;
69
 		Real depth = 18.10;
70
 		Real dz = 2.6;
70
 		Real dz = 2.6;
71
-		int  nz = 1;
71
+		int  nz = 10000;
72
 
72
 
73
 		receivers->SetNumberOfPoints(nz);
73
 		receivers->SetNumberOfPoints(nz);
74
 		int ir = 0;
74
 		int ir = 0;
83
 
83
 
84
     auto EmEarth = EMEarth1D::NewSP();
84
     auto EmEarth = EMEarth1D::NewSP();
85
         //EmEarth->SetHankelTransformMethod(DIGITALFILTERING);
85
         //EmEarth->SetHankelTransformMethod(DIGITALFILTERING);
86
+        EmEarth->SetHankelTransformMethod(CHAVE);
87
+
86
         EmEarth->SetFieldsToCalculate(BOTH); // Fortran needs this
88
         EmEarth->SetFieldsToCalculate(BOTH); // Fortran needs this
87
 		EmEarth->AttachDipoleSource(dipole);
89
 		EmEarth->AttachDipoleSource(dipole);
88
 		EmEarth->AttachLayeredEarthEM(earth);
90
 		EmEarth->AttachLayeredEarthEM(earth);

+ 5
- 5
Modules/FDEM1D/examples/inp/config.inp View File

1
 // Hankel Transform type uncomment desired
1
 // Hankel Transform type uncomment desired
2
-FHTKEY51       // Key's   51 point FHT
3
-//FHTKEY101      // Key's  101 point FHT
4
-//FHTKEY201      // Key's  201 point FHT
2
+CHAVE       // Key's   51 point FHT
3
+//CHAVE      // Key's  101 point FHT
4
+//CHAVE      // Key's  201 point FHT
5
 //FHTKONG61      // Kong's  61 point FHT
5
 //FHTKONG61      // Kong's  61 point FHT
6
 //FHTKONG121     // Kong's 121 point FHT
6
 //FHTKONG121     // Kong's 121 point FHT
7
 //FHTKONG241	 // Kong's 241 point FHT
7
 //FHTKONG241	 // Kong's 241 point FHT
8
-//ANDERSON801    // Anderson's 801 Point FHT, with lagged convolution
8
+//CHAVE    // Anderson's 801 Point FHT, with lagged convolution
9
 //CHAVE          // Chave's Gaussian Quadrature
9
 //CHAVE          // Chave's Gaussian Quadrature
10
-//QWEKEY         // Key's Gaussian Qwuadrature with extraploation
10
+//CHAVE         // Key's Gaussian Qwuadrature with extraploation
11
 //IRONS
11
 //IRONS
12
 .1               // minimum dipole ratio
12
 .1               // minimum dipole ratio
13
 1e-5             // minumum dipole moment
13
 1e-5             // minumum dipole moment

+ 1
- 1
Modules/FDEM1D/examples/plottimings.py View File

56
 
56
 
57
 plt.gca().set_yscale('log')    
57
 plt.gca().set_yscale('log')    
58
 plt.gca().set_title( str(compiler) + " " + str(BENCH[compiler]["version"]) ) 
58
 plt.gca().set_title( str(compiler) + " " + str(BENCH[compiler]["version"]) ) 
59
-plt.suptitle( cpuinfo.get_cpu_info()['brand'] ) 
59
+#plt.suptitle( cpuinfo.get_cpu_info()['brand'] ) 
60
 
60
 
61
 
61
 
62
 
62
 

+ 4
- 1
Modules/FDEM1D/src/EMEarth1D.cpp View File

680
         Real rho = (Receivers->GetLocation(irec).head<2>() - tDipole->GetLocation().head<2>()).norm();
680
         Real rho = (Receivers->GetLocation(irec).head<2>() - tDipole->GetLocation().head<2>()).norm();
681
         //Real rho = ( ((Receivers->GetLocation(irec) - tDipole->GetLocation()).head(2)).eval() ).norm();
681
         //Real rho = ( ((Receivers->GetLocation(irec) - tDipole->GetLocation()).head(2)).eval() ).norm();
682
 
682
 
683
-        tDipole->SetKernels(ifreq, FieldsToCalculate, Receivers, irec, Earth);
683
+        tDipole->SetKernels( ifreq, FieldsToCalculate, Receivers, irec, Earth );
684
         Hankel->ComputeRelated( rho, tDipole->GetKernelManager() );
684
         Hankel->ComputeRelated( rho, tDipole->GetKernelManager() );
685
         tDipole->UpdateFields( ifreq,  Hankel, wavef );
685
         tDipole->UpdateFields( ifreq,  Hankel, wavef );
686
     }
686
     }
755
         #pragma omp parallel
755
         #pragma omp parallel
756
         #endif
756
         #endif
757
         { // OpenMP Parallel Block
757
         { // OpenMP Parallel Block
758
+
758
             #ifdef LEMMAUSEOMP
759
             #ifdef LEMMAUSEOMP
759
             int tid = omp_get_thread_num();
760
             int tid = omp_get_thread_num();
760
             int nthreads = omp_get_num_threads();
761
             int nthreads = omp_get_num_threads();
763
             int nthreads=1;
764
             int nthreads=1;
764
             #endif
765
             #endif
765
             auto tDipole = Dipole->Clone();
766
             auto tDipole = Dipole->Clone();
767
+
766
             std::shared_ptr<HankelTransform> Hankel;
768
             std::shared_ptr<HankelTransform> Hankel;
767
             switch (HankelType) {
769
             switch (HankelType) {
768
                 case ANDERSON801:
770
                 case ANDERSON801:
787
                     std::cerr << "Hankel transform cannot be created\n";
789
                     std::cerr << "Hankel transform cannot be created\n";
788
                     exit(EXIT_FAILURE);
790
                     exit(EXIT_FAILURE);
789
             }
791
             }
792
+
790
             if ( tDipole->GetNumberOfFrequencies() < Receivers->GetNumberOfPoints() ) {
793
             if ( tDipole->GetNumberOfFrequencies() < Receivers->GetNumberOfPoints() ) {
791
                 for (int ifreq=0; ifreq<tDipole->GetNumberOfFrequencies(); ++ifreq) {
794
                 for (int ifreq=0; ifreq<tDipole->GetNumberOfFrequencies(); ++ifreq) {
792
                     // Propogation constant in free space being input to Hankel
795
                     // Propogation constant in free space being input to Hankel

+ 1
- 1
Modules/FDEM1D/src/FHTAnderson801.cpp View File

1042
 		//Zans.resize(this->NumConv, (int)(this->kernelVec.size()));
1042
 		//Zans.resize(this->NumConv, (int)(this->kernelVec.size()));
1043
 		//Zans.setZero();
1043
 		//Zans.setZero();
1044
         //Zwork = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(801, (int)(this->kernelVec.size()));
1044
         //Zwork = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(801, (int)(this->kernelVec.size()));
1045
-        Zans  = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(this->NumConv, (int)(this->kernelVec.size()));
1045
+        Zans = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(this->NumConv, (int)(this->kernelVec.size()));
1046
 
1046
 
1047
  		// 1010 Loop
1047
  		// 1010 Loop
1048
  		for (int ilag=0; ilag < this->NumConv; ++ilag) {
1048
  		for (int ilag=0; ilag < this->NumConv; ++ilag) {

+ 1
- 2
Modules/FDEM1D/src/KernelEM1DSpec.cpp View File

1682
     }
1682
     }
1683
 
1683
 
1684
     // TODO in PotentialBelowSourceLayer:
1684
     // TODO in PotentialBelowSourceLayer:
1685
-
1686
     template<>
1685
     template<>
1687
     Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
1686
     Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
1688
         Complex dd =  ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
1687
         Complex dd =  ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
1815
             }
1814
             }
1816
             p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
1815
             p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
1817
         }
1816
         }
1818
-        Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
1817
+        Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z + p);
1819
         if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
1818
         if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
1820
             con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
1819
             con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
1821
                         ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
1820
                         ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);

+ 69
- 62
Modules/FDEM1D/testing/BenchKiHa.h View File

80
 		Real dy = 20;
80
 		Real dy = 20;
81
 		Real dz = 20;
81
 		Real dz = 20;
82
 
82
 
83
-		int  nx = 5;  //13
84
-		int  ny = 5;  //13
85
-		int  nz = 5;  //13
83
+		int  nx = 11;  //13
84
+		int  ny = 11;  //13
85
+		int  nz = 11;  //13
86
         Delta = nx*ny*nz*1e-9;
86
         Delta = nx*ny*nz*1e-9;
87
 
87
 
88
 		receivers->SetNumberOfPoints(nx*ny*nz);
88
 		receivers->SetNumberOfPoints(nx*ny*nz);
114
 
114
 
115
    void test_Hz() {
115
    void test_Hz() {
116
 
116
 
117
+        std::cout.precision(4);
118
+
117
         dipole->SetType(MAGNETICDIPOLE);
119
         dipole->SetType(MAGNETICDIPOLE);
118
 		dipole->SetPolarisation(ZPOLARISATION);
120
 		dipole->SetPolarisation(ZPOLARISATION);
119
 
121
 
120
         // Put in a unit test that will be slow.
122
         // Put in a unit test that will be slow.
121
         std::cout << "MAGNETICDIPOLE Z polarisation" << std::endl;
123
         std::cout << "MAGNETICDIPOLE Z polarisation" << std::endl;
122
         std::cout << "=====================================\n";
124
         std::cout << "=====================================\n";
123
-	    std::cout << "Lemma/C++: ";
125
+	    std::cout << std::setw(18) << "Lemma/C++: ";
124
         std::cout.flush();
126
         std::cout.flush();
125
 
127
 
126
   	    timer.begin();
128
   	    timer.begin();
127
 	    EmEarth->MakeCalc3();
129
 	    EmEarth->MakeCalc3();
128
 	    Real lemmaTime = timer.end();
130
 	    Real lemmaTime = timer.end();
129
-        std::cout << lemmaTime << " [s]" << std::endl;
131
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
130
 
132
 
131
         auto lc = receivers->GetEfield( 0 );
133
         auto lc = receivers->GetEfield( 0 );
132
 
134
 
133
         #ifdef KIHALEE_EM1D
135
         #ifdef KIHALEE_EM1D
134
 	    receivers->ClearFields();
136
 	    receivers->ClearFields();
135
-        std::cout << "FORTRAN KiHa: ";
137
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
136
         std::cout.flush();
138
         std::cout.flush();
137
 
139
 
138
   	    timer.begin();
140
   	    timer.begin();
139
  	    EmEarth->MakeCalc();
141
  	    EmEarth->MakeCalc();
140
 	    Real kihaTime = timer.end();
142
 	    Real kihaTime = timer.end();
141
-
142
-        std::cout << kihaTime << " [s]" << std::endl;
143
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
143
 
144
 
144
         auto fc = receivers->GetEfield( 0 ); //0,0);
145
         auto fc = receivers->GetEfield( 0 ); //0,0);
145
 
146
 
146
-        std::cout.precision(16);
147
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
148
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
149
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
150
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
147
+        //std::cout.precision(16);
148
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
149
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
150
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
151
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
151
 
152
 
152
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
153
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
153
         #endif
154
         #endif
155
 
156
 
156
    void test_Hx() {
157
    void test_Hx() {
157
 
158
 
159
+        std::cout.precision(4);
160
+
158
         dipole->SetType(MAGNETICDIPOLE);
161
         dipole->SetType(MAGNETICDIPOLE);
159
 		dipole->SetPolarisation(XPOLARISATION);
162
 		dipole->SetPolarisation(XPOLARISATION);
160
 
163
 
161
         // Put in a unit test that will be slow.
164
         // Put in a unit test that will be slow.
162
         std::cout << "MAGNETICDIPOLE X polarisation" << std::endl;
165
         std::cout << "MAGNETICDIPOLE X polarisation" << std::endl;
163
         std::cout << "=====================================\n";
166
         std::cout << "=====================================\n";
164
-	    std::cout << "Lemma/C++: ";
167
+	    std::cout << std::setw(18) << "Lemma/C++: ";
165
         std::cout.flush();
168
         std::cout.flush();
166
 
169
 
167
   	    timer.begin();
170
   	    timer.begin();
168
 	    EmEarth->MakeCalc3();
171
 	    EmEarth->MakeCalc3();
169
 	    Real lemmaTime = timer.end();
172
 	    Real lemmaTime = timer.end();
170
-        std::cout << lemmaTime << " [s]" << std::endl;
173
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
171
 
174
 
172
         auto lc = receivers->GetEfield( 0 );
175
         auto lc = receivers->GetEfield( 0 );
173
 
176
 
174
         #ifdef KIHALEE_EM1D
177
         #ifdef KIHALEE_EM1D
175
 	    receivers->ClearFields();
178
 	    receivers->ClearFields();
176
-        std::cout << "FORTRAN KiHa: ";
179
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
177
   	    timer.begin();
180
   	    timer.begin();
178
  	    EmEarth->MakeCalc();
181
  	    EmEarth->MakeCalc();
179
 	    Real kihaTime = timer.end();
182
 	    Real kihaTime = timer.end();
180
-        std::cout << kihaTime << " [s]" << std::endl;
183
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
181
 
184
 
182
         auto fc = receivers->GetEfield( 0 ); //0,0);
185
         auto fc = receivers->GetEfield( 0 ); //0,0);
183
 
186
 
184
-        std::cout.precision(16);
185
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
186
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
187
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
188
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
187
+        //std::cout.precision(16);
188
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
189
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
190
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
191
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
189
 
192
 
190
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
193
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
191
         #endif
194
         #endif
193
 
196
 
194
    void test_Hy() {
197
    void test_Hy() {
195
 
198
 
199
+        std::cout.precision(4);
200
+
196
         dipole->SetType(MAGNETICDIPOLE);
201
         dipole->SetType(MAGNETICDIPOLE);
197
 		dipole->SetPolarisation(YPOLARISATION);
202
 		dipole->SetPolarisation(YPOLARISATION);
198
 
203
 
199
         // Put in a unit test that will be slow.
204
         // Put in a unit test that will be slow.
200
         std::cout << "MAGNETICDIPOLE Y polarisation" << std::endl;
205
         std::cout << "MAGNETICDIPOLE Y polarisation" << std::endl;
201
         std::cout << "=====================================\n";
206
         std::cout << "=====================================\n";
202
-	    std::cout << "Lemma/C++: ";
207
+	    std::cout << std::setw(18) << "Lemma/C++: ";
203
         std::cout.flush();
208
         std::cout.flush();
204
 
209
 
205
   	    timer.begin();
210
   	    timer.begin();
206
 	    EmEarth->MakeCalc3();
211
 	    EmEarth->MakeCalc3();
207
 	    Real lemmaTime = timer.end();
212
 	    Real lemmaTime = timer.end();
208
-        std::cout << lemmaTime << " [s]" << std::endl;
213
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
209
 
214
 
210
         auto lc = receivers->GetEfield( 0 );
215
         auto lc = receivers->GetEfield( 0 );
211
 
216
 
212
         #ifdef KIHALEE_EM1D
217
         #ifdef KIHALEE_EM1D
213
 	    receivers->ClearFields();
218
 	    receivers->ClearFields();
214
-        std::cout << "FORTRAN KiHa: ";
219
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
215
         std::cout.flush();
220
         std::cout.flush();
216
   	    timer.begin();
221
   	    timer.begin();
217
  	    EmEarth->MakeCalc();
222
  	    EmEarth->MakeCalc();
218
 	    Real kihaTime = timer.end();
223
 	    Real kihaTime = timer.end();
219
-        std::cout << kihaTime << " [s]" << std::endl;
224
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
220
 
225
 
221
         auto fc = receivers->GetEfield( 0 ); //0,0);
226
         auto fc = receivers->GetEfield( 0 ); //0,0);
222
 
227
 
223
-        std::cout.precision(16);
224
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
225
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
226
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
227
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
228
+        //std::cout.precision(16);
229
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
230
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
231
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
232
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
228
 
233
 
229
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
234
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
230
         #endif
235
         #endif
232
 
237
 
233
    void test_Ex() {
238
    void test_Ex() {
234
 
239
 
240
+        std::cout.precision(4);
241
+
235
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
242
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
236
 		dipole->SetPolarisation(XPOLARISATION);
243
 		dipole->SetPolarisation(XPOLARISATION);
237
 
244
 
238
         // Put in a unit test that will be slow.
245
         // Put in a unit test that will be slow.
239
         std::cout << "GROUNDEDELECTRICDIPOLE X polarisation" << std::endl;
246
         std::cout << "GROUNDEDELECTRICDIPOLE X polarisation" << std::endl;
240
         std::cout << "=====================================\n";
247
         std::cout << "=====================================\n";
241
-	    std::cout << "Lemma/C++: ";
248
+	    std::cout << std::setw(18) << "Lemma/C++: ";
242
         std::cout.flush();
249
         std::cout.flush();
243
 
250
 
244
   	    timer.begin();
251
   	    timer.begin();
245
 	    EmEarth->MakeCalc3();
252
 	    EmEarth->MakeCalc3();
246
 	    Real lemmaTime = timer.end();
253
 	    Real lemmaTime = timer.end();
247
-        std::cout << lemmaTime << " [s]" << std::endl;
254
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
248
 
255
 
249
         auto lc = receivers->GetEfield( 0 );
256
         auto lc = receivers->GetEfield( 0 );
250
 
257
 
251
         #ifdef KIHALEE_EM1D
258
         #ifdef KIHALEE_EM1D
252
 	    receivers->ClearFields();
259
 	    receivers->ClearFields();
253
-        std::cout << "FORTRAN KiHa: ";
260
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
254
         std::cout.flush();
261
         std::cout.flush();
255
   	    timer.begin();
262
   	    timer.begin();
256
  	    EmEarth->MakeCalc();
263
  	    EmEarth->MakeCalc();
257
 	    Real kihaTime = timer.end();
264
 	    Real kihaTime = timer.end();
258
-        std::cout << kihaTime << " [s]" << std::endl;
265
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
259
 
266
 
260
         auto fc = receivers->GetEfield( 0 ); //0,0);
267
         auto fc = receivers->GetEfield( 0 ); //0,0);
261
 
268
 
262
-        std::cout.precision(16);
263
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
264
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
265
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
266
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
269
+        //std::cout.precision(16);
270
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
271
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
272
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
273
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
267
 
274
 
268
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
275
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
269
         #endif
276
         #endif
271
 
278
 
272
    void test_Ey() {
279
    void test_Ey() {
273
 
280
 
281
+        std::cout.precision(4);
282
+
274
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
283
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
275
 		dipole->SetPolarisation(YPOLARISATION);
284
 		dipole->SetPolarisation(YPOLARISATION);
276
 
285
 
277
         // Put in a unit test that will be slow.
286
         // Put in a unit test that will be slow.
278
         std::cout << "GROUNDEDELECTRICDIPOLE Y polarisation" << std::endl;
287
         std::cout << "GROUNDEDELECTRICDIPOLE Y polarisation" << std::endl;
279
         std::cout << "=====================================\n";
288
         std::cout << "=====================================\n";
280
-	    std::cout << "Lemma/C++: ";
289
+	    std::cout << std::setw(18) << "Lemma/C++: ";
281
         std::cout.flush();
290
         std::cout.flush();
282
 
291
 
283
   	    timer.begin();
292
   	    timer.begin();
284
 	    EmEarth->MakeCalc3();
293
 	    EmEarth->MakeCalc3();
285
 	    Real lemmaTime = timer.end();
294
 	    Real lemmaTime = timer.end();
286
-        std::cout << lemmaTime << " [s]" << std::endl;
295
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
287
 
296
 
288
         auto lc = receivers->GetEfield( 0 );
297
         auto lc = receivers->GetEfield( 0 );
289
 
298
 
290
         #ifdef KIHALEE_EM1D
299
         #ifdef KIHALEE_EM1D
291
 	    receivers->ClearFields();
300
 	    receivers->ClearFields();
292
-        std::cout << "KiHa/FORTRAN: ";
301
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
293
         std::cout.flush();
302
         std::cout.flush();
294
 
303
 
295
         timer.begin();
304
         timer.begin();
296
  	    EmEarth->MakeCalc();
305
  	    EmEarth->MakeCalc();
297
 	    Real kihaTime = timer.end();
306
 	    Real kihaTime = timer.end();
298
-        std::cout << kihaTime << " [s]" << std::endl;
307
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
299
 
308
 
300
         auto fc = receivers->GetEfield( 0 ); //0,0);
309
         auto fc = receivers->GetEfield( 0 ); //0,0);
301
 
310
 
302
-        std::cout << "Lemma time:" << lemmaTime << "\tKiHa time:" << kihaTime << std::endl;
303
-
304
-        std::cout.precision(16);
305
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
306
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
307
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
308
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
311
+        //std::cout.precision(16);
312
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
313
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
314
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
315
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
309
 
316
 
310
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
317
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
311
         #endif
318
         #endif
313
 
320
 
314
    void test_Ez() {
321
    void test_Ez() {
315
 
322
 
323
+        std::cout.precision(4);
324
+
316
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
325
         dipole->SetType(GROUNDEDELECTRICDIPOLE);
317
 		dipole->SetPolarisation(ZPOLARISATION);
326
 		dipole->SetPolarisation(ZPOLARISATION);
318
 
327
 
319
         // Put in a unit test that will be slow.
328
         // Put in a unit test that will be slow.
320
         std::cout << "GROUNDEDELECTRICDIPOLE Z polarisation" << std::endl;
329
         std::cout << "GROUNDEDELECTRICDIPOLE Z polarisation" << std::endl;
321
         std::cout << "=====================================\n";
330
         std::cout << "=====================================\n";
322
-	    std::cout << "Lemma/C++: ";
331
+	    std::cout << std::setw(18) << "Lemma/C++: ";
323
         std::cout.flush();
332
         std::cout.flush();
324
 
333
 
325
   	    timer.begin();
334
   	    timer.begin();
326
 	    EmEarth->MakeCalc3();
335
 	    EmEarth->MakeCalc3();
327
 	    Real lemmaTime = timer.end();
336
 	    Real lemmaTime = timer.end();
328
-        std::cout << lemmaTime << " [s]" << std::endl;
337
+        std::cout << std::setw(14) << lemmaTime << std::setw(6) << " [s]" << std::endl;
329
 
338
 
330
         auto lc = receivers->GetEfield( 0 );
339
         auto lc = receivers->GetEfield( 0 );
331
 
340
 
332
         #ifdef KIHALEE_EM1D
341
         #ifdef KIHALEE_EM1D
333
 	    receivers->ClearFields();
342
 	    receivers->ClearFields();
334
-        std::cout << "KiHa/FORTRAN: ";
343
+        std::cout << std::setw(18) << "KiHa/Fortran: ";
335
         std::cout.flush();
344
         std::cout.flush();
336
 
345
 
337
         timer.begin();
346
         timer.begin();
338
  	    EmEarth->MakeCalc();
347
  	    EmEarth->MakeCalc();
339
 	    Real kihaTime = timer.end();
348
 	    Real kihaTime = timer.end();
340
-        std::cout << kihaTime << " [s]" << std::endl;
349
+        std::cout << std::setw(14) << kihaTime << std::setw(6) << " [s]" << std::endl;
341
 
350
 
342
         auto fc = receivers->GetEfield( 0 ); //0,0);
351
         auto fc = receivers->GetEfield( 0 ); //0,0);
343
 
352
 
344
-        std::cout << "Lemma time:" << lemmaTime << "\tKiHa time:" << kihaTime << std::endl;
345
-
346
-        std::cout.precision(16);
347
-        std::cout << "Lemma norm |" << (lc).norm() << "|" << std::endl;
348
-        std::cout << "KiHa norm  |" << (fc).norm() << "|" << std::endl;
349
-        std::cout << "Difference norm |" << (lc - fc).norm() << "|\n";
350
-        std::cout << "Speedup:" << kihaTime/lemmaTime << "\n" << std::endl;
353
+        //std::cout.precision(16);
354
+        std::cout << std::setw(18) << "Lemma norm: "      << std::setw(14) << (lc).norm() << std::endl;
355
+        std::cout << std::setw(18) << "KiHa norm: "       << std::setw(14) <<  (fc).norm() << std::endl;
356
+        std::cout << std::setw(18) << "Difference norm: " << std::setw(14) << (lc - fc).norm() << "\n";
357
+        std::cout << std::setw(18) << "Speedup: "         << std::setw(14) << kihaTime/lemmaTime << "\n" << std::endl;
351
 
358
 
352
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
359
         TS_ASSERT_DELTA((lc-fc).norm(), 0.0, Delta);
353
         #endif
360
         #endif

Loading…
Cancel
Save