Skip to content

Commit

Permalink
Auto-format code changes (#597)
Browse files Browse the repository at this point in the history
Auto-format code using Clang-Format

Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
github-actions[bot] and actions-user authored Jul 9, 2024
1 parent 8c318b8 commit 46d0a74
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 213 deletions.
1 change: 1 addition & 0 deletions include/micm/solver/solver_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace micm
public:
using DenseMatrixPolicyType = DenseMatrixPolicy;
using SparseMatrixPolicyType = SparseMatrixPolicy;

protected:
SolverParametersPolicy options_;
System system_;
Expand Down
366 changes: 187 additions & 179 deletions test/integration/analytical_policy.hpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/integration/analytical_surface_rxn_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

template<class BuilderPolicy, class StateType = micm::State<>>
void test_analytical_surface_rxn(
BuilderPolicy& builder,
double tolerance = 1e-8,
std::function<void(StateType&)> prepare_for_solve = [](StateType& state){},
std::function<void(StateType&)> postpare_for_solve = [](StateType& state){})
BuilderPolicy& builder,
double tolerance = 1e-8,
std::function<void(StateType&)> prepare_for_solve = [](StateType& state) {},
std::function<void(StateType&)> postpare_for_solve = [](StateType& state) {})
{
// parameters, from CAMP/test/unit_rxn_data/test_rxn_surface.F90
const double mode_GMD = 1.0e-6; // mode geometric mean diameter [m]
Expand Down
14 changes: 9 additions & 5 deletions test/integration/cuda/test_cuda_analytical_rosenbrock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,16 @@ TEST(AnalyticalExamplesCudaRosenbrock, BranchedSuperStiffButAnalytical)

TEST(AnalyticalExamplesCudaRosenbrock, Robertson)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-10;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
return builderType(params);
};

auto solver = rosenbrock_solver(micm::RosenbrockSolverParameters::TwoStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1, copy_to_device, copy_to_host);

solver = rosenbrock_solver(micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1, copy_to_device, copy_to_host);

Expand All @@ -167,7 +168,8 @@ TEST(AnalyticalExamplesCudaRosenbrock, SurfaceRxn)

TEST(AnalyticalExamplesCudaRosenbrock, E5)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-13;
params.absolute_tolerance_ = std::vector<double>(6, 1e-17);
// this paper https://archimede.uniba.it/~testset/report/e5.pdf
Expand Down Expand Up @@ -197,7 +199,8 @@ TEST(AnalyticalExamplesCudaRosenbrock, E5)

TEST(AnalyticalExamplesCudaRosenbrock, Oregonator)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
// anything below 1e-6 is too strict for the Oregonator
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
Expand All @@ -222,7 +225,8 @@ TEST(AnalyticalExamplesCudaRosenbrock, Oregonator)

TEST(AnalyticalExamplesCudaRosenbrock, HIRES)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(8, params.relative_tolerance_ * 1e-2);
return builderType(params);
Expand Down
16 changes: 10 additions & 6 deletions test/integration/jit/test_jit_analytical_rosenbrock.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "../analytical_policy.hpp"
#include "../analytical_surface_rxn_policy.hpp"

#include <micm/jit/solver/jit_linear_solver.hpp>
#include <micm/jit/solver/jit_solver_builder.hpp>
#include <micm/jit/solver/jit_solver_parameters.hpp>
#include <micm/jit/solver/jit_linear_solver.hpp>
#include <micm/solver/rosenbrock_solver_parameters.hpp>

#include <gtest/gtest.h>
Expand Down Expand Up @@ -127,15 +127,16 @@ TEST(AnalyticalExamplesJitRosenbrock, BranchedSuperStiffButAnalytical)

TEST(AnalyticalExamplesJitRosenbrock, Robertson)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-10;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
return builderType(params);
};

auto solver = rosenbrock_solver(micm::RosenbrockSolverParameters::TwoStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1);

solver = rosenbrock_solver(micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1);

Expand All @@ -160,7 +161,8 @@ TEST(AnalyticalExamplesJitRosenbrock, SurfaceRxn)

TEST(AnalyticalExamplesJitRosenbrock, E5)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-13;
params.absolute_tolerance_ = std::vector<double>(6, 1e-17);
// this paper https://archimede.uniba.it/~testset/report/e5.pdf
Expand Down Expand Up @@ -190,7 +192,8 @@ TEST(AnalyticalExamplesJitRosenbrock, E5)

