1 #include "Epetra_ConfigDefs.h" 4 #include "Epetra_MpiComm.h" 6 #include "Epetra_SerialComm.h" 9 #include "NRL_ModelF.hpp" 11 #include "objectiveFunction.hpp" 14 int main(
int argc,
char *argv[]){
16 std::string xmlInFileName =
"";
17 std::string xmlExtraFileName =
"";
19 Teuchos::CommandLineProcessor clp(
false);
20 clp.setOption(
"xml-in-file",&xmlInFileName,
"The XML file to read into a parameter list");
21 clp.setOption(
"extra-file",&xmlExtraFileName,
"Extra XML file to read into a parameter list");
22 clp.setDocString(
"TO DO.");
24 Teuchos::CommandLineProcessor::EParseCommandLineReturn
25 parse_return = clp.parse(argc,argv);
26 if( parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
27 std::cout <<
"\nEnd Result: TEST FAILED" << std::endl;
32 MPI_Init(&argc, &argv);
33 Epetra_MpiComm Comm(MPI_COMM_WORLD);
35 Epetra_SerialComm Comm;
38 Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::rcp(
new Teuchos::ParameterList);
39 if(xmlInFileName.length()) {
40 Teuchos::updateParametersFromXmlFile(xmlInFileName, inoutArg(*paramList));
42 if(xmlExtraFileName.length()) {
43 Teuchos::updateParametersFromXmlFile(xmlExtraFileName, inoutArg(*paramList));
47 paramList->print(std::cout,2,
true,
true);
50 Teuchos::RCP<objectiveFunction<double>> obj = Teuchos::rcp(
new objectiveFunction<double>(Comm,*paramList));
55 int nvert = obj->interface->Mesh->face_type;
56 Epetra_SerialDenseVector x(nvert), y(nvert);
64 for (
unsigned int inode=0; inode<nvert; ++inode){
65 node = obj->interface->Mesh->faces_nodes[nvert*eglob+inode];
66 x(inode) = obj->interface->Mesh->nodes_coord[3*node+0];
67 y(inode) = obj->interface->Mesh->nodes_coord[3*node+1];
71 xmin = x(inode); xmax = x(inode);
72 ymin = y(inode); ymax = y(inode);
90 std::mt19937 G(time(NULL));
91 std::uniform_real_distribution<double>
u(xmin,xmax);
92 std::uniform_real_distribution<double> v(ymin,ymax);
94 std::cout << std::setw(width) <<
"cell" << std::setw(width) <<
"testx" << std::setw(width) <<
"testy" << std::setw(width) <<
"pnpoly" << std::setw(width) <<
"xi" << std::setw(width) <<
"eta" << std::setw(width) <<
"residual\n";
96 for (
unsigned int nmc=0;
nmc<nnmc; ++
nmc){
100 int result =
pnpoly(nvert,x,y,testx,testy);
107 double residual = 0.0;
109 residual = obj->inverse_isoparametric_mapping(testx, testy, x, y, xi, eta);
112 std::cout << std::setw(width) << eglob << std::setw(width) << testx << std::setw(width) << testy << std::setw(width) << result << std::setw(width) << xi << std::setw(width) << eta << std::setw(width) << residual <<
"\n";
int main(int argc, char *argv[])
int pnpoly(int &nvert, Epetra_SerialDenseVector &vertx, Epetra_SerialDenseVector &verty, double &testx, double &testy)