py projection without sym

This commit is contained in:
Christian Zimmermann 2017-04-27 19:03:02 +02:00
parent 67a95c7394
commit 0a5cdd2339
3 changed files with 50 additions and 0 deletions

View file

@ -144,6 +144,12 @@ namespace MultiArrayTools
// ma_functional.h
class vec3d2Function;
// ma_functional.h
class pyProjFunction;
// ma_functional.h
class pyProjNoSymFunction;
}
#endif

View file

@ -71,4 +71,26 @@ namespace MultiArrayTools
zz * i.template getIndex<0>().getMetaPos()[2] ) );
return out;
}
pyProjNoSymFunction::pyProjNoSymFunction(const OutRange& outRange) : mOutRange(new OutRange( outRange )),
out(mOutRange->begin()) {}
pyProjNoSymFunction::OutIndex pyProjNoSymFunction::operator()(const InIndex& i) const
{
DistIndex& di = out.template getIndex<0>();
ScalProdIndex& si = out.template getIndex<1>();
const int xx = i.template getIndex<1>().getMetaPos();
const int yy = i.template getIndex<2>().getMetaPos();
const int zz = i.template getIndex<3>().getMetaPos();
if(xx == 0 or yy == 0 or zz == 0){ // anistotropy in C2
di.atMeta(0);
si.atMeta(0);
}
di.atMeta( xx * xx + yy * yy + zz * zz );
si.atMeta( xx * i.template getIndex<0>().getMetaPos()[0] +
yy * i.template getIndex<0>().getMetaPos()[1] +
zz * i.template getIndex<0>().getMetaPos()[2] );
return out;
}
}

View file

@ -84,6 +84,28 @@ namespace MultiArrayTools
std::shared_ptr<OutRange> mOutRange;
mutable OutIndex out;
};
class pyProjNoSymFunction
{
public:
typedef SingleIndex<int,RangeType::SPACE> CoordIndex;
typedef SingleIndex<std::array<int,3>,RangeType::MOMENTUM> 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;
typedef MultiRange<SingleRange<size_t,RangeType::DISTANCE>,
SingleRange<int,RangeType::SPACE> > OutRange;
DEFAULT_MEMBERS(pyProjNoSymFunction);
pyProjNoSymFunction(const OutRange& outRange);
OutIndex operator()(const InIndex& i) const;
private:
std::shared_ptr<OutRange> mOutRange;
mutable OutIndex out;
};
}