&name[0] -> name.data()

This commit is contained in:
jingang 2019-06-14 19:59:27 -04:00
parent f57c4b919c
commit e5b2c6b477
8 changed files with 25 additions and 25 deletions

View file

@ -102,7 +102,7 @@ void initialize_mpi(MPI_Comm intracomm)
// Create bank datatype
Particle::Bank b;
MPI_Aint disp[6];
MPI_Get_address(&b.r, &disp[0]);
MPI_Get_address(c&b.r, &disp[0]);
MPI_Get_address(&b.u, &disp[1]);
MPI_Get_address(&b.E, &disp[2]);
MPI_Get_address(&b.wgt, &disp[3]);

View file

@ -401,7 +401,7 @@ RectLattice::to_hdf5_inner(hid_t lat_group) const
}
hsize_t dims[3] {nz, ny, nx};
write_int(lat_group, 3, dims, "universes", &out[0], false);
write_int(lat_group, 3, dims, "universes", out.data(), false);
} else {
hsize_t nx {static_cast<hsize_t>(n_cells_[0])};
@ -417,7 +417,7 @@ RectLattice::to_hdf5_inner(hid_t lat_group) const
}
hsize_t dims[3] {1, ny, nx};
write_int(lat_group, 3, dims, "universes", &out[0], false);
write_int(lat_group, 3, dims, "universes", out.data(), false);
}
}
@ -897,7 +897,7 @@ HexLattice::to_hdf5_inner(hid_t lat_group) const
}
hsize_t dims[3] {nz, ny, nx};
write_int(lat_group, 3, dims, "universes", &out[0], false);
write_int(lat_group, 3, dims, "universes", out.data(), false);
}
//==============================================================================

View file

