@@ -13,12 +13,12 @@ import Base: show, size
1313export LaMEM_grid, read_LaMEM_inputfile
1414export save_LaMEM_markers_parallel, save_LaMEM_topography
1515export get_processor_partitioning, read_data_VTR, read_data_PVTR, create_partitioning_file
16- export crop_bounds, get_proc_bound, get_proc_grid, get_particles_distribution, get_LaMEM_grid_info, get_processor_partitioning_info, check_markers_directory, setup_model_domain, LaMEM_partitioning_info
16+ export crop_bounds, get_proc_bound, get_proc_grid, get_particles_distribution, get_LaMEM_grid_info, get_processor_partitioning_info, check_markers_directory, setup_model_domain, LaMEMPartitioningInfo
1717
1818"""
1919Structure that holds information about the LaMEM partitioning
2020"""
21- struct LaMEM_partitioning_info <: AbstractGeneralGrid
21+ struct LaMEMPartitioningInfo <: AbstractGeneralGrid
2222
2323 # Number of processors in each direction
2424 nProcX:: Int64
@@ -29,23 +29,23 @@ struct LaMEM_partitioning_info <: AbstractGeneralGrid
2929 nNodeY:: Int64
3030 nNodeZ:: Int64
3131 # Coordinates of the nodes end of each processor
32- xc
33- yc
34- zc
32+ xc:: Vector{Float64}
33+ yc:: Vector{Float64}
34+ zc:: Vector{Float64}
3535
3636end
3737
3838"""
3939Structure that holds information about the LaMEM particles distribution for partitioning
4040"""
41- struct particles_distribution <: AbstractGeneralGrid
41+ struct ParticlesDistribution <: AbstractGeneralGrid
4242
43- x_start
44- x_end
45- y_start
46- y_end
47- z_start
48- z_end
43+ x_start:: Vector{Int64}
44+ x_end:: Vector{Int64}
45+ y_start:: Vector{Int64}
46+ y_end:: Vector{Int64}
47+ z_start:: Vector{Int64}
48+ z_end:: Vector{Int64}
4949
5050end
5151
@@ -562,8 +562,8 @@ function get_ind2(dx, xc, Nprocx)
562562 xi[k] = round ((xc[k + 1 ] - xc[k]) / dx)
563563 end
564564
565- ix_start = cumsum ([0 ; xi[1 : (end - 1 )]]) .+ 1
566- ix_end = cumsum (xi[ 1 : end ] )
565+ ix_start = @views cumsum ([0 ; xi[1 : (end - 1 )]]) .+ 1
566+ ix_end = cumsum (xi)
567567
568568 end
569569
@@ -1095,7 +1095,7 @@ function coordinate_grids(Data::LaMEM_grid; cell = false)
10951095 return X, Y, Z
10961096end
10971097
1098- function Base. show (io:: IO , d:: LaMEM_partitioning_info )
1098+ function Base. show (io:: IO , d:: LaMEMPartitioningInfo )
10991099
11001100 println (io, " LaMEM Partitioning info: " )
11011101 println (io, " nProcX : $(d. nProcX) " )
@@ -1165,8 +1165,8 @@ end
11651165 p_dist = get_particles_distribution(Grid, P)
11661166 Get the distribution of particles in the grid
11671167 Grid: LaMEM_grid
1168- P: LaMEM_partitioning_info
1169- Returns a LaMEM_partitioning_info object with the distribution of particles in the grid
1168+ P: LaMEMPartitioningInfo
1169+ Returns a LaMEMPartitioningInfo object with the distribution of particles in the grid
11701170"""
11711171function get_particles_distribution (Grid, P)
11721172
@@ -1198,7 +1198,7 @@ function get_particles_distribution(Grid, P)
11981198 y_end = iy_end[num_j[:]]
11991199 z_end = iz_end[num_k[:]]
12001200
1201- p_dist = particles_distribution (x_start, x_end, y_start, y_end, z_start, z_end)
1201+ p_dist = ParticlesDistribution (x_start, x_end, y_start, y_end, z_start, z_end)
12021202
12031203 return p_dist
12041204
@@ -1208,7 +1208,7 @@ end
12081208 Grid = get_proc_grid(Grid_info, p_dist, proc_bounds, proc_num, RandomNoise)
12091209 Get the local grid for the current processor
12101210 Grid_info: LaMEM_grid
1211- p_dist: LaMEM_partitioning_info
1211+ p_dist: LaMEMPartitioningInfo
12121212 proc_bounds: bounds of the current processor
12131213 proc_num: processor number
12141214 RandomNoise: add random noise to the grid (0/1)
@@ -1251,13 +1251,9 @@ function get_proc_grid(Grid_info, p_dist, proc_bounds, proc_num, RandomNoise)
12511251 dYNoise = dYNoise .* (rand (size (dYNoise)) - 0.5 )
12521252 dZNoise = dZNoise .* (rand (size (dZNoise)) - 0.5 )
12531253
1254- Xpart = X + dXNoise
1255- Ypart = Y + dYNoise
1256- Zpart = Z + dZNoise
1257-
1258- X = Xpart
1259- Y = Ypart
1260- Z = Zpart
1254+ X .+ = dXNoise
1255+ Y .+ = dYNoise
1256+ Z .+ = dZNoise
12611257 x = X (1 , :, 1 )
12621258 y = Y (:, 1 , 1 )
12631259 z = Z (1 , 1 , :)
@@ -1283,7 +1279,7 @@ end
12831279proc_bounds = get_proc_bound(Grid, p_dist, proc_num)
12841280 Get the bounds of the current processor in x, y, z direction
12851281 Grid: LaMEM_grid
1286- p_dist: LaMEM_partitioning_info
1282+ p_dist: LaMEMPartitioningInfo
12871283 proc_num: processor number
12881284 Returns a 3 element vector with maximum and minimum values[[x_min, x_max],[y_min, y_max],[z_min, z_max]] for current processor proc_num
12891285
@@ -1302,7 +1298,7 @@ Grid_example = LaMEM_grid(
13021298 [],[],[]
13031299 )
13041300P_example = setup_model_domain(Grid_example.coord_x, Grid_example.coord_y, Grid_example.coord_z, Grid_example.nel_x, Grid_example.nel_x, Grid_example.nel_x, 8)
1305- p_dist_example = get_particles_distribution (Grid_example,P_example)
1301+ p_dist_example = get_ParticlesDistribution (Grid_example,P_example)
13061302proc_bounds = get_proc_bound(Grid_example,p_dist_example,2)
13071303```
13081304"""
@@ -1545,7 +1541,7 @@ function setup_model_domain(coord_x::AbstractVector{<:Real},
15451541 iy = calculate_domain_divisions (ny, Nprocy)
15461542 iz = calculate_domain_divisions (nz, Nprocz)
15471543
1548- P = LaMEM_partitioning_info (
1544+ P = LaMEMPartitioningInfo (
15491545 Nprocx, Nprocy, Nprocz,
15501546 nnodx, nnody, nnodz,
15511547 xcoor[ix], ycoor[iy],zcoor[iz]
0 commit comments