added (p,x,y,z) -> (yy,py) projection function

This commit is contained in:
Christian Zimmermann 2017-03-30 21:42:53 +02:00
parent 8c2ced598f
commit 5a5d8883b4
2 changed files with 37 additions and 0 deletions

View file

@ -49,4 +49,21 @@ namespace MultiArrayTools
i.template getIndex<2>().getMetaPos() * i.template getIndex<2>().getMetaPos() ); i.template getIndex<2>().getMetaPos() * i.template getIndex<2>().getMetaPos() );
return out; return out;
} }
pyProjFunction::pyProjFunction(const OutRange& outRange) : mOutRange(new OutRange( outRange )),
out(mOutRange->begin()) {}
pyProjFunction::OutIndex pyProjFunction::operator()(const InIndex& i) const
{
DistIndex& di = out.template getIndex<0>();
ScalProdIndex& si = out.template getIndex<1>();
di.atMeta( i.template getIndex<1>().getMetaPos() * i.template getIndex<1>().getMetaPos() +
i.template getIndex<2>().getMetaPos() * i.template getIndex<2>().getMetaPos() +
i.template getIndex<3>().getMetaPos() * i.template getIndex<3>().getMetaPos() );
si.atMeta( i.template getIndex<1>().getMetaPos() * i.template getIndex<0>().getMetaPos()[0]
i.template getIndex<2>().getMetaPos() * i.template getIndex<0>().getMetaPos()[1]
i.template getIndex<3>().getMetaPos() * i.template getIndex<0>().getMetaPos()[2] );
return out;
}
} }

View file

@ -62,6 +62,26 @@ namespace MultiArrayTools
std::shared_ptr<OutRange> mOutRange; std::shared_ptr<OutRange> mOutRange;
mutable OutIndex out; mutable OutIndex out;
}; };
class pyProjFunction
{
public:
typedef SingleIndex<int,RangeType::SPACE> CoordIndex;
typedef SingleIndex<std::array<int,3>,RangeType::MOMETUM> MomIndex;
typedef MultiIndex<MomIndex,CoordIndex,CoordIndex,CoordIndex> InIndex;
typedef SingleIndex<size_t,RangeType::DISTANCE> DistIndex;
typedef SingleIndex<int,RangeType::SPACE> ScalProdIndex;
typedef MultiIndex<DistIndex,ScalProdIndex> OutIndex;
DEFAULT_MEMBERS(pyProjFunction);
pyProjFunction(const OutRange& outRange);
OutIndex operator()(const InIndex& i) const;
private:
std::shared_ptr<OutRange> mOutRange;
mutable OutIndex out;
};
} }