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 Sep 13, 2024
1 parent 3000016 commit 9584c62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/particles/diagnostics/CovarianceMatrixMath.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace impactx::diagnostics
amrex::ParticleReal theta = 0.0_prt;

// Discriminant should be < 0. Otherwise, keep theta at default and throw an error.
if(discriminant > 0.0_prt){
if(discriminant > 0.0_prt){
std::cout << "Polynomial in CubicRoots has one or more complex roots." << "\n";
} else {
theta = acos(R/sqrt(-pow(Q,3)));
Expand All @@ -66,13 +66,13 @@ namespace impactx::diagnostics
std::cout << "Discriminant, Q, R " << discriminant << " " << Q << " " << R << "\n";
std::cout << "Return x1, x2, x3 " << x1 << " " << x2 << " " << x3 << "\n";

roots = std::make_tuple(x1,x2,x3);
roots = std::make_tuple(x1,x2,x3);
return roots;
}


/** Function to take the trace of a square 6x6 matrix.
*
*
* @param[in] matrix A
* @returns the trace of A
*/
Expand All @@ -81,11 +81,11 @@ namespace impactx::diagnostics
amrex::Array2D<amrex::ParticleReal, 1, 6, 1, 6> A
)
{
int const dim = 6;
int const dim = 6;
amrex::ParticleReal trA = 0.0;

for (int i = 1; i < dim+1; i++) {
trA += A(i,i);
trA += A(i,i);
}
return trA;
}
Expand Down Expand Up @@ -115,9 +115,9 @@ namespace impactx::diagnostics
}

}

}
return C;
return C;
}


Expand Down
12 changes: 6 additions & 6 deletions src/particles/diagnostics/EmittanceInvariants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <stdexcept>
#include <AMReX_Extension.H>
#include <AMReX_REAL.H>
#include <AMReX_GpuComplex.H>
#include <AMReX_GpuComplex.H>
#include <cmath>
#include <vector>
#include <tuple>
Expand All @@ -22,7 +22,7 @@ namespace impactx::diagnostics
{

/** This function returns the three independent kinetic invariants
* denoted I2, I4, and I6 as constructed from the 6x6
* denoted I2, I4, and I6 as constructed from the 6x6
* beam covariance matrix. These three quantities are invariant
* under any linear symplectic transport map, and are used in the
* calculation of the three eigenemittances.
Expand Down Expand Up @@ -51,8 +51,8 @@ namespace impactx::diagnostics
amrex::Array2D<amrex::ParticleReal, 1, 6, 1, 6> S4;
amrex::Array2D<amrex::ParticleReal, 1, 6, 1, 6> S6;

// Construct the matrix S1 = Sigma*J. This is a
// permutation of the columns of Sigma with
// Construct the matrix S1 = Sigma*J. This is a
// permutation of the columns of Sigma with
// a change of sign.
for (int i = 1; i < 7; i++) {
for (int j = 1; j < 7; j++) {
Expand All @@ -69,7 +69,7 @@ namespace impactx::diagnostics
S2 = impactx::diagnostics::MultiplyMat(S1,S1);
S4 = impactx::diagnostics::MultiplyMat(S2,S2);
S6 = impactx::diagnostics::MultiplyMat(S2,S4);

// Define the three kinematic invariants (should be nonnegative).
I2 = -impactx::diagnostics::TraceMat(S2)/2.0_prt;
I4 = +impactx::diagnostics::TraceMat(S4)/2.0_prt;
Expand Down Expand Up @@ -130,6 +130,6 @@ namespace impactx::diagnostics
emittances = std::make_tuple(e1,e2,e3);
return emittances;
}


} // namespace impactx::diagnostics

0 comments on commit 9584c62

Please sign in to comment.