| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Rapid Optimization Library (ROL) Package |
| 4 |
// |
| 5 |
// Copyright 2014 NTESS and the ROL contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
/*! \file example_01.cpp |
| 11 |
\brief Shows how to solve the stochastic Stefan-Boltzmann problem. |
| 12 |
*/ |
| 13 |
|
| 14 |
#include "Teuchos_Comm.hpp" |
| 15 |
#include "ROL_Stream.hpp" |
| 16 |
#include "Teuchos_GlobalMPISession.hpp" |
| 17 |
#include "Teuchos_XMLParameterListHelpers.hpp" |
| 18 |
|
| 19 |
#include "Tpetra_Core.hpp" |
| 20 |
#include "Tpetra_Version.hpp" |
| 21 |
|
| 22 |
#include <iostream> |
| 23 |
#include <algorithm> |
| 24 |
//#include <fenv.h> |
| 25 |
|
| 26 |
#include "ROL_Bounds.hpp" |
| 27 |
#include "ROL_Reduced_Objective_SimOpt.hpp" |
| 28 |
#include "ROL_MonteCarloGenerator.hpp" |
| 29 |
#include "ROL_OptimizationSolver.hpp" |
| 30 |
#include "ROL_TpetraTeuchosBatchManager.hpp" |
| 31 |
|
| 32 |
#include "../TOOLS/meshmanager.hpp" |
| 33 |
#include "../TOOLS/pdeconstraint.hpp" |
| 34 |
#include "../TOOLS/pdeobjective.hpp" |
| 35 |
#include "../TOOLS/pdevector.hpp" |
| 36 |
#include "../TOOLS/batchmanager.hpp" |
| 37 |
#include "pde_stoch_stefan_boltzmann.hpp" |
| 38 |
#include "obj_stoch_stefan_boltzmann.hpp" |
| 39 |
#include "mesh_stoch_stefan_boltzmann.hpp" |
| 40 |
|
| 41 |
typedef double RealT; |
| 42 |
|
| 43 |
template<class Real> |
| 44 |
Real random(const Teuchos::Comm<int> &comm, |
| 45 |
const Real a = -1, const Real b = 1) { |
| 46 |
Real val(0), u(0); |
| 47 |
if ( Teuchos::rank<int>(comm)==0 ) { |
| 48 |
u = static_cast<Real>(rand())/static_cast<Real>(RAND_MAX); |
| 49 |
val = (b-a)*u + a; |
| 50 |
} |
| 51 |
Teuchos::broadcast<int,Real>(comm,0,1,&val); |
| 52 |
return val; |
| 53 |
} |
| 54 |
|
| 55 |
int main(int argc, char *argv[]) { |
| 56 |
//feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); |
| 57 |
|
| 58 |
// This little trick lets us print to std::cout only if a (dummy) command-line argument is provided. |
| 59 |
int iprint = argc - 1; |
| 60 |
ROL::Ptr<std::ostream> outStream; |
| 61 |
ROL::nullstream bhs; // outputs nothing |
| 62 |
|
| 63 |
/*** Initialize communicator. ***/ |
| 64 |
Teuchos::GlobalMPISession mpiSession (&argc, &argv, &bhs); |
| 65 |
ROL::Ptr<const Teuchos::Comm<int> > comm |
| 66 |
= Tpetra::getDefaultComm(); |
| 67 |
ROL::Ptr<const Teuchos::Comm<int> > serial_comm |
| 68 |
= ROL::makePtr<Teuchos::SerialComm<int>>(); |
| 69 |
const int myRank = comm->getRank(); |
| 70 |
if ((iprint > 0) && (myRank == 0)) { |
| 71 |
outStream = ROL::makePtrFromRef(std::cout); |
| 72 |
} |
| 73 |
else { |
| 74 |
outStream = ROL::makePtrFromRef(bhs); |
| 75 |
} |
| 76 |
int errorFlag = 0; |
| 77 |
|
| 78 |
// *** Example body. |
| 79 |
try { |
| 80 |
|
| 81 |
/*** Read in XML input ***/ |
| 82 |
std::string filename = "input.xml"; |
| 83 |
Teuchos::RCP<Teuchos::ParameterList> parlist = Teuchos::rcp( new Teuchos::ParameterList() ); |
| 84 |
Teuchos::updateParametersFromXmlFile( filename, parlist.ptr() ); |
| 85 |
|
| 86 |
// Problem dimensions |
| 87 |
const int stochDim = 32, controlDim = 1; |
| 88 |
const RealT one(1); |
| 89 |
|
| 90 |
/*************************************************************************/ |
| 91 |
/***************** BUILD GOVERNING PDE ***********************************/ |
| 92 |
/*************************************************************************/ |
| 93 |
/*** Initialize main data structure. ***/ |
| 94 |
ROL::Ptr<MeshManager<RealT> > meshMgr |
| 95 |
= ROL::makePtr<MeshManager_BackwardFacingStepChannel<RealT>>(*parlist); |
| 96 |
// = ROL::makePtr<StochasticStefanBoltzmannMeshManager<RealT>>(*parlist); |
| 97 |
// Initialize Stefan-Boltzmann PDE. |
| 98 |
ROL::Ptr<StochasticStefanBoltzmannPDE<RealT> > pde |
| 99 |
= ROL::makePtr<StochasticStefanBoltzmannPDE<RealT>>(*parlist); |
| 100 |
ROL::Ptr<ROL::Constraint_SimOpt<RealT> > con |
| 101 |
= ROL::makePtr<PDE_Constraint<RealT>>(pde,meshMgr,serial_comm,*parlist,*outStream); |
| 102 |
// Cast the constraint and get the assembler. |
| 103 |
ROL::Ptr<PDE_Constraint<RealT> > pdecon |
| 104 |
= ROL::dynamicPtrCast<PDE_Constraint<RealT> >(con); |
| 105 |
ROL::Ptr<Assembler<RealT> > assembler = pdecon->getAssembler(); |
| 106 |
con->setSolveParameters(*parlist); |
| 107 |
|
| 108 |
/*************************************************************************/ |
| 109 |
/***************** BUILD VECTORS *****************************************/ |
| 110 |
/*************************************************************************/ |
| 111 |
ROL::Ptr<Tpetra::MultiVector<> > u_ptr = assembler->createStateVector(); |
| 112 |
ROL::Ptr<Tpetra::MultiVector<> > p_ptr = assembler->createStateVector(); |
| 113 |
ROL::Ptr<Tpetra::MultiVector<> > du_ptr = assembler->createStateVector(); |
| 114 |
u_ptr->randomize(); //u_ptr->putScalar(static_cast<RealT>(1)); |
| 115 |
p_ptr->randomize(); //p_ptr->putScalar(static_cast<RealT>(1)); |
| 116 |
du_ptr->randomize(); //du_ptr->putScalar(static_cast<RealT>(0)); |
| 117 |
ROL::Ptr<ROL::Vector<RealT> > up |
| 118 |
= ROL::makePtr<PDE_PrimalSimVector<RealT>>(u_ptr,pde,assembler); |
| 119 |
ROL::Ptr<ROL::Vector<RealT> > pp |
| 120 |
= ROL::makePtr<PDE_PrimalSimVector<RealT>>(p_ptr,pde,assembler); |
| 121 |
ROL::Ptr<ROL::Vector<RealT> > dup |
| 122 |
= ROL::makePtr<PDE_PrimalSimVector<RealT>>(du_ptr,pde,assembler); |
| 123 |
// Create residual vectors |
| 124 |
ROL::Ptr<Tpetra::MultiVector<> > r_ptr = assembler->createResidualVector(); |
| 125 |
r_ptr->randomize(); //r_ptr->putScalar(static_cast<RealT>(1)); |
| 126 |
ROL::Ptr<ROL::Vector<RealT> > rp |
| 127 |
= ROL::makePtr<PDE_DualSimVector<RealT>>(r_ptr,pde,assembler); |
| 128 |
// Create control vector and set to ones |
| 129 |
ROL::Ptr<std::vector<RealT> > z_ptr = ROL::makePtr<std::vector<RealT>>(controlDim); |
| 130 |
ROL::Ptr<std::vector<RealT> > dz_ptr = ROL::makePtr<std::vector<RealT>>(controlDim); |
| 131 |
ROL::Ptr<std::vector<RealT> > yz_ptr = ROL::makePtr<std::vector<RealT>>(controlDim); |
| 132 |
// Create control direction vector and set to random |
| 133 |
for (int i = 0; i < controlDim; ++i) { |
| 134 |
(*z_ptr)[i] = random<RealT>(*comm); |
| 135 |
(*dz_ptr)[i] = 1e-3*random<RealT>(*comm); |
| 136 |
(*yz_ptr)[i] = random<RealT>(*comm); |
| 137 |
} |
| 138 |
ROL::Ptr<ROL::Vector<RealT> > zp |
| 139 |
= ROL::makePtr<PDE_OptVector<RealT>>(ROL::makePtr<ROL::StdVector<RealT>>(z_ptr)); |
| 140 |
ROL::Ptr<ROL::Vector<RealT> > dzp |
| 141 |
= ROL::makePtr<PDE_OptVector<RealT>>(ROL::makePtr<ROL::StdVector<RealT>>(dz_ptr)); |
| 142 |
ROL::Ptr<ROL::Vector<RealT> > yzp |
| 143 |
= ROL::makePtr<PDE_OptVector<RealT>>(ROL::makePtr<ROL::StdVector<RealT>>(yz_ptr)); |
| 144 |
//ROL::Ptr<Tpetra::MultiVector<> > z_ptr = assembler->createControlVector(); |
| 145 |
//ROL::Ptr<Tpetra::MultiVector<> > dz_ptr = assembler->createControlVector(); |
| 146 |
//ROL::Ptr<Tpetra::MultiVector<> > yz_ptr = assembler->createControlVector(); |
| 147 |
//z_ptr->randomize(); z_ptr->putScalar(static_cast<RealT>(280)); |
| 148 |
//dz_ptr->randomize(); //dz_ptr->putScalar(static_cast<RealT>(0)); |
| 149 |
//yz_ptr->randomize(); //yz_ptr->putScalar(static_cast<RealT>(0)); |
| 150 |
//ROL::Ptr<ROL::TpetraMultiVector<RealT> > zpde |
| 151 |
// = ROL::makePtr<PDE_PrimalOptVector<RealT>>(z_ptr,pde,assembler); |
| 152 |
//ROL::Ptr<ROL::TpetraMultiVector<RealT> > dzpde |
| 153 |
// = ROL::makePtr<PDE_PrimalOptVector<RealT>>(dz_ptr,pde,assembler); |
| 154 |
//ROL::Ptr<ROL::TpetraMultiVector<RealT> > yzpde |
| 155 |
// = ROL::makePtr<PDE_PrimalOptVector<RealT>>(yz_ptr,pde,assembler); |
| 156 |
//ROL::Ptr<ROL::Vector<RealT> > zp = ROL::makePtr<PDE_OptVector<RealT>>(zpde); |
| 157 |
//ROL::Ptr<ROL::Vector<RealT> > dzp = ROL::makePtr<PDE_OptVector<RealT>>(dzpde); |
| 158 |
//ROL::Ptr<ROL::Vector<RealT> > yzp = ROL::makePtr<PDE_OptVector<RealT>>(yzpde); |
| 159 |
// Create ROL SimOpt vectors |
| 160 |
ROL::Vector_SimOpt<RealT> x(up,zp); |
| 161 |
ROL::Vector_SimOpt<RealT> d(dup,dzp); |
| 162 |
|
| 163 |
/*************************************************************************/ |
| 164 |
/***************** BUILD COST FUNCTIONAL *********************************/ |
| 165 |
/*************************************************************************/ |
| 166 |
std::vector<ROL::Ptr<QoI<RealT> > > qoi_vec(2,ROL::nullPtr); |
| 167 |
qoi_vec[0] = ROL::makePtr<QoI_StateCost<RealT>>(pde->getVolFE(),*parlist); |
| 168 |
//qoi_vec[1] = ROL::makePtr<QoI_ControlCost<RealT>>( |
| 169 |
// pde->getVolFE(),pde->getBdryFE(0),pde->getBdryCellLocIds(0),*parlist); |
| 170 |
qoi_vec[1] = ROL::makePtr<QoI_AdvectionCost<RealT>>(); |
| 171 |
ROL::Ptr<StochasticStefanBoltzmannStdObjective<RealT> > std_obj |
| 172 |
= ROL::makePtr<StochasticStefanBoltzmannStdObjective<RealT>>(*parlist); |
| 173 |
ROL::Ptr<ROL::Objective_SimOpt<RealT> > obj |
| 174 |
= ROL::makePtr<PDE_Objective<RealT>>(qoi_vec,std_obj,assembler); |
| 175 |
ROL::Ptr<ROL::Reduced_Objective_SimOpt<RealT> > objReduced |
| 176 |
= ROL::makePtr<ROL::Reduced_Objective_SimOpt<RealT>>(obj, con, up, zp, pp, true, false); |
| 177 |
|
| 178 |
/*************************************************************************/ |
| 179 |
/***************** BUILD BOUND CONSTRAINT ********************************/ |
| 180 |
/*************************************************************************/ |
| 181 |
RealT upper = parlist->sublist("Problem").get("Upper Advection Bound", 100.0); |
| 182 |
RealT lower = parlist->sublist("Problem").get("Lower Advection Bound",-100.0); |
| 183 |
ROL::Ptr<std::vector<RealT> > zlo_ptr = ROL::makePtr<std::vector<RealT>>(controlDim,lower); |
| 184 |
ROL::Ptr<std::vector<RealT> > zhi_ptr = ROL::makePtr<std::vector<RealT>>(controlDim,upper); |
| 185 |
ROL::Ptr<ROL::Vector<RealT> > zlop |
| 186 |
= ROL::makePtr<PDE_OptVector<RealT>>(ROL::makePtr<ROL::StdVector<RealT>>(zlo_ptr)); |
| 187 |
ROL::Ptr<ROL::Vector<RealT> > zhip |
| 188 |
= ROL::makePtr<PDE_OptVector<RealT>>(ROL::makePtr<ROL::StdVector<RealT>>(zhi_ptr)); |
| 189 |
//ROL::Ptr<Tpetra::MultiVector<> > zlo_ptr = assembler->createControlVector(); |
| 190 |
//ROL::Ptr<Tpetra::MultiVector<> > zhi_ptr = assembler->createControlVector(); |
| 191 |
//zlo_ptr->putScalar(static_cast<RealT>(280)); |
| 192 |
//zhi_ptr->putScalar(static_cast<RealT>(370)); |
| 193 |
//ROL::Ptr<ROL::TpetraMultiVector<RealT> > zlopde |
| 194 |
// = ROL::makePtr<PDE_PrimalOptVector<RealT>>(zlo_ptr,pde,assembler); |
| 195 |
//ROL::Ptr<ROL::TpetraMultiVector<RealT> > zhipde |
| 196 |
// = ROL::makePtr<PDE_PrimalOptVector<RealT>>(zhi_ptr,pde,assembler); |
| 197 |
//ROL::Ptr<ROL::Vector<RealT> > zlop = ROL::makePtr<PDE_OptVector<RealT>>(zlopde); |
| 198 |
//ROL::Ptr<ROL::Vector<RealT> > zhip = ROL::makePtr<PDE_OptVector<RealT>>(zhipde); |
| 199 |
ROL::Ptr<ROL::BoundConstraint<RealT> > bnd |
| 200 |
= ROL::makePtr<ROL::Bounds<RealT>>(zlop,zhip); |
| 201 |
|
| 202 |
/*************************************************************************/ |
| 203 |
/***************** BUILD SAMPLER *****************************************/ |
| 204 |
/*************************************************************************/ |
| 205 |
int nsamp = parlist->sublist("Problem").get("Number of Samples",100); |
| 206 |
std::vector<RealT> tmp = {-one,one}; |
| 207 |
std::vector<std::vector<RealT> > bounds(stochDim,tmp); |
| 208 |
ROL::Ptr<ROL::BatchManager<RealT> > bman |
| 209 |
= ROL::makePtr<PDE_OptVector_BatchManager<RealT>>(comm); |
| 210 |
ROL::Ptr<ROL::SampleGenerator<RealT> > sampler |
| 211 |
= ROL::makePtr<ROL::MonteCarloGenerator<RealT>>(nsamp,bounds,bman); |
| 212 |
|
| 213 |
/*************************************************************************/ |
| 214 |
/***************** BUILD STOCHASTIC PROBLEM ******************************/ |
| 215 |
/*************************************************************************/ |
| 216 |
ROL::OptimizationProblem<RealT> opt(objReduced,zp,bnd); |
| 217 |
parlist->sublist("SOL").set("Initial Statistic", one); |
| 218 |
opt.setStochasticObjective(*parlist,sampler); |
| 219 |
|
| 220 |
/*************************************************************************/ |
| 221 |
/***************** RUN VECTOR AND DERIVATIVE CHECKS **********************/ |
| 222 |
/*************************************************************************/ |
| 223 |
bool checkDeriv = parlist->sublist("Problem").get("Check Derivatives",false); |
| 224 |
if ( checkDeriv ) { |
| 225 |
up->checkVector(*pp,*dup,true,*outStream); |
| 226 |
zp->checkVector(*yzp,*dzp,true,*outStream); |
| 227 |
obj->checkGradient(x,d,true,*outStream); |
| 228 |
obj->checkHessVec(x,d,true,*outStream); |
| 229 |
con->checkApplyJacobian(x,d,*up,true,*outStream); |
| 230 |
con->checkApplyAdjointHessian(x,*dup,d,x,true,*outStream); |
| 231 |
con->checkAdjointConsistencyJacobian(*dup,d,x,true,*outStream); |
| 232 |
con->checkInverseJacobian_1(*up,*up,*up,*zp,true,*outStream); |
| 233 |
con->checkInverseAdjointJacobian_1(*up,*up,*up,*zp,true,*outStream); |
| 234 |
objReduced->checkGradient(*zp,*dzp,true,*outStream); |
| 235 |
objReduced->checkHessVec(*zp,*dzp,true,*outStream); |
| 236 |
opt.check(*outStream); |
| 237 |
} |
| 238 |
|
| 239 |
/*************************************************************************/ |
| 240 |
/***************** SOLVE OPTIMIZATION PROBLEM ****************************/ |
| 241 |
/*************************************************************************/ |
| 242 |
parlist->sublist("Step").set("Type","Trust Region"); |
| 243 |
ROL::OptimizationSolver<RealT> solver(opt,*parlist); |
| 244 |
(*z_ptr)[0] = parlist->sublist("Problem").get("Advection Magnitude",0.0); |
| 245 |
u_ptr->putScalar(450.0); |
| 246 |
std::clock_t timer = std::clock(); |
| 247 |
solver.solve(*outStream); |
| 248 |
*outStream << "Optimization time: " |
| 249 |
<< static_cast<RealT>(std::clock()-timer)/static_cast<RealT>(CLOCKS_PER_SEC) |
| 250 |
<< " seconds." << std::endl << std::endl; |
| 251 |
|
| 252 |
/*************************************************************************/ |
| 253 |
/***************** OUTPUT RESULTS ****************************************/ |
| 254 |
/*************************************************************************/ |
| 255 |
std::clock_t timer_print = std::clock(); |
| 256 |
assembler->printMeshData(*outStream); |
| 257 |
// Output control to file |
| 258 |
//pdecon->outputTpetraVector(z_ptr,"control.txt"); |
| 259 |
*outStream << std::endl << "Advection value: " << (*z_ptr)[0] << std::endl; |
| 260 |
// Output expected state and samples to file |
| 261 |
*outStream << std::endl << "Print Expected Value of State" << std::endl; |
| 262 |
up->zero(); pp->zero(); dup->zero(); |
| 263 |
RealT tol(1.e-8); |
| 264 |
ROL::Ptr<ROL::BatchManager<RealT> > bman_Eu |
| 265 |
= ROL::makePtr<ROL::TpetraTeuchosBatchManager<RealT>>(comm); |
| 266 |
std::vector<RealT> sample(stochDim); |
| 267 |
std::stringstream name_samp; |
| 268 |
name_samp << "samples_" << bman->batchID() << ".txt"; |
| 269 |
std::ofstream file_samp; |
| 270 |
file_samp.open(name_samp.str()); |
| 271 |
file_samp << std::scientific << std::setprecision(15); |
| 272 |
for (int i = 0; i < sampler->numMySamples(); ++i) { |
| 273 |
*outStream << "Sample i = " << i << std::endl; |
| 274 |
sample = sampler->getMyPoint(i); |
| 275 |
con->setParameter(sample); |
| 276 |
con->solve(*rp,*dup,*zp,tol); |
| 277 |
up->axpy(sampler->getMyWeight(i),*dup); |
| 278 |
for (int j = 0; j < stochDim; ++j) { |
| 279 |
file_samp << std::setw(25) << std::left << sample[j]; |
| 280 |
} |
| 281 |
file_samp << std::endl; |
| 282 |
} |
| 283 |
file_samp.close(); |
| 284 |
bman_Eu->sumAll(*up,*pp); |
| 285 |
pdecon->outputTpetraVector(p_ptr,"mean_state.txt"); |
| 286 |
// Build objective function distribution |
| 287 |
*outStream << std::endl << "Print Objective CDF" << std::endl; |
| 288 |
RealT val1(0), val2(0); |
| 289 |
int nsamp_dist = parlist->sublist("Problem").get("Number of Output Samples",100); |
| 290 |
ROL::Ptr<ROL::Objective_SimOpt<RealT> > stateCost |
| 291 |
= ROL::makePtr<IntegralObjective<RealT>>(qoi_vec[0],assembler); |
| 292 |
ROL::Ptr<ROL::Reduced_Objective_SimOpt<RealT> > redStateCost |
| 293 |
= ROL::makePtr<ROL::Reduced_Objective_SimOpt<RealT>>(stateCost, con, up, zp, pp, true, false); |
| 294 |
ROL::Ptr<ROL::Objective_SimOpt<RealT> > ctrlCost |
| 295 |
= ROL::makePtr<IntegralObjective<RealT>>(qoi_vec[1],assembler); |
| 296 |
ROL::Ptr<ROL::Reduced_Objective_SimOpt<RealT> > redCtrlCost |
| 297 |
= ROL::makePtr<ROL::Reduced_Objective_SimOpt<RealT>>(ctrlCost, con, up, zp, pp, true, false); |
| 298 |
ROL::Ptr<ROL::SampleGenerator<RealT> > sampler_dist |
| 299 |
= ROL::makePtr<ROL::MonteCarloGenerator<RealT>>(nsamp_dist,bounds,bman); |
| 300 |
std::stringstream name; |
| 301 |
name << "obj_samples_" << bman->batchID() << ".txt"; |
| 302 |
std::ofstream file; |
| 303 |
file.open(name.str()); |
| 304 |
file << std::scientific << std::setprecision(15); |
| 305 |
for (int i = 0; i < sampler_dist->numMySamples(); ++i) { |
| 306 |
sample = sampler_dist->getMyPoint(i); |
| 307 |
redStateCost->setParameter(sample); |
| 308 |
val1 = redStateCost->value(*zp,tol); |
| 309 |
redCtrlCost->setParameter(sample); |
| 310 |
val2 = redCtrlCost->value(*zp,tol); |
| 311 |
for (int j = 0; j < stochDim; ++j) { |
| 312 |
file << std::setw(25) << std::left << sample[j]; |
| 313 |
} |
| 314 |
file << std::setw(25) << std::left << val1; |
| 315 |
file << std::setw(25) << std::left << val2 << std::endl; |
| 316 |
} |
| 317 |
file.close(); |
| 318 |
*outStream << "Output time: " |
| 319 |
<< static_cast<RealT>(std::clock()-timer_print)/static_cast<RealT>(CLOCKS_PER_SEC) |
| 320 |
<< " seconds." << std::endl << std::endl; |
| 321 |
|
| 322 |
Teuchos::Array<RealT> res(1,0); |
| 323 |
con->solve(*rp,*up,*zp,tol); |
| 324 |
r_ptr->norm2(res.view(0,1)); |
| 325 |
|
| 326 |
/*************************************************************************/ |
| 327 |
/***************** CHECK RESIDUAL NORM ***********************************/ |
| 328 |
/*************************************************************************/ |
| 329 |
*outStream << "Residual Norm: " << res[0] << std::endl << std::endl; |
| 330 |
errorFlag += (res[0] > 1.e-6 ? 1 : 0); |
| 331 |
} |
| 332 |
catch (std::logic_error& err) { |
| 333 |
*outStream << err.what() << "\n"; |
| 334 |
errorFlag = -1000; |
| 335 |
}; // end try |
| 336 |
|
| 337 |
if (errorFlag != 0) |
| 338 |
std::cout << "End Result: TEST FAILED\n"; |
| 339 |
else |
| 340 |
std::cout << "End Result: TEST PASSED\n"; |
| 341 |
|
| 342 |
return 0; |
| 343 |
} |