Skip to content

Commit 7e9fd73

Browse files
authored
Format .jl files
1 parent 5d4547e commit 7e9fd73

17 files changed

Lines changed: 203 additions & 170 deletions

deprecated/flux.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ function calc_flux!(::Val{0}, ::Val{2}, face::Face, DVM_data::DVM_Data, faceid::
328328
# @show ps_data.neighbor.data[faceid][2].midpoint
329329
# end
330330
fw_test = zeros(DIM + 2)
331-
for i = 1:2^(DIM-1)
331+
for i = 1:(2^(DIM-1))
332332
nps_data = ps_data.neighbor.data[faceid][i]
333333
vs_data_n = nps_data.vs_data
334334
ds = nps_data.ds[dir]

lib/P4estTypes/src/connectivity.jl

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ the roots of `Pxest` quadtrees or octrees. The parameter `X` is 4 if the
66
roots are quads (2D aka p4est) and 8 if they are hexes (3D aka p8est).
77
88
# Fields
9+
910
$(DocStringExtensions.FIELDS)
1011
1112
# Usage
@@ -15,23 +16,23 @@ $(DocStringExtensions.FIELDS)
1516
Construct a connectivity mesh for the roots of a forest-of-quadtrees using
1617
p4est's built-in mesh connectivities. Valid values for `name` are
1718
18-
- `:unitsquare`: the unit square.
19-
- `:periodic`: all-periodic unit square.
20-
- `:rotwrap`: periodic unit square (the left and right faces are identified,
21-
and bottom and top opposite).
22-
- `:corner`: three-tree mesh around a corner.
23-
- `:pillow`: two trees on top of each other.
24-
- `:moebius`: a five-tree moebius band.
25-
- `:star`: six-tree star.
26-
- `:cubed`: six sides of a unit cube.
27-
- `:disk_nonperiodic`: five-tree flat spherical disk.
28-
- `:icosahedron`: for mapping the sphere using an icosahedron (see
29-
`@doc P4estTypes.P4est.p4est_connectivity_new_icosahedron` for more info).
30-
- `:shell2d`: 2D spherical shell.
31-
- `:disk2d`: maps a 2D disk.
32-
33-
34-
---
19+
- `:unitsquare`: the unit square.
20+
- `:periodic`: all-periodic unit square.
21+
- `:rotwrap`: periodic unit square (the left and right faces are identified,
22+
and bottom and top opposite).
23+
- `:corner`: three-tree mesh around a corner.
24+
- `:pillow`: two trees on top of each other.
25+
- `:moebius`: a five-tree moebius band.
26+
- `:star`: six-tree star.
27+
- `:cubed`: six sides of a unit cube.
28+
- `:disk_nonperiodic`: five-tree flat spherical disk.
29+
- `:icosahedron`: for mapping the sphere using an icosahedron (see
30+
`@doc P4estTypes.P4est.p4est_connectivity_new_icosahedron` for more info).
31+
- `:shell2d`: 2D spherical shell.
32+
- `:disk2d`: maps a 2D disk.
33+
34+
* * *
35+
3536
Connectivity{4}(:disk, periodic_x::Bool, periodic_y::Bool)
3637
3738
Create a connectivity structure for a five-tree flat spherical disk. The
@@ -40,26 +41,28 @@ the x and y directions, respectively.
4041
4142
See `@doc P4estTypes.P4est.p4est_connectivity_new_disk` for detailed information.
4243
43-
---
44+
* * *
45+
4446
Connectivity{8}(name::Symbol)
4547
4648
Construct a connectivity mesh for the roots of a forest-of-octrees using
4749
p8est's built-in mesh connectivities. Valid values for `name` are
4850
49-
- `:unitcube`: the unit cube.
50-
- `:periodic`: an all-periodic unit cube.
51-
- `:rotcubes`: contains a few cubes (these are rotated against each other to
52-
stress the topology routines).
53-
- `:rotwrap`: a mostly periodic unit cube (see
54-
`@doc P4estTypes.P4est.p8est_connectivity_new_rotwrap`).
55-
- `:shell`: a spherical shell (see
56-
`@doc P4estTypes.P4est.p8est_connectivity_new_shell`).
57-
- `:sphere`: a solid sphere (see
58-
`@doc P4estTypes.P4est.p8est_connectivity_new_sphere`).
59-
- `:twocubes`: two cubes.
60-
- `:twowrap`: two cubes where the two far ends are identified periodically.
61-
62-
---
51+
- `:unitcube`: the unit cube.
52+
- `:periodic`: an all-periodic unit cube.
53+
- `:rotcubes`: contains a few cubes (these are rotated against each other to
54+
stress the topology routines).
55+
- `:rotwrap`: a mostly periodic unit cube (see
56+
`@doc P4estTypes.P4est.p8est_connectivity_new_rotwrap`).
57+
- `:shell`: a spherical shell (see
58+
`@doc P4estTypes.P4est.p8est_connectivity_new_shell`).
59+
- `:sphere`: a solid sphere (see
60+
`@doc P4estTypes.P4est.p8est_connectivity_new_sphere`).
61+
- `:twocubes`: two cubes.
62+
- `:twowrap`: two cubes where the two far ends are identified periodically.
63+
64+
* * *
65+
6366
Connectivity{8}(:torus, nsegments)
6467
6568
Create a connectivity structure that builds a revolution torus. Here
@@ -68,7 +71,8 @@ Create a connectivity structure that builds a revolution torus. Here
6871
See `@doc P4estTypes.P4est.p8est_connectivity_new_torus` for detailed
6972
information.
7073
71-
---
74+
* * *
75+
7276
Connectivity{8}(:torus, nsegments)
7377
7478
Create a connectivity structure that builds a revolution torus. Here
@@ -77,7 +81,8 @@ Create a connectivity structure that builds a revolution torus. Here
7781
See `@doc P4estTypes.P4est.p8est_connectivity_new_torus` for detailed
7882
information.
7983
80-
---
84+
* * *
85+
8186
Connectivity{X}(:twotrees, l_face, r_face, orientation) where {X}
8287
8388
Create a connectivity structure (`X=4` for quadtrees and `X=8` for octrees) for
@@ -86,20 +91,22 @@ two trees being rotated with respect to each other in a user-defined way. Here
8691
respectively. The argument `orientation` gives the orientation code of the
8792
trees with respect to each other.
8893
89-
---
94+
* * *
95+
9096
Connectivity{X}(vertices, elements) where {X}
9197
9298
Creates a connectivity from the given list of vertices and element-to-vertex
9399
connectivity. The parameter set to `X=4` is for quads and `X=8` for hexes.
94100
95-
- `vertices`: should be a number-of-vertices by 3 matrix where the columns
96-
correspond to x, y, and z coordinates (typically the `z` coordinate will be
97-
zero for a 2D forest).
98-
- `elements`: should be a number-of-vertices by 4 or 8 matrix where the columns
99-
vertex indices used to define each element. Note that z-ordering should be
100-
used, and it should use zero-indexing.
101+
- `vertices`: should be a number-of-vertices by 3 matrix where the columns
102+
correspond to x, y, and z coordinates (typically the `z` coordinate will be
103+
zero for a 2D forest).
104+
- `elements`: should be a number-of-vertices by 4 or 8 matrix where the columns
105+
vertex indices used to define each element. Note that z-ordering should be
106+
used, and it should use zero-indexing.
107+
108+
* * *
101109
102-
---
103110
Connectivity{X}(filename::String) where {X}
104111
105112
Create a connectivity from an ABAQUS input at `filename`. The parameter set to
@@ -110,9 +117,10 @@ See `@doc P4estTypes.P4est.p4est_connectivity_read_inp` and
110117
files.
111118
112119
# See also
113-
- [`brick`](@ref): a function to create a rectangular [`Connectivity`](@ref).
114-
- [`connectivity`](@ref): a function to get the connectivity of a [`Pxest`](@ref).
115-
- [`refine`](@ref): a function to create a refined [`Connectivity`](@ref).
120+
121+
- [`brick`](@ref): a function to create a rectangular [`Connectivity`](@ref).
122+
- [`connectivity`](@ref): a function to get the connectivity of a [`Pxest`](@ref).
123+
- [`refine`](@ref): a function to create a refined [`Connectivity`](@ref).
116124
"""
117125
mutable struct Connectivity{X,P}
118126
"""The pointer (of type `P`) can be a pointer to either a

lib/P4estTypes/src/ghost.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ for a `Pxest{X}`. Also stores the corresponding local domain quadrants,
66
mirrors, that are in other rank's ghost layers.
77
88
# Fields
9+
910
$(DocStringExtensions.FIELDS)
1011
1112
# See also
12-
- [`ghostlayer`](@ref): a function used to construct a `GhostLayer`
13+
14+
- [`ghostlayer`](@ref): a function used to construct a `GhostLayer`
1315
"""
1416
mutable struct GhostLayer{X,P}
1517
"""The pointer (of type `P`) can be a pointer to either a

lib/P4estTypes/src/lnodes.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
Stores a parallel numbering of Lobatto nodes for a `Pxest{X}`.
55
66
# Fields
7+
78
$(DocStringExtensions.FIELDS)
89
910
# See also
10-
- [`lnodes`](@ref): a function used to construct `LNodes`
11+
12+
- [`lnodes`](@ref): a function used to construct `LNodes`
1113
"""
1214
mutable struct LNodes{X,P}
1315
"""The pointer (of type `P`) can be a pointer to either a

lib/P4estTypes/src/pxest.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ and `X=8` indicates an octant; quadrant is used both as the general
213213
term and the term for the 2D object).
214214
215215
# Fields
216+
216217
$(DocStringExtensions.FIELDS)
217218
"""
218219
struct QuadrantWrapper{X,P}
@@ -308,6 +309,7 @@ end
308309
Stores the quadrants in a tree of a Pxest{X}.
309310
310311
# Fields
312+
311313
$(DocStringExtensions.FIELDS)
312314
"""
313315
struct Tree{X,P,Q} <: AbstractArray{QuadrantWrapper,1}
@@ -357,19 +359,21 @@ So, each rank will only have access to the quadrants it owns.) Second, using
357359
forest via callback functions.
358360
359361
# Fields
362+
360363
$(DocStringExtensions.FIELDS)
361364
362365
# See also
363-
- [`pxest`](@ref): a function that constructs a `Pxest` from a [`Connectivity`](@ref).
364-
- [`iterateforest`](@ref): a function to iterate over the volumes, faces, edges, and
365-
corners of the forest.
366-
- [`refine!`](@ref): refine the quadrants of the forest.
367-
- [`coarsen!`](@ref): coarsen the quadrants of the forest.
368-
- [`balance!`](@ref): two-to-one balance the quadrants of the forest.
369-
- [`partition!`](@ref): partition the quadrants of the forest.
370-
- [`ghostlayer`](@ref): get the ghost layer of quadrants for the forest.
371-
- [`lnodes`](@ref): get a global node numbering.
372-
- [`P4estTypes.savevtk`](@ref): save a VTK representation of the forest.
366+
367+
- [`pxest`](@ref): a function that constructs a `Pxest` from a [`Connectivity`](@ref).
368+
- [`iterateforest`](@ref): a function to iterate over the volumes, faces, edges, and
369+
corners of the forest.
370+
- [`refine!`](@ref): refine the quadrants of the forest.
371+
- [`coarsen!`](@ref): coarsen the quadrants of the forest.
372+
- [`balance!`](@ref): two-to-one balance the quadrants of the forest.
373+
- [`partition!`](@ref): partition the quadrants of the forest.
374+
- [`ghostlayer`](@ref): get the ghost layer of quadrants for the forest.
375+
- [`lnodes`](@ref): get a global node numbering.
376+
- [`P4estTypes.savevtk`](@ref): save a VTK representation of the forest.
373377
"""
374378
mutable struct Pxest{X,P,C} <: AbstractArray{Tree,1}
375379
"""The pointer (of type `P`) can be a pointer to either a

