@@ -13,12 +13,12 @@ import Base: show, size
13
13
export LaMEM_grid, read_LaMEM_inputfile
14
14
export save_LaMEM_markers_parallel, save_LaMEM_topography
15
15
export 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
17
17
18
18
"""
19
19
Structure that holds information about the LaMEM partitioning
20
20
"""
21
- struct LaMEM_partitioning_info <: AbstractGeneralGrid
21
+ struct LaMEMPartitioningInfo <: AbstractGeneralGrid
22
22
23
23
# Number of processors in each direction
24
24
nProcX:: Int64
@@ -29,23 +29,23 @@ struct LaMEM_partitioning_info <: AbstractGeneralGrid
29
29
nNodeY:: Int64
30
30
nNodeZ:: Int64
31
31
# 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}
35
35
36
36
end
37
37
38
38
"""
39
39
Structure that holds information about the LaMEM particles distribution for partitioning
40
40
"""
41
- struct particles_distribution <: AbstractGeneralGrid
41
+ struct ParticlesDistribution <: AbstractGeneralGrid
42
42
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}
49
49
50
50
end
51
51
@@ -562,8 +562,8 @@ function get_ind2(dx, xc, Nprocx)
562
562
xi[k] = round ((xc[k + 1 ] - xc[k]) / dx)
563
563
end
564
564
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)
567
567
568
568
end
569
569
@@ -1095,7 +1095,7 @@ function coordinate_grids(Data::LaMEM_grid; cell = false)
1095
1095
return X, Y, Z
1096
1096
end
1097
1097
1098
- function Base. show (io:: IO , d:: LaMEM_partitioning_info )
1098
+ function Base. show (io:: IO , d:: LaMEMPartitioningInfo )
1099
1099
1100
1100
println (io, " LaMEM Partitioning info: " )
1101
1101
println (io, " nProcX : $(d. nProcX) " )
@@ -1165,8 +1165,8 @@ end
1165
1165
p_dist = get_particles_distribution(Grid, P)
1166
1166
Get the distribution of particles in the grid
1167
1167
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
1170
1170
"""
1171
1171
function get_particles_distribution (Grid, P)
1172
1172
@@ -1198,7 +1198,7 @@ function get_particles_distribution(Grid, P)
1198
1198
y_end = iy_end[num_j[:]]
1199
1199
z_end = iz_end[num_k[:]]
1200
1200
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)
1202
1202
1203
1203
return p_dist
1204
1204
@@ -1208,7 +1208,7 @@ end
1208
1208
Grid = get_proc_grid(Grid_info, p_dist, proc_bounds, proc_num, RandomNoise)
1209
1209
Get the local grid for the current processor
1210
1210
Grid_info: LaMEM_grid
1211
- p_dist: LaMEM_partitioning_info
1211
+ p_dist: LaMEMPartitioningInfo
1212
1212
proc_bounds: bounds of the current processor
1213
1213
proc_num: processor number
1214
1214
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)
1251
1251
dYNoise = dYNoise .* (rand (size (dYNoise)) - 0.5 )
1252
1252
dZNoise = dZNoise .* (rand (size (dZNoise)) - 0.5 )
1253
1253
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
1261
1257
x = X (1 , :, 1 )
1262
1258
y = Y (:, 1 , 1 )
1263
1259
z = Z (1 , 1 , :)
@@ -1283,7 +1279,7 @@ end
1283
1279
proc_bounds = get_proc_bound(Grid, p_dist, proc_num)
1284
1280
Get the bounds of the current processor in x, y, z direction
1285
1281
Grid: LaMEM_grid
1286
- p_dist: LaMEM_partitioning_info
1282
+ p_dist: LaMEMPartitioningInfo
1287
1283
proc_num: processor number
1288
1284
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
1289
1285
@@ -1302,7 +1298,7 @@ Grid_example = LaMEM_grid(
1302
1298
[],[],[]
1303
1299
)
1304
1300
P_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)
1306
1302
proc_bounds = get_proc_bound(Grid_example,p_dist_example,2)
1307
1303
```
1308
1304
"""
@@ -1545,7 +1541,7 @@ function setup_model_domain(coord_x::AbstractVector{<:Real},
1545
1541
iy = calculate_domain_divisions (ny, Nprocy)
1546
1542
iz = calculate_domain_divisions (nz, Nprocz)
1547
1543
1548
- P = LaMEM_partitioning_info (
1544
+ P = LaMEMPartitioningInfo (
1549
1545
Nprocx, Nprocy, Nprocz,
1550
1546
nnodx, nnody, nnodz,
1551
1547
xcoor[ix], ycoor[iy],zcoor[iz]
0 commit comments