Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 5, 2024
1 parent b0b6354 commit b6c92f9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Source/Particles/ParticleBoundaryBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ struct CopyAndTimestamp {
amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> m_phi;
int m_idim;
int m_iside;


template <typename DstData, typename SrcData>
AMREX_GPU_HOST_DEVICE
Expand All @@ -189,35 +189,35 @@ struct CopyAndTimestamp {
for (int j = 0; j < src.m_num_runtime_int; ++j) {
dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i];
}

amrex::ParticleReal const ux = dst.m_rdata[PIdx::ux][dst_i];
amrex::ParticleReal const uy = dst.m_rdata[PIdx::uy][dst_i];
amrex::ParticleReal const uz = dst.m_rdata[PIdx::uz][dst_i];

//storage of `stepScraped`
dst.m_runtime_idata[m_step_index][dst_i] = m_step;

//calculation and storage of `deltaTimeScraped`
amrex::Real delta_t;
amrex::Real exit_velocity = 0; //the i_dim component of the velocity
if (m_idim == 0) {
exit_velocity = ux;
#if (defined WARPX_DIM_RZ)
exit_velocity = std::sqrt(std::pow(ux, 2) + std::pow(uy, 2)); // u_r
#endif
#endif
} else if (m_idim == 1) {
exit_velocity = uy;
#if (defined WARPX_DIM_RZ)
exit_velocity = std::atan2(uy, ux); // u_theta
#endif
} else {
exit_velocity = uz;
}
}

if (m_iside==1){ //iside=1, we are in the right side
delta_t = std::abs(dst.m_rdata[m_idim][dst_i]-m_phi[m_idim])/exit_velocity;
delta_t = std::abs(dst.m_rdata[m_idim][dst_i]-m_phi[m_idim])/exit_velocity;
} else{
delta_t = std::abs(dst.m_rdata[m_idim][dst_i]-m_plo[m_idim])/exit_velocity;
delta_t = std::abs(dst.m_rdata[m_idim][dst_i]-m_plo[m_idim])/exit_velocity;
}
dst.m_runtime_rdata[m_delta_index][dst_i] = delta_t;

Expand Down Expand Up @@ -248,11 +248,11 @@ struct CopyAndTimestamp {
#endif

//calculation of the normal to the boundary
std::array<double, 3> n = {0.0, 0.0, 0.0};
std::array<double, 3> n = {0.0, 0.0, 0.0};
n[m_idim]=1-2*m_iside;
dst.m_runtime_rdata[m_normal_index][dst_i]= n[0];
dst.m_runtime_rdata[m_normal_index+1][dst_i]= n[1];
dst.m_runtime_rdata[m_normal_index+2][dst_i]= n[2];
dst.m_runtime_rdata[m_normal_index+2][dst_i]= n[2];
}
};

Expand Down Expand Up @@ -458,7 +458,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc,
if (np == 0) { continue; }

auto predicate = IsOutsideDomainBoundary{plo, phi, idim, iside};

const auto ptile_data = ptile.getConstParticleTileData();

amrex::ReduceOps<amrex::ReduceOpSum> reduce_op;
Expand Down Expand Up @@ -623,4 +623,4 @@ ParticleBoundaryBuffer::getParticleBufferPointer(const std::string species_name,
auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name);

return &buffer[index];
}
}

0 comments on commit b6c92f9

Please sign in to comment.