-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
477 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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,26 @@ | ||
--- | ||
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: 150 | ||
IndentWidth: 2 | ||
IndentPPDirectives: AfterHash | ||
NamespaceIndentation: All | ||
PackConstructorInitializers: 'Never' | ||
SpaceAfterTemplateKeyword: 'false' | ||
SpaceBeforeCtorInitializerColon: 'true' | ||
SpaceBeforeInheritanceColon: 'true' | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: 'true' | ||
SpaceInEmptyBlock: true | ||
Standard: 'Latest' |
This file contains 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,58 @@ | ||
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 | ||
|
||
- name: Check out code, run clang format, push changes | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Format code | ||
run: | | ||
find include -type f \( -name '*.hpp' -o -name '*.h' \) -exec clang-format -i --style=file {} + | ||
find src -type f \( -name '*.cu' -o -name '*.hpp' -o -name '*.h' -o -name '*.cpp' \) -exec clang-format -i --style=file {} + | ||
find test -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.cpp' \) ! -path 'test/tutorial/*' -exec clang-format -i --style=file {} + | ||
- 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 | ||
# a failue of this step means changes were detected | ||
if: steps.check-changes.outcome != 'success' | ||
run: | | ||
git push origin HEAD:main-formatting | ||
- name: Create Pull Request | ||
# a failue of this step means changes were detected | ||
if: steps.check-changes.outcome != 'success' | ||
uses: peter-evans/create-pull-request@v3 | ||
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" |
This file contains 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 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,71 @@ | ||
// Copyright (C) 2023-2024 National Center for Atmospheric Research, University of Illinois at Urbana-Champaign | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace open_atmos | ||
{ | ||
namespace validation | ||
{ | ||
struct Keys | ||
{ | ||
const std::string version = "version"; | ||
const std::string name = "name"; | ||
|
||
// Configuration | ||
const std::string species = "species"; | ||
const std::string phases = "phases"; | ||
const std::string reactions = "reactions"; | ||
|
||
// Species | ||
const std::string tracer_type = "tracer type"; | ||
const std::string absolute_tolerance = "absolute tolerance"; | ||
const std::string diffusion_coefficient = "diffusion coefficient [m2 s-1]"; | ||
const std::string molecular_weight = "molecular weight [kg mol-1]"; | ||
const std::string henrys_law_constant_298 = "HLC(298K) [mol m-3 Pa-1]"; | ||
const std::string henrys_law_constant_exponential_factor = "HLC exponential factor [K]"; | ||
const std::string phase = "phase"; | ||
const std::string n_star = "N star"; | ||
const std::string density = "density [kg m-3]"; | ||
} keys; | ||
|
||
// Initialize static const members of Keys | ||
|
||
struct Configuration | ||
{ | ||
const std::vector<std::string> required_keys{ keys.version, keys.species, keys.phases, keys.reactions }; | ||
const std::vector<std::string> optional_keys{ keys.name }; | ||
} configuration; | ||
|
||
struct Species | ||
{ | ||
const std::vector<std::string> required_keys{ keys.name }; | ||
const std::vector<std::string> optional_keys{ keys.tracer_type, | ||
keys.absolute_tolerance, | ||
keys.diffusion_coefficient, | ||
keys.molecular_weight, | ||
keys.phase, | ||
keys.henrys_law_constant_298, | ||
keys.henrys_law_constant_exponential_factor, | ||
keys.n_star, | ||
keys.density }; | ||
} species; | ||
|
||
struct Phase | ||
{ | ||
const std::vector<std::string> required_keys; | ||
const std::vector<std::string> optional_keys; | ||
} phase; | ||
|
||
struct Mechanism | ||
{ | ||
const std::vector<std::string> required_keys; | ||
const std::vector<std::string> optional_keys; | ||
} mechanism; | ||
|
||
} // namespace validation | ||
} // namespace open_atmos |
This file contains 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 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 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.