Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include <iostream>
00007
00008 #include "Albany_Utils.hpp"
00009 #include "Albany_SolverFactory.hpp"
00010 #include "Thyra_EpetraModelEvaluator.hpp"
00011 #include "Piro_PerformAnalysis.hpp"
00012 #include "Thyra_VectorBase.hpp"
00013 #include "Teuchos_GlobalMPISession.hpp"
00014 #include "Teuchos_TimeMonitor.hpp"
00015 #include "Teuchos_VerboseObject.hpp"
00016 #include "Teuchos_StandardCatchMacros.hpp"
00017
00018
00019 int main(int argc, char *argv[]) {
00020
00021 int status=0;
00022 bool success = true;
00023 Teuchos::GlobalMPISession mpiSession(&argc,&argv);
00024 Teuchos::RCP<Teuchos::FancyOStream> out(Teuchos::VerboseObjectBase::getDefaultOStream());
00025
00026
00027 char * xmlfilename=0;
00028 char defaultfile[20]={"inputAnalysis.xml"};
00029 if(argc>1){
00030 if(!strcmp(argv[1],"--help")){
00031 printf("albanyAnalysis [inputfile.xml]\n");
00032 exit(1);
00033 }
00034 else
00035 xmlfilename=argv[1];
00036 }
00037 else
00038 xmlfilename=defaultfile;
00039
00040
00041 try {
00042 Teuchos::RCP<Teuchos::Time> totalTime =
00043 Teuchos::TimeMonitor::getNewTimer("AlbanyAnalysis: ***Total Time***");
00044 Teuchos::TimeMonitor totalTimer(*totalTime);
00045
00046 using namespace std;
00047
00048 *out << "\nStarting Albany Analysis via Piro!" << std::endl;
00049
00050
00051
00052 Teuchos::RCP<Albany::SolverFactory> slvrfctry =
00053 Teuchos::rcp(new Albany::SolverFactory(xmlfilename, Albany_MPI_COMM_WORLD));
00054 Teuchos::RCP<Epetra_Comm> appComm = Albany::createEpetraCommFromMpiComm(Albany_MPI_COMM_WORLD);
00055 Teuchos::RCP<EpetraExt::ModelEvaluator> App = slvrfctry->create(appComm, appComm);
00056
00057
00058 Thyra::EpetraModelEvaluator appThyra;
00059 appThyra.initialize(App, Teuchos::null);
00060
00061 Teuchos::RCP< Thyra::VectorBase<double> > p;
00062
00063
00064 std::string analysisPackage = slvrfctry->getAnalysisParameters().get("Analysis Package","Solve");
00065 status = Piro::PerformAnalysis(appThyra, slvrfctry->getAnalysisParameters(), p);
00066
00067
00068
00069
00070
00071 status = slvrfctry->checkAnalysisTestResults(0, p);
00072
00073
00074 if (mpiSession.getRank()>0) status=0;
00075 else *out << "\nNumber of Failed Comparisons: " << status << std::endl;
00076 }
00077 TEUCHOS_STANDARD_CATCH_STATEMENTS(true, std::cerr, success);
00078 if (!success) status+=10000;
00079
00080 Teuchos::TimeMonitor::summarize(std::cout, false, true, false);
00081 return status;
00082 }