lib/P4estTypes/test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ mktempdir() do tmp_dir
3939
@test success(pipeline(cmd, stderr = stderr, stdout = stdout))
4040

4141
@testset "$f" for f in testfiles
42-
cmd = `$(mpiexec()) -n $nprocs $(Base.julia_cmd()) --startup-file=no --project=$tmp_project $(joinpath(test_dir, f))`
42+
cmd =
43+
`$(mpiexec()) -n $nprocs $(Base.julia_cmd()) --startup-file=no --project=$tmp_project $(joinpath(test_dir, f))`
4344
@test success(pipeline(cmd, stderr = stderr, stdout = stdout))
4445
end
4546
end

src/adaptive.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function replace_PS(::Val{1}, out_quad, in_quads, which_tree, DVM_data::DVM_Data
7575
)
7676
index = findfirst(x -> x === Odata, datas)
7777
deleteat!(datas, index)
78-
for i = 1:2^DIM
78+
for i = 1:(2^DIM)
7979
pw_in_quad = PointerWrapper(in_quads[i])
8080
dp = PointerWrapper(P4est_PS_Data, pw_in_quad.p.user_data[])
8181
ps_data = PS_copy(Odata)
@@ -96,7 +96,7 @@ function replace_PS(::Val{2^DIM}, out_quad, in_quads, which_tree, DVM_data::DVM_
9696
pw_in_quad = PointerWrapper(in_quads[1])
9797
dp = PointerWrapper(P4est_PS_Data, pw_in_quad.p.user_data[])
9898
Odatas = Vector{PS_Data}(undef, 2^DIM)
99-
for i = 1:2^DIM
99+
for i = 1:(2^DIM)
100100
pw_out_quad = PointerWrapper(out_quad[i])
101101
Odatas[i] = unsafe_pointer_to_objref(
102102
pointer(PointerWrapper(P4est_PS_Data, pw_out_quad.p.user_data[]).ps_data),
@@ -114,7 +114,7 @@ function replace_PS(::Val{2^DIM}, out_quad, in_quads, which_tree, DVM_data::DVM_
114114
end
115115
ps_data.ds .*= 2.0
116116
index = findfirst(x -> x === Odatas[1], datas)
117-
deleteat!(datas, index:index+2^DIM-1)
117+
deleteat!(datas, index:(index+2^DIM-1))
118118
insert!(datas, index, ps_data)
119119
dp[] = P4est_PS_Data(pointer_from_objref(ps_data))
120120
end
@@ -159,7 +159,7 @@ end
159159
function coarsen_flag_PS(ps_datas::Vector{PS_Data}, levels::Vector{Int}, DVM_data::DVM_Data)
160160
global_data = DVM_data.global_data
161161
flag = Cint(1)
162-
for i = 1:2^DIM
162+
for i = 1:(2^DIM)
163163
if boundary_flag(DVM_data, ps_datas[i])
164164
return Cint(0)
165165
end
@@ -181,7 +181,7 @@ function p4est_coarsen_flag(forest::Ptr{p4est_t}, which_tree, quadrants)
181181
quadrants_wrap = unsafe_wrap(Vector{Ptr{p4est_quadrant_t}}, quadrants, 2^DIM)
182182
levels = Vector{Int}(undef, 2^DIM)
183183
ps_datas = Vector{PS_Data}(undef, 2^DIM)
184-
for i = 1:2^DIM
184+
for i = 1:(2^DIM)
185185
qp = PointerWrapper(quadrants_wrap[i])
186186
dp = PointerWrapper(P4est_PS_Data, qp.p.user_data[])
187187
levels[i] = qp.level[]

src/connectivity.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ function Cartesian_connectivity(Nx, Ny, xmin, xmax, ymin, ymax)
22
vertices_C = Array{NTuple{2,Float64}}(undef, Nx + 1, Ny + 1)
33
dx = (xmax - xmin) / Nx
44
dy = (ymax - ymin) / Ny
5-
for j = 1:Ny+1
6-
for i = 1:Nx+1
5+
for j = 1:(Ny+1)
6+
for i = 1:(Nx+1)
77
vertices_C[i, j] = (xmin + (i - 1) * dx, ymin + (j - 1) * dy)
88
end
99
end

src/flux_interp_t.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function calc_flux!(::Val{0}, ::Val{2}, face::Face, DVM_data::DVM_Data, faceid::
247247
rot = get_rot(faceid) # Left: -1, Right: 1
248248
gas = DVM_data.global_data.gas
249249
vs_data = ps_data.vs_data
250-
for i = 1:2^(DIM-1)
250+
for i = 1:(2^(DIM-1))
251251
nps_data = ps_data.neighbor.data[faceid][i]
252252
vs_data_n = nps_data.vs_data
253253
ds = nps_data.ds[dir]

src/ghost.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end
2323
function get_mirror_data_inner!(ps_data::PS_Data, vs_temp::AV)
2424
vs_data = ps_data.vs_data
2525
vs_num = vs_data.vs_num
26-
vs_temp[1:NDF*vs_num] .= reshape(vs_data.df, vs_num * NDF)
26+
vs_temp[1:(NDF*vs_num)] .= reshape(vs_data.df, vs_num * NDF)
2727
end
2828
function get_mirror_data(ps4est, global_data)
2929
GC.@preserve ps4est global_data begin
@@ -46,10 +46,10 @@ function get_mirror_data(ps4est, global_data)
4646
ap = Base.unsafe_wrap(Vector{Cdouble}, p, 3 * DIM + 3 + NDF * vs_num)
4747
offset = 0
4848
ap[1:(offset+=DIM)] .= ps_data.ds
49-
ap[offset+1:(offset+=DIM)] .= ps_data.midpoint
50-
ap[offset+1:(offset+=DIM+2)] .= ps_data.w
49+
ap[(offset+1):(offset+=DIM)] .= ps_data.midpoint
50+
ap[(offset+1):(offset+=DIM+2)] .= ps_data.w
5151
ap[offset+=1] = ps_data.vs_data.vs_num
52-
vs_temp = @view(ap[offset+1:(offset+=NDF*vs_num)])
52+
vs_temp = @view(ap[(offset+1):(offset+=NDF*vs_num)])
5353
get_mirror_data_inner!(ps_data, vs_temp)
5454
mirror_data_pointers[i] = p
5555
end
@@ -112,8 +112,8 @@ function get_mirror_structure(ps4est, global_data::Global_Data)
112112
p = Ptr{Cdouble}(sc_malloc(-1, vs_num * (DIM + 2) * sizeof(Cdouble)))
113113
ap = Base.unsafe_wrap(Vector{Cdouble}, p, vs_num * (DIM + 2))
114114
weight_temp = @view(ap[1:vs_num])
115-
level_temp = @view(ap[vs_num+1:vs_num*2])
116-
midpoint_temp = @view(ap[vs_num*2+1:vs_num*(DIM+2)])
115+
level_temp = @view(ap[(vs_num+1):(vs_num*2)])
116+
midpoint_temp = @view(ap[(vs_num*2+1):(vs_num*(DIM+2))])
117117
get_mirror_structure_inner!(ps_data, weight_temp, level_temp, midpoint_temp)
118118
mirror_structure_pointers[i] = p
119119
end
@@ -141,7 +141,7 @@ function update_mirror_data!(ps4est, DVM_data::DVM_Data)
141141
mirror_data_pointers[i],
142142
3 * DIM + 3 + NDF * vs_num,
143143
)
144-
vs_temp = @view(ap[3*DIM+3+1:end])
144+
vs_temp = @view(ap[(3*DIM+3+1):end])
145145
get_mirror_data_inner!(ps_data, vs_temp)
146146
end
147147
end

0 commit comments

Comments
 (0)