Skip to content

Commit

Permalink
Updating templates
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Jul 31, 2024
1 parent c2c3084 commit 6079dc1
Show file tree
Hide file tree
Showing 24 changed files with 147 additions and 82 deletions.
7 changes: 7 additions & 0 deletions src/scion/math/ChebyshevApproximation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::DomainVariant;

/* constructor */

#include "scion/math/ChebyshevApproximation/src/ctor.hpp"

/* interface implementation function */
Expand Down
7 changes: 7 additions & 0 deletions src/scion/math/ChebyshevSeries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::DomainVariant;

/* constructor */

#include "scion/math/ChebyshevSeries/src/ctor.hpp"

/* methods */
Expand Down
7 changes: 7 additions & 0 deletions src/scion/math/HistogramTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::DomainVariant;

/* constructor */

#include "scion/math/HistogramTable/src/ctor.hpp"

/* methods */
Expand Down
14 changes: 7 additions & 7 deletions src/scion/math/HistogramTableFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ namespace math {
* type F and the container type used for the x values and the functions. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y, typename Z, typename F,
template < typename X, typename F,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
class HistogramTableFunction :
public SingleTableFunctionBase< HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::Histogram, X, Y, Z, F,
public SingleTableFunctionBase< HistogramTableFunction< X, F, XContainer, FContainer >,
interpolation::Histogram, X, F,
XContainer, FContainer > {

/* friend declarations */
friend class SingleTableFunctionBase< HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::Histogram, X, Y, Z, F,
friend class SingleTableFunctionBase< HistogramTableFunction< X, F, XContainer, FContainer >,
interpolation::Histogram, X, F,
XContainer, FContainer >;

/* type aliases */
using Parent = SingleTableFunctionBase< HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::Histogram, X, Y, Z, F,
using Parent = SingleTableFunctionBase< HistogramTableFunction< X, F, XContainer, FContainer >,
interpolation::Histogram, X, F,
XContainer, FContainer >;

/* fields */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ using Catch::Matchers::WithinRel;
using namespace njoy::scion;
template < typename X, typename Y = X >
using InterpolationTable = math::InterpolationTable< X, Y >;
template < typename X, typename Y = X, typename Z = X,
typename F = InterpolationTable< X >,
template < typename X, typename F = InterpolationTable< X >,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
using HistogramTableFunction = math::HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >;
using HistogramTableFunction = math::HistogramTableFunction< X, F, XContainer, FContainer >;
using InterpolationType = interpolation::InterpolationType;

SCENARIO( "HistogramTableFunction" ) {
Expand Down Expand Up @@ -115,8 +114,8 @@ SCENARIO( "HistogramTableFunction" ) {
XView x = njoy::utility::make_view( xvalues );
FView f = njoy::utility::make_view( fvalues );

HistogramTableFunction< double, double, double, InterpolationTable< double >,
XView, FView > chunk( std::move( x ), std::move( f ) );
HistogramTableFunction< double, InterpolationTable< double >,
XView, FView > chunk( std::move( x ), std::move( f ) );

THEN( "a HistogramTable can be constructed and members can be tested" ) {

Expand Down
7 changes: 7 additions & 0 deletions src/scion/math/InterpolationTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::DomainVariant;

/* constructor */

#include "scion/math/InterpolationTable/src/ctor.hpp"

/* methods */
Expand Down
30 changes: 21 additions & 9 deletions src/scion/math/InterpolationTableFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,30 @@ namespace math {
* @class
* @brief Tabulated data with one or more interpolation types
*/
template < typename X, typename F, typename Y, typename Z >
template < typename X, typename F >
class InterpolationTableFunction :
public TwoDimensionalFunctionBase< InterpolationTableFunction< X, F, Y, Z >, X, Y, Z > {
public TwoDimensionalFunctionBase< InterpolationTableFunction< X, F >,
X, typename F::XType, typename F::YType > {

/* friend declarations */
friend class TwoDimensionalFunctionBase< InterpolationTableFunction< X, F, Y, Z >, X, Y, Z >;
friend class TwoDimensionalFunctionBase< InterpolationTableFunction< X, F >,
X, typename F::XType, typename F::YType >;

/* type aliases */
using Parent = TwoDimensionalFunctionBase< InterpolationTableFunction< X, F, Y, Z >, X, Y, Z >;
using Parent = TwoDimensionalFunctionBase< InterpolationTableFunction< X, F >, X,
typename F::XType, typename F::YType >;
using Y = typename Parent::YType;
using Z = typename Parent::ZType;
using XIterator = typename std::vector< X >::const_iterator;
using FIterator = typename std::vector< F >::const_iterator;
using XContainer = njoy::utility::IteratorView< XIterator >;
using FContainer = njoy::utility::IteratorView< FIterator >;
using TableVariant = std::variant<
LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >,
LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >,
LogLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
LogLogTableFunction< X, Y, Z, F, XContainer, FContainer > >;
LinearLinearTableFunction< X, F, XContainer, FContainer >,
HistogramTableFunction< X, F, XContainer, FContainer >,
LinearLogTableFunction< X, F, XContainer, FContainer >,
LogLinearTableFunction< X, F, XContainer, FContainer >,
LogLogTableFunction< X, F, XContainer, FContainer > >;

/* fields */
std::vector< X > x_;
Expand All @@ -69,7 +74,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::ZType;

/* constructor */

#include "scion/math/InterpolationTableFunction/src/ctor.hpp"

/* methods */
Expand Down
10 changes: 5 additions & 5 deletions src/scion/math/InterpolationTableFunction/src/generateTables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void generateTables() {
case interpolation::InterpolationType::LinearLinear : {

tables.emplace_back(
LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >(
LinearLinearTableFunction< X, F, XContainer, FContainer >(
XContainer( xStart, xEnd ),
FContainer( fStart, fEnd ) ) );
break;
Expand All @@ -27,7 +27,7 @@ void generateTables() {

linearised = false;
tables.emplace_back(
HistogramTableFunction< X, Y, Z, F, XContainer, FContainer >(
HistogramTableFunction< X, F, XContainer, FContainer >(
XContainer( xStart, xEnd ),
FContainer( fStart, fEnd ) ) );
break;
Expand All @@ -36,7 +36,7 @@ void generateTables() {

linearised = false;
tables.emplace_back(
LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >(
LinearLogTableFunction< X, F, XContainer, FContainer >(
XContainer( xStart, xEnd ),
FContainer( fStart, fEnd ) ) );
break;
Expand All @@ -45,7 +45,7 @@ void generateTables() {

linearised = false;
tables.emplace_back(
LogLinearTableFunction< X, Y, Z, F, XContainer, FContainer >(
LogLinearTableFunction< X, F, XContainer, FContainer >(
XContainer( xStart, xEnd ),
FContainer( fStart, fEnd ) ) );
break;
Expand All @@ -54,7 +54,7 @@ void generateTables() {

linearised = false;
tables.emplace_back(
LogLogTableFunction< X, Y, Z, F, XContainer, FContainer >(
LogLogTableFunction< X, F, XContainer, FContainer >(
XContainer( xStart, xEnd ),
FContainer( fStart, fEnd ) ) );
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ template < typename X, typename Y = X >
using InterpolationTable = math::InterpolationTable< X, Y >;
template < typename X, typename Y = X >
using LegendreSeries = math::LegendreSeries< X, Y >;
template < typename X, typename F, typename Y = X, typename Z = X >
using InterpolationTableFunction = math::InterpolationTableFunction< X, F, Y, Z >;
template < typename X, typename F >
using InterpolationTableFunction = math::InterpolationTableFunction< X, F >;
using InterpolationType = interpolation::InterpolationType;

using Table2D = InterpolationTableFunction< double, InterpolationTable< double > >;
Expand Down
7 changes: 7 additions & 0 deletions src/scion/math/LegendreSeries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ namespace math {

public:

/* type aliases */

using typename Parent::XType;
using typename Parent::YType;
using typename Parent::DomainVariant;

/* constructor */

#include "scion/math/LegendreSeries/src/ctor.hpp"

/* methods */
Expand Down
14 changes: 7 additions & 7 deletions src/scion/math/LinearLinearTableFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ namespace math {
* type F and the container type used for the x values and the functions. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y, typename Z, typename F,
template < typename X, typename F,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
class LinearLinearTableFunction :
public SingleTableFunctionBase< LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLinear, X, Y, Z, F,
public SingleTableFunctionBase< LinearLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLinear, X, F,
XContainer, FContainer > {

/* friend declarations */
friend class SingleTableFunctionBase< LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLinear, X, Y, Z, F,
friend class SingleTableFunctionBase< LinearLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLinear, X, F,
XContainer, FContainer >;

/* type aliases */
using Parent = SingleTableFunctionBase< LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLinear, X, Y, Z, F,
using Parent = SingleTableFunctionBase< LinearLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLinear, X, F,
XContainer, FContainer >;

/* fields */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ using Catch::Matchers::WithinRel;
using namespace njoy::scion;
template < typename X, typename Y = X >
using InterpolationTable = math::InterpolationTable< X, Y >;
template < typename X, typename Y = X, typename Z = X,
typename F = InterpolationTable< X >,
template < typename X, typename F = InterpolationTable< X >,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
using LinearLinearTableFunction = math::LinearLinearTableFunction< X, Y, Z, F, XContainer, FContainer >;
using LinearLinearTableFunction = math::LinearLinearTableFunction< X, F, XContainer, FContainer >;
using InterpolationType = interpolation::InterpolationType;

SCENARIO( "LinearLinearTableFunction" ) {
Expand Down Expand Up @@ -115,7 +114,7 @@ SCENARIO( "LinearLinearTableFunction" ) {
XView x = njoy::utility::make_view( xvalues );
FView f = njoy::utility::make_view( fvalues );

LinearLinearTableFunction< double, double, double, InterpolationTable< double >,
LinearLinearTableFunction< double, InterpolationTable< double >,
XView, FView > chunk( std::move( x ), std::move( f ) );

THEN( "a LinearLinearTable can be constructed and members can be tested" ) {
Expand Down
14 changes: 7 additions & 7 deletions src/scion/math/LinearLogTableFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ namespace math {
* type F and the container type used for the x values and the functions. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y, typename Z, typename F,
template < typename X, typename F,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
class LinearLogTableFunction :
public SingleTableFunctionBase< LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, Y, Z, F,
public SingleTableFunctionBase< LinearLogTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, F,
XContainer, FContainer > {

/* friend declarations */
friend class SingleTableFunctionBase< LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, Y, Z, F,
friend class SingleTableFunctionBase< LinearLogTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, F,
XContainer, FContainer >;

/* type aliases */
using Parent = SingleTableFunctionBase< LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, Y, Z, F,
using Parent = SingleTableFunctionBase< LinearLogTableFunction< X, F, XContainer, FContainer >,
interpolation::LinearLogarithmic, X, F,
XContainer, FContainer >;

/* fields */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ using Catch::Matchers::WithinRel;
using namespace njoy::scion;
template < typename X, typename Y = X >
using InterpolationTable = math::InterpolationTable< X, Y >;
template < typename X, typename Y = X, typename Z = X,
typename F = InterpolationTable< X >,
template < typename X, typename F = InterpolationTable< X >,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
using LinearLogTableFunction = math::LinearLogTableFunction< X, Y, Z, F, XContainer, FContainer >;
using LinearLogTableFunction = math::LinearLogTableFunction< X, F, XContainer, FContainer >;
using InterpolationType = interpolation::InterpolationType;

SCENARIO( "LinearLogTableFunction" ) {
Expand Down Expand Up @@ -115,8 +114,8 @@ SCENARIO( "LinearLogTableFunction" ) {
XView x = njoy::utility::make_view( xvalues );
FView f = njoy::utility::make_view( fvalues );

LinearLogTableFunction< double, double, double, InterpolationTable< double >,
XView, FView > chunk( std::move( x ), std::move( f ) );
LinearLogTableFunction< double, InterpolationTable< double >,
XView, FView > chunk( std::move( x ), std::move( f ) );

THEN( "a LinearLogTable can be constructed and members can be tested" ) {

Expand Down
14 changes: 7 additions & 7 deletions src/scion/math/LogLinearTableFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ namespace math {
* type F and the container type used for the x values and the functions. This allows us to
* use something like utility::IteratorView instead of std::vector.
*/
template < typename X, typename Y, typename Z, typename F,
template < typename X, typename F,
typename XContainer = std::vector< X >,
typename FContainer = std::vector< F > >
class LogLinearTableFunction :
public SingleTableFunctionBase< LogLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, Y, Z, F,
public SingleTableFunctionBase< LogLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, F,
XContainer, FContainer > {

/* friend declarations */
friend class SingleTableFunctionBase< LogLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, Y, Z, F,
friend class SingleTableFunctionBase< LogLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, F,
XContainer, FContainer >;

/* type aliases */
using Parent = SingleTableFunctionBase< LogLinearTableFunction< X, Y, Z, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, Y, Z, F,
using Parent = SingleTableFunctionBase< LogLinearTableFunction< X, F, XContainer, FContainer >,
interpolation::LogarithmicLinear, X, F,
XContainer, FContainer >;

/* fields */
Expand Down
Loading

0 comments on commit 6079dc1

Please sign in to comment.