Skip to content

Commit

Permalink
add formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmontoya committed Oct 3, 2024
1 parent 0f1ee79 commit ff5f16a
Show file tree
Hide file tree
Showing 50 changed files with 4,690 additions and 3,668 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: format-check

on:
push:
branches:
- 'main'
tags: '*'
pull_request:

jobs:
check-format:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version="1.0.45"))'
julia -e 'using JuliaFormatter; format(".")'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
16 changes: 8 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ Pkg.add("Documenter")
using Documenter
using StableSpectralElements

push!(LOAD_PATH,"../src/")
push!(LOAD_PATH, "../src/")

makedocs(
sitename = "StableSpectralElements.jl",
authors = "Tristan Montoya",
pages = [
"Home" => "index.md",
"Reference" => ["`ConservationLaws`" => "ConservationLaws.md",
"`SpatialDiscretizations`" => "SpatialDiscretizations.md"]
"Reference" => [
"`ConservationLaws`" => "ConservationLaws.md",
"`SpatialDiscretizations`" => "SpatialDiscretizations.md",
],
],
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true",
assets = ["assets/favicon.ico"],
ansicolor=true
)
ansicolor = true,
),
)
deploydocs(
repo="github.com/tristanmontoya/StableSpectralElements.jl.git"
)
deploydocs(repo = "github.com/tristanmontoya/StableSpectralElements.jl.git")
8 changes: 8 additions & 0 deletions src/.JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use SciML style: https://github.com/SciML/SciMLStyle
style = "sciml"

# Python style alignment. See https://github.com/domluna/JuliaFormatter.jl/pull/732.
yas_style_nesting = true

# Align struct fields for better readability of large struct definitions
align_struct_field = true
139 changes: 92 additions & 47 deletions src/Analysis/Analysis.jl
Original file line number Diff line number Diff line change
@@ -1,49 +1,94 @@
module Analysis

using LinearMaps: LinearMap, UniformScalingMap
using LinearAlgebra: Diagonal, diag, diagm, mul!, lmul!, dot, norm, eigen, inv, svd, qr, pinv, eigsortby, I, rank, cond
using JLD2: save, load, save_object, load_object
using Plots: plot, savefig, plot!, scatter, text, annotate!, vline!, grid, theme_palette, twinx, @layout
using LaTeXStrings: LaTeXString, latexstring
using SparseArrays: sparse, blockdiag, kron!
using OrdinaryDiffEq: OrdinaryDiffEqAlgorithm, ODESolution, ODEIntegrator, solve, RK4, step!, reinit!
using StartUpDG: MeshData, vandermonde
using RecipesBase
using Printf
using PrettyTables
using Markdown
using TimerOutputs
using BenchmarkTools

using ..ConservationLaws
using ..SpatialDiscretizations
using ..GridFunctions
using ..Solvers
using ..MatrixFreeOperators
using ..File
using ..Visualize

export AbstractAnalysis, AbstractAnalysisResults, analyze, analyze_new, save_analysis, tabulate_analysis, tabulate_analysis_for_paper

abstract type AbstractAnalysis end
abstract type AbstractAnalysisResults end

function save_analysis(analysis::AbstractAnalysis,
results::AbstractAnalysisResults)
save(string(analysis.analysis_path, "analysis.jld2"),
Dict("analysis" => analysis,
"results" => results))
end

export ErrorAnalysis, AbstractNorm, QuadratureL2, QuadratureL2Normalized
include("error.jl")

export ConservationAnalysis, PrimaryConservationAnalysis, EnergyConservationAnalysis, EntropyConservationAnalysis, ConservationAnalysisResults, ConservationAnalysisResultsWithDerivative, evaluate_conservation, evaluate_conservation_residual
include("conservation.jl")

export RefinementAnalysis, RefinementErrorAnalysis, RefinementAnalysisResults, RefinementErrorAnalysisResults, run_refinement, get_tickslogscale
include("refinement.jl")

export scaling_test_euler_2d
include("benchmark.jl")
end
using LinearMaps: LinearMap, UniformScalingMap
using LinearAlgebra:
Diagonal,
diag,
diagm,
mul!,
lmul!,
dot,
norm,
eigen,
inv,
svd,
qr,
pinv,
eigsortby,
I,
rank,
cond
using JLD2: save, load, save_object, load_object
using Plots:
plot,
savefig,
plot!,
scatter,
text,
annotate!,
vline!,
grid,
theme_palette,
twinx,
@layout
using LaTeXStrings: LaTeXString, latexstring
using SparseArrays: sparse, blockdiag, kron!
using OrdinaryDiffEq:
OrdinaryDiffEqAlgorithm, ODESolution, ODEIntegrator, solve, RK4,
step!, reinit!
using StartUpDG: MeshData, vandermonde
using RecipesBase
using Printf
using PrettyTables
using Markdown
using TimerOutputs
using BenchmarkTools

using ..ConservationLaws
using ..SpatialDiscretizations
using ..GridFunctions
using ..Solvers
using ..MatrixFreeOperators
using ..File
using ..Visualize

export AbstractAnalysis,
AbstractAnalysisResults,
analyze,
analyze_new,
save_analysis,
tabulate_analysis,
tabulate_analysis_for_paper

abstract type AbstractAnalysis end
abstract type AbstractAnalysisResults end

function save_analysis(analysis::AbstractAnalysis, results::AbstractAnalysisResults)
save(string(analysis.analysis_path, "analysis.jld2"),
Dict("analysis" => analysis, "results" => results))
end

export ErrorAnalysis, AbstractNorm, QuadratureL2, QuadratureL2Normalized
include("error.jl")

export ConservationAnalysis,
PrimaryConservationAnalysis,
EnergyConservationAnalysis,
EntropyConservationAnalysis,
ConservationAnalysisResults,
ConservationAnalysisResultsWithDerivative,
evaluate_conservation,
evaluate_conservation_residual
include("conservation.jl")

export RefinementAnalysis,
RefinementErrorAnalysis,
RefinementAnalysisResults,
RefinementErrorAnalysisResults,
run_refinement,
get_tickslogscale
include("refinement.jl")

export scaling_test_euler_2d
include("benchmark.jl")
end
Loading

0 comments on commit ff5f16a

Please sign in to comment.