Skip to content

Commit

Permalink
Updating interpolation for 2d version, update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Jul 26, 2024
1 parent 6fede67 commit 7077fa2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/scion/math/HistogramTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace math {

/**
* @class
* @brief Tabulated data with histogram interpolation (y is constant in x)
* @brief Tabulated x,y data with histogram interpolation (y is constant in x)
*
* The HistogramTable is templatised on the container type used for the
* x and y values in addition to the actual x and y types. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y = X,
template < typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class HistogramTable :
Expand Down
4 changes: 2 additions & 2 deletions src/scion/math/LinearLinearTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace math {

/**
* @class
* @brief Tabulated data with linear-linear interpolation (y is linear in x)
* @brief Tabulated x,y data with linear-linear interpolation (y is linear in x)
*
* The LinearLinearTable is templatised on the container type used for the
* x and y values in addition to the actual x and y types. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y = X,
template < typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class LinearLinearTable :
Expand Down
4 changes: 2 additions & 2 deletions src/scion/math/LinearLogTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace math {

/**
* @class
* @brief Tabulated data with linear-log interpolation (y is linear in ln(x))
* @brief Tabulated x,y data with linear-log interpolation (y is linear in ln(x))
*
* The LinearLogTable is templatised on the container type used for the
* x and y values in addition to the actual x and y types. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y = X,
template < typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class LinearLogTable :
Expand Down
4 changes: 2 additions & 2 deletions src/scion/math/LogLinearTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace math {

/**
* @class
* @brief Tabulated data with log-linear interpolation (ln(y) is linear in x)
* @brief Tabulated x,y data with log-linear interpolation (ln(y) is linear in x)
*
* The LogLinearTable is templatised on the container type used for the
* x and y values in addition to the actual x and y types. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y = X,
template < typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class LogLinearTable :
Expand Down
4 changes: 2 additions & 2 deletions src/scion/math/LogLogTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace math {

/**
* @class
* @brief Tabulated data with log-log interpolation (ln(y) is linear in ln(x))
* @brief Tabulated x,y data with log-log interpolation (ln(y) is linear in ln(x))
*
* The LogLogTable is templatised on the container type used for the
* x and y values in addition to the actual x and y types. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y = X,
template < typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class LogLogTable :
Expand Down
4 changes: 2 additions & 2 deletions src/scion/math/SingleTableBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ namespace math {

/**
* @class
* @brief Base class for tabulated data using a single interpolation region
* @brief Base class for x,y tabulated data using a single interpolation region
*
* This base class provides the common interface for single region
* interpolation data such as the LinearLinearTable, LogLogTable, etc.
*/
template < typename Derived, typename Interpolator,
typename X, typename Y = X,
typename X, typename Y,
typename XContainer = std::vector< X >,
typename YContainer = std::vector< Y > >
class SingleTableBase : public OneDimensionalFunctionBase< Derived, X, Y > {
Expand Down
10 changes: 5 additions & 5 deletions src/scion/math/SingleTableBase/src/verifyTable.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
static IntervalDomain< X >
static IntervalDomain< X >
verifyTableAndRetrieveDomain( const XContainer& x, const YContainer& y ) {

if ( ( ! verification::isAtLeastOfSize( x, 2 ) ) ||
( ! verification::isAtLeastOfSize( y, 2 ) ) ) {

Log::error( "Insufficient x or y values defined for tabulated data "
Log::error( "Insufficient x or y values defined for x,y tabulated data "
"with a single interpolation type (at least 2 points are "
"required)" );
Log::info( "x.size(): {}", x.size() );
Expand All @@ -14,7 +14,7 @@ verifyTableAndRetrieveDomain( const XContainer& x, const YContainer& y ) {

if ( ! verification::isSameSize( x, y ) ) {

Log::error( "Inconsistent number of x and y values for tabulated data "
Log::error( "Inconsistent number of x and y values for x,y tabulated data "
"with a single interpolation type" );
Log::info( "x.size(): {}", x.size() );
Log::info( "y.size(): {}", y.size() );
Expand All @@ -24,13 +24,13 @@ verifyTableAndRetrieveDomain( const XContainer& x, const YContainer& y ) {
if ( ! verification::isSorted( x ) ) {

Log::error( "The x values do not appear to be in ascending order for "
"tabulated data with a single interpolation type" );
"x,y tabulated data with a single interpolation type" );
throw std::exception();
}

if ( ! verification::isUnique( x ) ) {

Log::error( "The x values do not appear to be unique for tabulated values "
Log::error( "The x values do not appear to be unique for x,y tabulated values "
"with a single interpolation type" );

auto iter = std::adjacent_find( x.begin(), x.end() );
Expand Down

0 comments on commit 7077fa2

Please sign in to comment.