diff --git a/src/scion/math/InterpolationTableFunction/src/ctor.hpp b/src/scion/math/InterpolationTableFunction/src/ctor.hpp index 5c4dd10..7d8f4fe 100644 --- a/src/scion/math/InterpolationTableFunction/src/ctor.hpp +++ b/src/scion/math/InterpolationTableFunction/src/ctor.hpp @@ -25,9 +25,9 @@ InterpolationTableFunction( InterpolationTableFunction&& table ) : } /** - * @brief Copy assignment using a continuous energy table + * @brief Copy assignment using a table * - * @param[in] table the continuous energy table to be copied + * @param[in] table the table to be copied */ InterpolationTableFunction& operator=( const InterpolationTableFunction& base ) { @@ -39,9 +39,9 @@ InterpolationTableFunction& operator=( const InterpolationTableFunction& base ) } /** - * @brief Move assignment using a continuous energy table + * @brief Move assignment using a table * - * @param[in] table the continuous energy table to be moved + * @param[in] table the table to be moved */ InterpolationTableFunction& operator=( InterpolationTableFunction&& base ) { @@ -55,12 +55,7 @@ InterpolationTableFunction& operator=( InterpolationTableFunction&& base ) { private: /** - * @brief Constructor - * - * @param x the x values of the tabulated data - * @param y the y values of the tabulated data - * @param boundaries the boundaries of the interpolation regions - * @param interpolants the interpolation types of the interpolation regions + * @brief Private constructor */ InterpolationTableFunction( std::tuple< std::vector< X >, @@ -80,7 +75,7 @@ InterpolationTableFunction( * @brief Constructor * * @param x the x values of the tabulated data - * @param y the y values of the tabulated data + * @param f the f(y) functions of the tabulated data * @param boundaries the boundaries of the interpolation regions * @param interpolants the interpolation types of the interpolation regions */ @@ -95,7 +90,7 @@ InterpolationTableFunction( std::vector< X > x, std::vector< F > f, * @brief Constructor for tabulated data in a single interpolation zone * * @param x the x values of the tabulated data - * @param y the y values of the tabulated data + * @param f the f(y) functions of the tabulated data * @param interpolant the interpolation type of the data (default lin-lin) */ InterpolationTableFunction( std::vector< X > x, std::vector< F > f, diff --git a/src/scion/verification/ranges.hpp b/src/scion/verification/ranges.hpp index f206a9f..f30bf37 100644 --- a/src/scion/verification/ranges.hpp +++ b/src/scion/verification/ranges.hpp @@ -64,6 +64,17 @@ bool isUnique( const Range& range ) { return range.end() == std::adjacent_find( range.begin(), range.end() ); } +/** @brief Verify if a range consists of the same element + * + * @param[in] range the range + */ +template < typename Range > +bool isAllSameElement( const Range& range ) { + + return range.end() == std::adjacent_find( range.begin(), range.end(), + std::not_equal_to{} ); +} + } // math namespace } // scion namespace } // njoy namespace diff --git a/src/scion/verification/ranges/test/ranges.test.cpp b/src/scion/verification/ranges/test/ranges.test.cpp index f8b36c8..adc809e 100644 --- a/src/scion/verification/ranges/test/ranges.test.cpp +++ b/src/scion/verification/ranges/test/ranges.test.cpp @@ -20,6 +20,7 @@ SCENARIO( "verification ranges" ) { std::vector< double > unsorted = { 3., 2., 1. }; std::vector< double > unique = { 1., 2., 3. }; std::vector< double > notunique = { 1., 2., 2., 3. }; + std::vector< double > same = { 1., 1., 1., 1. }; WHEN( "the verification functions are called" ) { @@ -47,6 +48,9 @@ SCENARIO( "verification ranges" ) { CHECK( true == verification::isUnique( size1 ) ); CHECK( true == verification::isUnique( unique ) ); CHECK( false == verification::isUnique( notunique ) ); + + CHECK( false == verification::isAllSameElement( unique ) ); + CHECK( true == verification::isAllSameElement( same ) ); } // THEN } // WHEN } // GIVEN