Commit a164fe31 authored by snuverink_j's avatar snuverink_j
Browse files

Merge branch '487-clang-compiler-for-inttsc-wsign-compare' into 'master'

Resolve "Clang compiler warning for IntTSC (-Wsign-compare)"

Closes #487

See merge request !301
parents 1fadf7c9 982955b4
......@@ -275,19 +275,14 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * pdata;
fiter.offset(-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
fiter.offset(+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
return;
}
......@@ -314,21 +309,15 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * pdata;
fiter.offset(-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
fiter.offset(+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
return;
for (int p0 = -1; p0 <= 1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
return;
}
// scatter particle data into Field using cached mesh information
......@@ -343,19 +332,14 @@ public:
// adjust position of Field iterator to lgp position
//fiter.moveBy(lgpoff);
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * pdata;
fiter.offset(-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
fiter.offset(+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
for (int p0 = -1; p0 <= 1; ++p0) {
fiter.offset(p0) += W(p0,0) * pdata;
}
return;
}
......@@ -382,23 +366,15 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
/* pdata = (1 - dpos(0)) * (*fiter) +
dpos(0) * fiter.offset(1);*/
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(+1);
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
pdata = 0;
for (int p0=-1; p0<=1; ++p0) {
pdata += W(p0,0)*fiter.offset(p0);
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
pdata = 0;
for (int p0 = -1; p0 <= 1; ++p0) {
pdata += W(p0,0) * fiter.offset(p0);
}
return;
}
......@@ -425,21 +401,15 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(+1);
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
pdata = 0;
for (int p0=-1; p0<=1; ++p0) {
pdata += W(p0,0)*fiter.offset(p0);
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
pdata = 0;
for (int p0 = -1; p0 <= 1; ++p0) {
pdata += W(p0,0) * fiter.offset(p0);
}
return;
}
......@@ -454,20 +424,15 @@ public:
// Try to find ngp in local fields and get iterator
fiter = getFieldIter(f,ngp);
// accumulate into particle attrib
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * fiter.offset(+1);
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
pdata = 0;
for (int p0=-1; p0<=1; ++p0) {
pdata += W(p0,0)*fiter.offset(p0);
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
pdata = 0;
for (int p0 = -1; p0 <= 1; ++p0) {
pdata += W(p0,0) * fiter.offset(p0);
}
return;
}
......@@ -507,27 +472,16 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,0) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,+1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,-1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,+1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,-1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,0) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
return;
}
......@@ -554,28 +508,16 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,0) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,+1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,-1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,+1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,-1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,0) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
return;
}
......@@ -592,28 +534,16 @@ public:
// adjust position of Field iterator to lgp position
// fiter.moveBy(lgpoff);
// accumulate into local elements
/*
*fiter += .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,-1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,0) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(-1,+1) += .125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,-1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(0,+1) += .25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,-1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,0) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * pdata;
fiter.offset(+1,+1) += .125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * pdata;
*/
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
fiter.offset(p0,p1) += W(p0,0) * W(p1,1) * pdata;
}
}
return;
}
......@@ -640,29 +570,17 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,-1) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(-1,0) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,+1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,-1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,+1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) *fiter.offset(+1,-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(+1,0) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(+1,+1) ;
*/
pdata = 0;
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
pdata = 0;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
return;
}
......@@ -689,30 +607,17 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,-1) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(-1,0) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,+1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,-1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,+1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) *fiter.offset(+1,-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(+1,0) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(+1,+1) ;
*/
pdata = 0;
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
pdata = 0;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
return;
}
......@@ -726,30 +631,17 @@ public:
// Try to find ngp in local fields and get iterator
fiter = getFieldIter(f,ngp);
// accumulate into particle attrib
/*
pdata = .25*(3.-4.dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * (*fiter) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,-1) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(-1,0) +
.125*(1.-4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(-1,+1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,-1) +
.25*(3.-4.dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(0,+1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.-4.*dpos(1)+4.*dpos(1)*dpos(1)) *fiter.offset(+1,-1) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .25*(3.-4.dpos(1)*dpos(1)) * fiter.offset(+1,0) +
.125*(1.+4.*dpos(0)+4.*dpos(0)*dpos(0)) * .125*(1.+4.*dpos(1)+4.*dpos(1)*dpos(1)) * fiter.offset(+1,+1) ;
*/
pdata = 0;
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
pdata = 0;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
pdata += W(p0,0) * W(p1,1) * fiter.offset(p0,p1);
}
}
return;
}
......@@ -790,21 +682,18 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
//double interpol_tot = 0;
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
for (int p2=-1; p2<=1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
//interpol_tot+= W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
//std::cout << "the total interpolation is = " << interpol_tot << std::endl;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
for (int p2 = -1; p2 <= 1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
return;
}
......@@ -831,22 +720,18 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into local elements
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
//double interpol_tot = 0;
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
for (int p2=-1; p2<=1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
//interpol_tot+= W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
// std::cout << "the total interpolation is = " << interpol_tot << std::endl;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
for (int p2 = -1; p2 <= 1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
return;
}
......@@ -860,23 +745,18 @@ public:
// Try to find ngp in local fields and get iterator
fiter = getFieldIter(f,ngp);
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
for (int p2=-1; p2<=1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
// std::cout << "HELLOOO from scatter" << std::endl;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
for (int p2 = -1; p2 <= 1; ++p2) {
fiter.offset(p0,p1,p2) += W(p0,0) * W(p1,1) * W(p2,2) * pdata;
}
}
}
return;
}
......@@ -902,22 +782,19 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
pdata = 0;
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
for (int p2=-1; p2<=1; ++p2) {
pdata += W(p0,0) * W(p1,1) * W(p2,2) * fiter.offset(p0,p1,p2);
}
}
}
//std::cout << "GATHERED pdata = " << pdata << std::endl;
pdata = 0;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 * dpos(i) + 4 * dpos(i) * dpos(i));
else if (p==0) return .25 * (3 - 4 * dpos(i) * dpos(i));
else if (p==+1) return .125 * (1 + 4 * dpos(i) + 4 * dpos(i) * dpos(i)); };
for (int p0 = -1; p0 <= 1; ++p0) {
for (int p1 = -1; p1 <= 1; ++p1) {
for (int p2 = -1; p2 <= 1; ++p2) {
pdata += W(p0,0) * W(p1,1) * W(p2,2) * fiter.offset(p0,p1,p2);
}
}
}
return;
}
......@@ -944,21 +821,19 @@ public:
// normalize dpos by mesh spacing
dpos /= delta;
// accumulate into particle attrib
pdata = 0;
auto W = [dpos](unsigned p, unsigned i) {
if (p==-1) return .125*(1.-4.*dpos(i)+4.*dpos(i)*dpos(i));
else if (p==0) return .25*(3.-4.*dpos(i)*dpos(i));
else if (p==+1) return .125*(1.+4.*dpos(i)+4.*dpos(i)*dpos(i)); };
for (int p0=-1; p0<=1; ++p0) {
for (int p1=-1; p1<=1; ++p1) {
for (int p2=-1; p2<=1; ++p2) {
pdata += W(p0,0) * W(p1,1) * W(p2,2) * fiter.offset(p0,p1,p2);
}
}
}
pdata = 0;
auto W = [dpos](int p, unsigned i) {
if (p==-1) return .125 * (1 - 4 *