-
Notifications
You must be signed in to change notification settings - Fork 7
Add spline compatibility check helper #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
// Copyright (C) The DDC development team, see COPYRIGHT.md file | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
#include <type_traits> | ||
|
||
#include <ddc/ddc.hpp> | ||
|
||
#include "spline_builder.hpp" | ||
#include "spline_builder_2d.hpp" | ||
#include "spline_evaluator.hpp" | ||
#include "spline_evaluator_2d.hpp" | ||
|
||
namespace ddc { | ||
|
||
template <class T> | ||
struct is_spline_builder : std::false_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSplines, | ||
class InterpolationDDim, | ||
ddc::BoundCond BcLower, | ||
ddc::BoundCond BcUpper, | ||
SplineSolver Solver> | ||
struct is_spline_builder<SplineBuilder< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines, | ||
InterpolationDDim, | ||
BcLower, | ||
BcUpper, | ||
Solver>> : std::true_type | ||
{ | ||
}; | ||
|
||
/** | ||
* @brief A helper to check if T is a SplineBuilder | ||
* @tparam T The type to be checked if is a SplineBuilder | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_builder_v = is_spline_builder<T>::value; | ||
|
||
template <class T> | ||
struct is_spline_builder2d : std::false_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSpline1, | ||
class BSpline2, | ||
class DDimI1, | ||
class DDimI2, | ||
ddc::BoundCond BcLower1, | ||
ddc::BoundCond BcUpper1, | ||
ddc::BoundCond BcLower2, | ||
ddc::BoundCond BcUpper2, | ||
ddc::SplineSolver Solver> | ||
struct is_spline_builder2d<SplineBuilder2D< | ||
ExecSpace, | ||
MemorySpace, | ||
BSpline1, | ||
BSpline2, | ||
DDimI1, | ||
DDimI2, | ||
BcLower1, | ||
BcUpper1, | ||
BcLower2, | ||
BcUpper2, | ||
Solver>> : std::true_type | ||
{ | ||
}; | ||
|
||
/** | ||
* @brief A helper to check if T is a SplineBuilder2D | ||
* @tparam T The type to be checked if is a SplineBuilder2D | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_builder2d_v = is_spline_builder2d<T>::value; | ||
|
||
template <class T> | ||
struct is_spline_evaluator : std::false_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSplines, | ||
class EvaluationDDim, | ||
class LowerExtrapolationRule, | ||
class UpperExtrapolationRule> | ||
struct is_spline_evaluator<SplineEvaluator< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines, | ||
EvaluationDDim, | ||
LowerExtrapolationRule, | ||
UpperExtrapolationRule>> : std::true_type | ||
{ | ||
}; | ||
|
||
/** | ||
* @brief A helper to check if T is a SplineEvaluator | ||
* @tparam T The type to be checked if is a SplineEvaluator | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_evaluator_v = is_spline_evaluator<T>::value; | ||
|
||
template <class T> | ||
struct is_spline_evaluator2d : std::false_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSpline1, | ||
class BSpline2, | ||
class EvaluationDDim1, | ||
class EvaluationDDim2, | ||
class LowerExtrapolationRule1, | ||
class UpperExtrapolationRule1, | ||
class LowerExtrapolationRule2, | ||
class UpperExtrapolationRule2> | ||
struct is_spline_evaluator2d<SplineEvaluator2D< | ||
ExecSpace, | ||
MemorySpace, | ||
BSpline1, | ||
BSpline2, | ||
EvaluationDDim1, | ||
EvaluationDDim2, | ||
LowerExtrapolationRule1, | ||
UpperExtrapolationRule1, | ||
LowerExtrapolationRule2, | ||
UpperExtrapolationRule2>> : std::true_type | ||
{ | ||
}; | ||
|
||
/** | ||
* @brief A helper to check if T is a SplineEvaluator2D | ||
* @tparam T The type to be checked if is a SplineEvaluator2D | ||
*/ | ||
template <class T> | ||
inline constexpr bool is_spline_evaluator2d_v = is_spline_evaluator2d<T>::value; | ||
|
||
template <class Builder, class Evaluator> | ||
struct is_evaluator_admissible : std::false_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSplines, | ||
class InterpolationDDim, | ||
ddc::BoundCond BcLower, | ||
ddc::BoundCond BcUpper, | ||
SplineSolver Solver, | ||
class LowerExtrapolationRule, | ||
class UpperExtrapolationRule> | ||
struct is_evaluator_admissible< | ||
SplineBuilder< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines, | ||
InterpolationDDim, | ||
BcLower, | ||
BcUpper, | ||
Solver>, | ||
SplineEvaluator< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines, | ||
InterpolationDDim, | ||
LowerExtrapolationRule, | ||
UpperExtrapolationRule>> : std::true_type | ||
{ | ||
}; | ||
|
||
template < | ||
class ExecSpace, | ||
class MemorySpace, | ||
class BSplines1, | ||
class BSplines2, | ||
class DDimI1, | ||
class DDimI2, | ||
ddc::BoundCond BcLower1, | ||
ddc::BoundCond BcUpper1, | ||
ddc::BoundCond BcLower2, | ||
ddc::BoundCond BcUpper2, | ||
SplineSolver Solver, | ||
class LowerExtrapolationRule1, | ||
class UpperExtrapolationRule1, | ||
class LowerExtrapolationRule2, | ||
class UpperExtrapolationRule2> | ||
struct is_evaluator_admissible< | ||
SplineBuilder2D< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines1, | ||
BSplines2, | ||
DDimI1, | ||
DDimI2, | ||
BcLower1, | ||
BcUpper1, | ||
BcLower2, | ||
BcUpper2, | ||
Solver>, | ||
SplineEvaluator2D< | ||
ExecSpace, | ||
MemorySpace, | ||
BSplines1, | ||
BSplines2, | ||
DDimI1, | ||
DDimI2, | ||
LowerExtrapolationRule1, | ||
UpperExtrapolationRule1, | ||
LowerExtrapolationRule2, | ||
UpperExtrapolationRule2>> : std::true_type | ||
{ | ||
}; | ||
|
||
/** | ||
* @brief A helper to check if SplineEvaluator is admissible for SplineBuilder | ||
* @tparam Builder The builder type to be checked if it is admissible for Evaluator | ||
* @tparam Evaluator The evaluator type to be checked if it is admissible for Builder | ||
*/ | ||
template <class Builder, class Evaluator> | ||
inline constexpr bool is_evaluator_admissible_v | ||
= is_evaluator_admissible<Builder, Evaluator>::value; | ||
|
||
} // namespace ddc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.