Browse Source

Imporovements still coming to kernel calculation

master
Trevor Irons 8 years ago
parent
commit
2da966371e
2 changed files with 16 additions and 6 deletions
  1. 1
    1
      examples/KernelV0.cpp
  2. 15
    5
      src/KernelV0.cpp

+ 1
- 1
examples/KernelV0.cpp View File

44
     // may be more natural to work with?
44
     // may be more natural to work with?
45
     std::vector<std::string> tx = {std::string("Coil 1")};
45
     std::vector<std::string> tx = {std::string("Coil 1")};
46
     std::vector<std::string> rx = {std::string("Coil 1")};
46
     std::vector<std::string> rx = {std::string("Coil 1")};
47
-    Kern->CalculateK0( tx, rx , false ); //, false );
47
+    Kern->CalculateK0( tx, rx , true ); //, false );
48
     //Kern->CalculateK0( "Coil 1", "Coil 1" );
48
     //Kern->CalculateK0( "Coil 1", "Coil 1" );
49
 
49
 
50
 }
50
 }

+ 15
- 5
src/KernelV0.cpp View File

118
                 // TODO query for method, altough with flat antennae, this is fastest
118
                 // TODO query for method, altough with flat antennae, this is fastest
119
                 EMEarths.back()->SetHankelTransformMethod(ANDERSON801);
119
                 EMEarths.back()->SetHankelTransformMethod(ANDERSON801);
120
         }
120
         }
121
-        IntegrateOnOctreeGrid( 1e-1, vtkOutput );
121
+        IntegrateOnOctreeGrid( 1e-5, vtkOutput );
122
 
122
 
123
     }
123
     }
124
 
124
 
130
 
130
 
131
         this->tol = tolerance;
131
         this->tol = tolerance;
132
         //Vector3r                Size;
132
         //Vector3r                Size;
133
-            Size << 200,200,100;
133
+            Size << 200,200,200;
134
         //Vector3r                Origin;
134
         //Vector3r                Origin;
135
-            Origin << 0,0,0;
135
+            Origin << 0,0,1.0;
136
         Vector3r                cpos;  // centre position
136
         Vector3r                cpos;  // centre position
137
             //cpos << 100,100,50;
137
             //cpos << 100,100,50;
138
             cpos = (Size-Origin).array() / 2.;
138
             cpos = (Size-Origin).array() / 2.;
200
         //return Complex(volume*Bt.norm());
200
         //return Complex(volume*Bt.norm());
201
         return Complex(volume*Bt.norm());
201
         return Complex(volume*Bt.norm());
202
         //return Complex(volume);
202
         //return Complex(volume);
203
+
204
+//        Vn(ir) = ComputeV0Cell(Bt, Br, volume, 1.0);
203
     }
205
     }
204
 
206
 
205
     //--------------------------------------------------------------------------------------
207
     //--------------------------------------------------------------------------------------
209
     bool KernelV0::EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
211
     bool KernelV0::EvaluateKids( const Vector3r& size, const int& level, const Vector3r& cpos,
210
         const Complex& parentVal ) {
212
         const Complex& parentVal ) {
211
 
213
 
214
+        std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
215
+        std::cout.flush();
216
+
212
         // Next level step, interested in one level below
217
         // Next level step, interested in one level below
213
         // bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)
218
         // bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)
214
         Vector3r step  = size.array() / (Real)(1 << (level+1) );
219
         Vector3r step  = size.array() / (Real)(1 << (level+1) );
277
     bool KernelV0::EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
282
     bool KernelV0::EvaluateKids2( const Vector3r& size, const int& level, const Vector3r& cpos,
278
         const Complex& parentVal, vtkHyperOctree* oct, vtkHyperOctreeCursor* curse) {
283
         const Complex& parentVal, vtkHyperOctree* oct, vtkHyperOctreeCursor* curse) {
279
 
284
 
280
-        //std::cout << "\rlevel " << level << "\t" << nleaves;
281
-        //std::cout.flush();
285
+        std::cout << "\r" << (int)(1e2*VOLSUM/(Size[0]*Size[1]*Size[2])) << "\t" << nleaves;
286
+        std::cout.flush();
282
 
287
 
283
         // Next level step, interested in one level below
288
         // Next level step, interested in one level below
284
         // bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)
289
         // bitshift requires one extra, faster than, and equivalent to std::pow(2, level+1)
328
                 curse->ToChild(ichild);
333
                 curse->ToChild(ichild);
329
                 Vector3r cp = pos; // Eigen complains about combining these
334
                 Vector3r cp = pos; // Eigen complains about combining these
330
                 cp += posadd.row(ichild);
335
                 cp += posadd.row(ichild);
336
+                // Testing for position via alternative means
331
                 //Real p[3];
337
                 //Real p[3];
332
                 //GetPosition(curse, p);
338
                 //GetPosition(curse, p);
333
                 //std::cout << cp[0] << "\t" << p[0] << "\t" << cp[1] << "\t" << p[1] << "\t" << cp[2] << "\t" << p[2] << "\t" <<  vol<< std::endl;
339
                 //std::cout << cp[0] << "\t" << p[0] << "\t" << cp[1] << "\t" << p[1] << "\t" << cp[2] << "\t" << p[2] << "\t" <<  vol<< std::endl;
345
         return true;       // leaf
351
         return true;       // leaf
346
     }
352
     }
347
 
353
 
354
+    //--------------------------------------------------------------------------------------
355
+    //       Class:  KernelV0
356
+    //      Method:  GetPosition
357
+    //--------------------------------------------------------------------------------------
348
     void KernelV0::GetPosition( vtkHyperOctreeCursor* Cursor, Real* p ) {
358
     void KernelV0::GetPosition( vtkHyperOctreeCursor* Cursor, Real* p ) {
349
         Real ratio=1.0/(1<<(Cursor->GetCurrentLevel()));
359
         Real ratio=1.0/(1<<(Cursor->GetCurrentLevel()));
350
         //step  = ((Size).array() / std::pow(2.,Cursor->GetCurrentLevel()));
360
         //step  = ((Size).array() / std::pow(2.,Cursor->GetCurrentLevel()));

Loading…
Cancel
Save