@ -183,11 +183,11 @@ int RegularMesh::get_bin(Position r) const
// Determine indices
std::vector<int> ijk(n_dimension_);
bool in_mesh;
get_indices(r, &ijk[0], &in_mesh);
get_indices(r, ijk.data(), &in_mesh);
if (!in_mesh) return -1;
// Convert indices to bin
return get_bin_from_indices(&ijk[0]);
return get_bin_from_indices(ijk.data());
}
int RegularMesh::get_bin_from_indices(const int* ijk) const
@ -497,9 +497,9 @@ void RegularMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
int n = n_dimension_;
std::vector<int> ijk0(n), ijk1(n);
bool start_in_mesh;
get_indices(r0, &ijk0[0], &start_in_mesh);
get_indices(r0, ijk0.data(), &start_in_mesh);
bool end_in_mesh;
get_indices(r1, &ijk1[0], &end_in_mesh);
get_indices(r1, ijk1.data(), &end_in_mesh);
// Reset coordinates and check for a mesh intersection if necessary.
if (start_in_mesh) {
@ -509,7 +509,7 @@ void RegularMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
// The initial coords do not lie in the mesh. Check to see if the particle
// eventually intersects the mesh and compute the relevant coords and
// indices.
if (!intersects(r0, r1, &ijk0[0])) return;
if (!intersects(r0, r1, ijk0.data())) return;
}
r1 = r;
@ -521,7 +521,7 @@ void RegularMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
// The track ends in this cell. Use the particle end location rather
// than the mesh surface and stop iterating.
double distance = (r1 - r0).norm();
bins.push_back(get_bin_from_indices(&ijk0[0]));
bins.push_back(get_bin_from_indices(ijk0.data()));
lengths.push_back(distance / total_distance);
break;
}
@ -543,7 +543,7 @@ void RegularMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
// Pick the closest mesh surface and append this traversal to the output.
auto j = std::min_element(d.begin(), d.end()) - d.begin();
double distance = d[j];
bins.push_back(get_bin_from_indices(&ijk0[0]));
bins.push_back(get_bin_from_indices(ijk0.data()));
lengths.push_back(distance / total_distance);
// Translate to the oncoming mesh surface.
@ -584,15 +584,15 @@ void RegularMesh::surface_bins_crossed(const Particle* p,
int n = n_dimension_;
std::vector<int> ijk0(n), ijk1(n);
bool start_in_mesh;
get_indices(r0, &ijk0[0], &start_in_mesh);
get_indices(r0, ijk0.data(), &start_in_mesh);
bool end_in_mesh;
get_indices(r1, &ijk1[0], &end_in_mesh);
get_indices(r1, ijk1.data(), &end_in_mesh);
// Check if the track intersects any part of the mesh.
if (!start_in_mesh) {
Position r0_copy = r0;
std::vector<int> ijk0_copy(ijk0);
if (!intersects(r0_copy, r1, &ijk0_copy[0])) return;
if (!intersects(r0_copy, r1, ijk0_copy.data())) return;
}
// ========================================================================
@ -650,7 +650,7 @@ void RegularMesh::surface_bins_crossed(const Particle* p,
// Outward current on i max surface
if (in_mesh) {
int i_surf = 4*i + 3;
int i_mesh = get_bin_from_indices(&ijk0[0]);
int i_mesh = get_bin_from_indices(ijk0.data());
int i_bin = 4*n*i_mesh + i_surf - 1;
bins.push_back(i_bin);
@ -671,7 +671,7 @@ void RegularMesh::surface_bins_crossed(const Particle* p,
// i min surface
if (in_mesh) {
int i_surf = 4*i + 2;
int i_mesh = get_bin_from_indices(&ijk0[0]);
int i_mesh = get_bin_from_indices(ijk0.data());
int i_bin = 4*n*i_mesh + i_surf - 1;
bins.push_back(i_bin);
@ -683,7 +683,7 @@ void RegularMesh::surface_bins_crossed(const Particle* p,
// Outward current on i min surface
if (in_mesh) {
int i_surf = 4*i + 1;
int i_mesh = get_bin_from_indices(&ijk0[0]);
int i_mesh = get_bin_from_indices(ijk0.data());
int i_bin = 4*n*i_mesh + i_surf - 1;
bins.push_back(i_bin);
@ -704,7 +704,7 @@ void RegularMesh::surface_bins_crossed(const Particle* p,
// i max surface
if (in_mesh) {
int i_surf = 4*i + 4;
int i_mesh = get_bin_from_indices(&ijk0[0]);
int i_mesh = get_bin_from_indices(ijk0.data());
int i_bin = 4*n*i_mesh + i_surf - 1;
bins.push_back(i_bin);

View file

@ -19,7 +19,7 @@ LegendreFilter::get_all_bins(const Particle* p, int estimator,
FilterMatch& match) const
{
std::vector<double> wgt(n_bins_);
calc_pn_c(order_, p->mu_, &wgt[0]);
calc_pn_c(order_, p->mu_, wgt.data());
for (int i = 0; i < n_bins_; i++) {
match.bins_.push_back(i);
match.weights_.push_back(wgt[i]);

View file

@ -59,7 +59,7 @@ MeshFilter::text_label(int bin) const
int n_dim = mesh.n_dimension_;
std::vector<int> ijk(n_dim);
mesh.get_indices_from_bin(bin, &ijk[0]);
mesh.get_indices_from_bin(bin, ijk.data());
std::stringstream out;
out << "Mesh Index (" << ijk[0];

View file

@ -37,14 +37,14 @@ SphericalHarmonicsFilter::get_all_bins(const Particle* p, int estimator,
// Determine cosine term for scatter expansion if necessary
std::vector<double> wgt(order_ + 1);
if (cosine_ == SphericalHarmonicsCosine::scatter) {
calc_pn_c(order_, p->mu_, &wgt[0]);
calc_pn_c(order_, p->mu_, wgt.data());
} else {
for (int i = 0; i < order_ + 1; i++) wgt[i] = 1;
}
// Find the Rn,m values
std::vector<double> rn(n_bins_);
calc_rn(order_, p->u_last_, &rn[0]);
calc_rn(order_, p->u_last_, rn.data());
int j = 0;
for (int n = 0; n < order_ + 1; n++) {

View file

@ -51,7 +51,7 @@ SpatialLegendreFilter::get_all_bins(const Particle* p, int estimator,
// Compute and return the Legendre weights.
std::vector<double> wgt(order_ + 1);
calc_pn_c(order_, x_norm, &wgt[0]);
calc_pn_c(order_, x_norm, wgt.data());
for (int i = 0; i < order_ + 1; i++) {
match.bins_.push_back(i);
match.weights_.push_back(wgt[i]);

View file

@ -37,7 +37,7 @@ ZernikeFilter::get_all_bins(const Particle* p, int estimator,
if (r <= 1.0) {
// Compute and return the Zernike weights.
std::vector<double> zn(n_bins_);
calc_zn(order_, r, theta, &zn[0]);
calc_zn(order_, r, theta, zn.data());
for (int i = 0; i < n_bins_; i++) {
match.bins_.push_back(i);
match.weights_.push_back(zn[i]);
@ -94,7 +94,7 @@ ZernikeRadialFilter::get_all_bins(const Particle* p, int estimator,
if (r <= 1.0) {
// Compute and return the Zernike weights.
std::vector<double> zn(n_bins_);
calc_zn_rad(order_, r, &zn[0]);
calc_zn_rad(order_, r, zn.data());
for (int i = 0; i < n_bins_; i++) {
match.bins_.push_back(i);
match.weights_.push_back(zn[i]);