diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index cf71a5fa..8c19b1ea 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -22,9 +22,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@v4.8.0 + uses: jidicula/clang-format-action@v4.13.0 with: - clang-format-version: '14' + clang-format-version: '18' check-path: ${{ matrix.path['check'] }} exclude-regex: ${{ matrix.path['exclude'] }} fallback-style: 'Chromium' # optional diff --git a/CMakeLists.txt b/CMakeLists.txt index d89577c8..fb91e92d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14) -project(SPERR VERSION 0.8.1 LANGUAGES CXX DESCRIPTION "Lossy Scientific Compression with SPERR") +project(SPERR VERSION 0.8.2 LANGUAGES CXX DESCRIPTION "Lossy Scientific Compression with SPERR") if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD "20" CACHE STRING "Choose the C++ Standard to use." FORCE) diff --git a/include/SPECK3D_INT.h b/include/SPECK3D_INT.h index c0a459d5..881f98d5 100644 --- a/include/SPECK3D_INT.h +++ b/include/SPECK3D_INT.h @@ -62,7 +62,7 @@ class SPECK3D_INT : public SPECK_INT { virtual void m_process_S(size_t idx1, size_t idx2, size_t& counter, bool) = 0; virtual void m_process_P(size_t i, size_t m, size_t& c, bool) = 0; // Called by `m_code_S()`. virtual void m_process_P_lite(size_t idx) = 0; // Called by `m_sorting_pass()` directly. - virtual void m_additional_initialization(){}; // empty by default + virtual void m_additional_initialization() {}; // empty by default void m_code_S(size_t idx1, size_t idx2); auto m_partition_S_XYZ(Set3D, uint16_t) const -> std::tuple, uint16_t>; diff --git a/include/SPERR3D_Stream_Tools.h b/include/SPERR3D_Stream_Tools.h index d94b2e00..11cb65ae 100644 --- a/include/SPERR3D_Stream_Tools.h +++ b/include/SPERR3D_Stream_Tools.h @@ -56,8 +56,9 @@ class SPERR3D_Stream_Tools { // Given the header of a bitstream and a desired percentage to truncate, return an // updated header and a list of {offset, len} to access. // Note: this function assumes that the header is complete. - auto m_progressive_helper(const void* header_buf, size_t buf_len, unsigned pct) const - -> std::tuple>; + auto m_progressive_helper(const void* header_buf, + size_t buf_len, + unsigned pct) const -> std::tuple>; }; } // End of namespace sperr diff --git a/include/sperr_helper.h b/include/sperr_helper.h index 041be3ae..befca0b0 100644 --- a/include/sperr_helper.h +++ b/include/sperr_helper.h @@ -136,8 +136,9 @@ auto read_whole_file(std::string filename) -> vec_type; // Read sections of a file (extract sections from a memory buffer), and append those sections // to the end of `dst`. The read from file version avoids reading not-requested sections. // The sections are defined by pairs of offsets and lengths, both in number of bytes. -auto read_sections(std::string filename, const std::vector& sections, vec8_type& dst) - -> RTNType; +auto read_sections(std::string filename, + const std::vector& sections, + vec8_type& dst) -> RTNType; auto extract_sections(const void* buf, size_t buf_len, const std::vector& sections, diff --git a/src/Conditioner.cpp b/src/Conditioner.cpp index 1031f4d7..8d637554 100644 --- a/src/Conditioner.cpp +++ b/src/Conditioner.cpp @@ -63,8 +63,9 @@ auto sperr::Conditioner::condition(vecd_type& buf, dims_type dims) -> condi_type return header; } -auto sperr::Conditioner::inverse_condition(vecd_type& buf, dims_type dims, condi_type header) - -> RTNType +auto sperr::Conditioner::inverse_condition(vecd_type& buf, + dims_type dims, + condi_type header) -> RTNType { // unpack meta bit fields auto meta = sperr::unpack_8_booleans(header[0]); diff --git a/src/SPECK_INT.cpp b/src/SPECK_INT.cpp index 1fa457c6..fa04a877 100644 --- a/src/SPECK_INT.cpp +++ b/src/SPECK_INT.cpp @@ -410,7 +410,7 @@ void sperr::SPECK_INT::m_refinement_pass_decode() goto INITIALIZE_NEWLY_FOUND_POINTS_LABEL; // <-- Point 4 } } - } // Finish the case where `m_threshold >= 2`. + } // Finish the case where `m_threshold >= 2`. else { // Start the case where `m_threshold == 1`. for (size_t i = 0; i < bits_x64; i += 64) { auto value = m_LSP_mask.rlong(i); diff --git a/src/SPERR3D_OMP_C.cpp b/src/SPERR3D_OMP_C.cpp index 22e71509..3ac128ab 100644 --- a/src/SPERR3D_OMP_C.cpp +++ b/src/SPERR3D_OMP_C.cpp @@ -259,7 +259,9 @@ auto sperr::SPERR3D_OMP_C::m_gather_chunk(const T* vol, // Will be subject to Named Return Value Optimization. return chunk_buf; } -template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const float*, dims_type, std::array) - -> vecd_type; -template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const double*, dims_type, std::array) - -> vecd_type; +template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const float*, + dims_type, + std::array) -> vecd_type; +template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const double*, + dims_type, + std::array) -> vecd_type; diff --git a/src/SPERR3D_Stream_Tools.cpp b/src/SPERR3D_Stream_Tools.cpp index 4248d790..2017b1ad 100644 --- a/src/SPERR3D_Stream_Tools.cpp +++ b/src/SPERR3D_Stream_Tools.cpp @@ -104,8 +104,8 @@ auto sperr::SPERR3D_Stream_Tools::get_stream_header(const void* p) const -> SPER return header; } -auto sperr::SPERR3D_Stream_Tools::progressive_read(const std::string& filename, unsigned pct) const - -> vec8_type +auto sperr::SPERR3D_Stream_Tools::progressive_read(const std::string& filename, + unsigned pct) const -> vec8_type { // Read the header of this bitstream. auto vec20 = sperr::read_n_bytes(filename, 20); diff --git a/src/sperr_helper.cpp b/src/sperr_helper.cpp index 1089415b..eb45d23f 100644 --- a/src/sperr_helper.cpp +++ b/src/sperr_helper.cpp @@ -333,8 +333,9 @@ auto sperr::write_n_bytes(std::string filename, size_t n_bytes, const void* buff return RTNType::Good; } -auto sperr::read_sections(std::string filename, const std::vector& sections, vec8_type& dst) - -> RTNType +auto sperr::read_sections(std::string filename, + const std::vector& sections, + vec8_type& dst) -> RTNType { // Calculate the farthest file location to be read. size_t far = 0; @@ -494,8 +495,10 @@ auto sperr::calc_stats(const T* arr1, const T* arr2, size_t arr_len, size_t omp_ return {rmse, linfty, psnr, arr1min, arr1max}; } template auto sperr::calc_stats(const float*, const float*, size_t, size_t) -> std::array; -template auto sperr::calc_stats(const double*, const double*, size_t, size_t) - -> std::array; +template auto sperr::calc_stats(const double*, + const double*, + size_t, + size_t) -> std::array; template auto sperr::kahan_summation(const T* arr, size_t len) -> T @@ -514,8 +517,8 @@ auto sperr::kahan_summation(const T* arr, size_t len) -> T template auto sperr::kahan_summation(const float*, size_t) -> float; template auto sperr::kahan_summation(const double*, size_t) -> double; -auto sperr::chunk_volume(dims_type vol_dim, dims_type chunk_dim) - -> std::vector> +auto sperr::chunk_volume(dims_type vol_dim, + dims_type chunk_dim) -> std::vector> { // Step 1: figure out how many segments are there along each axis. auto n_segs = std::array(); diff --git a/utilities/double_prec.cpp b/utilities/raw_tools/double_prec.cpp similarity index 100% rename from utilities/double_prec.cpp rename to utilities/raw_tools/double_prec.cpp diff --git a/utilities/sperr2d.cpp b/utilities/sperr2d.cpp index 0a8a1f51..89a7313b 100644 --- a/utilities/sperr2d.cpp +++ b/utilities/sperr2d.cpp @@ -220,6 +220,13 @@ int main(int argc, char* argv[]) std::cout << "SPERR needs an output destination when decoding!" << std::endl; return __LINE__; } + // Print a warning message if there's no output specified + if (cflag && bitstream.empty()) + std::cout << "Warning: no output file provided. Consider using --bitstream option." + << std::endl; + if (dflag && decomp_f64.empty() && decomp_f32.empty() && decomp_lowres_f64.empty() && + decomp_lowres_f32.empty()) + std::cout << "Warning: no output file provided." << std::endl; // // Really starting the real work! diff --git a/utilities/sperr3d.cpp b/utilities/sperr3d.cpp index 0e4b71a4..b23bf66a 100644 --- a/utilities/sperr3d.cpp +++ b/utilities/sperr3d.cpp @@ -12,8 +12,9 @@ // This functions takes in a filename, and a full resolution. It then creates a list of // filenames, each has the coarsened resolution appended. -auto create_filenames(std::string name, sperr::dims_type vdims, sperr::dims_type cdims) - -> std::vector +auto create_filenames(std::string name, + sperr::dims_type vdims, + sperr::dims_type cdims) -> std::vector { auto filenames = std::vector(); auto resolutions = sperr::coarsened_resolutions(vdims, cdims); @@ -254,6 +255,13 @@ int main(int argc, char* argv[]) return __LINE__ % 256; } } + // Print a warning message if there's no output specified + if (cflag && bitstream.empty()) + std::cout << "Warning: no output file provided. Consider using --bitstream option." + << std::endl; + if (dflag && decomp_f64.empty() && decomp_f32.empty() && decomp_lowres_f64.empty() && + decomp_lowres_f32.empty()) + std::cout << "Warning: no output file provided." << std::endl; // // Really starting the real work!