Skip to content

Commit 09b5093

Browse files
BENOIT CUILHEMartinFerrand
authored andcommitted
replace CS_MALLOC by CS_MALLOC_HD in arrays
1 parent 9a6bd6a commit 09b5093

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/lagr/cs_lagr.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ _update_boundary_face_type(void)
817817

818818
{
819819
int *bc_flag;
820-
CS_MALLOC(bc_flag, mesh->n_b_faces, int);
820+
CS_MALLOC_HD(bc_flag, mesh->n_b_faces, int);
821821

822822
for (cs_lnum_t i = 0; i < mesh->n_b_faces; i++)
823823
bc_flag[i] = bcs->elt_type[i];
@@ -984,7 +984,7 @@ cs_lagr_init_arrays(void)
984984
assert(bound_stat == nullptr);
985985

986986
if (n_boundary_stats > 0)
987-
CS_MALLOC(bound_stat, n_b_faces * n_boundary_stats, cs_real_t);
987+
CS_MALLOC_HD(bound_stat, n_b_faces * n_boundary_stats, cs_real_t);
988988
}
989989

990990
/*----------------------------------------------------------------------------
@@ -1531,7 +1531,7 @@ cs_lagr_get_internal_conditions(void)
15311531
cs_glob_lagr_internal_conditions = _create_internal_cond_struct();
15321532

15331533
if (cs_glob_lagr_internal_conditions->i_face_zone_id == nullptr) {
1534-
CS_MALLOC(cs_glob_lagr_internal_conditions->i_face_zone_id,
1534+
CS_MALLOC_HD(cs_glob_lagr_internal_conditions->i_face_zone_id,
15351535
cs_glob_mesh->n_i_faces,
15361536
int);
15371537

@@ -1754,13 +1754,13 @@ cs_lagr_solve_time_step(const int itypfb[],
17541754
if ( lagr_model->clogging == 1
17551755
|| lagr_model->roughness == 1
17561756
|| lagr_model->dlvo == 1)
1757-
CS_MALLOC(tempp, mesh->n_cells, cs_real_t);
1757+
CS_MALLOC_HD(tempp, mesh->n_cells, cs_real_t);
17581758

17591759
ipass ++;
17601760

17611761
static cs_real_t *vislen = nullptr;
17621762
if ((lagr_model->deposition == 1) && (ipass == 1)) {
1763-
CS_MALLOC(vislen, n_b_faces, cs_real_t);
1763+
CS_MALLOC_HD(vislen, n_b_faces, cs_real_t);
17641764
for (cs_lnum_t ifac = 0; ifac < n_b_faces; ifac++)
17651765
vislen[ifac] = -cs_math_big_r;
17661766
}
@@ -2127,41 +2127,41 @@ cs_lagr_solve_time_step(const int itypfb[],
21272127
/* First pass allocate and compute it */
21282128
if (extra_i[phase_id].grad_pr == nullptr) {
21292129
const cs_lnum_t ncelet = cs_glob_mesh->n_cells_with_ghosts;
2130-
CS_MALLOC(extra_i[phase_id].grad_pr, ncelet, cs_real_3_t);
2130+
CS_MALLOC_HD(extra_i[phase_id].grad_pr, ncelet, cs_real_3_t);
21312131

21322132
// TODO : check if the pressure and velocity allocs can be removed
21332133
if ( ( cs_glob_lagr_time_scheme->interpol_field != 0
21342134
|| cs_glob_lagr_time_scheme->extended_t_scheme != 0)
21352135
&& cs_glob_lagr_model->idistu == 1)
2136-
CS_MALLOC(extra_i[phase_id].grad_lagr_time, ncelet, cs_real_3_t);
2136+
CS_MALLOC_HD(extra_i[phase_id].grad_lagr_time, ncelet, cs_real_3_t);
21372137

21382138
if ( cs_glob_lagr_model->modcpl > 0
21392139
|| cs_glob_lagr_model->shape > 0
21402140
|| cs_glob_lagr_time_scheme->interpol_field != 0)
2141-
CS_MALLOC(extra_i[phase_id].grad_vel, ncelet, cs_real_33_t);
2141+
CS_MALLOC_HD(extra_i[phase_id].grad_vel, ncelet, cs_real_33_t);
21422142

21432143
if ( cs_glob_lagr_model->physical_model != CS_LAGR_PHYS_OFF
21442144
&& extra->temperature != nullptr
21452145
&& cs_glob_lagr_time_scheme->interpol_field > 0
21462146
&& phase_id == 0)
2147-
CS_MALLOC(extra_i[phase_id].grad_tempf, ncelet, cs_real_3_t);
2147+
CS_MALLOC_HD(extra_i[phase_id].grad_tempf, ncelet, cs_real_3_t);
21482148

21492149
/* Allocate the gradients of second order statistics */
21502150
for (int i = 0; i < 9; i++)
2151-
CS_MALLOC(extra_i[phase_id].grad_cov_skp[i], ncelet, cs_real_3_t);
2151+
CS_MALLOC_HD(extra_i[phase_id].grad_cov_skp[i], ncelet, cs_real_3_t);
21522152
for (int i = 0; i < 6; i++)
2153-
CS_MALLOC(extra_i[phase_id].grad_cov_sk[i], ncelet, cs_real_3_t);
2153+
CS_MALLOC_HD(extra_i[phase_id].grad_cov_sk[i], ncelet, cs_real_3_t);
21542154

21552155
if ( cs_glob_lagr_time_scheme->extended_t_scheme !=0
21562156
&& cs_glob_lagr_model->idistu == 1) {
2157-
CS_MALLOC(extra_i[phase_id].grad_lagr_time, ncelet, cs_real_3_t);
2157+
CS_MALLOC_HD(extra_i[phase_id].grad_lagr_time, ncelet, cs_real_3_t);
21582158
if (cs_glob_lagr_model->modcpl == 1)
2159-
CS_MALLOC(extra_i[phase_id].grad_lagr_time_r_et, ncelet, cs_real_3_t);
2159+
CS_MALLOC_HD(extra_i[phase_id].grad_lagr_time_r_et, ncelet, cs_real_3_t);
21602160
}
21612161

21622162
if (cs_glob_lagr_model->modcpl > 0) {
2163-
CS_MALLOC(extra_i[phase_id].anisotropic_lagr_time, ncelet, cs_real_3_t);
2164-
CS_MALLOC(extra_i[phase_id].anisotropic_bx, ncelet, cs_real_3_t);
2163+
CS_MALLOC_HD(extra_i[phase_id].anisotropic_lagr_time, ncelet, cs_real_3_t);
2164+
CS_MALLOC_HD(extra_i[phase_id].anisotropic_bx, ncelet, cs_real_3_t);
21652165
}
21662166
cs_lagr_aux_mean_fluid_quantities(0,
21672167
phase_id,
@@ -2257,8 +2257,8 @@ cs_lagr_solve_time_step(const int itypfb[],
22572257
n_occupied_cells
22582258
= _get_n_occupied_cells(p_set, 0, p_set->n_particles);
22592259

2260-
CS_MALLOC(occupied_cell_ids, n_occupied_cells, cs_lnum_t);
2261-
CS_MALLOC(particle_list, n_occupied_cells+1, cs_lnum_t);
2260+
CS_MALLOC_HD(occupied_cell_ids, n_occupied_cells, cs_lnum_t);
2261+
CS_MALLOC_HD(particle_list, n_occupied_cells+1, cs_lnum_t);
22622262

22632263
_occupied_cells(p_set, 0, p_set->n_particles,
22642264
n_occupied_cells,
@@ -2275,7 +2275,7 @@ cs_lagr_solve_time_step(const int itypfb[],
22752275
/* Initialize lists (ids of cells and particles) */
22762276
cs_lnum_t *cell_particle_idx;
22772277

2278-
CS_MALLOC(cell_particle_idx, n_occupied_cells+1, cs_lnum_t);
2278+
CS_MALLOC_HD(cell_particle_idx, n_occupied_cells+1, cs_lnum_t);
22792279
cell_particle_idx[0] = 0;
22802280

22812281
cs_lnum_t enter_parts = p_set->n_particles;

src/lagr/cs_lagr_coupling.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,17 @@ cs_lagr_coupling_initialize(void)
132132
&& lag_st->npts > 0);
133133

134134
/* Init particle volume and mass in cell */
135-
CS_MALLOC(volp, n_cells_ext, cs_real_t);
136-
CS_MALLOC(volm, n_cells_ext, cs_real_t);
135+
CS_MALLOC_HD(volp, n_cells_ext, cs_real_t);
136+
CS_MALLOC_HD(volm, n_cells_ext, cs_real_t);
137137
cs_array_real_fill_zero(n_cells_ext, volp);
138138
cs_array_real_fill_zero(n_cells_ext, volm);
139139

140140
if (lag_st->ltsdyn == 1) {
141141
/* Momentum source terms
142142
===================== */
143143
if (is_time_averaged) {
144-
CS_MALLOC(t_st_vel, n_cells_ext, cs_real_3_t);
145-
CS_MALLOC(t_st_imp_vel, n_cells_ext, cs_real_t);
144+
CS_MALLOC_HD(t_st_vel, n_cells_ext, cs_real_3_t);
145+
CS_MALLOC_HD(t_st_imp_vel, n_cells_ext, cs_real_t);
146146
}
147147
else {
148148
if (f_st_vel != nullptr)
@@ -164,14 +164,14 @@ cs_lagr_coupling_initialize(void)
164164
(difficult to write something for v2, which loses its meaning as
165165
"Rij component") */
166166
if (is_time_averaged)
167-
CS_MALLOC(t_st_k, n_cells_ext, cs_real_t);
167+
CS_MALLOC_HD(t_st_k, n_cells_ext, cs_real_t);
168168
else if (f_st_k != nullptr)
169169
t_st_k = f_st_k->val;
170170
cs_array_real_fill_zero(n_cells_ext, t_st_k);
171171
}
172172
else if (extra->itytur == 3) {
173173
if (is_time_averaged)
174-
CS_MALLOC(t_st_rij, n_cells_ext, cs_real_6_t);
174+
CS_MALLOC_HD(t_st_rij, n_cells_ext, cs_real_6_t);
175175
else if (f_st_rij != nullptr)
176176
t_st_rij = (cs_real_6_t*)(f_st_rij->val);
177177
cs_array_real_fill_zero(n_cells_ext * 6, (cs_real_t *)t_st_rij);
@@ -186,7 +186,7 @@ cs_lagr_coupling_initialize(void)
186186
|| cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_CTWR )) {
187187
if (t_st_p == nullptr) {
188188
if (is_time_averaged)
189-
CS_MALLOC(t_st_p, n_cells_ext, cs_real_t);
189+
CS_MALLOC_HD(t_st_p, n_cells_ext, cs_real_t);
190190
else if (f_st_p != nullptr)
191191
t_st_p = f_st_p->val;
192192
}
@@ -208,8 +208,8 @@ cs_lagr_coupling_initialize(void)
208208
|| cs_glob_lagr_model->physical_model == CS_LAGR_PHYS_CTWR) {
209209

210210
if (is_time_averaged) {
211-
CS_MALLOC(t_st_t_e, n_cells_ext, cs_real_t);
212-
CS_MALLOC(t_st_t_i, n_cells_ext, cs_real_t);
211+
CS_MALLOC_HD(t_st_t_e, n_cells_ext, cs_real_t);
212+
CS_MALLOC_HD(t_st_t_i, n_cells_ext, cs_real_t);
213213
}
214214
else {
215215
t_st_t_e = f_st_t_e->val;

src/lagr/cs_lagr_fragmentation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ cs_lagr_fragmentation(cs_real_t dt,
450450

451451
/* Create local array (containing the particle index) */
452452
cs_lnum_t *corr;
453-
CS_MALLOC(corr, lnum_particles, cs_lnum_t);
453+
CS_MALLOC_HD(corr, lnum_particles, cs_lnum_t);
454454

455455
/* Create local list (containing the class and the global index) */
456456
cs_lnum_2_t * interf;
457-
CS_MALLOC(interf, lnum_particles, cs_lnum_2_t);
457+
CS_MALLOC_HD(interf, lnum_particles, cs_lnum_2_t);
458458

459459
/* Browse the list of particles already existing */
460460
for (cs_lnum_t idx = main_start; idx < main_end; ++idx) {
@@ -541,7 +541,7 @@ cs_lagr_fragmentation(cs_real_t dt,
541541

542542
/* Local array to save new fragments (class, index) */
543543
cs_lnum_2_t *interf_frag;
544-
CS_MALLOC(interf_frag, newpart, cs_lnum_2_t);
544+
CS_MALLOC_HD(interf_frag, newpart, cs_lnum_2_t);
545545

546546
for (cs_lnum_t i=0; i<newpart; ++i) {
547547
cs_lnum_t curr_class
@@ -562,7 +562,7 @@ cs_lagr_fragmentation(cs_real_t dt,
562562

563563
/* Sort all particles in a cell by class */
564564
cs_lnum_2_t *interf_tot;
565-
CS_MALLOC(interf_tot, tot_size, cs_lnum_2_t);
565+
CS_MALLOC_HD(interf_tot, tot_size, cs_lnum_2_t);
566566

567567
cs_lagr_agglo_merge_arrays(interf, interf_frag,
568568
lnum_particles, newpart, interf_tot);
@@ -575,7 +575,7 @@ cs_lagr_fragmentation(cs_real_t dt,
575575
/* Split the local particle set by class to facilitate merging */
576576
cs_lnum_t* cls_gaps;
577577

578-
CS_MALLOC(cls_gaps, tot_size+1, cs_lnum_t);
578+
CS_MALLOC_HD(cls_gaps, tot_size+1, cs_lnum_t);
579579

580580
_gaps_classes(interf_tot, tot_size,
581581
nb_cls, cls_gaps);

src/lagr/cs_lagr_porosity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ cs_lagr_porosity(void)
123123
const cs_lnum_t n_i_faces = mesh->n_i_faces;
124124

125125
cs_real_t *covered_surface = nullptr;
126-
CS_MALLOC(covered_surface, mesh->n_cells_with_ghosts, cs_real_t);
126+
CS_MALLOC_HD(covered_surface, mesh->n_cells_with_ghosts, cs_real_t);
127127

128128
/* Initialization */
129129
for (cs_lnum_t cell_id = 0; cell_id < n_cells_ext; cell_id++)

0 commit comments

Comments
 (0)