From 955730aa2056eee2150866bfcae778f1cacc745c Mon Sep 17 00:00:00 2001 From: Jiwon Gim Date: Fri, 7 Jun 2024 15:41:17 -0600 Subject: [PATCH] add clang format --- .clang-format | 43 ++ .github/workflows/clang-format.yml | 53 ++ include/tuvx/grid.hpp | 62 +- include/tuvx/profile.hpp | 40 +- .../radiative_transfer/radiation_field.hpp | 52 +- include/tuvx/radiative_transfer/radiator.hpp | 40 +- .../solvers/delta_eddington.hpp | 46 +- .../solvers/delta_eddington.inl | 7 +- include/tuvx/util/array2d.hpp | 95 ++- include/tuvx/util/array3d.hpp | 136 +++-- include/tuvx/util/config_yaml.h | 549 +++++++++--------- src/util/config.cpp | 67 ++- test/regression/solvers/delta_eddington.cpp | 8 +- test/regression/solvers/delta_eddington.hpp | 8 +- test/unit/grid.cpp | 8 +- test/unit/profile.cpp | 8 +- test/unit/util/array2d.cpp | 8 +- test/unit/util/array3d.cpp | 8 +- 18 files changed, 731 insertions(+), 507 deletions(-) create mode 100644 .clang-format create mode 100644 .github/workflows/clang-format.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..02e05ab9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,43 @@ +--- +BasedOnStyle: Google +AlignAfterOpenBracket: 'AlwaysBreak' +AllowAllConstructorInitializersOnNextLine: 'false' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AlignConsecutiveMacros: 'true' +AllowShortCaseLabelsOnASingleLine: 'true' +AllowShortFunctionsOnASingleLine: 'None' +AllowShortIfStatementsOnASingleLine: 'Never' +AllowShortLoopsOnASingleLine: 'false' +BreakBeforeBraces: Allman +BinPackArguments: 'false' +BinPackParameters: 'false' +Cpp11BracedListStyle: 'false' +ColumnLimit: 125 +IndentWidth: 2 +IndentPPDirectives: BeforeHash +NamespaceIndentation: All +PackConstructorInitializers: 'Never' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeCtorInitializerColon: 'true' +SpaceBeforeInheritanceColon: 'true' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'true' +SpaceInEmptyBlock: true +Standard: 'Latest' +IncludeBlocks: Regroup +IncludeCategories: + # TUV-X project headers + - Regex: '<(tuvx)\/' + Priority: 2 + # CUDA headers (in progress) + - Regex: '<(cuda)[[:alnum:].(-|_)*]+>' + Priority: 3 + # External libraries headers + - Regex: '<[[:alnum:].(-|_)*]+\/' + Priority: 4 + # System headers + - Regex: '<[[:alnum:].(-|_)*]+>' + Priority: 5 + # Main, local, private headers + - Regex: '".*' + Priority: 1 \ No newline at end of file diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 00000000..79ae4ac3 --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,53 @@ +name: Clang-Format + +on: + push: + branches: + - main + +jobs: + format: + name: Run Clang-Format + runs-on: ubuntu-latest + + steps: + - name: Install Clang-Format + run: sudo apt-get update && sudo apt-get install clang-format && clang-format --version + + - name: Check out code, run clang format, push changes + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run clang-format + run: | + find include -type f \( -name '*.hpp' -or -name '*.h' \) -exec clang-format -i --style=file --verbose {} + + find src -type f \( -name '*.cpp' -or -name '*.c' \) -exec clang-format -i --style=file --verbose {} + + + - name: Check for changes + id: check-changes + run: git diff --exit-code + continue-on-error: true + + - name: Commit and push changes + # a failue of this step means changes were detected + if: steps.check-changes.outcome != 'success' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit" + + - name: Push changes to main-formatting branch + if: steps.check-changes.outcome != 'success' + run: git push origin HEAD:main-formatting + + - name: Create Pull Request + if: steps.check-changes.outcome != 'success' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Auto-format code using Clang-Format" + title: "Auto-format code changes" + body: "This is an automated pull request to apply code formatting using Clang-Format." + branch: main-formatting \ No newline at end of file diff --git a/include/tuvx/grid.hpp b/include/tuvx/grid.hpp index ffb464b4..616b2e7b 100644 --- a/include/tuvx/grid.hpp +++ b/include/tuvx/grid.hpp @@ -1,14 +1,15 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file Grid dimensions +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once -#include - #include -namespace tuvx { +#include + +namespace tuvx +{ /// @brief Grid dimensions /// @@ -18,9 +19,10 @@ namespace tuvx { /// /// When grid dimensions are constant, the size of the column /// dimension is 1. - template > - class Grid { - public: + template> + class Grid + { + public: /// Grid centers ArrayPolicy mid_points_; /// Grid edges @@ -33,24 +35,29 @@ namespace tuvx { /// @param number_of_columns Number of columns. /// @param number_of_sections Number of grid sections per column. Grid(const std::string& units, size_t number_of_columns, size_t number_of_sections) - : units_(units), - mid_points_(number_of_sections, number_of_columns), - edges_(number_of_sections+1, number_of_columns), - is_constant_(false) {} + : units_(units), + mid_points_(number_of_sections, number_of_columns), + edges_(number_of_sections + 1, number_of_columns), + is_constant_(false) + { + } /// @brief Constructor for a grid with dimensions that are constant. /// @param units Units of the grid. /// @param number_of_sections Number of grid sections per column. Grid(const std::string& units, size_t number_of_sections) - : units_(units), - mid_points_(number_of_sections, 1), - edges_(number_of_sections+1, 1), - is_constant_(true) {} + : units_(units), + mid_points_(number_of_sections, 1), + edges_(number_of_sections + 1, 1), + is_constant_(true) + { + } /// @brief Number of columns /// /// When the grid dimensions are constant, the number of columns is 1. - size_t NumberOfColumns() const { + size_t NumberOfColumns() const + { return mid_points_.Size2(); } @@ -60,7 +67,8 @@ namespace tuvx { /// the grid for a single column. The total number of values stored by /// the grid would then be the number of grid sections times the number /// of columns. - size_t NumberOfSections() const { + size_t NumberOfSections() const + { return mid_points_.Size1(); } @@ -68,24 +76,28 @@ namespace tuvx { /// /// Grid edges are the boundaries of the grid sections. The number of /// grid edges is one more than the number of grid sections. - size_t NumberOfEdges() const { + size_t NumberOfEdges() const + { return edges_.Size1(); } /// @brief Units of the grid. - std::string Units() const { + std::string Units() const + { return units_; } /// @brief Check if the grid dimensions are constant across columns. - bool IsConstant() const { + bool IsConstant() const + { return is_constant_; } - private: + + private: /// Units of the grid. std::string units_; /// True if the grid dimensions are constant across columns. bool is_constant_; }; -} // namespace tuvx \ No newline at end of file +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/profile.hpp b/include/tuvx/profile.hpp index 790fadc2..55545c74 100644 --- a/include/tuvx/profile.hpp +++ b/include/tuvx/profile.hpp @@ -1,20 +1,22 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file Profile of a property on a grid. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once -#include - -#include #include +#include -namespace tuvx { +#include + +namespace tuvx +{ /// @brief Profile of a property on a grid. - template > - class Profile { - public: + template> + class Profile + { + public: /// Values at grid mid-points. ArrayPolicy mid_point_values_; /// Values at grid edges. @@ -28,19 +30,21 @@ namespace tuvx { /// @param grid Grid that the profile is defined on. template Profile(const std::string& units, size_t number_of_columns, const GridPolicy& grid) - : units_(units), - mid_point_values_(grid.mid_points_.Size1(), number_of_columns), - edge_values_(grid.edges_.Size1(), number_of_columns) {} + : units_(units), + mid_point_values_(grid.mid_points_.Size1(), number_of_columns), + edge_values_(grid.edges_.Size1(), number_of_columns) + { + } /// Units of the profile. - std::string Units() const { + std::string Units() const + { return units_; } - private: + private: /// Units of the profile. std::string units_; - }; -} // namespace tuvx \ No newline at end of file +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/radiative_transfer/radiation_field.hpp b/include/tuvx/radiative_transfer/radiation_field.hpp index efd72a8f..d570e1b7 100644 --- a/include/tuvx/radiative_transfer/radiation_field.hpp +++ b/include/tuvx/radiative_transfer/radiation_field.hpp @@ -1,23 +1,25 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file Radiation field vertically and wavelength resolved. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once -#include - -#include #include +#include + +#include -namespace tuvx { +namespace tuvx +{ /// @brief Radiation field components vertically and wavelength resolved. /// /// Data structures are designed to hold the radiation field components /// for a collection of columns in a 3D grid. /// Arrays are indexed by wavelength, vertical edge, and column. - template > - struct RadiationFieldComponents { + template> + struct RadiationFieldComponents + { /// Direct component of the radiation field. ArrayPolicy direct_; /// Upwelling component of the radiation field. @@ -30,19 +32,18 @@ namespace tuvx { /// @param vertical_grid Vertical grid. /// @param wavelength_grid Wavelength grid. template - RadiationFieldComponents(size_t number_of_columns, GridPolicy& vertical_grid, - GridPolicy& wavelength_grid) - : direct_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), - number_of_columns), - upwelling_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), - number_of_columns), - downwelling_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), - number_of_columns) {} + RadiationFieldComponents(size_t number_of_columns, GridPolicy& vertical_grid, GridPolicy& wavelength_grid) + : direct_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), number_of_columns), + upwelling_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), number_of_columns), + downwelling_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfEdges(), number_of_columns) + { + } }; /// @brief Radiation field vertically and wavelength resolved. - template >> - struct RadiationField { + template>> + struct RadiationField + { /// Total spectral irradiance. ComponentPolicy spectral_irradiance_; /// Total actinic flux. @@ -53,10 +54,11 @@ namespace tuvx { /// @param vertical_grid Vertical grid. /// @param wavelength_grid Wavelength grid. template - RadiationField(size_t number_of_columns, GridPolicy& vertical_grid, - GridPolicy& wavelength_grid) - : spectral_irradiance_(number_of_columns, vertical_grid, wavelength_grid), - actinic_flux_(number_of_columns, vertical_grid, wavelength_grid) {} + RadiationField(size_t number_of_columns, GridPolicy& vertical_grid, GridPolicy& wavelength_grid) + : spectral_irradiance_(number_of_columns, vertical_grid, wavelength_grid), + actinic_flux_(number_of_columns, vertical_grid, wavelength_grid) + { + } }; -} // namespace tuvx \ No newline at end of file +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/radiative_transfer/radiator.hpp b/include/tuvx/radiative_transfer/radiator.hpp index 8060982f..be8826e3 100644 --- a/include/tuvx/radiative_transfer/radiator.hpp +++ b/include/tuvx/radiative_transfer/radiator.hpp @@ -1,21 +1,25 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file Optically active atmospheric component +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + * + * Optically active atmospheric component + */ #pragma once -#include #include +#include -namespace tuvx { +namespace tuvx +{ /// @brief Optical properties of a radiative transfer component. /// /// The optical properties are represented by 3D arrays indexed by /// [column][wavelength][vertical layer]. - template > - class RadiatorState { - public: + template> + class RadiatorState + { + public: /// Layer optical depth (unitless) ArrayPolicy optical_depth_; /// Single scattering albedo (unitless) @@ -29,18 +33,18 @@ namespace tuvx { /// @param wavelength_grid Wavelength grid. template RadiatorState(size_t number_of_columns, GridPolicy& vertical_grid, GridPolicy& wavelength_grid) - : optical_depth_(wavelength_grid.NumberOfSections(), - vertical_grid.NumberOfSections(), number_of_columns), - single_scattering_albedo_(wavelength_grid.NumberOfSections(), - vertical_grid.NumberOfSections(), number_of_columns), - asymmetry_parameter_(wavelength_grid.NumberOfSections(), - vertical_grid.NumberOfSections(), number_of_columns) {} - + : optical_depth_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfSections(), number_of_columns), + single_scattering_albedo_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfSections(), number_of_columns), + asymmetry_parameter_(wavelength_grid.NumberOfSections(), vertical_grid.NumberOfSections(), number_of_columns) + { + } + /// @brief Accumulate a set of optical properties. /// @param states Vector of optical properties for individual optically active components. /// @return Accumulated optical properties. template - static RadiatorStatePolicy Accumulate(const std::vector& states) { + static RadiatorStatePolicy Accumulate(const std::vector& states) + { // [DEV NOTES] Placeholder for the RadiatorState::Accumulate method return states[0]; } @@ -48,4 +52,4 @@ namespace tuvx { // Placeholder for the Radiator class (if needed) -} // namespace tuvx \ No newline at end of file +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/radiative_transfer/solvers/delta_eddington.hpp b/include/tuvx/radiative_transfer/solvers/delta_eddington.hpp index 4bcc35b2..9bae0f08 100644 --- a/include/tuvx/radiative_transfer/solvers/delta_eddington.hpp +++ b/include/tuvx/radiative_transfer/solvers/delta_eddington.hpp @@ -1,25 +1,29 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file Delta-Eddington solver for radiative transfer. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + * + * Delta-Eddington solver for radiative transfer. + */ #pragma once -#include -#include -#include - #include #include #include #include -namespace tuvx { +#include +#include +#include + +namespace tuvx +{ /// @brief Radiative flux calculator that applies the delta-Eddington Approximation. /// /// [DEV NOTES] We can determine whether this should be a class or a set of functions - class DeltaEddington { - public: + class DeltaEddington + { + public: /// Construct a Delta-Eddington solver. DeltaEddington() = default; @@ -38,14 +42,20 @@ namespace tuvx { /// The original delta-Eddington paper is: /// Joseph and Wiscombe, J. Atmos. Sci., 33, 2453-2459, 1976 /// DOI: https://doi.org/10.1175/1520-0469(1976)033%3C2452:TDEAFR%3E2.0.CO;2 - template - void Solve(const std::vector& solar_zenith_angles, - const std::map& grids, - const std::map& profiles, - const RadiatorStatePolicy& accumulated_radiator_states, - RadiationFieldPolicy& radiation_field) const; + template< + typename T, + typename GridPolicy, + typename ProfilePolicy, + typename RadiatorStatePolicy, + typename RadiationFieldPolicy> + void Solve( + const std::vector& solar_zenith_angles, + const std::map& grids, + const std::map& profiles, + const RadiatorStatePolicy& accumulated_radiator_states, + RadiationFieldPolicy& radiation_field) const; }; -} // namespace tuvx +} // namespace tuvx #include "delta_eddington.inl" \ No newline at end of file diff --git a/include/tuvx/radiative_transfer/solvers/delta_eddington.inl b/include/tuvx/radiative_transfer/solvers/delta_eddington.inl index 1d0de7f7..d0d8375e 100644 --- a/include/tuvx/radiative_transfer/solvers/delta_eddington.inl +++ b/include/tuvx/radiative_transfer/solvers/delta_eddington.inl @@ -1,6 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 - +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ namespace tuvx { template diff --git a/include/tuvx/util/array2d.hpp b/include/tuvx/util/array2d.hpp index 55a9861f..ff8d6bd6 100644 --- a/include/tuvx/util/array2d.hpp +++ b/include/tuvx/util/array2d.hpp @@ -1,45 +1,80 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file 2D array with row-major storage. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include -namespace tuvx { +namespace tuvx +{ /// @brief 2D array with row-major storage. - template - class Array2D { - public: - Array2D() = default; + template + class Array2D + { + public: + Array2D() = default; - Array2D(size_t dim1, size_t dim2) - : dim1_(dim1), dim2_(dim2), data_(dim1 * dim2) {} + Array2D(size_t dim1, size_t dim2) + : dim1_(dim1), + dim2_(dim2), + data_(dim1 * dim2) + { + } - T &operator()(size_t i, size_t j) { return data_[index(i, j)]; } + T &operator()(size_t i, size_t j) + { + return data_[index(i, j)]; + } - const T &operator()(size_t i, size_t j) const { - return data_[index(i, j)]; - } + const T &operator()(size_t i, size_t j) const + { + return data_[index(i, j)]; + } - size_t Size1() const { return dim1_; } - size_t Size2() const { return dim2_; } + size_t Size1() const + { + return dim1_; + } + size_t Size2() const + { + return dim2_; + } - typename std::vector::iterator begin() { return data_.begin(); } - typename std::vector::iterator end() { return data_.end(); } - typename std::vector::const_iterator begin() const { - return data_.begin(); - } - typename std::vector::const_iterator end() const { return data_.end(); } + typename std::vector::iterator begin() + { + return data_.begin(); + } + typename std::vector::iterator end() + { + return data_.end(); + } + typename std::vector::const_iterator begin() const + { + return data_.begin(); + } + typename std::vector::const_iterator end() const + { + return data_.end(); + } - std::vector &AsVector() { return data_; } - const std::vector &AsVector() const { return data_; } + std::vector &AsVector() + { + return data_; + } + const std::vector &AsVector() const + { + return data_; + } - private: - size_t index(size_t i, size_t j) const { return i * dim2_ + j; } + private: + size_t index(size_t i, size_t j) const + { + return i * dim2_ + j; + } - size_t dim1_, dim2_; - std::vector data_; + size_t dim1_, dim2_; + std::vector data_; }; -} // namespace tuvx \ No newline at end of file +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/util/array3d.hpp b/include/tuvx/util/array3d.hpp index c50d0538..46c43f7e 100644 --- a/include/tuvx/util/array3d.hpp +++ b/include/tuvx/util/array3d.hpp @@ -1,54 +1,92 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -/// @file 3D array with row-major storage. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include #include -namespace tuvx { - -/// @brief 3D array with row-major storage. -template class Array3D { -public: - Array3D() = default; - - Array3D(size_t dim1, size_t dim2, size_t dim3) - : dim1_(dim1), dim2_(dim2), dim3_(dim3), data_(dim1 * dim2 * dim3) {} - - T &operator()(size_t i, size_t j, size_t k) { return data_[index(i, j, k)]; } - - const T &operator()(size_t i, size_t j, size_t k) const { - return data_[index(i, j, k)]; - } - - size_t Size1() const { return dim1_; } - - size_t Size2() const { return dim2_; } - - size_t Size3() const { return dim3_; } - - typename std::vector::iterator begin() { return data_.begin(); } - - typename std::vector::iterator end() { return data_.end(); } - - typename std::vector::const_iterator begin() const { - return data_.begin(); - } - - typename std::vector::const_iterator end() const { return data_.end(); } - - std::vector &AsVector() { return data_; } - const std::vector &AsVector() const { return data_; } - -private: - size_t index(size_t i, size_t j, size_t k) const { - return i * dim2_ * dim3_ + j * dim3_ + k; - } - - size_t dim1_, dim2_, dim3_; - std::vector data_; -}; - -} // namespace tuvx \ No newline at end of file +namespace tuvx +{ + + /// @brief 3D array with row-major storage. + template + class Array3D + { + public: + Array3D() = default; + + Array3D(size_t dim1, size_t dim2, size_t dim3) + : dim1_(dim1), + dim2_(dim2), + dim3_(dim3), + data_(dim1 * dim2 * dim3) + { + } + + T &operator()(size_t i, size_t j, size_t k) + { + return data_[index(i, j, k)]; + } + + const T &operator()(size_t i, size_t j, size_t k) const + { + return data_[index(i, j, k)]; + } + + size_t Size1() const + { + return dim1_; + } + + size_t Size2() const + { + return dim2_; + } + + size_t Size3() const + { + return dim3_; + } + + typename std::vector::iterator begin() + { + return data_.begin(); + } + + typename std::vector::iterator end() + { + return data_.end(); + } + + typename std::vector::const_iterator begin() const + { + return data_.begin(); + } + + typename std::vector::const_iterator end() const + { + return data_.end(); + } + + std::vector &AsVector() + { + return data_; + } + const std::vector &AsVector() const + { + return data_; + } + + private: + size_t index(size_t i, size_t j, size_t k) const + { + return i * dim2_ * dim3_ + j * dim3_ + k; + } + + size_t dim1_, dim2_, dim3_; + std::vector data_; + }; + +} // namespace tuvx \ No newline at end of file diff --git a/include/tuvx/util/config_yaml.h b/include/tuvx/util/config_yaml.h index 7fcd6111..a14a1dd9 100644 --- a/include/tuvx/util/config_yaml.h +++ b/include/tuvx/util/config_yaml.h @@ -1,284 +1,291 @@ -// Copyright (C) 2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include #ifdef __cplusplus -#include + #include -extern "C" { +extern "C" +{ typedef YAML::Node Yaml; typedef YAML::iterator YamlIterator; #endif -/// @brief Interoperatble string type -struct string_t { - char* ptr_; - int size_; -}; - -/// @brief Interoperable array type for strings -struct string_array_t { - string_t* ptr_; - int size_; -}; - -/// @brief Interoperable array type for doubles -struct double_array_t { - double* ptr_; - int size_; -}; - -/// @brief Interoperable array type for YAML nodes -struct node_array_t { - Yaml** ptr_; - int size_; -}; - -/// @brief Creates a YAML node from a string -/// @param yaml_string YAML in string form -/// @return pointer to the new YAML node -Yaml* yaml_create_from_string(const char* yaml_string); - -/// @brief Creates a YAML node from a YAML file -/// @param file_path path to the YAML file -/// @return pointer to the new YAML node -Yaml* yaml_create_from_file(const char* file_path); - -/// @brief Outputs a YAML node to a file -/// @param node YAML node to output -/// @param file_path path to file to create (any existing file will be overwritten) -void yaml_to_file(Yaml* node, const char* file_path); - -/// @brief Returns the number of child elements in the node -/// This works for vectors and maps -/// @param node YAML node to return size of -/// @return number of node elements -int yaml_size(Yaml* node); - -/// @brief Returns an iterator to the first child node -/// @param node YAML node to iterate over -/// @return beginning iterator -YamlIterator* yaml_begin(Yaml* node); - -/// @brief Returns an iterator to one element past the last child node -/// @param node YAML node to iterator over -/// @return ending iterator -YamlIterator* yaml_end(Yaml* node); - -/// @brief Increments a YAML iterator -/// @param iter YAML iterator to increment -/// @param end YAML iterator one element past end -/// @return true if incremented iter < end, false otherwise -bool yaml_increment(YamlIterator* iter, YamlIterator* end); - -/// @brief Checks if a YAML iterator is at the end -/// @param iter YAML iterator to check -/// @param end YAML iterator one element past end -/// @return true if iter == end, false otherwise -bool yaml_at_end(YamlIterator* iter, YamlIterator* end); - -/// @brief Returns the key associated with a YAML iterator -/// @param iter YAML iterator to return key for -/// @return key as a c string -string_t yaml_key(YamlIterator* iter); - -/// @brief Returns a sub-node -/// @param node parent YAML node -/// @param key key to find -/// @param found true if successful, false otherwise -/// @return sub-node -Yaml* yaml_get_node(Yaml* node, const char* key, bool& found); - -/// @brief Gets a string from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return Pointer to string as const char array -string_t yaml_get_string(Yaml* node, const char* key, bool& found); - -/// @brief Gets an integer from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return integer value -int yaml_get_int(Yaml* node, const char* key, bool& found); - -/// @brief Gets a float from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return float value -float yaml_get_float(Yaml* node, const char* key, bool& found); - -/// @brief Gets a double from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return double value -double yaml_get_double(Yaml* node, const char* key, bool& found); - -/// @brief Gets a boolean from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return boolean value -bool yaml_get_bool(Yaml* node, const char* key, bool& found); - -/// @brief Gets an array of strings from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return string array -string_array_t yaml_get_string_array(Yaml* node, const char* key, bool& found); - -/// @brief Gets an array of doubles from a YAML node -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return double array -double_array_t yaml_get_double_array(Yaml* node, const char* key, bool& found); - -/// @brief Gets an array of YAML nodes from a YAML node -/// @details It is expected that the caller takes ownership of the individual -/// pointers to YAML nodes in the array -/// @param node YAML node -/// @param key key to search for -/// @param found true if successful, false otherwise -/// @return node array -node_array_t yaml_get_node_array(Yaml* node, const char* key, bool& found); - -/// @brief Gets a node from a YAML iterator -/// @param iter YAML iterator -/// @return YAML node -Yaml* yaml_get_node_from_iterator(YamlIterator* iter); - -/// @brief Gets a string from a YAML iterator -/// @param iter YAML iterator -/// @return string as a c string -string_t yaml_get_string_from_iterator(YamlIterator* iter); - -/// @brief Gets an int from a YAML iterator -/// @param iter YAML iterator -/// @return integer value -int yaml_get_int_from_iterator(YamlIterator* iter); - -/// @brief Gets a float from a YAML iterator -/// @param iter YAML iterator -/// @return float value -float yaml_get_float_from_iterator(YamlIterator* iter); - -/// @brief Gets a double from a YAML iterator -/// @param iter YAML iterator -/// @return double value -double yaml_get_double_from_iterator(YamlIterator* iter); - -/// @brief Gets a boolean from a YAML iterator -/// @param iter YAML iterator -/// @return boolean value -bool yaml_get_bool_from_iterator(YamlIterator* iter); - -/// @brief Gets an array of strings from a YAML iterator -/// @param iter YAML iterator -/// @return string array -string_array_t yaml_get_string_array_from_iterator(YamlIterator* iter); - -/// @brief Adds a YAML node to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value YAML node to add -void yaml_add_node(Yaml* node, const char* key, Yaml* value); - -/// @brief Adds a string to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value string to add -void yaml_add_string(Yaml* node, const char* key, const char* value); - -/// @brief Adds an int to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value integer to add -void yaml_add_int(Yaml* node, const char* key, int value); - -/// @brief Adds a float to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value float to add -void yaml_add_float(Yaml* node, const char* key, float value); - -/// @brief Adds a double to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value double to add -void yaml_add_double(Yaml* node, const char* key, double value); - -/// @brief Adds a boolean to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value boolean to add -void yaml_add_bool(Yaml* node, const char* key, bool value); - -/// @brief Adds an array of strings to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value string array to add -void yaml_add_string_array(Yaml* node, const char* key, string_array_t value); - -/// @brief Adds an array of doubles to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value double array to add -void yaml_add_double_array(Yaml* node, const char* key, double_array_t value); - -/// @brief Adds an array of YAML nodes to a YAML node -/// @param node YAML node -/// @param key key to apply value to -/// @param value node array to add -void yaml_add_node_array(Yaml* node, const char* key, node_array_t value); - -/// @brief Copies a YAML node -/// @param node YAML node to copy -/// @return pointer to the new YAML node -Yaml* yaml_copy_node(Yaml* node); - -/// @brief Copies a YAML node to a string -/// @param node YAML node to copy -/// @return pointer to the new string -string_t yaml_to_string(Yaml* node); - -/// @brief Merges one YAML node into another -/// @param dest destination YAML node -/// @param src source YAML node -/// @return true if successful, false otherwise -bool yaml_merge_node(Yaml* dest, const Yaml* src); - -/// @brief Cleans up memory for a YAML node -/// @param ptr Node pointer to free memory for -void yaml_delete_node(Yaml* ptr); - -/// @brief Cleans up memory for a char array -/// @param string String to free memory for -void yaml_delete_string(string_t string); - -/// @brief Cleans up memory for an array of strings -/// @param array array to free memory for -void yaml_delete_string_array(string_array_t array); - -/// @brief Cleans up memory for an array of doubles -/// @param array array to free memory for -void yaml_delete_double_array(double_array_t array); - -/// @brief Cleans up memory for an array of YAML nodes -/// @details It is expected that the caller retains ownership of the -/// individual node pointers in the array -/// @param array array to free memory for -void yaml_delete_node_array(node_array_t array); - -/// @brief Cleans up memory for a YAML iterator -/// @param ptr Iterator to free memory for -void yaml_delete_iterator(YamlIterator* ptr); + /// @brief Interoperatble string type + struct string_t + { + char* ptr_; + int size_; + }; + + /// @brief Interoperable array type for strings + struct string_array_t + { + string_t* ptr_; + int size_; + }; + + /// @brief Interoperable array type for doubles + struct double_array_t + { + double* ptr_; + int size_; + }; + + /// @brief Interoperable array type for YAML nodes + struct node_array_t + { + Yaml** ptr_; + int size_; + }; + + /// @brief Creates a YAML node from a string + /// @param yaml_string YAML in string form + /// @return pointer to the new YAML node + Yaml* yaml_create_from_string(const char* yaml_string); + + /// @brief Creates a YAML node from a YAML file + /// @param file_path path to the YAML file + /// @return pointer to the new YAML node + Yaml* yaml_create_from_file(const char* file_path); + + /// @brief Outputs a YAML node to a file + /// @param node YAML node to output + /// @param file_path path to file to create (any existing file will be overwritten) + void yaml_to_file(Yaml* node, const char* file_path); + + /// @brief Returns the number of child elements in the node + /// This works for vectors and maps + /// @param node YAML node to return size of + /// @return number of node elements + int yaml_size(Yaml* node); + + /// @brief Returns an iterator to the first child node + /// @param node YAML node to iterate over + /// @return beginning iterator + YamlIterator* yaml_begin(Yaml* node); + + /// @brief Returns an iterator to one element past the last child node + /// @param node YAML node to iterator over + /// @return ending iterator + YamlIterator* yaml_end(Yaml* node); + + /// @brief Increments a YAML iterator + /// @param iter YAML iterator to increment + /// @param end YAML iterator one element past end + /// @return true if incremented iter < end, false otherwise + bool yaml_increment(YamlIterator* iter, YamlIterator* end); + + /// @brief Checks if a YAML iterator is at the end + /// @param iter YAML iterator to check + /// @param end YAML iterator one element past end + /// @return true if iter == end, false otherwise + bool yaml_at_end(YamlIterator* iter, YamlIterator* end); + + /// @brief Returns the key associated with a YAML iterator + /// @param iter YAML iterator to return key for + /// @return key as a c string + string_t yaml_key(YamlIterator* iter); + + /// @brief Returns a sub-node + /// @param node parent YAML node + /// @param key key to find + /// @param found true if successful, false otherwise + /// @return sub-node + Yaml* yaml_get_node(Yaml* node, const char* key, bool& found); + + /// @brief Gets a string from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return Pointer to string as const char array + string_t yaml_get_string(Yaml* node, const char* key, bool& found); + + /// @brief Gets an integer from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return integer value + int yaml_get_int(Yaml* node, const char* key, bool& found); + + /// @brief Gets a float from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return float value + float yaml_get_float(Yaml* node, const char* key, bool& found); + + /// @brief Gets a double from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return double value + double yaml_get_double(Yaml* node, const char* key, bool& found); + + /// @brief Gets a boolean from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return boolean value + bool yaml_get_bool(Yaml* node, const char* key, bool& found); + + /// @brief Gets an array of strings from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return string array + string_array_t yaml_get_string_array(Yaml* node, const char* key, bool& found); + + /// @brief Gets an array of doubles from a YAML node + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return double array + double_array_t yaml_get_double_array(Yaml* node, const char* key, bool& found); + + /// @brief Gets an array of YAML nodes from a YAML node + /// @details It is expected that the caller takes ownership of the individual + /// pointers to YAML nodes in the array + /// @param node YAML node + /// @param key key to search for + /// @param found true if successful, false otherwise + /// @return node array + node_array_t yaml_get_node_array(Yaml* node, const char* key, bool& found); + + /// @brief Gets a node from a YAML iterator + /// @param iter YAML iterator + /// @return YAML node + Yaml* yaml_get_node_from_iterator(YamlIterator* iter); + + /// @brief Gets a string from a YAML iterator + /// @param iter YAML iterator + /// @return string as a c string + string_t yaml_get_string_from_iterator(YamlIterator* iter); + + /// @brief Gets an int from a YAML iterator + /// @param iter YAML iterator + /// @return integer value + int yaml_get_int_from_iterator(YamlIterator* iter); + + /// @brief Gets a float from a YAML iterator + /// @param iter YAML iterator + /// @return float value + float yaml_get_float_from_iterator(YamlIterator* iter); + + /// @brief Gets a double from a YAML iterator + /// @param iter YAML iterator + /// @return double value + double yaml_get_double_from_iterator(YamlIterator* iter); + + /// @brief Gets a boolean from a YAML iterator + /// @param iter YAML iterator + /// @return boolean value + bool yaml_get_bool_from_iterator(YamlIterator* iter); + + /// @brief Gets an array of strings from a YAML iterator + /// @param iter YAML iterator + /// @return string array + string_array_t yaml_get_string_array_from_iterator(YamlIterator* iter); + + /// @brief Adds a YAML node to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value YAML node to add + void yaml_add_node(Yaml* node, const char* key, Yaml* value); + + /// @brief Adds a string to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value string to add + void yaml_add_string(Yaml* node, const char* key, const char* value); + + /// @brief Adds an int to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value integer to add + void yaml_add_int(Yaml* node, const char* key, int value); + + /// @brief Adds a float to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value float to add + void yaml_add_float(Yaml* node, const char* key, float value); + + /// @brief Adds a double to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value double to add + void yaml_add_double(Yaml* node, const char* key, double value); + + /// @brief Adds a boolean to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value boolean to add + void yaml_add_bool(Yaml* node, const char* key, bool value); + + /// @brief Adds an array of strings to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value string array to add + void yaml_add_string_array(Yaml* node, const char* key, string_array_t value); + + /// @brief Adds an array of doubles to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value double array to add + void yaml_add_double_array(Yaml* node, const char* key, double_array_t value); + + /// @brief Adds an array of YAML nodes to a YAML node + /// @param node YAML node + /// @param key key to apply value to + /// @param value node array to add + void yaml_add_node_array(Yaml* node, const char* key, node_array_t value); + + /// @brief Copies a YAML node + /// @param node YAML node to copy + /// @return pointer to the new YAML node + Yaml* yaml_copy_node(Yaml* node); + + /// @brief Copies a YAML node to a string + /// @param node YAML node to copy + /// @return pointer to the new string + string_t yaml_to_string(Yaml* node); + + /// @brief Merges one YAML node into another + /// @param dest destination YAML node + /// @param src source YAML node + /// @return true if successful, false otherwise + bool yaml_merge_node(Yaml* dest, const Yaml* src); + + /// @brief Cleans up memory for a YAML node + /// @param ptr Node pointer to free memory for + void yaml_delete_node(Yaml* ptr); + + /// @brief Cleans up memory for a char array + /// @param string String to free memory for + void yaml_delete_string(string_t string); + + /// @brief Cleans up memory for an array of strings + /// @param array array to free memory for + void yaml_delete_string_array(string_array_t array); + + /// @brief Cleans up memory for an array of doubles + /// @param array array to free memory for + void yaml_delete_double_array(double_array_t array); + + /// @brief Cleans up memory for an array of YAML nodes + /// @details It is expected that the caller retains ownership of the + /// individual node pointers in the array + /// @param array array to free memory for + void yaml_delete_node_array(node_array_t array); + + /// @brief Cleans up memory for a YAML iterator + /// @param ptr Iterator to free memory for + void yaml_delete_iterator(YamlIterator* ptr); #ifdef __cplusplus } diff --git a/src/util/config.cpp b/src/util/config.cpp index 19f3f748..589854e3 100644 --- a/src/util/config.cpp +++ b/src/util/config.cpp @@ -1,9 +1,13 @@ -// Copyright (C) 2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 +/* Copyright (C) 2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include + #include -#include + #include +#include Yaml* yaml_create_from_string(const char* yaml_string) { @@ -68,7 +72,8 @@ string_t yaml_get_string(Yaml* node, const char* key, bool& found) { found = (*node)[key].IsDefined(); string_t string; - if (found) { + if (found) + { std::string str = (*node)[key].as(); string.size_ = str.length(); string.ptr_ = new char[string.size_ + 1]; @@ -83,28 +88,32 @@ string_t yaml_get_string(Yaml* node, const char* key, bool& found) int yaml_get_int(Yaml* node, const char* key, bool& found) { found = (*node)[key].IsDefined(); - if (found) return (*node)[key].as(); + if (found) + return (*node)[key].as(); return 0; } float yaml_get_float(Yaml* node, const char* key, bool& found) { found = (*node)[key].IsDefined(); - if (found) return (*node)[key].as(); + if (found) + return (*node)[key].as(); return 0.0f; } double yaml_get_double(Yaml* node, const char* key, bool& found) { found = (*node)[key].IsDefined(); - if (found) return (*node)[key].as(); + if (found) + return (*node)[key].as(); return 0.0; } bool yaml_get_bool(Yaml* node, const char* key, bool& found) { found = (*node)[key].IsDefined(); - if (found) return (*node)[key].as(); + if (found) + return (*node)[key].as(); return false; } @@ -115,14 +124,15 @@ string_array_t yaml_get_string_array(Yaml* node, const char* key, bool& found) array.ptr_ = nullptr; YAML::Node array_node = (*node)[key]; found = array_node.IsDefined(); - if (!found) return array; + if (!found) + return array; array.size_ = array_node.size(); - array.ptr_ = new string_t[ array.size_ ]; + array.ptr_ = new string_t[array.size_]; for (std::size_t i = 0; i < array_node.size(); ++i) { std::string str = array_node[i].as(); array.ptr_[i].size_ = str.length(); - array.ptr_[i].ptr_ = new char[ str.length() + 1 ]; + array.ptr_[i].ptr_ = new char[str.length() + 1]; strcpy(array.ptr_[i].ptr_, str.c_str()); } return array; @@ -135,9 +145,10 @@ double_array_t yaml_get_double_array(Yaml* node, const char* key, bool& found) array.ptr_ = nullptr; YAML::Node array_node = (*node)[key]; found = array_node.IsDefined(); - if (!found) return array; + if (!found) + return array; array.size_ = array_node.size(); - array.ptr_ = new double[ array.size_ ]; + array.ptr_ = new double[array.size_]; for (std::size_t i = 0; i < array_node.size(); ++i) { array.ptr_[i] = array_node[i].as(); @@ -152,9 +163,10 @@ node_array_t yaml_get_node_array(Yaml* node, const char* key, bool& found) array.ptr_ = nullptr; YAML::Node array_node = (*node)[key]; found = array_node.IsDefined(); - if (!found) return array; + if (!found) + return array; array.size_ = array_node.size(); - array.ptr_ = new YAML::Node*[ array.size_ ]; + array.ptr_ = new YAML::Node*[array.size_]; for (std::size_t i = 0; i < array_node.size(); ++i) { array.ptr_[i] = new YAML::Node(array_node[i].as()); @@ -202,12 +214,12 @@ string_array_t yaml_get_string_array_from_iterator(YamlIterator* iter) string_array_t array; YAML::Node array_node = (*iter)->IsDefined() ? (*iter)->as() : (*iter)->second.as(); array.size_ = array_node.size(); - array.ptr_ = new string_t[ array.size_ ]; + array.ptr_ = new string_t[array.size_]; for (std::size_t i = 0; i < array_node.size(); ++i) { std::string str = array_node[i].as(); array.ptr_[i].size_ = str.length(); - array.ptr_[i].ptr_ = new char[ str.length() + 1 ]; + array.ptr_[i].ptr_ = new char[str.length() + 1]; strcpy(array.ptr_[i].ptr_, str.c_str()); } return array; @@ -291,14 +303,16 @@ string_t yaml_to_string(Yaml* node) bool yaml_merge_node(Yaml* node, const Yaml* other) { - if (!node->IsMap() || !other->IsMap()) return false; - for(YAML::const_iterator it=(*other).begin(); it!=(*other).end(); ++it) + if (!node->IsMap() || !other->IsMap()) + return false; + for (YAML::const_iterator it = (*other).begin(); it != (*other).end(); ++it) { std::string key = it->first.as(); if ((*node)[key].IsDefined() && (*node)[key].IsMap() && it->second.IsMap()) { Yaml subnode = (*node)[key]; - if (!yaml_merge_node(&subnode, &it->second)) return false; + if (!yaml_merge_node(&subnode, &it->second)) + return false; (*node)[key] = subnode; } else @@ -320,27 +334,28 @@ void yaml_delete_node(Yaml* ptr) void yaml_delete_string(string_t string) { - delete [] string.ptr_; + delete[] string.ptr_; } void yaml_delete_string_array(string_array_t array) { - if (!array.ptr_) return; + if (!array.ptr_) + return; for (std::size_t i = 0; i < array.size_; ++i) { - delete [] array.ptr_[i].ptr_; + delete[] array.ptr_[i].ptr_; } - delete [] array.ptr_; + delete[] array.ptr_; } void yaml_delete_double_array(double_array_t array) { - delete [] array.ptr_; + delete[] array.ptr_; } void yaml_delete_node_array(node_array_t array) { - delete [] array.ptr_; + delete[] array.ptr_; } void yaml_delete_iterator(YamlIterator* ptr) diff --git a/test/regression/solvers/delta_eddington.cpp b/test/regression/solvers/delta_eddington.cpp index fa30478a..e482834e 100644 --- a/test/regression/solvers/delta_eddington.cpp +++ b/test/regression/solvers/delta_eddington.cpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::DeltaEddington. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include "delta_eddington.hpp" diff --git a/test/regression/solvers/delta_eddington.hpp b/test/regression/solvers/delta_eddington.hpp index c08a220d..d3807279 100644 --- a/test/regression/solvers/delta_eddington.hpp +++ b/test/regression/solvers/delta_eddington.hpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::DeltaEddington. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include diff --git a/test/unit/grid.cpp b/test/unit/grid.cpp index 8d744366..70d22aaa 100644 --- a/test/unit/grid.cpp +++ b/test/unit/grid.cpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::Grid. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include diff --git a/test/unit/profile.cpp b/test/unit/profile.cpp index 94431fc5..f4da1716 100644 --- a/test/unit/profile.cpp +++ b/test/unit/profile.cpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::Profile. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include diff --git a/test/unit/util/array2d.cpp b/test/unit/util/array2d.cpp index c1bf18db..30288725 100644 --- a/test/unit/util/array2d.cpp +++ b/test/unit/util/array2d.cpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::Array2D. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include diff --git a/test/unit/util/array3d.cpp b/test/unit/util/array3d.cpp index 4c64ecaf..bdb4aedd 100644 --- a/test/unit/util/array3d.cpp +++ b/test/unit/util/array3d.cpp @@ -1,7 +1,7 @@ -// Copyright (C) 2023-2024 National Center for Atmospheric Research -// SPDX-License-Identifier: Apache-2.0 -// -// Tests for tuvx::Array3D. +/* Copyright (C) 2023-2024 National Center for Atmospheric Research + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include