Skip to content

Commit

Permalink
Merge branch 'hotfix/0.24.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Apr 6, 2021
2 parents 071bbb1 + 0a7d6ef commit 36772b5
Show file tree
Hide file tree
Showing 51 changed files with 245 additions and 128 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## [Unreleased]

## [0.24.1] - 2021-04-06
### Fixed
- Periodic halo for HEALPix mesh
- General warnings and suggestions by DeepCode bot
- Compilation problems with clang 3.8


## [0.24.0] - 2021-03-19
### Fixed
- Fixed hang in band distribution for L160000x8000 grid
Expand Down Expand Up @@ -273,6 +280,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
## 0.13.0 - 2018-02-16

[Unreleased]: https://github.com/ecmwf/atlas/compare/master...develop
[0.24.1]: https://github.com/ecmwf/atlas/compare/0.24.0...0.24.1
[0.24.0]: https://github.com/ecmwf/atlas/compare/0.23.0...0.24.0
[0.23.0]: https://github.com/ecmwf/atlas/compare/0.22.1...0.23.0
[0.22.1]: https://github.com/ecmwf/atlas/compare/0.22.0...0.22.1
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Atlas
[![travis master](https://img.shields.io/travis/ecmwf/atlas/master.svg?label=master&logo=travis)](http://travis-ci.org/ecmwf/atlas "master")
[![travis develop](https://img.shields.io/travis/ecmwf/atlas/develop.svg?label=develop&logo=travis)](http://travis-ci.org/ecmwf/atlas "develop")
[![codecov](https://codecov.io/gh/ecmwf/atlas/branch/develop/graph/badge.svg)](https://codecov.io/gh/ecmwf/atlas)
[![deepcode](https://www.deepcode.ai/api/gh/badge?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF0Zm9ybTEiOiJnaCIsIm93bmVyMSI6ImVjbXdmIiwicmVwbzEiOiJhdGxhcyIsImluY2x1ZGVMaW50IjpmYWxzZSwiYXV0aG9ySWQiOjI4NzA4LCJpYXQiOjE2MTc3MDk0NjR9.dzPznp_XHjk1qD3h--C0wFBJg0EA_dYYtFQWPS69p8k)](https://www.deepcode.ai/app/gh/ecmwf/atlas/_/dashboard?utm_content=gh%2Fecmwf%2Fatlas)

Project home: https://confluence.ecmwf.int/display/ATLAS
Contact: Willem Deconinck ([email protected])
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.24.0
0.24.1
2 changes: 1 addition & 1 deletion src/apps/atlas-meshgen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int Meshgen2Gmsh::execute( const Args& args ) {
catch ( eckit::Exception& e ) {
Log::error() << e.what() << std::endl;
Log::error() << e.callStack() << std::endl;
throw e;
throw;
}

if ( grid.projection().units() == "degrees" ) {
Expand Down
12 changes: 6 additions & 6 deletions src/atlas/domain/detail/Domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ const Domain* atlas__Domain__ctor_config( const eckit::Parametrisation* config )
void atlas__Domain__type( const Domain* This, char*& type, int& size ) {
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_Domain" );
std::string s = This->type();
size = static_cast<int>( s.size() + 1 );
type = new char[size];
strcpy( type, s.c_str() );
size = static_cast<int>( s.size() );
type = new char[size + 1];
std::strncpy( type, s.c_str(), size + 1 );
}
void atlas__Domain__hash( const Domain* This, char*& hash, int& size ) {
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_Domain" );
eckit::MD5 md5;
This->hash( md5 );
std::string s = md5.digest();
size = static_cast<int>( s.size() + 1 );
hash = new char[size];
strcpy( hash, s.c_str() );
size = static_cast<int>( s.size() );
hash = new char[size + 1 ];
std::strncpy( hash, s.c_str(), size + 1 );
}
Domain::Spec* atlas__Domain__spec( const Domain* This ) {
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_Domain" );
Expand Down
5 changes: 4 additions & 1 deletion src/atlas/domain/detail/RectangularDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class RectangularDomain : public Domain {
virtual bool global() const override { return global_; }
bool zonal_band() const { return is_zonal_band( {xmin_, xmax_}, units_ ); }

virtual bool empty() const override { return ( xmin_ == xmax_ ) or ( ymin_ == ymax_ ); }
virtual bool empty() const override {
// deepcode ignore FloatingPointEquals: We want exact comparison
return ( xmin_ == xmax_ ) or ( ymin_ == ymax_ );
}

virtual Spec spec() const override;

Expand Down
2 changes: 2 additions & 0 deletions src/atlas/field/FieldCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* nor does it submit to any jurisdiction.
*/

// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end

#include "atlas/field/FieldCreator.h"

#include <map>
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/field/State.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* nor does it submit to any jurisdiction.
*/

// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end

#include "atlas/field/State.h"

#include <iomanip>
Expand Down
6 changes: 3 additions & 3 deletions src/atlas/field/detail/FieldInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ const char* atlas__Field__name( FieldImpl* This ) {
void atlas__Field__datatype( FieldImpl* This, char*& datatype, int& size, int& allocated ) {
ATLAS_ASSERT( This != nullptr, "Cannot access datatype of uninitialised atlas_Field" );
std::string s = This->datatype().str();
size = s.size() + 1;
datatype = new char[size];
strcpy( datatype, s.c_str() );
size = static_cast<int>( s.size() );
datatype = new char[size + 1];
std::strncpy( datatype, s.c_str(), size + 1 );
allocated = true;
}

Expand Down
8 changes: 4 additions & 4 deletions src/atlas/functionspace/CellColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,10 @@ void atlas__fs__CellColumns__checksum_fieldset( const CellColumns* This, const f
ATLAS_ASSERT( This );
ATLAS_ASSERT( fieldset );
std::string checksum_str( This->checksum( fieldset ) );
size = checksum_str.size();
size = static_cast<int>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}

// -----------------------------------------------------------------------------------
Expand All @@ -754,10 +754,10 @@ void atlas__fs__CellColumns__checksum_field( const CellColumns* This, const fiel
ATLAS_ASSERT( This );
ATLAS_ASSERT( field );
std::string checksum_str( This->checksum( field ) );
size = checksum_str.size();
size = static_cast<int>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/atlas/functionspace/EdgeColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,10 @@ void atlas__fs__EdgeColumns__checksum_fieldset( const EdgeColumns* This, const f
ATLAS_ASSERT( This );
ATLAS_ASSERT( fieldset );
std::string checksum_str( This->checksum( fieldset ) );
size = checksum_str.size();
size = static_cast<int>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}

// -----------------------------------------------------------------------------------
Expand All @@ -753,10 +753,10 @@ void atlas__fs__EdgeColumns__checksum_field( const EdgeColumns* This, const fiel
ATLAS_ASSERT( This );
ATLAS_ASSERT( field );
std::string checksum_str( This->checksum( field ) );
size = checksum_str.size();
size = static_cast<int>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/atlas/functionspace/detail/FunctionSpaceInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ void atlas__FunctionSpace__delete( FunctionSpaceImpl* This ) {
void atlas__FunctionSpace__name( const FunctionSpaceImpl* This, char*& name, int& size ) {
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_FunctionSpace" );
std::string s = This->type();
size = static_cast<int>( s.size() + 1 );
name = new char[size];
strcpy( name, s.c_str() );
size = static_cast<int>( s.size() );
name = new char[size + 1];
std::strncpy( name, s.c_str(), size + 1 );
}

field::FieldImpl* atlas__FunctionSpace__create_field( const FunctionSpaceImpl* This,
Expand Down
8 changes: 4 additions & 4 deletions src/atlas/functionspace/detail/NodeColumnsInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ void atlas__NodesFunctionSpace__checksum_fieldset( const NodeColumns* This, cons
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_functionspace_NodeColumns" );
ATLAS_ASSERT( fieldset != nullptr, "Cannot access uninitialised atlas_FieldSet" );
std::string checksum_str( This->checksum( fieldset ) );
size = checksum_str.size();
size = static_cast<int>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}

void atlas__NodesFunctionSpace__checksum_field( const NodeColumns* This, const field::FieldImpl* field, char*& checksum,
int& size, int& allocated ) {
ATLAS_ASSERT( This != nullptr, "Cannot access uninitialised atlas_functionspace_NodeColumns" );
ATLAS_ASSERT( field != nullptr, "Cannot access uninitialised atlas_Field" );
std::string checksum_str( This->checksum( field ) );
size = checksum_str.size();
size = static_cast<int>(checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}

void atlas__NodesFunctionSpace__sum_double( const NodeColumns* This, const field::FieldImpl* field, double& sum,
Expand Down
4 changes: 2 additions & 2 deletions src/atlas/functionspace/detail/StructuredColumnsInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void atlas__fs__StructuredColumns__checksum_fieldset( const detail::StructuredCo
size = static_cast<idx_t>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1);
}

void atlas__fs__StructuredColumns__checksum_field( const detail::StructuredColumns* This, const field::FieldImpl* field,
Expand All @@ -131,7 +131,7 @@ void atlas__fs__StructuredColumns__checksum_field( const detail::StructuredColum
size = static_cast<idx_t>( checksum_str.size() );
checksum = new char[size + 1];
allocated = true;
strcpy( checksum, checksum_str.c_str() );
std::strncpy( checksum, checksum_str.c_str(), size + 1 );
}

void atlas__fs__StructuredColumns__index_host( const detail::StructuredColumns* This, idx_t*& data, idx_t& i_min,
Expand Down
4 changes: 3 additions & 1 deletion src/atlas/grid/StructuredPartitionPolygon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* nor does it submit to any jurisdiction.
*/

// file deepcode ignore MissingOpenCheckOnFile: False positive

#include "atlas/grid/StructuredPartitionPolygon.h"

#include <fstream>
Expand Down Expand Up @@ -339,7 +341,7 @@ void StructuredPartitionPolygon::outputPythonScript( const eckit::PathName& file
// clang-format off
if ( mpi_rank == r ) {
std::ofstream f( filepath.asString().c_str(), mpi_rank == 0 ? std::ios::trunc : std::ios::app );

ATLAS_ASSERT( f.is_open() );
if ( mpi_rank == 0 ) {
f << "\n" "import sys"
"\n"
Expand Down
6 changes: 3 additions & 3 deletions src/atlas/grid/detail/grid/Grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ void atlas__grid__Grid__uid( const Grid* This, char*& uid, int& size ) {
eckit::MD5 md5;
This->hash( md5 );
std::string s = This->uid();
size = static_cast<int>( s.size() + 1 );
uid = new char[size];
strcpy( uid, s.c_str() );
size = static_cast<int>( s.size() );
uid = new char[size + 1];
std::strncpy( uid, s.c_str(), size + 1 );
}

Grid::Domain::Implementation* atlas__grid__Grid__lonlat_bounding_box( const Grid* This ) {
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/grid/detail/grid/GridBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* nor does it submit to any jurisdiction.
*/

// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end

#include "GridBuilder.h"

#include <regex.h>
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/grid/detail/partitioner/Partitioner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* nor does it submit to any jurisdiction.
*/

// file deepcode ignore CppMemoryLeak: static pointers for global registry are OK and will be cleaned up at end

#include "atlas/grid/detail/partitioner/Partitioner.h"

#include <map>
Expand Down
1 change: 1 addition & 0 deletions src/atlas/grid/detail/spacing/LinearSpacing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void LinearSpacing::setup( double start, double end, long N, bool endpoint ) {

double step;
volatile double _N = N; // volatile keyword prevents agressive optimization by Cray compiler
// deepcode ignore FloatingPointEquals: Expect possible bit-identical start and end
if ( start == end ) {
step = 0.;
}
Expand Down
12 changes: 6 additions & 6 deletions src/atlas/io/Exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ NotDecodable::NotDecodable( const std::string& type_name ) :

//---------------------------------------------------------------------------------------------------------------------

Exception::~Exception() {}
NotEncodable::~NotEncodable() {}
NotDecodable::~NotDecodable() {}
InvalidRecord::~InvalidRecord() {}
DataCorruption::~DataCorruption() {}
WriteError::~WriteError() {}
Exception::~Exception() = default;
NotEncodable::~NotEncodable() = default;
NotDecodable::~NotDecodable() = default;
InvalidRecord::~InvalidRecord() = default;
DataCorruption::~DataCorruption() = default;
WriteError::~WriteError() = default;

//---------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/atlas/io/Record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ std::string Record::URI::str() const {

Record::Record() : record_( new ParsedRecord() ) {}

Record::Record( const Record& other ) : record_( other.record_ ) {}
Record::Record( const Record& other ) = default;

//---------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/atlas/io/Stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Stream::Stream( eckit::DataHandle* datahandle ) : shared_( datahandle ), ptr_( s

Stream::Stream( std::shared_ptr<eckit::DataHandle> datahandle ) : shared_( datahandle ), ptr_( shared_.get() ) {}

Stream::Stream( const Stream& other ) : shared_( other.shared_ ), ptr_( other.ptr_ ) {}
Stream::Stream( const Stream& other ) = default;

eckit::DataHandle& Stream::datahandle() {
ATLAS_ASSERT( ptr_ != nullptr );
Expand Down
3 changes: 2 additions & 1 deletion src/atlas/io/detail/Base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ std::string Base64::encode( const void* data, size_t len ) {

size_t out_len = 4 * ( ( len + 2 ) / 3 ); /* 3-byte blocks to 4-byte */

if ( out_len < len )
if ( out_len < len ) {
return std::string(); /* integer overflow */
}

std::string str;
str.resize( out_len );
Expand Down
13 changes: 12 additions & 1 deletion src/atlas/io/detail/StaticAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
*/

#pragma once
#ifndef __clang_analyzer__

#ifndef ATLAS_IO_STATIC_ASSERT
#if defined(__clang_analyzer__)
#define ATLAS_IO_STATIC_ASSERT 0
#elif defined(__clang__) && (__clang_major__ < 4)
#define ATLAS_IO_STATIC_ASSERT 0
#else
#define ATLAS_IO_STATIC_ASSERT 1
#endif
#endif

#if ATLAS_IO_STATIC_ASSERT

#include <cstdlib>
#include "atlas/io/detail/TypeTraits.h"
Expand Down
4 changes: 2 additions & 2 deletions src/atlas/io/detail/Time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ inline _put_time<CharT> put_time( const std::tm* time, const CharT* fmt ) {

template <typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>& operator<<( std::basic_ostream<CharT, Traits>& os, _put_time<CharT> f ) {
typedef typename std::ostreambuf_iterator<CharT, Traits> Iter;
typedef std::time_put<CharT, Iter> TimePut;
using Iter = typename std::ostreambuf_iterator<CharT, Traits>;
using TimePut = std::time_put<CharT, Iter>;

const CharT* const fmt_end = f.fmt + Traits::length( f.fmt );
const TimePut& mp = std::use_facet<TimePut>( os.getloc() );
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/mesh/Connectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class IrregularConnectivityImpl {

/// @brief Rename this Connectivity
void rename( const std::string& name ) {
strncpy( name_, name.c_str(), std::max( name.size(), MAX_STRING_SIZE() ) );
std::strncpy( name_, name.c_str(), std::max( name.size(), MAX_STRING_SIZE() ) );
}

/// @brief Number of rows in the connectivity table
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/mesh/Nodes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void atlas__mesh__Nodes__str( Nodes* This, char*& str, int& size ) {
std::string s = ss.str();
size = static_cast<int>( s.size() );
str = new char[size + 1];
strcpy( str, s.c_str() );
std::strncpy( str, s.c_str(), size + 1 );
}

IrregularConnectivity* atlas__mesh__Nodes__edge_connectivity( Nodes* This ) {
Expand Down
5 changes: 5 additions & 0 deletions src/atlas/mesh/PartitionPolygon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <fstream>
#include <sstream>

#include "eckit/exception/Exceptions.h"

#include "atlas/array/MakeView.h"
#include "atlas/field/Field.h"
#include "atlas/mesh.h"
Expand Down Expand Up @@ -112,6 +114,9 @@ void PartitionPolygon::outputPythonScript( const eckit::PathName& filepath, cons
for ( int r = 0; r < mpi_size; ++r ) {
if ( mpi_rank == r ) {
std::ofstream f( filepath.asString().c_str(), mpi_rank == 0 ? std::ios::trunc : std::ios::app );
if( !f.is_open() ) {
throw eckit::CantOpenFile(filepath);
}
//clang-format off
if ( mpi_rank == 0 ) {
f << "\n"
Expand Down
Loading

0 comments on commit 36772b5

Please sign in to comment.