TEST(AnalyticalExamples, Oregonator)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
// anything below 1e-6 is too strict for the Oregonator
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
Expand All @@ -215,7 +218,8 @@ TEST(AnalyticalExamples, Oregonator)

TEST(AnalyticalExamples, HIRES)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(8, params.relative_tolerance_ * 1e-2);
return builderType(params);
Expand Down
14 changes: 9 additions & 5 deletions test/integration/test_analytical_rosenbrock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ TEST(AnalyticalExamples, BranchedSuperStiffButAnalytical)

TEST(AnalyticalExamples, Robertson)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-10;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
return builderType(params);
};

auto solver = rosenbrock_solver(micm::RosenbrockSolverParameters::TwoStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1);

solver = rosenbrock_solver(micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters());
test_analytical_robertson<builderType, stateType>(solver, 2e-1);

Expand All @@ -155,7 +156,8 @@ TEST(AnalyticalExamples, Robertson)

TEST(AnalyticalExamples, E5)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-13;
params.absolute_tolerance_ = std::vector<double>(6, 1e-17);
// this paper https://archimede.uniba.it/~testset/report/e5.pdf
Expand Down Expand Up @@ -185,7 +187,8 @@ TEST(AnalyticalExamples, E5)

TEST(AnalyticalExamples, Oregonator)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
// anything below 1e-6 is too strict for the Oregonator
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(5, params.relative_tolerance_ * 1e-2);
Expand Down Expand Up @@ -219,7 +222,8 @@ TEST(AnalyticalExamples, SurfaceRxn)

TEST(AnalyticalExamples, HIRESConfig)
{
auto rosenbrock_solver = [](auto params) {
auto rosenbrock_solver = [](auto params)
{
params.relative_tolerance_ = 1e-6;
params.absolute_tolerance_ = std::vector<double>(8, params.relative_tolerance_ * 1e-2);
return micm::CpuSolverBuilder<micm::RosenbrockSolverParameters>(params);
Expand Down
17 changes: 7 additions & 10 deletions test/unit/cuda/solver/test_cuda_solver_builder.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include <micm/cuda/solver/cuda_solver_builder.hpp>
#include <micm/cuda/solver/cuda_solver_parameters.hpp>
#include <micm/solver/backward_euler.hpp>
#include <micm/solver/rosenbrock.hpp>
#include <micm/solver/rosenbrock_solver_parameters.hpp>

#include <micm/cuda/solver/cuda_solver_builder.hpp>
#include <micm/cuda/solver/cuda_solver_parameters.hpp>

#include <micm/solver/solver_builder.hpp>
#include <micm/util/matrix.hpp>
#include <micm/util/sparse_matrix.hpp>
Expand Down Expand Up @@ -40,14 +38,13 @@ namespace
std::vector<micm::Process> reactions = { r1, r2 };
} // namespace


TEST(SolverBuilder, CanBuildCudaSolvers)
{
constexpr std::size_t L = 4;
auto cuda_rosenbrock = micm::CudaSolverBuilder<micm::CudaRosenbrockSolverParameters, L>(
micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters())
.SetSystem(the_system)
.SetReactions(reactions)
.SetNumberOfGridCells(L)
.Build();
micm::RosenbrockSolverParameters::ThreeStageRosenbrockParameters())
.SetSystem(the_system)
.SetReactions(reactions)
.SetNumberOfGridCells(L)
.Build();
}
6 changes: 2 additions & 4 deletions test/unit/jit/solver/test_jit_solver_builder.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include <micm/jit/solver/jit_solver_builder.hpp>
#include <micm/jit/solver/jit_solver_parameters.hpp>
#include <micm/solver/backward_euler.hpp>
#include <micm/solver/rosenbrock.hpp>
#include <micm/solver/rosenbrock_solver_parameters.hpp>

#include <micm/jit/solver/jit_solver_builder.hpp>
#include <micm/jit/solver/jit_solver_parameters.hpp>

#include <micm/solver/solver_builder.hpp>
#include <micm/util/matrix.hpp>
#include <micm/util/sparse_matrix.hpp>
Expand Down

0 comments on commit 46d0a74

Please sign in to comment.