Skip to content

Commit

Permalink
add static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
ayzk committed Dec 11, 2024
1 parent db63591 commit 7ddd65d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/SZ3/decomposition/InterpolationDecomposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class InterpolationDecomposition : public concepts::DecompositionInterface<T, in
public:
InterpolationDecomposition(const Config &conf, Quantizer quantizer) : quantizer(quantizer) {
static_assert(std::is_base_of<concepts::QuantizerInterface<T, int>, Quantizer>::value,
"must implement the quatizer interface");
"must implement the quantizer interface");
}

T *decompress(const Config &conf, std::vector<int> &quant_inds, T *dec_data) override {
Expand Down
5 changes: 3 additions & 2 deletions include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ class LorenzoRegressionDecomposition : public concepts::DecompositionInterface<T
conf.absErrorBound),
precision(conf.absErrorBound),
conf(conf) {
static_assert(std::is_base_of<concepts::QuantizerInterface<T, int>, Quantizer>::value,
"must implement the quantizer interface");

if (N != 1 && N != 3) {
fprintf(stderr, "SZMeta Front only support 1D or 3D data\n");
throw std::invalid_argument("SZMeta Front only support 1D or 3D data");
}
static_assert(std::is_base_of<concepts::QuantizerInterface<T, int>, Quantizer>::value,
"must implement the quatizer interface");
}

~LorenzoRegressionDecomposition() override { clear(); }
Expand Down
2 changes: 1 addition & 1 deletion include/SZ3/decomposition/NoPredictionDecomposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NoPredictionDecomposition : public concepts::DecompositionInterface<T, int
public:
NoPredictionDecomposition(const Config &conf, Quantizer quantizer) : quantizer(quantizer) {
static_assert(std::is_base_of<concepts::QuantizerInterface<T, int>, Quantizer>::value,
"must implement the quatizer interface");
"must implement the quantizer interface");
}

T *decompress(const Config &conf, std::vector<int> &quant_inds, T *dec_data) override {
Expand Down
4 changes: 4 additions & 0 deletions include/SZ3/decomposition/TimeSeriesDecomposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class TimeSeriesDecomposition : public concepts::DecompositionInterface<T, int,
stride(conf.stride),
num_elements(conf.num),
data_ts0(data_ts0) {
static_assert(std::is_base_of<concepts::PredictorInterface<T, N - 1>, Predictor>::value,
"must implement the predictor interface");
static_assert(std::is_base_of<concepts::QuantizerInterface<T, int>, Quantizer>::value,
"must implement the quantizer interface");
assert((conf.dims.size() == 2) && "timestep prediction requires 2d dataset");
global_dimensions[0] = conf.dims[0];
global_dimensions[1] = conf.dims[1];
Expand Down

0 comments on commit 7ddd65d

Please sign in to comment.