void SBConvolve::SBConvolveImpl::add(const SBProfile& rhs) { dbg<<"Start SBConvolveImpl::add. Adding item # "<<_plist.size()+1<<std::endl; // Add new terms(s) to the _plist: assert(GetImpl(rhs)); const SBProfileImpl* p = GetImpl(rhs); const SBConvolveImpl* sbc = dynamic_cast<const SBConvolveImpl*>(p); const SBAutoConvolve::SBAutoConvolveImpl* sbc2 = dynamic_cast<const SBAutoConvolve::SBAutoConvolveImpl*>(p); const SBAutoCorrelate::SBAutoCorrelateImpl* sbc3 = dynamic_cast<const SBAutoCorrelate::SBAutoCorrelateImpl*>(p); if (sbc) { dbg<<" (Item is really "<<sbc->_plist.size()<<" items.)"<<std::endl; // If rhs is an SBConvolve, copy its list here for (ConstIter pptr = sbc->_plist.begin(); pptr!=sbc->_plist.end(); ++pptr) { if (!pptr->isAnalyticK() && !_real_space) throw SBError("SBConvolve requires members to be analytic in k"); if (!pptr->isAnalyticX() && _real_space) throw SBError("Real_space SBConvolve requires members to be analytic in x"); _plist.push_back(*pptr); } } else if (sbc2) { dbg<<" (Item is really AutoConvolve.)"<<std::endl; // If rhs is an SBAutoConvolve, put two of its item here: const SBProfile& obj = sbc2->getAdaptee(); if (!obj.isAnalyticK() && !_real_space) throw SBError("SBConvolve requires members to be analytic in k"); if (!obj.isAnalyticX() && _real_space) throw SBError("Real_space SBConvolve requires members to be analytic in x"); _plist.push_back(obj); _plist.push_back(obj); } else if (sbc3) { dbg<<" (Item is really AutoCorrelate items.)"<<std::endl; // If rhs is an SBAutoCorrelate, put its item and 180 degree rotated verion here: const SBProfile& obj = sbc3->getAdaptee(); if (!obj.isAnalyticK() && !_real_space) throw SBError("SBConvolve requires members to be analytic in k"); if (!obj.isAnalyticX() && _real_space) throw SBError("Real_space SBConvolve requires members to be analytic in x"); _plist.push_back(obj); SBProfile temp = obj; temp.applyRotation(180. * degrees); _plist.push_back(temp); } else { if (!rhs.isAnalyticK() && !_real_space) throw SBError("SBConvolve requires members to be analytic in k"); if (!rhs.isAnalyticX() && _real_space) throw SBError("Real-space SBConvolve requires members to be analytic in x"); _plist.push_back(rhs); } }
double SBAutoCorrelate::SBAutoCorrelateImpl::xValue(const Position<double>& pos) const { SBProfile temp = _adaptee; temp.applyRotation(180. * degrees); return RealSpaceConvolve(_adaptee,temp,pos,getFlux(),this->gsparams); }