Просмотр исходного кода

Compiles with Lemma 0.2, not tested yet

master
T-bone 6 лет назад
Родитель
Сommit
b6185dc902
3 измененных файлов: 39 добавлений и 47 удалений
  1. 2
    6
      examples/EMSchur3D.cpp
  2. 2
    2
      include/EMSchur3DBase.h
  3. 35
    39
      src/EMSchur3DBase.cpp

+ 2
- 6
examples/EMSchur3D.cpp Просмотреть файл

@@ -18,7 +18,7 @@
18 18
  */
19 19
 
20 20
 #include <LemmaCore>
21
-#include "RectilinearGridReader.h"
21
+//#include "RectilinearGridReader.h"
22 22
 //#include "AEMSurveyReader.h"
23 23
 #include "EMSchur3D.h"
24 24
 //#include "LayeredEarthEMReader.h"
@@ -84,19 +84,15 @@ int main( int argc, char** argv ) {
84 84
             else exit(EXIT_FAILURE);
85 85
 	    }
86 86
 
87
-
88
-    /*
89 87
     //////////////////////////////////////////////////
90 88
     // And solve
91
-    EM3D->SetRectilinearGrid(GridRead->GetGrid());
89
+    EM3D->SetRectilinearGrid( std::static_pointer_cast<RectilinearGrid>( GridRead->GetGrid() ) ); // UGLY!
92 90
     EM3D->SetLayeredEarthEM( LayEarthRead->GetLayeredEarth() );
93 91
     EM3D->SetAEMSurvey( AEMRead->GetSurvey() );
94 92
     EM3D->LoadMeshToolsConductivityModel( argv[3] );
95 93
     EM3D->SetResFileName(argv[5]);
96 94
     //EM3D->SetCSolver( Lemma::SPARSELU ); // Lemma::BiCGSTAB );
97 95
     EM3D->Solve();
98
-    */
99
-    std::cout << *EM3D;
100 96
 
101 97
     exit(EXIT_SUCCESS);
102 98
 }

+ 2
- 2
include/EMSchur3DBase.h Просмотреть файл

@@ -206,7 +206,7 @@ class EMSchur3DBase : public LemmaObject {
206 206
     /** Sets the RectilinearGrid to use
207 207
      *  @param[in] Grid is a pointer to the Grid to be used.
208 208
      */
209
-    //void SetAEMSurvey(AEMSurvey* Survey);
209
+    void SetAEMSurvey( std::shared_ptr<AEMSurvey> Survey);
210 210
 
211 211
     /** Sets the prefix for results files (.log and .vtr) the source fiducial is added as well
212 212
      */
@@ -351,7 +351,7 @@ class EMSchur3DBase : public LemmaObject {
351 351
     //std::shared_ptr<RectilinearGridVTKExporter>         VTKGridExporter;
352 352
 
353 353
     /** Class containing information about the AEM survey */
354
-    //AEMSurvey*                      Survey;
354
+    std::shared_ptr<AEMSurvey>                          Survey;
355 355
 
356 356
     std::shared_ptr<LayeredEarthEM>                     LayModel;
357 357
 

+ 35
- 39
src/EMSchur3DBase.cpp Просмотреть файл

@@ -1463,45 +1463,41 @@ namespace Lemma {
1463 1463
         return ;
1464 1464
     }
1465 1465
 
1466
-//     //--------------------------------------------------------------------------------------
1467
-//     //       Class:  EMSchur3DBase
1468
-//     //      Method:  SetAEMSurvey
1469
-//     //--------------------------------------------------------------------------------------
1470
-//     void EMSchur3DBase::SetAEMSurvey ( AEMSurvey* SurveyIn ) {
1471
-//         if (Survey) Survey->DetachFrom(this);
1472
-//         Survey = SurveyIn;
1473
-//         Survey->AttachTo(this);
1474
-//
1475
-//         // OK determine how many frequencies we are dealing with
1476
-//         Omegas = 2.*PI*Survey->GetFrequencies();
1477
-//
1478
-//         return ;
1479
-//     }		// -----  end of method EMSchur3DBase::SetAEMSurvey  -----// -----  end of method EMSchur3DBase::LoadMeshToolsConductivityModel  -----
1466
+    //--------------------------------------------------------------------------------------
1467
+    //       Class:  EMSchur3DBase
1468
+    //      Method:  SetAEMSurvey
1469
+    //--------------------------------------------------------------------------------------
1470
+    void EMSchur3DBase::SetAEMSurvey ( std::shared_ptr<AEMSurvey> SurveyIn ) {
1471
+        Survey = SurveyIn;
1472
+        // determine how many frequencies we are dealing with
1473
+        Omegas = 2.*PI*Survey->GetFrequencies();
1474
+        return ;
1475
+    }		// -----  end of method EMSchur3DBase::SetAEMSurvey  -----// -----  end of method EMSchur3DBase::LoadMeshToolsConductivityModel  -----
1480 1476
 
1481
-//     //--------------------------------------------------------------------------------------
1482
-//     //       Class:  EMSchur3DBase
1483
-//     //      Method:  Solve
1484
-//     //--------------------------------------------------------------------------------------
1485
-//     void EMSchur3DBase::Solve (  ) {
1486
-//
1487
-//         // TODO, these should throw exceptions for a GUI to catch
1488
-//         if (!LayModel or !Survey or !Grid or !sigma) {
1489
-//             std::cerr << "You need to set something. EMSChur3D::Solve()";
1490
-//             exit(EXIT_FAILURE);
1491
-//         }
1492
-//
1493
-//         //BuildD(); // strangely necessary, bug, track down.
1494
-//         Setup();
1495
-//
1496
-//         std::cout << "Entering parallel solve" << std::endl;
1497
-//         #ifdef LEMMAUSEOMP
1498
-//         #pragma omp parallel for schedule(static,1)
1499
-//         #endif
1500
-//         for (int isource=0; isource<Survey->GetNumberOfSources(); ++isource) {
1501
-//             SolveSource(Survey->GetSource(isource), isource);
1502
-//         }
1503
-//
1504
-//         return ;
1505
-//     }		// -----  end of method EMSchur3DBase::Solve  -----
1477
+    //--------------------------------------------------------------------------------------
1478
+    //       Class:  EMSchur3DBase
1479
+    //      Method:  Solve
1480
+    //--------------------------------------------------------------------------------------
1481
+    void EMSchur3DBase::Solve (  ) {
1482
+
1483
+        // TODO, these should throw exceptions for a GUI to catch
1484
+        if (!LayModel or !Survey or !Grid or !sigma) {
1485
+            std::cerr << "You need to set something. EMSChur3D::Solve()";
1486
+            exit(EXIT_FAILURE);
1487
+        }
1488
+
1489
+        //BuildD(); // strangely necessary, bug, track down.
1490
+        Setup();
1491
+
1492
+        std::cout << "Entering parallel solve" << std::endl;
1493
+        #ifdef LEMMAUSEOMP
1494
+        #pragma omp parallel for schedule(static,1)
1495
+        #endif
1496
+        for (int isource=0; isource<Survey->GetNumberOfSources(); ++isource) {
1497
+            SolveSource(Survey->GetSource(isource), isource);
1498
+        }
1499
+
1500
+        return ;
1501
+    }		// -----  end of method EMSchur3DBase::Solve  -----
1506 1502
 
1507 1503
 }		// -----  end of Lemma  name  -----

Загрузка…
Отмена
Сохранить