Skip to content
Snippets Groups Projects
Commit a6eeb315 authored by R D Schaffer's avatar R D Schaffer
Browse files

added logic to look into the current zone which has been used by the...

added logic to look into the current zone which has been used by the AtlasFieldCache to cache the field description for one cell. The current zone has multiple cells, e.g. for all of the solenoid. This avoids re-looking up the same zone as one navigates out of a cell
parent cfbbce68
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,9 @@ private:
/// Full 3d field
BFieldCache m_cache3d;
/// zone of full 3d field cache
const BFieldZone* m_zone3d { 0 };
/// Fast 2d field
BFieldCacheZR m_cacheZR;
......
......@@ -22,23 +22,26 @@ inline MagField::AtlasFieldCache::AtlasFieldCache(double solFieldScale,
inline bool
MagField::AtlasFieldCache::fillFieldCache(double z, double r, double phi)
{
// search for the zone
const BFieldZone* zone =
m_fieldMap ? m_fieldMap->findBFieldZone(z, r, phi) : nullptr;
if (!zone) {
// Get a new zone from the map ONLY if we are no longer in the current zone
if (!m_zone3d || !m_zone3d->inside( z, r, phi )) {
// search for the zone
m_zone3d = m_fieldMap ? m_fieldMap->findBFieldZone(z, r, phi) : nullptr;
}
if (!m_zone3d) {
// outsize all zones
return false;
}
// set scale for field
m_scaleToUse = (zone->id() == m_solZoneId) ? m_solScale : m_torScale;
m_scaleToUse = (m_zone3d->id() == m_solZoneId) ? m_solScale : m_torScale;
// fill the cache, pass in current scale factor
zone->getCache(z, r, phi, m_cache3d, m_scaleToUse);
m_zone3d->getCache(z, r, phi, m_cache3d, m_scaleToUse);
// save pointer to the conductors in the zone
m_cond = zone->condVector();
m_cond = m_zone3d->condVector();
return true;
}
......
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