Explorar el Código

Beginning work on adding lagged convolution to Key FHT classes.

lagkey
Trevor Irons hace 6 años
padre
commit
7d1e64b6c8

+ 3
- 1
Modules/FDEM1D/examples/Hantenna.cpp Ver fichero

@@ -202,7 +202,9 @@ const char *buildString = __DATE__ ", " __TIME__;
202 202
 	for (int iy=0; iy<ny; ++iy) {
203 203
 	for (int ix=0; ix<nx; ++ix) {
204 204
         hreal << receivers->GetLocation(i).transpose() << "\t";
205
- 		hreal << receivers->GetHfield(0, i).transpose() << "\n";
205
+ 		//hreal << receivers->GetHfield(0, i).transpose() << "\n"; ( complex, notation )
206
+ 		hreal << receivers->GetHfield(0, i).transpose().real() << "\t";
207
+ 		hreal << receivers->GetHfield(0, i).transpose().imag() << "\n";
206 208
         ++i;
207 209
     }
208 210
     }

+ 15
- 2
Modules/FDEM1D/include/FHTKey201.h Ver fichero

@@ -20,6 +20,7 @@
20 20
 #define  FHTKEY201_INC
21 21
 
22 22
 #include "HankelTransform.h"
23
+#include "CubicSplineInterpolator.h"
23 24
 
