used .data() to access underlying raw data of container

This commit is contained in:
Axel Kohlmeyer
2025-06-25 20:22:30 -04:00
parent 96d1704b8e
commit e9b5e55f18
3 changed files with 5 additions and 5 deletions

View File

@ -90,7 +90,7 @@ void ElectrodeMatrix::compute_array(double **array, bool timer_flag)
MPI_Barrier(world);
double kspace_time = MPI_Wtime();
update_mpos();
electrode_kspace->compute_matrix(&mpos[0], array, timer_flag);
electrode_kspace->compute_matrix(mpos.data(), array, timer_flag);
MPI_Barrier(world);
if (timer_flag && (comm->me == 0))
utils::logmesg(lmp, "KSpace time: {:.4g} s\n", MPI_Wtime() - kspace_time);
@ -98,7 +98,7 @@ void ElectrodeMatrix::compute_array(double **array, bool timer_flag)
pair_contribution(array);
//cout << array[0][0] << ", " << array[0][1] << endl;
self_contribution(array);
electrode_kspace->compute_matrix_corr(&mpos[0], array);
electrode_kspace->compute_matrix_corr(mpos.data(), array);
if (tfflag) tf_contribution(array);
// reduce coulomb matrix with contributions from all procs

View File

@ -2425,9 +2425,9 @@ void FixLbFluid::dump(const bigint step)
velocity_2_fort[2 + 3 * (i + (subNbx + 3) * (j + (subNby + 3) * k))] = u_lb[i][j][k][2];
}
MPI_File_write_all(dump_file_handle_raw, &density_2_fort[0], 1, fluid_density_2_mpitype,
MPI_File_write_all(dump_file_handle_raw, density_2_fort.data(), 1, fluid_density_2_mpitype,
MPI_STATUS_IGNORE);
MPI_File_write_all(dump_file_handle_raw, &velocity_2_fort[0], 1, fluid_velocity_2_mpitype,
MPI_File_write_all(dump_file_handle_raw, velocity_2_fort.data(), 1, fluid_velocity_2_mpitype,
MPI_STATUS_IGNORE);
// For C output use the following but switch to MPI_ORDER_C in mpiTypeXXXWrite

View File

@ -527,7 +527,7 @@ void ReaderNative::read_buf(void * ptr, size_t size, size_t count)
std::string ReaderNative::read_binary_str(size_t size)
{
std::string str(size, '\0');
read_buf(&str[0], sizeof(char), size);
read_buf(str.data(), sizeof(char), size);
return str;
}