Trilinos based (stochastic) FEM solvers
main.cpp
Go to the documentation of this file.
1 /*
2 Brian Staber (brian.staber@gmail.com)
3 */
4 
5 #include "Epetra_ConfigDefs.h"
6 #ifdef HAVE_MPI
7 #include "mpi.h"
8 #include "Epetra_MpiComm.h"
9 #else
10 #include "Epetra_SerialComm.h"
11 #endif
12 
13 #include "manufacturedSolution.hpp"
14 #include "Teuchos_RCP.hpp"
15 #include "Teuchos_ParameterList.hpp"
16 #include "Teuchos_StandardCatchMacros.hpp"
17 #include "Teuchos_CommandLineProcessor.hpp"
18 #include "Teuchos_XMLParameterListCoreHelpers.hpp"
19 
20 int main(int argc, char *argv[]){
21 
22  std::string xmlInFileName = "";
23 
24  Teuchos::CommandLineProcessor clp(false);
25  clp.setOption("xml-in-file",&xmlInFileName,"The XML file to read into a parameter list");
26  clp.setDocString("TO DO.");
27 
28  Teuchos::CommandLineProcessor::EParseCommandLineReturn
29  parse_return = clp.parse(argc,argv);
30  if( parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
31  std::cout << "\nEnd Result: TEST FAILED" << std::endl;
32  return parse_return;
33  }
34 
35 #ifdef HAVE_MPI
36 MPI_Init(&argc, &argv);
37  Epetra_MpiComm Comm(MPI_COMM_WORLD);
38 #else
39  Epetra_SerialComm Comm;
40 #endif
41 
42  Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::rcp(new Teuchos::ParameterList);
43  if(xmlInFileName.length()) {
44  Teuchos::updateParametersFromXmlFile(xmlInFileName, inoutArg(*paramList));
45  }
46 
47  if (Comm.MyPID()==0){
48  paramList->print(std::cout,2,true,true);
49  }
50  for (unsigned int i=0; i<5; ++i){
51  std::string inputPath = "/Users/brian/Documents/GitHub/Trilinos/cee530/mesh/manufactured" + std::to_string(i) + ".msh";
52  std::string outputPath = "/Users/brian/Documents/GitHub/Trilinos_results/cee530/manufactured/manufactured" + std::to_string(i) + ".mtx";
53  Teuchos::RCP<manufactured> interface = Teuchos::rcp(new manufactured(Comm,*paramList,inputPath));
54  double errorL2 = interface->solve(outputPath);
55  if (Comm.MyPID()==0){
56  std::cout << errorL2 << "\n";
57  }
58  }
59 
60 #ifdef HAVE_MPI
61  MPI_Finalize();
62 #endif
63 return 0;
64 
65 }
int main(int argc, char *argv[])
Definition: main.cpp:23
for i
Definition: costFunction.m:38