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 int main(
int argc,
char *argv[]){
21 std::string xmlInFileName =
"";
22 std::string extraXmlFile =
"";
23 std::string xmlOutFileName =
"paramList.out";
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));
47 paramList->print(std::cout,2,
true,
true);
51 std::string mesh_file = Teuchos::getParameter<std::string>(paramList->sublist(
"Shinozuka"),
"mesh_file");
52 mesh Mesh(Comm,mesh_file);
53 Epetra_Map StandardMap(-1,Mesh.n_local_nodes_without_ghosts,&Mesh.local_nodes_without_ghosts[0],0,Comm);
55 int order = Teuchos::getParameter<int>(paramList->sublist(
"Shinozuka"),
"order");
56 double L1 = Teuchos::getParameter<double>(paramList->sublist(
"Shinozuka"),
"lx");
57 double L2 = Teuchos::getParameter<double>(paramList->sublist(
"Shinozuka"),
"ly");
58 double L3 = Teuchos::getParameter<double>(paramList->sublist(
"Shinozuka"),
"lz");
60 for (
int real=0; real<32; ++real){
62 Teuchos::RCP<shinozuka> RandomField = Teuchos::rcp(
new shinozuka(order,L1,L2,L3));
64 Epetra_MultiVector V(StandardMap,5,
"true");
65 Epetra_MultiVector G(StandardMap,5,
"true");
67 RandomField->rng.seed(real);
68 for (
unsigned int i=0;
i<5; ++
i){
69 RandomField->generator(*V(
i),Mesh);
73 double deltaMk = 0.10;
75 double alpha = 3.0/(2.0*deltaN*deltaN);
double beta = 1.0;
76 RandomField->icdf_gamma(*V(0),*G(0),alpha,beta);
78 alpha = 3.0/(2.0*deltaN*deltaN) - 1.0/2.0;
79 RandomField->icdf_gamma(*V(1),*G(1),alpha,beta);
81 alpha = 1.0/(deltaMk*deltaMk); beta = 1.0*deltaMk*deltaMk;
82 RandomField->icdf_gamma(*V(3),*G(3),alpha,beta);
83 RandomField->icdf_gamma(*V(4),*G(4),alpha,beta);
88 std::string path =
"/Users/brian/Documents/GitHub/Trilinos_results/isotransrandomfield/";
89 int NumTargetElements = 0;
91 NumTargetElements = Mesh.n_nodes;
93 Epetra_Map MapOnRoot(-1,NumTargetElements,0,Comm);
94 Epetra_Export ExportOnRoot(StandardMap,MapOnRoot);
95 Epetra_MultiVector lhs_root(MapOnRoot,5,
true);
97 lhs_root.PutScalar(0.0);
98 lhs_root.Export(G,ExportOnRoot,Insert);
99 std::string
filename = path +
"shinozuka_translatedfield_deltaN_" + std::to_string(deltaN) +
"_deltaMk_" + std::to_string(deltaMk) +
"_real_" + std::to_string(real) +
".mtx";
100 int error = EpetraExt::MultiVectorToMatrixMarketFile(filename.c_str(),lhs_root,0,0,
false);
int main(int argc, char *argv[])