50 #include "Teuchos_GlobalMPISession.hpp"
51 #include "Teuchos_Comm.hpp"
52 #include "Teuchos_DefaultComm.hpp"
53 #include "Teuchos_CommHelpers.hpp"
69 int main(
int argc,
char *argv[]) {
71 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
74 int iprint = argc - 1;
75 bool print = (iprint>0);
76 ROL::Ptr<std::ostream> outStream;
79 outStream = ROL::makePtrFromRef(std::cout);
81 outStream = ROL::makePtrFromRef(bhs);
95 ROL::Ptr<BurgersFEM<RealT> > fem
96 = ROL::makePtr<BurgersFEM<RealT>>(nx,nl,cH1,cL2);
97 fem->test_inverse_mass(*outStream);
98 fem->test_inverse_H1(*outStream);
103 ROL::Ptr<ROL::Constraint_SimOpt<RealT> > con
104 = ROL::makePtr<Constraint_BurgersControl<RealT>>(fem,hess);
109 ROL::Ptr<std::vector<RealT> > z_ptr
110 = ROL::makePtr<std::vector<RealT>>(nx+2, 0.0);
111 ROL::Ptr<ROL::Vector<RealT> > zp
112 = ROL::makePtr<PrimalControlVector>(z_ptr,fem);
114 ROL::Ptr<std::vector<RealT> > u_ptr
115 = ROL::makePtr<std::vector<RealT>>(nx, 1.0);
116 ROL::Ptr<ROL::Vector<RealT> > up
117 = ROL::makePtr<PrimalStateVector>(u_ptr,fem);
119 ROL::Ptr<std::vector<RealT> > c_ptr
120 = ROL::makePtr<std::vector<RealT>>(nx, 1.0);
121 ROL::Ptr<ROL::Vector<RealT> > cp
122 = ROL::makePtr<PrimalConstraintVector>(c_ptr,fem);
126 RealT tol = std::sqrt(ROL::ROL_EPSILON<RealT>());
127 con->solve(*cp,*up,*zp,tol);
128 RealT rnorm = cp->norm();
129 con->value(*cp,*up,*zp,tol);
130 RealT cnorm = cp->norm();
131 errorFlag += ((cnorm > tol) ? 1 : 0) + ((rnorm > tol) ? 1 : 0);
132 *outStream << std::scientific << std::setprecision(8);
133 *outStream <<
"\nTest SimOpt solve at feasible (u,z):\n";
134 *outStream <<
" Solver Residual = " << rnorm <<
"\n";
135 *outStream <<
" ||c(u,z)|| = " << cnorm;
136 *outStream <<
"\n\n";
138 catch (std::logic_error& err) {
139 *outStream << err.what() <<
"\n";
144 std::cout <<
"End Result: TEST FAILED\n";
146 std::cout <<
"End Result: TEST PASSED\n";
L2VectorPrimal< RealT > PrimalControlVector
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
H1VectorDual< RealT > DualStateVector
L2VectorDual< RealT > DualControlVector
H1VectorDual< RealT > PrimalConstraintVector
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])
H1VectorPrimal< RealT > PrimalStateVector
H1VectorPrimal< RealT > DualConstraintVector