瀏覽代碼

Cleaned up debugging commands

lagkey
Trevor Irons 6 年之前
父節點
當前提交
e1bf50e95f
共有 3 個檔案被更改,包括 4 行新增48 行删除
  1. 3
    17
      Modules/FDEM1D/src/EMEarth1D.cpp
  2. 0
    3
      Modules/FDEM1D/src/FHTAnderson801.cpp
  3. 1
    28
      Modules/FDEM1D/src/FHTKey201.cpp

+ 3
- 17
Modules/FDEM1D/src/EMEarth1D.cpp 查看文件

@@ -779,41 +779,27 @@ namespace Lemma {
779 779
 
780 780
         // Determine number of lagged convolutions to do
781 781
         int nlag = 1; // (Key==0)  We need an extra for some reason for stability? Maybe in Spline?
782
-        Real lrho ( 1.01* rhomax );
782
+        Real lrho ( 1.0 * rhomax );
783 783
         while ( lrho > rhomin ) {
784 784
             nlag += 1;
785 785
             lrho *= Hankel->GetABSER();
786
-            //std::cout << "lrho\t" << lrho << std::endl;
787 786
         }
788
-        // Key variant
789
-//        Real lamMin = Filter.base(1)/rMax;
790
-//        Real lamMax = Filter.base(end)/rMin;
791
-//        auto nLambda = ceil(log(lamMax/lamMin)/log(filterSpacing))+1;
792
-        //nlag = 3;
793
-        //std::cout << "nlag\t" << nlag << std::endl;
794
-
795
-        //int nlag = rhomin
787
+
796 788
         auto tDipole = antenna->GetDipoleSource(0);
797 789
         tDipole->SetKernels(ifreq, FieldsToCalculate, Receivers, irec, Earth);
798 790
 
799 791
         // Instead we should pass the antenna into this so that Hankel hass all the rho arguments...
800
-        Hankel->ComputeLaggedRelated( 1.01* rhomax, nlag, tDipole->GetKernelManager() );
801
-
802
-        //std::cout << "After! " << Hankel->GetAnswer() << std::endl;
792
+        Hankel->ComputeLaggedRelated( 1.0*rhomax, nlag, tDipole->GetKernelManager() );
803 793
 
804 794
         // Sort the dipoles by rho
805 795
         for (int idip=0; idip<antenna->GetNumberOfDipoles(); ++idip) {
806
-        //for (int idip=0; idip<1; ++idip) {
807 796
             auto tDipole = antenna->GetDipoleSource(idip);
808 797
             tDipole->SetKernels(ifreq, FieldsToCalculate, Receivers, irec, Earth);
809 798
             // Pass Hankel2 a message here so it knows which one to return in Zgauss!
810 799
             Real rho = (Receivers->GetLocation(irec).head<2>() - tDipole->GetLocation().head<2>()).norm();
811
-            //std::cout << " in Lagged " <<  rho << "\t" << rhomin << "\t" << rhomax << std::endl;
812 800
             Hankel->SetLaggedArg( rho );
813 801
             tDipole->UpdateFields( ifreq,  Hankel, wavef );
814 802
         }
815
-        //std::cout << "Spline\n";
816
-        //std::cout << Receivers->GetHfield(0, irec) << std::endl;
817 803
     }
818 804
 
819 805
     //////////////////////////////////////////////////////////

+ 0
- 3
Modules/FDEM1D/src/FHTAnderson801.cpp 查看文件