24 25
 namespace Lemma {
25 26
 
@@ -27,8 +28,8 @@ namespace Lemma {
27 28
       \ingroup FDEM1D
28 29
       \brief   Impliments the fast Hankel transform as outlines by Key 2011
29 30
       \details This filter uses 51, 101, or 201 filter points and supports both lagged and related
30
-                kernel arguments. This algorithm is a port of code carrying the following copyright and
31
-                restriction:
31
+                kernel arguments. This algorithm is a port of code carrying the following copyright
32
+                and restriction:
32 33
                 %------------------------------------------------------------------%
33 34
                 % Copyright (c) 2012 by the Society of Exploration Geophysicists.  %
34 35
                 % For more information, go to http://software.seg.org/2012/0003 .  %
@@ -83,10 +84,16 @@ namespace Lemma {
83 84
 
84 85
         void ComputeRelated(const Real& rho, std::shared_ptr<KernelEM1DManager> KernelManager);
85 86
 
87
+        void ComputeLaggedRelated(const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager);
88
+
86 89
         // ====================  ACCESS        =======================
87 90
 
88 91
         // ====================  INQUIRY       =======================
89 92
 
93
+        Real GetABSER();
94
+
95
+        void SetLaggedArg(const Real& rho);
96
+
90 97
         /** Returns the name of the underlying class, similiar to Python's type */
91 98
         virtual std::string GetName() const;
92 99
 
@@ -101,6 +108,12 @@ namespace Lemma {
101 108
         // Shared Filter Weights
102 109
 		static const Eigen::Matrix<Real, 201, 3>  WT201;
103 110
 
111
+        /// Spines for lagged convolutions (real part)
112
+        std::vector <std::shared_ptr<CubicSplineInterpolator> > splineVecReal;
113
+
114
+        /// Spines for lagged convolutions (imaginary part)
115
+        std::vector < std::shared_ptr<CubicSplineInterpolator> > splineVecImag;
116
+
104 117
         /// Holds answer, dimensions are NumConv, and NumberRelated.
105 118
         Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic> Zans;
106 119
 

+ 7
- 4
Modules/FDEM1D/src/EMEarth1D.cpp Ver fichero

@@ -231,7 +231,7 @@ namespace Lemma {
231 231
         if (Antenna->GetName() == std::string("PolygonalWireAntenna") || Antenna->GetName() == std::string("TEMTransmitter") ) {
232 232
             icalc += 1;
233 233
             // Check to see if they are all on a plane? If so we can do this fast
234
-            if (Antenna->IsHorizontallyPlanar() && HankelType == ANDERSON801) {
234
+            if (Antenna->IsHorizontallyPlanar() && 1==2 && ( HankelType == ANDERSON801 || HankelType== FHTKEY201  )) {
235 235
                 #ifdef HAVE_BOOST_PROGRESS
236 236
                 if (progressbar) {
237 237
                     disp = new boost::progress_display( Receivers->GetNumberOfPoints()*Antenna->GetNumberOfFrequencies() );
@@ -243,7 +243,12 @@ namespace Lemma {
243 243
                     #pragma omp parallel
244 244
                     {
245 245
                     #endif
246
-                    auto Hankel = FHTAnderson801::NewSP();
246
+                    //if (HankelType == ANDERSON801) {
247
+                        auto Hankel = FHTAnderson801::NewSP();
248
+                    //}
249
+                    //else if(HankelType == FHTKEY201) {
250
+                    //    auto Hankel = FHTKey201::NewSP();
251
+                    //}
247 252
                     #ifdef LEMMAUSEOMP
248 253
                     #pragma omp for schedule(static, 1)
249 254
                     #endif
@@ -797,9 +802,7 @@ namespace Lemma {
797 802
         //std::cout << Hankel->GetAnswer() << std::endl;
798 803
         //std::cout << Hankel->GetArg() << std::endl;
799 804
 
800
-
801 805
         // Sort the dipoles by rho
802
-
803 806
         for (int idip=0; idip<antenna->GetNumberOfDipoles(); ++idip) {
804 807
         //for (int idip=0; idip<1; ++idip) {
805 808
             auto tDipole = antenna->GetDipoleSource(idip);

+ 61
- 0
Modules/FDEM1D/src/FHTKey201.cpp Ver fichero

@@ -371,4 +371,65 @@ namespace Lemma {
371 371
         return ;
372 372
     }		// -----  end of method FHTKey201::ComputeRelated  -----
373 373
 
374
+    //--------------------------------------------------------------------------------------
375
+    //       Class:  FHTKey201
376
+    //      Method:  ComputeLaggedRelated
377
+    //--------------------------------------------------------------------------------------
378
+    void FHTKey201::ComputeLaggedRelated ( const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager ) {
379
+
380
+        int nrel = (int)(KernelManager->GetSTLVector().size());
381
+        Eigen::Matrix<Complex, 201, Eigen::Dynamic > Zwork;
382
+        Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(nlag, nrel);
383
+        Zwork.resize(201, nrel);
384
+        VectorXr lambda = WT201.col(0).array()/rho;
385
+        int NumFun = 0;
386
+        int idx = 0;
387
+
388
+        // Get Kernel values
389
+        for (int ir=0; ir<lambda.size(); ++ir) {
390
+            // irelated loop
391
+            ++NumFun;
392
+            KernelManager->ComputeReflectionCoeffs(lambda(ir), idx, rho);
393
+            for (int ir2=0; ir2<nrel; ++ir2) {
394
+                // Zwork* needed due to sign convention of filter weights
395
+ 			    Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
396
+            }
397
+
398
+        }
399
+
400
+        // We diverge slightly from Key here, each kernel is evaluated seperately, whereby instead
401
+        // they prefer to sum them. The reason is that all those terms have been removed from the kernels
402
+        // in the interests of making them as generic and reusable as possible. This approach requires slightly
403
+        // more multiplies, but the same number of kernel evaluations, which is the expensive part.
404
+        // Inner product and scale
405
+        for (int ir2=0; ir2<nrel; ++ir2) {
406
+            Zans(0, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
407
+        }
408
+
409
+        return ;
410
+    }		// -----  end of method FHTKey201::ComputeLaggedRelated  -----
411
+
412
+
413
+    //--------------------------------------------------------------------------------------
414
+    //       Class:  FHTKey201
415
+    //      Method:  GetABSER
416
+    //--------------------------------------------------------------------------------------
417
+    Real FHTKey201::GetABSER (  ) {
418
+        return WT201(1,0)/WT201(0,0);
419
+    }		// -----  end of method FHTKey201::GetABSER  -----
420
+
421
+
422
+    //--------------------------------------------------------------------------------------
423
+    //       Class:  FHTKey201
424
+    //      Method:  SetLaggedArg
425
+    //--------------------------------------------------------------------------------------
426
+    void FHTKey201::SetLaggedArg ( const Real& rho  ) {
427
+        for (int i=0; i<Zans.cols(); ++ i) {
428
+            Zans(0, i) = Complex( splineVecReal[i]->Interpolate(rho),
429
+                                  splineVecImag[i]->Interpolate(rho) );
430
+        }
431
+        return ;
432
+    }		// -----  end of method FHTKey201::SetLaggedArg  -----
433
+
434
+
374 435
 }		// -----  end of Lemma  name  -----

Loading…
Cancelar
Guardar