Skip to content

Commit

Permalink
updating ...
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Aug 7, 2024
2 parents 6079dc1 + 9c49ddc commit fd76c11
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/scion/math/InterpolationTableFunction/src/ctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Expand All @@ -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 ) {

Expand All @@ -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 >,
Expand All @@ -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
*/
Expand All @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions src/scion/verification/ranges.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/scion/verification/ranges/test/ranges.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) {

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd76c11

Please sign in to comment.