From 67a95c7394d536e0e7e1d97d314ff163f4dd2f15 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Mon, 3 Apr 2017 14:36:48 +0200 Subject: [PATCH] minor change in py proj --- src/ma_functional.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/ma_functional.cc b/src/ma_functional.cc index f8b216b..84772c1 100644 --- a/src/ma_functional.cc +++ b/src/ma_functional.cc @@ -57,13 +57,18 @@ namespace MultiArrayTools { 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] ); + 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( abs( xx * i.template getIndex<0>().getMetaPos()[0] + + yy * i.template getIndex<0>().getMetaPos()[1] + + zz * i.template getIndex<0>().getMetaPos()[2] ) ); return out; } }