15 #include <boost/scoped_ptr.hpp> 16 #include <boost/test/unit_test.hpp> 19 #include "eckit/config/LocalConfiguration.h" 26 #include "oops/util/DateTime.h" 43 boost::scoped_ptr<const eckit::LocalConfiguration>
file_;
44 boost::scoped_ptr<lorenz95::Resolution>
resol_;
46 boost::scoped_ptr<util::DateTime>
time_;
47 boost::scoped_ptr<oops::Variables>
vars_;
56 boost::scoped_ptr<lorenz95::IncrementL95>
58 BOOST_CHECK(dx.get() !=
NULL);
62 boost::scoped_ptr<lorenz95::IncrementL95>
64 boost::scoped_ptr<lorenz95::IncrementL95>
66 BOOST_CHECK(dx2.get() !=
NULL);
70 boost::scoped_ptr<lorenz95::IncrementL95>
73 BOOST_CHECK(dx2.get() !=
NULL);
77 util::DateTime tt(file_->getString(
"date"));
97 std::string filename(file_->getString(
"filename"));
98 std::ifstream inStream(filename.c_str());
99 if (!inStream.is_open()) {
100 BOOST_ERROR(
"diff functionality cannot be determined");
105 inStream >> resolInt;
109 std::vector<double> doubleVec(resolInt);
110 for (
int i = 0;
i < resolInt; ++
i) {
111 inStream >> doubleVec[
i];
115 for (
int i = 0;
i < resol_->npoints(); ++
i) {
116 BOOST_CHECK_CLOSE((dx.getField())[
i],
117 doubleVec[
i] - (doubleVec[
i] + (doubleVec[
i] * fact)),
123 util::DateTime tt(file_->getString(
"date"));
128 bool goodData =
false;
129 for (
int i = 0;
i < resol_->npoints() && goodData ==
false; ++
i) {
130 if ((dx.getField())[
i] != 0) {
136 BOOST_ERROR(
"unable to test zero method, since test data is already all zero");
140 for (
int i = 0;
i < resol_->npoints(); ++
i) {
141 BOOST_CHECK_EQUAL(dx.getField()[
i], 0);
147 util::DateTime tt(file_->getString(
"date"));
152 bool goodData =
false;
153 for (
int i = 0;
i < resol_->npoints() && goodData ==
false; ++
i) {
154 if (dx.getField()[
i] != 0) {
160 BOOST_ERROR(
"unable to test zero method, since test data is already all zero");
162 const std::string modified_date_string(
"2010-01-01T10:35:00Z");
163 const util::DateTime dtModified(modified_date_string);
166 for (
int i = 0;
i < resol_->npoints(); ++
i) {
167 BOOST_CHECK_EQUAL(dx.getField()[
i], 0);
170 BOOST_CHECK(dx.validTime().toString() != date_str_);
175 util::DateTime tt(file_->getString(
"date"));
187 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
188 BOOST_CHECK_EQUAL(dx1.getField()[
i], dx2.
getField()[
i]);
193 util::DateTime tt(file_->getString(
"date"));
204 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
205 BOOST_CHECK_EQUAL(dx1.getField()[
i], 2.0 * dx2.
getField()[
i]);
210 util::DateTime tt(file_->getString(
"date"));
221 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
222 BOOST_CHECK_EQUAL(dx1.getField()[
i], 0.0);
227 util::DateTime tt(file_->getString(
"date"));
232 std::vector<double> testData(dx.getField().resol());
233 for (
unsigned int ii = 0; ii < testData.size(); ++ii) {
234 testData.at(ii) = dx.getField()[ii];
240 for (
int ii = 0; ii < dx.getField().resol(); ++ii) {
241 BOOST_CHECK_EQUAL(dx.getField()[ii], testData.at(ii) * fact);
246 util::DateTime tt(file_->getString(
"date"));
256 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
262 util::DateTime tt(file_->getString(
"date"));
269 double dpwResult = dx1.dot_product_with(dx2);
272 double testResult = 0.0;
273 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
274 testResult += (dx1.getField()[
i] * dx2.
getField()[
i]);
277 BOOST_CHECK_EQUAL(dpwResult, testResult);
281 util::DateTime tt(file_->getString(
"date"));
288 dx1.schur_product_with(dx2);
292 for (
int i = 0;
i < dx1.getField().resol(); ++
i) {
298 util::DateTime tt(file_->getString(
"date"));
304 const std::string filename(file_->getString(
"filename"));
305 std::ifstream inStream(filename.c_str());
306 if (!inStream.is_open()) {
307 BOOST_ERROR(
"read functionality cannot be determined");
311 inStream >> resolInt;
316 std::vector<double> doubleVec(resolInt);
317 for (
int i = 0;
i < resolInt; ++
i) {
318 inStream >> doubleVec[
i];
322 for (
int i = 0;
i < resol_->npoints(); ++
i) {
323 BOOST_CHECK_EQUAL(dx.getField()[
i], doubleVec[
i]);
328 util::DateTime tt(file_->getString(
"date"));
340 BOOST_CHECK_EQUAL(dx.
validTime().toString(), date_str_);
383 BOOST_AUTO_TEST_SUITE_END()
l_size ! loop over number of fields ke do je do i
Increment Class: Difference between two states.
boost::scoped_ptr< const eckit::LocalConfiguration > file_
boost::scoped_ptr< lorenz95::Resolution > resol_
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************! this routine is used to retrieve scalar boundary data for symmetric domain. subroutine MPP_GET_BOUNDARY_2D_(field, domain, ebuffer, sbuffer, wbuffer, nbuffer, flags, &position, complete, tile_count) type(domain2D), intent(in) ::domain MPP_TYPE_, intent(in) ::field(:,:) MPP_TYPE_, intent(inout), optional ::ebuffer(:), sbuffer(:), wbuffer(:), nbuffer(:) integer, intent(in), optional ::flags, position, tile_count logical, intent(in), optional ::complete MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_, allocatable, dimension(:,:) ::ebuffer2D, sbuffer2D, wbuffer2D, nbuffer2D integer ::xcount, ycount integer ::ntile logical ::need_ebuffer, need_sbuffer, need_wbuffer, need_nbuffer integer(LONG_KIND), dimension(MAX_DOMAIN_FIELDS, MAX_TILES), save ::f_addrs=-9999 integer(LONG_KIND), dimension(4, MAX_DOMAIN_FIELDS, MAX_TILES), save ::b_addrs=-9999 integer, save ::bsize(4)=0, isize=0, jsize=0, ksize=0, pos, list=0, l_size=0, upflags integer ::buffer_size(4) integer ::max_ntile, tile, update_position, ishift, jshift logical ::do_update, is_complete, set_mismatch character(len=3) ::text MPP_TYPE_ ::d_type type(overlapSpec), pointer ::bound=> NULL() ntile
boost::scoped_ptr< oops::Variables > vars_
real(fp), parameter, public e
const FieldL95 & getField() const
Access to data.
boost::scoped_ptr< util::DateTime > time_
const int & resol() const
Set and get.
BOOST_AUTO_TEST_CASE(test_GomL95_constructor)
void read(const eckit::Configuration &)
Utilities.
static const eckit::Configuration & config()
void read(const eckit::Configuration &)
Utilities.
const util::DateTime & validTime() const