@@ -949,9 +949,6 @@ namespace Lemma {
949 949
         DeleteSplines();
950 950
 
951 951
         // Now do cubic spline
952
-        // TODO Check that knots are set in right order, Eigen has reverse()
953
-        std::cout << "Arg\n" << Arg << std::endl;
954
-        std::cout << "Zans\n" << Zans << std::endl;
955 952
         for (int ii=0; ii<Zans.cols(); ++ii) {
956 953
             auto Spline = CubicSplineInterpolator::NewSP();
957 954
             Spline->SetKnots( Arg, Zans.col(ii).real() );

+ 1
- 28
Modules/FDEM1D/src/FHTKey201.cpp 查看文件

@@ -340,7 +340,6 @@ namespace Lemma {
340 340
         //kernelVec = KernelManager->GetSTLVector();
341 341
         int nrel = (int)(KernelManager->GetSTLVector().size());
342 342
         Eigen::Matrix<Complex, 201, Eigen::Dynamic > Zwork;
343
-        // TODO, if we want to allow lagged, then 1 below should be nlag
344 343
         Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(1, nrel);
345 344
         Zwork.resize(201, nrel);
346 345
         VectorXr lambda = WT201.col(0).array()/rho;
@@ -356,7 +355,6 @@ namespace Lemma {
356 355
                 // Zwork* needed due to sign convention of filter weights
357 356
  			    Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
358 357
             }
359
-
360 358
         }
361 359
 
362 360
         // We diverge slightly from Key here, each kernel is evaluated seperately, whereby instead
@@ -367,9 +365,6 @@ namespace Lemma {
367 365
         for (int ir2=0; ir2<nrel; ++ir2) {
368 366
             Zans(0, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
369 367
         }
370
-        std::cout << "rho\n" << rho << std::endl;
371
-        std::cout << "Zans\n" << Zans << std::endl;
372
-        exit(EXIT_SUCCESS);
373 368
         return ;
374 369
     }		// -----  end of method FHTKey201::ComputeRelated  -----
375 370
 
@@ -379,13 +374,9 @@ namespace Lemma {
379 374
     //--------------------------------------------------------------------------------------
380 375
     void FHTKey201::ComputeLaggedRelated ( const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager ) {
381 376
 
382
-        //std::cout << "rho max\t " << rho << std::endl;
383
-        //Real rho = 214.963;
384
-
385 377
         int nrel = (int)(KernelManager->GetSTLVector().size());
386 378
 
387 379
         Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic > Zwork;
388
-        //Eigen::Matrix<Complex, 201+nrel, Eigen::Dynamic > Zwork;
389 380
         Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(nlag, nrel);
390 381
         Zwork.resize(201+nlag, nrel);  // Zwork needs to be expanded to filter length + nlag
391 382
 
@@ -398,14 +389,11 @@ namespace Lemma {
398 389
         int NumFun = 0;
399 390
         int idx = 0;
400 391
 
401
-        //std::cout << lambda.transpose() << std::endl;
402
-
403 392
         VectorXr Arg(nlag);
404 393
         Arg(nlag-1) = rho;
405 394
         for (int ilag=nlag-2; ilag>=0; --ilag) {
406 395
             Arg(ilag) = Arg(ilag+1) * GetABSER();
407 396
         }
408
-        //std::cout << "Arg\t" << Arg << std::endl;
409 397
 
410 398
         // Get Kernel values
411 399
         for (int ir=0; ir<lambda.size(); ++ir) {
@@ -413,8 +401,6 @@ namespace Lemma {
413 401
             ++NumFun;
414 402
             KernelManager->ComputeReflectionCoeffs(lambda(ir), idx, rho);
415 403
             for (int ir2=0; ir2<nrel; ++ir2) {
416
-                // Zwork* needed due to sign convention of filter weights
417
- 			    //Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
418 404
  			    Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
419 405
             }
420 406
         }
@@ -424,32 +410,19 @@ namespace Lemma {
424 410
         // in the interests of making them as generic and reusable as possible. This approach requires slightly
425 411
         // more multiplies, but the same number of kernel evaluations, which is the expensive part.
426 412
         // Inner product and scale
427
-        int ilagr = nlag-1;
413
+        int ilagr = nlag-1; // Zwork is in opposite order from Arg
428 414
         for (int ilag=0; ilag<nlag; ++ilag) {
429 415
             for (int ir2=0; ir2<nrel; ++ir2) {
430
-                //Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
431
-                //Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1))/Arg(ilag);
432
-                // Segment
433
-                //std::cout << Zwork.col(ir2).segment(ilag,201).transpose() << std::endl;;
434
-                //WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1).segment(ilag,201);// / Arg(ilag);
435 416
                 Zans(ilagr, ir2) = Zwork.col(ir2).segment(ilag,201).dot( WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1) ) / Arg(ilagr);
436 417
             }
437 418
             ilagr -= 1;
438 419
         }
439
-        //std::cout << "Zans" << Zans << std::endl;
440
-        //exit(EXIT_SUCCESS);
441 420
 
442 421
         // make sure vectors are empty
443 422
         splineVecReal.clear();
444 423
         splineVecImag.clear();
445 424
 
446 425
         // Now do cubic spline
447
-        // TODO Check that knots are set in right order, Eigen has reverse()
448
-        //std::cout << "Arg\n" << Arg << std::endl;
449
-        //std::cout << "Arg.reverse()\n" << Arg.reverse() << std::endl;
450
-        //VectorXr Argr = Arg.reverse();
451
-        //std::cout << "Zans\n" << Zans << std::endl;
452
-        //exit(EXIT_SUCCESS);
453 426
         for (int ii=0; ii<Zans.cols(); ++ii) {
454 427
             auto SplineR = CubicSplineInterpolator::NewSP();
455 428
             SplineR->SetKnots( Arg, Zans.col(ii).real() );

Loading…
取消
儲存