11 #if HAVE_TARGET_CLONES
12 [[gnu::target_clones(
"avx2",
"default")]]
14 void getBzrphi(
double Bzrphi[4],
15 const double field[3][8],
105 const double x =
xyz[0];
106 const double y =
xyz[1];
107 const double z =
xyz[2];
115 const double gz = 1.0 - fz;
117 const double gr = 1.0 -
fr;
119 const double gphi = 1.0 - fphi;
137 B[0] = Bzrphi[1] *
c - Bzrphi[2] *
s;
138 B[1] = Bzrphi[1] *
s + Bzrphi[2] *
c;
147 std::array<double, 3> dBdz{};
148 std::array<double, 3> dBdr{};
149 std::array<double, 3> dBdphi{};
151 for (
int j = 0; j < 3; ++j) {
167 const double cc =
c *
c;
168 const double cs =
c *
s;
169 const double ss =
s *
s;
170 const double ccinvr =
cc * invr;
171 const double csinvr = cs * invr;
172 const double ssinvr =
ss * invr;
173 const double sinvr =
s * invr;
174 const double cinvr =
c * invr;
175 deriv[0] =
cc * dBdr[1] - cs * dBdr[2] - csinvr * dBdphi[1] +
176 ssinvr * dBdphi[2] + sinvr *
B[1];
177 deriv[1] = cs * dBdr[1] -
ss * dBdr[2] + ccinvr * dBdphi[1] -
178 csinvr * dBdphi[2] - cinvr *
B[1];
179 deriv[2] =
c * dBdz[1] -
s * dBdz[2];
180 deriv[3] = cs * dBdr[1] +
cc * dBdr[2] - ssinvr * dBdphi[1] -
181 csinvr * dBdphi[2] - sinvr *
B[0];
182 deriv[4] =
ss * dBdr[1] + cs * dBdr[2] + csinvr * dBdphi[1] +
183 ccinvr * dBdphi[2] + cinvr *
B[0];
184 deriv[5] =
s * dBdz[1] +
c * dBdz[2];
185 deriv[6] =
c * dBdr[0] - sinvr * dBdphi[0];
186 deriv[7] =
s * dBdr[0] + cinvr * dBdphi[0];