123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
-
-
-
-
-
-
- #include <LemmaCore>
-
-
- #include "EMSchur3D.h"
-
-
-
- #include "vtkRectilinearGridReader.h"
-
- using namespace Lemma;
-
- int main( int argc, char** argv ) {
-
- if (argc < 3) {
- std::cout << "EMSchur3D <rgrid.vtr> <1dmod> <source> " << std::endl;
- std::cout << "\trgrid.vtr - VTK Rectilinear grid file containing 3D conductivity structure.\n";
- exit( EXIT_SUCCESS );
- }
-
- #ifdef LEMMAUSEOMP
- std::cout << "Eigen is using OpenMP.\n";
- Eigen::initParallel();
- #endif
-
-
-
- auto vtr = vtkSmartPointer<vtkRectilinearGridReader>::New();
- vtr->SetFileName( argv[1] );
- if (!vtr->OpenVTKFile()) {
- std::cout << "Failed to open VTK file " << argv[1] << std::endl;
- return EXIT_FAILURE;
- }
- vtr->Update();
-
- auto gimp = RectilinearGridVTKImporter::NewSP();
- gimp->SetVTKInput( vtr->GetOutput() );
- gimp->ConvertGrid( 0, 0, 2150 );
-
-
-
- auto layeredEarth = LayeredEarthEM::DeSerialize( YAML::LoadFile(argv[2]) );
-
-
-
-
-
-
- auto AEMRead = AEMSurveyReader::NewSP();
- try{
- AEMRead->ReadASCIIAEMFile(argv[4]);
- } catch (std::exception& e) {
- std::cout << "Caught an error opening ASCII AEM file: ";
- std::cout << e.what() << std::endl;
- std::cout << "enter filename or 0 to exit programme\n";
- std::string inp;
- std::cin >> inp;
- if (inp != "0")
- AEMRead->ReadASCIIAEMFile( inp.c_str() );
- else exit(EXIT_FAILURE);
- }
-
-
-
-
-
- auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, SPARSEMAJOR>, Eigen::IncompleteLUT<Complex> > >::NewSP();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EM3D->SetRectilinearGrid( gimp->GetGrid() );
-
- EM3D->SetLayeredEarthEM( layeredEarth );
- EM3D->SetAEMSurvey( AEMRead->GetSurvey() );
- EM3D->LoadMeshToolsConductivityModel( argv[3] );
- EM3D->SetResFileName(argv[5]);
-
-
- EM3D->Solve();
-
- exit(EXIT_SUCCESS);
- }
|