Skip to content
Snippets Groups Projects
Commit 8ffc84c4 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'magfield_restrict_and_inside' into 'master'

Add ATH_RESTRICT to addBiotSavart inputs.

See merge request atlas/athena!37582
parents bf413121 740ace1a
No related branches found
No related tags found
No related merge requests found
...@@ -57,8 +57,7 @@ BFieldCache::inside(double z, double r, double phi) const ...@@ -57,8 +57,7 @@ BFieldCache::inside(double z, double r, double phi) const
if (phi < m_phimin) { if (phi < m_phimin) {
phi += 2.0 * M_PI; phi += 2.0 * M_PI;
} }
return (phi >= m_phimin && phi <= m_phimax && z >= m_zmin && z <= m_zmax && return (r <= m_rmax && r >= m_rmin && z <= m_zmax && z >= m_zmin &&
r >= m_rmin && r <= m_rmax); phi <= m_phimax && phi >= m_phimin);
} }
...@@ -21,7 +21,10 @@ class BFieldCond ...@@ -21,7 +21,10 @@ class BFieldCond
{ {
public: public:
// constructor // constructor
BFieldCond(bool finite, const double* p1, const double* p2, double curr) BFieldCond(bool finite,
const double* p1,
const double* p2,
double curr)
: m_finite(finite) : m_finite(finite)
, m_p1(Eigen::Map<const Eigen::Vector3d>(p1)) , m_p1(Eigen::Map<const Eigen::Vector3d>(p1))
, m_p2(Eigen::Map<const Eigen::Vector3d>(p2)) , m_p2(Eigen::Map<const Eigen::Vector3d>(p2))
...@@ -32,9 +35,9 @@ public: ...@@ -32,9 +35,9 @@ public:
// compute magnetic field, plus derivatives if requested, and add // compute magnetic field, plus derivatives if requested, and add
void addBiotSavart(double scaleFactor, void addBiotSavart(double scaleFactor,
const double* xyz, const double* ATH_RESTRICT xyz,
double* B, double* ATH_RESTRICT B,
double* deriv = nullptr) const; double* ATH_RESTRICT deriv = nullptr) const;
// scale the current wrt the nominal current // scale the current wrt the nominal current
void scaleCurrent(double factor) { m_curr = factor * m_nomCurr; } void scaleCurrent(double factor) { m_curr = factor * m_nomCurr; }
// accessors // accessors
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
*/ */
inline void inline void
BFieldCond::addBiotSavart(double scaleFactor, BFieldCond::addBiotSavart(double scaleFactor,
const double* xyz, const double* ATH_RESTRICT xyz,
double* B_in, double* ATH_RESTRICT B_in,
double* deriv) const double* ATH_RESTRICT deriv) const
{ {
static const double mu04pi = 1.0e-7; // mu_0/4pi static const double mu04pi = 1.0e-7; // mu_0/4pi
static const double minvsq = 10. * 10.; // (1 cm)^2 static const double minvsq = 10. * 10.; // (1 cm)^2
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "MagFieldElements/BFieldCache.h" #include "MagFieldElements/BFieldCache.h"
#include "MagFieldElements/BFieldVector.h" #include "MagFieldElements/BFieldVector.h"
#include "CxxUtils/restrict.h"
#include <array> #include <array>
#include <cmath> #include <cmath>
#include <vector> #include <vector>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment