diff --git a/cpp/aterms/atermbeam.h b/cpp/aterms/atermbeam.h index bd929e94431b85593194a37299c06d8923ef8177..498a12740e225622425c101001b600bf6356ef23 100644 --- a/cpp/aterms/atermbeam.h +++ b/cpp/aterms/atermbeam.h @@ -36,7 +36,7 @@ class ATermBeam : public ATermBase { last_field_id_ = 0; } - double AverageUpdateTime() const override { return update_interval_; } + double AverageUpdateTime() const final override { return update_interval_; } protected: virtual bool CalculateBeam(std::complex<float>* buffer, double time, diff --git a/cpp/aterms/atermconfig.h b/cpp/aterms/atermconfig.h index 396e92978e300dbeba8b5aa4655dc97009b0880c..111c96885ada3eed1c0d41a0cfe5bb92d57512e7 100644 --- a/cpp/aterms/atermconfig.h +++ b/cpp/aterms/atermconfig.h @@ -48,7 +48,7 @@ class ATermConfig : public ATermBase { size_t fieldId, const double* uvwInM) final override; /** Reimplemented from ATermBase */ - double AverageUpdateTime() const override { + double AverageUpdateTime() const final override { double avgTime = aterms_.front()->AverageUpdateTime(); for (size_t i = 1; i < aterms_.size(); ++i) avgTime = std::min(avgTime, aterms_[i]->AverageUpdateTime()); diff --git a/cpp/aterms/dldmaterm.h b/cpp/aterms/dldmaterm.h index 8af0b9a6f770c44665c0350bff1af3617d786ed9..80c746a49ac8e3efc4965c0c1e22df705d89dc53 100644 --- a/cpp/aterms/dldmaterm.h +++ b/cpp/aterms/dldmaterm.h @@ -25,7 +25,7 @@ class DLDMATerm final : public FitsATermBase { update_interval_ = updateInterval; } - double AverageUpdateTime() const override { + double AverageUpdateTime() const final override { return std::min(FitsATermBase::AverageUpdateTime(), update_interval_); } diff --git a/cpp/aterms/h5parmaterm.h b/cpp/aterms/h5parmaterm.h index 4c22920b5f01b673b87d8bc9ca1f34c8de6d5afb..436e83b0dd90a225c32796226161ca88abd876f7 100644 --- a/cpp/aterms/h5parmaterm.h +++ b/cpp/aterms/h5parmaterm.h @@ -198,7 +198,7 @@ class H5ParmATerm final : public ATermBase { } // Get average update time, fixed value for h5parm aterm - double AverageUpdateTime() const override final { return update_interval_; } + double AverageUpdateTime() const final override { return update_interval_; } private: // Expand complex exponential from amplitude and phase as diff --git a/cpp/aterms/pafbeamterm.h b/cpp/aterms/pafbeamterm.h index dfc37c44771ee1ceb0030b2da1e3e8c090db4165..e160538083ebcc957752b3333650428d7152d17c 100644 --- a/cpp/aterms/pafbeamterm.h +++ b/cpp/aterms/pafbeamterm.h @@ -31,7 +31,7 @@ class PAFBeamTerm final : public ATermBase { update_interval_ = update_interval; } - double AverageUpdateTime() const override { return update_interval_; } + double AverageUpdateTime() const final override { return update_interval_; } void Open(const std::string& filename_template, const std::vector<std::string>& antenna_map, diff --git a/cpp/common/constants.h b/cpp/common/constants.h index 420911ef08cd0d096d73bc08cae0ca5d07580f0e..475de8c02560e63227f8a2fa7c0dca9985bbb6fb 100644 --- a/cpp/common/constants.h +++ b/cpp/common/constants.h @@ -1,4 +1,4 @@ -// constants.h: %Constants used in this library. +// constants.h: Constants used in this library. // // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy) // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,7 +7,7 @@ #define EVERYBEAM_CONSTANTS_H // \file -// %Constants used in this library. +// Constants used in this library. #include "types.h" diff --git a/cpp/common/mathutils.h b/cpp/common/mathutils.h index bce2ea3901718b0918d3a865b3e109a17638b41a..f2ea992fa8a080afc5a30cee1cbc579ca547296c 100644 --- a/cpp/common/mathutils.h +++ b/cpp/common/mathutils.h @@ -20,8 +20,7 @@ inline real_t dot(const vector3r_t &arg0, const vector3r_t &arg1) { inline double norm(const vector3r_t &arg0) { return sqrt(dot(arg0, arg0)); } inline vector3r_t operator*(real_t arg0, const vector3r_t arg1) { - vector3r_t result = {{arg0 * arg1[0], arg0 * arg1[1], arg0 * arg1[2]}}; - return result; + return vector3r_t{arg0 * arg1[0], arg0 * arg1[1], arg0 * arg1[2]}; } inline vector3r_t normalize(const vector3r_t &arg0) { @@ -30,34 +29,25 @@ inline vector3r_t normalize(const vector3r_t &arg0) { inline vector2r_t cart2thetaphi(const vector3r_t &cart) { real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]); - vector2r_t thetaphi = {{M_PI_2 - atan2(cart[2], r), atan2(cart[1], cart[0])}}; - return thetaphi; + return vector2r_t{M_PI_2 - atan2(cart[2], r), atan2(cart[1], cart[0])}; } inline vector3r_t thetaphi2cart(const vector2r_t &thetaphi) { real_t r = sin(thetaphi[0]); - vector3r_t cart = { - {r * cos(thetaphi[1]), r * sin(thetaphi[1]), cos(thetaphi[0])}}; - return cart; + return vector3r_t{r * cos(thetaphi[1]), r * sin(thetaphi[1]), + cos(thetaphi[0])}; } // returns az, el, r. inline vector3r_t cart2sph(const vector3r_t &cart) { real_t r = sqrt(cart[0] * cart[0] + cart[1] * cart[1]); - - vector3r_t sph; - sph[0] = atan2(cart[1], cart[0]); - sph[1] = atan2(cart[2], r); - sph[2] = norm(cart); - return sph; + return vector3r_t{atan2(cart[1], cart[0]), atan2(cart[2], r), norm(cart)}; } // expects az, el, r. inline vector3r_t sph2cart(const vector3r_t &sph) { - vector3r_t cart = {{sph[2] * cos(sph[1]) * cos(sph[0]), - sph[2] * cos(sph[1]) * sin(sph[0]), - sph[2] * sin(sph[1])}}; - return cart; + return vector3r_t{sph[2] * cos(sph[1]) * cos(sph[0]), + sph[2] * cos(sph[1]) * sin(sph[0]), sph[2] * sin(sph[1])}; } inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) { @@ -70,23 +60,17 @@ inline matrix22c_t operator*(const matrix22c_t &arg0, const matrix22r_t &arg1) { } inline vector3r_t cross(const vector3r_t &arg0, const vector3r_t &arg1) { - vector3r_t result; - result[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; - result[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; - result[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0]; - return result; + return vector3r_t{arg0[1] * arg1[2] - arg0[2] * arg1[1], + arg0[2] * arg1[0] - arg0[0] * arg1[2], + arg0[0] * arg1[1] - arg0[1] * arg1[0]}; } inline vector3r_t operator+(const vector3r_t &arg0, const vector3r_t &arg1) { - vector3r_t result = { - {arg0[0] + arg1[0], arg0[1] + arg1[1], arg0[2] + arg1[2]}}; - return result; + return vector3r_t{arg0[0] + arg1[0], arg0[1] + arg1[1], arg0[2] + arg1[2]}; } inline vector3r_t operator-(const vector3r_t &arg0, const vector3r_t &arg1) { - vector3r_t result = { - {arg0[0] - arg1[0], arg0[1] - arg1[1], arg0[2] - arg1[2]}}; - return result; + return vector3r_t{arg0[0] - arg1[0], arg0[1] - arg1[1], arg0[2] - arg1[2]}; } inline matrix22c_t normalize(const raw_response_t &raw) { @@ -118,7 +102,5 @@ inline diag22c_t normalize(const raw_array_factor_t &raw) { return af; } - } // namespace everybeam - -#endif +#endif // EVERYBEAM_MATHUTIL_H diff --git a/cpp/common/types.h b/cpp/common/types.h index b845faebe7c5c61de1002635d76cce0b3db6306e..9813c55bc07ed4a44fa0d00f8cd452ab32c9cf4c 100644 --- a/cpp/common/types.h +++ b/cpp/common/types.h @@ -6,9 +6,6 @@ #ifndef EVERYBEAM_TYPES_H #define EVERYBEAM_TYPES_H -// \file -// Types used in this library. - #include <array> #include <cstring> #include <ostream> diff --git a/cpp/coords/itrfdirection.cc b/cpp/coords/itrfdirection.cc index e34c152aacd15cac17886c3721e43189cfa46bb8..500fe2fcc8f9425f3e5d74ab70fd22d5e138d679 100644 --- a/cpp/coords/itrfdirection.cc +++ b/cpp/coords/itrfdirection.cc @@ -61,7 +61,7 @@ ITRFDirection::ITRFDirection(const vector3r_t &direction) } vector3r_t ITRFDirection::at(real_t time) const { - std::lock_guard<std::mutex> lock(itsMutex); + std::lock_guard<std::mutex> lock(mutex_); // Cannot use MeasFrame::resetEpoch(Double), because that assumes the // argument is UTC in (fractional) days (MJD). @@ -70,8 +70,7 @@ vector3r_t ITRFDirection::at(real_t time) const { const casacore::MDirection &m_ITRF = converter_(); const casacore::MVDirection &mv_ITRF = m_ITRF.getValue(); - vector3r_t itrf = {{mv_ITRF(0), mv_ITRF(1), mv_ITRF(2)}}; - return itrf; + return vector3r_t{mv_ITRF(0), mv_ITRF(1), mv_ITRF(2)}; } } // namespace coords } // namespace everybeam \ No newline at end of file diff --git a/cpp/coords/itrfdirection.h b/cpp/coords/itrfdirection.h index 89b1dd5ca99f5a182c64919e52d8550a87bad6a3..ffd233ad1657f72491c0a262302bbaa16ab8e119 100644 --- a/cpp/coords/itrfdirection.h +++ b/cpp/coords/itrfdirection.h @@ -40,7 +40,7 @@ class ITRFDirection { mutable casacore::MeasFrame frame_; mutable casacore::MDirection::Convert converter_; - mutable std::mutex itsMutex; + mutable std::mutex mutex_; }; } // namespace coords } // namespace everybeam