5 #include "Epetra_ConfigDefs.h" 8 #include "Epetra_MpiComm.h" 10 #include "Epetra_SerialComm.h" 13 #include "Teuchos_CommandLineProcessor.hpp" 14 #include "Teuchos_StandardCatchMacros.hpp" 15 #include "Teuchos_ParameterList.hpp" 16 #include "Teuchos_XMLParameterListCoreHelpers.hpp" 19 #include <boost/math/special_functions/gamma.hpp> 21 int main(
int argc,
char *argv[]){
23 std::string xmlInFileName =
"";
25 Teuchos::CommandLineProcessor clp(
false);
26 clp.setOption(
"xml-in-file",&xmlInFileName,
"The XML file to read into a parameter list");
27 clp.setDocString(
"TO DO.");
29 Teuchos::CommandLineProcessor::EParseCommandLineReturn
30 parse_return = clp.parse(argc,argv);
31 if( parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
32 std::cout <<
"\nEnd Result: TEST FAILED" << std::endl;
37 MPI_Init(&argc, &argv);
38 Epetra_MpiComm Comm(MPI_COMM_WORLD);
40 Epetra_SerialComm Comm;
43 Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::rcp(
new Teuchos::ParameterList);
44 if(xmlInFileName.length()) {
45 Teuchos::updateParametersFromXmlFile(xmlInFileName, inoutArg(*paramList));
49 paramList->print(std::cout,2,
true,
true);
52 Teuchos::RCP<neumannInnerSurface_StochasticPolyconvexHGO> my_interface =
55 std::ifstream parameters_file_1, parameters_file_2, parameters_file_3, parameters_file_4;
56 std::string path = Teuchos::getParameter<std::string>(paramList->sublist(
"Mesh"),
"path_to_gmrf");
57 parameters_file_1.open(path+
"w1.txt");
58 parameters_file_2.open(path+
"w2.txt");
59 parameters_file_3.open(path+
"w3.txt");
60 parameters_file_4.open(path+
"w4.txt");
62 unsigned int n_cells_p1_med = 297828;
63 unsigned int n_nodes_p1_med = 58464;
66 std::string path_p1 = Teuchos::getParameter<std::string>(paramList->sublist(
"Mesh"),
"path_to_p1_connectivity");
68 my_interface->get_media(n_cells_p1_med,n_nodes_p1_med,path_p1);
70 if (parameters_file_1.is_open() && parameters_file_2.is_open() && parameters_file_3.is_open() && parameters_file_4.is_open()){
72 for (
int i=0;
i<n_nodes_p1_med; ++
i){
73 parameters_file_1 >> my_interface->w1_gmrf(
i);
74 parameters_file_2 >> my_interface->w2_gmrf(
i);
75 parameters_file_3 >> my_interface->w3_gmrf(
i);
76 parameters_file_4 >> my_interface->w4_gmrf(
i);
78 Teuchos::RCP<newtonRaphson> Newton = Teuchos::rcp(
new newtonRaphson(*my_interface,*paramList));
79 Newton->setParameters(*paramList);
80 Newton->Initialization();
81 error = Newton->Solve_with_Aztec(
true);
83 std::string filename1 = path +
"/review/disp_realization" + std::to_string(
nmc) +
".mtx";
84 Newton->print_newton_solution(filename1);
85 std::string filename2 = path +
"/review/stress_realization" + std::to_string(
nmc);
86 my_interface->compute_center_cauchy_stress(*Newton->x,filename2);
90 std::cout <<
"Newton failed | realization nb. " <<
nmc <<
"\n";
95 parameters_file_1.close();
96 parameters_file_2.close();
97 parameters_file_3.close();
98 parameters_file_4.close();
101 std::cout <<
"Couldn't open one of the parameters_file.\n";
int main(int argc, char *argv[])