/* This file is part of Lemma, a geophysical modelling and inversion API. * More information is available at http://lemmasoftware.org */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * @file * @date 01/04/2018 04:34:54 PM * @version $Id$ * @author Trevor Irons (ti) * @email tirons@egi.utah.edu * @copyright Copyright (c) 2018, University of Utah * @copyright Copyright (c) 2018, Lemma Software, LLC */ #include //#include "RectilinearGridReader.h" //#include "AEMSurveyReader.h" #include "EMSchur3D.h" //#include "LayeredEarthEMReader.h" //#include "CSymSimplicialCholesky.h" using namespace Lemma; int main( int argc, char** argv ) { // BiCGSTAB Diagonal preconditioner auto EM3D = EMSchur3D< Eigen::BiCGSTAB > >::NewSP(); if (argc < 3) { std::cout << "EMSchur3D <1dmod> " << std::endl; exit( EXIT_SUCCESS ); } /////////////////////////////////////////////////// // Read in Grid auto GridRead = RectilinearGridReader::NewSP(); try { GridRead->ReadASCIIGridFile( argv[1] ); } catch (std::exception& e) { std::cout << "Caught an error opening ASCII Grid 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") GridRead->ReadASCIIGridFile( inp.c_str() ); else exit(EXIT_FAILURE); } ////////////////////////////////////////////////// // Read in Layered earth, for backgound model auto LayEarthRead = LayeredEarthEMReader::NewSP(); try { LayEarthRead->ReadASCIIInputFile( argv[2] ); } catch (std::exception& e) { std::cout << "Caught an error opening ASCII Layered Earth 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") GridRead->ReadASCIIGridFile( inp.c_str() ); else exit(EXIT_FAILURE); } ////////////////////////////////////////////////// // Read in source specification 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); } ////////////////////////////////////////////////// // And solve EM3D->SetRectilinearGrid( std::static_pointer_cast( GridRead->GetGrid() ) ); // UGLY! EM3D->SetLayeredEarthEM( LayEarthRead->GetLayeredEarth() ); EM3D->SetAEMSurvey( AEMRead->GetSurvey() ); EM3D->LoadMeshToolsConductivityModel( argv[3] ); EM3D->SetResFileName(argv[5]); //EM3D->SetCSolver( Lemma::SPARSELU ); // Lemma::BiCGSTAB ); EM3D->Solve(); exit(EXIT_SUCCESS); }