11 #ifndef TEST_INTERFACE_INCREMENT_H_ 12 #define TEST_INTERFACE_INCREMENT_H_ 18 #define BOOST_TEST_NO_MAIN 19 #define BOOST_TEST_ALTERNATIVE_INIT_API 21 #define BOOST_TEST_DYN_LINK 22 #include <boost/test/unit_test.hpp> 24 #include <boost/noncopyable.hpp> 25 #include <boost/scoped_ptr.hpp> 27 #include "eckit/config/LocalConfiguration.h" 34 #include "oops/util/DateTime.h" 35 #include "oops/util/dot_product.h" 53 return theIncrementFixture;
71 boost::scoped_ptr<util::DateTime>
time_;
80 Increment_ dx(Test_::resol(), Test_::ctlvars(),
Test_::time());
82 BOOST_CHECK_EQUAL(dx.norm(), 0.0);
91 Increment_ dx1(Test_::resol(), Test_::ctlvars(),
Test_::time());
93 BOOST_CHECK(dx1.norm() > 0.0);
96 BOOST_CHECK(dx2.norm() > 0.0);
100 BOOST_CHECK_EQUAL(dx2.norm(), 0.0);
109 Increment_ dx1(Test_::resol(), Test_::ctlvars(),
Test_::time());
111 Increment_ dx2(Test_::resol(), Test_::ctlvars(),
Test_::time());
115 double dot1 = dx1.norm();
116 BOOST_CHECK(dot1 > 0.0);
118 double dot2 = dx2.norm();
119 BOOST_CHECK(dot2 > 0.0);
122 double dot3 = dx2.norm();
123 BOOST_CHECK(dot3 > 0.0);
125 BOOST_CHECK(dot3 <= dot1 + dot2);
134 Increment_ dx1(Test_::resol(), Test_::ctlvars(),
Test_::time());
143 BOOST_CHECK_SMALL(dx2.norm(), 1
e-8);
152 Increment_ dx1(Test_::resol(), Test_::ctlvars(),
Test_::time());
154 Increment_ dx2(Test_::resol(), Test_::ctlvars(),
Test_::time());
158 double zz1 = dot_product(dx1, dx2);
159 double zz2 = dot_product(dx2, dx1);
161 BOOST_CHECK_EQUAL(zz1, zz2);
170 Increment_ dx(Test_::resol(), Test_::ctlvars(),
Test_::time());
172 BOOST_CHECK(dx.norm() > 0.0);
176 BOOST_CHECK_EQUAL(dx.norm(), 0.0);
185 Increment_ dx1(Test_::resol(), Test_::ctlvars(),
Test_::time());
196 BOOST_CHECK_SMALL(dx2.norm(), 1
e-8);
208 typedef eckit::LocalConfiguration LocalConf_;
218 const State_ xx(Test_::resol(), Test_::ctlvars(), confstate);
222 const Locations_ locs(configlocs);
229 Increment_ dx(Test_::resol(), Test_::ctlvars(),
Test_::time());
237 InterpolatorTraj_ traj;
238 GeoVaLs_ hofx(locs,
vars);
239 xx.getValues(locs,
vars, hofx, traj);
245 GeoVaLs_ Hdx(locs,
vars);
248 dx.getValuesTL(locs,
vars, Hdx, traj);
256 Htdg.getValuesAD(locs,
vars, dg, traj);
259 double zz1 = dot_product(Htdg, dx);
260 double zz2 = dot_product(dg, Hdx);
263 << zz1-zz2 << std::endl;
265 BOOST_CHECK(zz1 != 0.0);
266 BOOST_CHECK(zz2 != 0.0);
267 BOOST_CHECK_CLOSE(zz1, zz2,
tol);
280 boost::unit_test::test_suite * ts = BOOST_TEST_SUITE(
"interface/Increment");
282 ts->add(BOOST_TEST_CASE(&testIncrementConstructor<MODEL>));
283 ts->add(BOOST_TEST_CASE(&testIncrementCopyConstructor<MODEL>));
284 ts->add(BOOST_TEST_CASE(&testIncrementTriangle<MODEL>));
285 ts->add(BOOST_TEST_CASE(&testIncrementOpPlusEq<MODEL>));
286 ts->add(BOOST_TEST_CASE(&testIncrementDotProduct<MODEL>));
287 ts->add(BOOST_TEST_CASE(&testIncrementAxpy<MODEL>));
288 ts->add(BOOST_TEST_CASE(&testIncrementInterpAD<MODEL>));
290 boost::unit_test::framework::master_test_suite().add(ts);
298 #endif // TEST_INTERFACE_INCREMENT_H_ oops::Geometry< MODEL > Geometry_
boost::scoped_ptr< util::DateTime > time_
integer, parameter, public warning
void testIncrementInterpAD()
static const oops::Variables & ctlvars()
void register_tests() const
static const util::DateTime & time()
void testIncrementTriangle()
static const Geometry_ & resol()
Encapsulates the model state.
boost::scoped_ptr< Geometry_ > resol_
static const eckit::Configuration & config()
void testIncrementCopyConstructor()
real(fp), parameter, public e
void testIncrementOpPlusEq()
Increment Class: Difference between two states.
void testIncrementConstructor()
boost::scoped_ptr< oops::Variables > ctlvars_
static IncrementFixture< MODEL > & getInstance()
void testIncrementDotProduct()
std::string testid() const