Commit 527134a5 authored by snuverink_j's avatar snuverink_j
Browse files

fix unused argument warnings in IPPL tests; fix spacing

parent 76c9e561
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit http://www.acl.lanl.gov/POOMS for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// TestFFT.cpp , Tim Williams 1/27/1997 // TestFFT.cpp , Tim Williams 1/27/1997
// Updated by Julian Cummings, 3/31/98 // Updated by Julian Cummings, 3/31/98
...@@ -40,10 +15,10 @@ enum InterPolT {NGP,CIC}; ...@@ -40,10 +15,10 @@ enum InterPolT {NGP,CIC};
enum BCT {OOO,OOP,PPP,DDD,DDO,DDP}; // OOO == all dim, open BC enum BCT {OOO,OOP,PPP,DDD,DDO,DDP}; // OOO == all dim, open BC
enum TestCases {test1}; enum TestCases {test1};
bool Configure(int argc, char *argv[], InterPolT *interPol, bool Configure(int argc, char *argv[], InterPolT *interPol,
unsigned int *nx, unsigned int *ny, unsigned int *nz, unsigned int *nx, unsigned int *ny, unsigned int *nz,
TestCases *test2Perform, TestCases *test2Perform,
int *serialDim, unsigned int *processes, unsigned int *nLoop) int *serialDim, unsigned int *processes, unsigned int *nLoop)
{ {
Inform msg("Configure "); Inform msg("Configure ");
...@@ -71,7 +46,7 @@ bool Configure(int argc, char *argv[], InterPolT *interPol, ...@@ -71,7 +46,7 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
*nLoop = atoi(argv[++i]); *nLoop = atoi(argv[++i]);
} else if (s == "-Decomp") { } else if (s == "-Decomp") {
*serialDim = atoi(argv[++i]); *serialDim = atoi(argv[++i]);
} }
else { else {
errmsg << "Illegal format for or unknown option '" << s.c_str() << "'."; errmsg << "Illegal format for or unknown option '" << s.c_str() << "'.";
errmsg << endl; errmsg << endl;
...@@ -113,25 +88,25 @@ int main(int argc, char *argv[]) ...@@ -113,25 +88,25 @@ int main(int argc, char *argv[])
const unsigned D=3U; const unsigned D=3U;
testmsg << "Dimensionality: D= " << D << " P= " << processes; testmsg << "Dimensionality: D= " << D << " P= " << processes;
testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz << endl; testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz << endl;
unsigned ngrid[D]; // grid sizes unsigned ngrid[D]; // grid sizes
// Used in evaluating correctness of results: // Used in evaluating correctness of results:
double realDiff; double realDiff = -1.0;
// Various counters, constants, etc: // Various counters, constants, etc:
unsigned int d; unsigned int d;
/*int tag = */ Ippl::Comm->next_tag(IPPL_APP_TAG0); /*int tag = */ Ippl::Comm->next_tag(IPPL_APP_TAG0);
double pi = acos(-1.0); double pi = acos(-1.0);
double twopi = 2.0*pi; double twopi = 2.0*pi;
// Timer: // Timer:
Timer timer; Timer timer;
// Layout information: // Layout information:
unsigned vnodes; // number of vnodes; input at cmd line unsigned vnodes; // number of vnodes; input at cmd line
e_dim_tag allParallel[D]; // Specifies SERIAL, PARALLEL dims e_dim_tag allParallel[D]; // Specifies SERIAL, PARALLEL dims
for (d=0; d<D; d++) for (d=0; d<D; d++)
allParallel[d] = PARALLEL; allParallel[d] = PARALLEL;
allParallel[0] = SERIAL; allParallel[0] = SERIAL;
...@@ -147,18 +122,18 @@ int main(int argc, char *argv[]) ...@@ -147,18 +122,18 @@ int main(int argc, char *argv[])
testmsg << "In-place CC transform using all-parallel layout ..." << endl; testmsg << "In-place CC transform using all-parallel layout ..." << endl;
// ================BEGIN INTERACTION LOOP==================================== // ================BEGIN INTERACTION LOOP====================================
//------------------------complex<-->complex------------------------------- //------------------------complex<-->complex-------------------------------
// Complex test Fields // Complex test Fields
// create standard domain // create standard domain
NDIndex<D> ndiStandard; NDIndex<D> ndiStandard;
for (d=0; d<D; d++) for (d=0; d<D; d++)
ndiStandard[d] = Index(ngrid[d]); ndiStandard[d] = Index(ngrid[d]);
// create new domain with axes permuted to match FFT output // create new domain with axes permuted to match FFT output
NDIndex<D> ndiPermuted; NDIndex<D> ndiPermuted;
ndiPermuted[0] = ndiStandard[D-1]; ndiPermuted[0] = ndiStandard[D-1];
for (d=1; d<D; d++) for (d=1; d<D; d++)
ndiPermuted[d] = ndiStandard[d-1]; ndiPermuted[d] = ndiStandard[d-1];
// create half-size domain for RC transform along zeroth axis // create half-size domain for RC transform along zeroth axis
...@@ -167,7 +142,7 @@ int main(int argc, char *argv[]) ...@@ -167,7 +142,7 @@ int main(int argc, char *argv[])
// create new domain with axes permuted to match FFT output // create new domain with axes permuted to match FFT output
NDIndex<D> ndiPermuted0h; NDIndex<D> ndiPermuted0h;
ndiPermuted0h[0] = ndiStandard0h[D-1]; ndiPermuted0h[0] = ndiStandard0h[D-1];
for (d=1; d<D; d++) for (d=1; d<D; d++)
ndiPermuted0h[d] = ndiStandard0h[d-1]; ndiPermuted0h[d] = ndiStandard0h[d-1];
// create half-size domain for sine transform along zeroth axis // create half-size domain for sine transform along zeroth axis
...@@ -177,21 +152,21 @@ int main(int argc, char *argv[]) ...@@ -177,21 +152,21 @@ int main(int argc, char *argv[])
// create new domain with axes permuted to match FFT output // create new domain with axes permuted to match FFT output
NDIndex<D> ndiPermuted1h; NDIndex<D> ndiPermuted1h;
ndiPermuted1h[0] = ndiStandard1h[D-1]; ndiPermuted1h[0] = ndiStandard1h[D-1];
for (d=1; d<D; d++) for (d=1; d<D; d++)
ndiPermuted1h[d] = ndiStandard1h[d-1]; ndiPermuted1h[d] = ndiStandard1h[d-1];
// all parallel layout, standard domain, normal axis order // all parallel layout, standard domain, normal axis order
FieldLayout<D> layoutPPStan(ndiStandard,allParallel,vnodes); FieldLayout<D> layoutPPStan(ndiStandard,allParallel,vnodes);
FieldLayout<D> layoutPPStan0h(ndiStandard0h,allParallel,vnodes); FieldLayout<D> layoutPPStan0h(ndiStandard0h,allParallel,vnodes);
FieldLayout<D> layoutPPStan1h(ndiStandard1h,allParallel,vnodes); FieldLayout<D> layoutPPStan1h(ndiStandard1h,allParallel,vnodes);
// create test Fields for complex-to-complex FFT // create test Fields for complex-to-complex FFT
BareField<std::complex<double>,D> CFieldPPStan(layoutPPStan); BareField<std::complex<double>,D> CFieldPPStan(layoutPPStan);
BareField<std::complex<double>,D> CFieldPPStan_save(layoutPPStan); BareField<std::complex<double>,D> CFieldPPStan_save(layoutPPStan);
BareField<double,D> diffFieldPPStan(layoutPPStan); BareField<double,D> diffFieldPPStan(layoutPPStan);
// For calling FieldDebug functions from debugger, set up output format: // For calling FieldDebug functions from debugger, set up output format:
setFormat(4,3); setFormat(4,3);
...@@ -205,22 +180,22 @@ int main(int argc, char *argv[]) ...@@ -205,22 +180,22 @@ int main(int argc, char *argv[])
yfact = 2.0*twopi/(ngrid[1]); yfact = 2.0*twopi/(ngrid[1]);
zfact = 2.0*twopi/(ngrid[2]); zfact = 2.0*twopi/(ngrid[2]);
kx = 1.0; ky = 2.0; kz = 3.0; // wavenumbers kx = 1.0; ky = 2.0; kz = 3.0; // wavenumbers
CFieldPPStan[ndiStandard[0]][ndiStandard[1]][ndiStandard[2]] = CFieldPPStan[ndiStandard[0]][ndiStandard[1]][ndiStandard[2]] =
sfact * ( sin( (ndiStandard[0]+1) * kx * xfact + sfact * ( sin( (ndiStandard[0]+1) * kx * xfact +
ndiStandard[1] * ky * yfact + ndiStandard[1] * ky * yfact +
ndiStandard[2] * kz * zfact ) + ndiStandard[2] * kz * zfact ) +
sin( (ndiStandard[0]+1) * kx * xfact - sin( (ndiStandard[0]+1) * kx * xfact -
ndiStandard[1] * ky * yfact - ndiStandard[1] * ky * yfact -
ndiStandard[2] * kz * zfact ) ) + ndiStandard[2] * kz * zfact ) ) +
cfact * (-cos( (ndiStandard[0]+1) * kx * xfact + cfact * (-cos( (ndiStandard[0]+1) * kx * xfact +
ndiStandard[1] * ky * yfact + ndiStandard[1] * ky * yfact +
ndiStandard[2] * kz * zfact ) + ndiStandard[2] * kz * zfact ) +
cos( (ndiStandard[0]+1) * kx * xfact - cos( (ndiStandard[0]+1) * kx * xfact -
ndiStandard[1] * ky * yfact - ndiStandard[1] * ky * yfact -
ndiStandard[2] * kz * zfact ) ); ndiStandard[2] * kz * zfact ) );
CFieldPPStan_save = CFieldPPStan; // Save values for checking later CFieldPPStan_save = CFieldPPStan; // Save values for checking later
// CC FFT tests // CC FFT tests
// Instantiate complex<-->complex FFT object // Instantiate complex<-->complex FFT object
// Transform in all directions // Transform in all directions
...@@ -246,16 +221,4 @@ int main(int argc, char *argv[]) ...@@ -246,16 +221,4 @@ int main(int argc, char *argv[])
testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz; testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz;
testmsg << " ||d||= " << fabs(realDiff) << endl; testmsg << " ||d||= " << fabs(realDiff) << endl;
return 0; return 0;
} }
\ No newline at end of file
/***************************************************************************
* $RCSfile: TestFFT-SPP.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:36 $
***************************************************************************/
/***************************************************************************
* $RCSfile: addheaderfooter,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
* IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software
*
* Visit http://www.acl.lanl.gov/POOMS for more details
*
***************************************************************************/
// -*- C++ -*-
/***************************************************************************
*
* The IPPL Framework
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
***************************************************************************/
// TestFFT.cpp , Tim Williams 1/27/1997 // TestFFT.cpp , Tim Williams 1/27/1997
// Updated by Julian Cummings, 3/31/98 // Updated by Julian Cummings, 3/31/98
...@@ -35,13 +10,13 @@ using namespace std; ...@@ -35,13 +10,13 @@ using namespace std;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Ippl ippl(argc,argv); Ippl ippl(argc,argv);
Inform testmsg(NULL,0); Inform testmsg(NULL,0);
const unsigned D=3U; const unsigned D=3U;
testmsg << "%%%%%%% Dimensionality: D = " << D << " %%%%%%%" << endl; testmsg << "%%%%%%% Dimensionality: D = " << D << " %%%%%%%" << endl;
unsigned ngrid[D]; // grid sizes unsigned ngrid[D]; // grid sizes
// Used in evaluating correctness of results: // Used in evaluating correctness of results:
...@@ -76,21 +51,21 @@ int main(int argc, char *argv[]) ...@@ -76,21 +51,21 @@ int main(int argc, char *argv[])
if( Ippl::Comm->myNode() == Parent ) { if( Ippl::Comm->myNode() == Parent ) {
bool vnodesOK = false; bool vnodesOK = false;
while (!vnodesOK) { while (!vnodesOK) {
compressTemps = false; compressTemps = false;
constInput = false; constInput = false;
for (d=0; d<D; d++) for (d=0; d<D; d++)
ngrid[d] = 32; ngrid[d] = 32;
// now broadcast data to other nodes // now broadcast data to other nodes
Message *mess = new Message(); Message *mess = new Message();
putMessage( *mess, vnodes ); putMessage( *mess, vnodes );
if (vnodes > 0) { if (vnodes > 0) {
putMessage(*mess, compressTemps); putMessage(*mess, compressTemps);
putMessage(*mess, constInput); putMessage(*mess, constInput);
for (d=0; d<D; d++) for (d=0; d<D; d++)
putMessage( *mess, ngrid[d] ); putMessage( *mess, ngrid[d] );
} }
Ippl::Comm->broadcast_all(mess, tag); Ippl::Comm->broadcast_all(mess, tag);
} }
} }
// now each node recieves the data // now each node recieves the data
...@@ -101,13 +76,13 @@ int main(int argc, char *argv[]) ...@@ -101,13 +76,13 @@ int main(int argc, char *argv[])
if (vnodes <= 0) break; if (vnodes <= 0) break;
getMessage(*mess, compressTemps); getMessage(*mess, compressTemps);
getMessage(*mess, constInput); getMessage(*mess, constInput);
for (d=0; d<D; d++) for (d=0; d<D; d++)
getMessage( *mess, ngrid[d] ); getMessage( *mess, ngrid[d] );
delete mess; delete mess;
//------------------------complex<-->complex------------------------------- //------------------------complex<-->complex-------------------------------
// Complex test Fields // Complex test Fields
// create standard domain // create standard domain
NDIndex<D> ndiStandard; NDIndex<D> ndiStandard;
for (d=0; d<D; d++) for (d=0; d<D; d++)
...@@ -198,27 +173,27 @@ int main(int argc, char *argv[]) ...@@ -198,27 +173,27 @@ int main(int argc, char *argv[])
// Rather more complete test functions (sine or cosine mode): // Rather more complete test functions (sine or cosine mode):
std::complex<double> sfact(1.0,0.0); // (1,0) for sine mode; (0,0) for cosine mode std::complex<double> sfact(1.0,0.0); // (1,0) for sine mode; (0,0) for cosine mode
std::complex<double> cfact(0.0,0.0); // (0,0) for sine mode; (1,0) for cosine mode std::complex<double> cfact(0.0,0.0); // (0,0) for sine mode; (1,0) for cosine mode
double xfact, kx, yfact, ky, zfact, kz; double xfact, kx, yfact, ky, zfact, kz;
xfact = pi/(ngrid[0] + 1.0); xfact = pi/(ngrid[0] + 1.0);
yfact = 2.0*twopi/(ngrid[1]); yfact = 2.0*twopi/(ngrid[1]);
zfact = 2.0*twopi/(ngrid[2]); zfact = 2.0*twopi/(ngrid[2]);
kx = 1.0; ky = 2.0; kz = 3.0; // wavenumbers kx = 1.0; ky = 2.0; kz = 3.0; // wavenumbers
CFieldPPStan[ndiStandard[0]][ndiStandard[1]][ndiStandard[2]] = CFieldPPStan[ndiStandard[0]][ndiStandard[1]][ndiStandard[2]] =
sfact * ( sin( (ndiStandard[0]+1) * kx * xfact + sfact * ( sin( (ndiStandard[0]+1) * kx * xfact +
ndiStandard[1] * ky * yfact + ndiStandard[1] * ky * yfact +
ndiStandard[2] * kz * zfact ) + ndiStandard[2] * kz * zfact ) +
sin( (ndiStandard[0]+1) * kx * xfact - sin( (ndiStandard[0]+1) * kx * xfact -
ndiStandard[1] * ky * yfact - ndiStandard[1] * ky * yfact -
ndiStandard[2] * kz * zfact ) ) + ndiStandard[2] * kz * zfact ) ) +
cfact * (-cos( (ndiStandard[0]+1) * kx * xfact + cfact * (-cos( (ndiStandard[0]+1) * kx * xfact +
ndiStandard[1] * ky * yfact + ndiStandard[1] * ky * yfact +
ndiStandard[2] * kz * zfact ) + ndiStandard[2] * kz * zfact ) +
cos( (ndiStandard[0]+1) * kx * xfact - cos( (ndiStandard[0]+1) * kx * xfact -
ndiStandard[1] * ky * yfact - ndiStandard[1] * ky * yfact -
ndiStandard[2] * kz * zfact ) ); ndiStandard[2] * kz * zfact ) );
CFieldPPStan_save = CFieldPPStan; // Save values for checking later CFieldPPStan_save = CFieldPPStan; // Save values for checking later
// RC FFT tests // RC FFT tests
RFieldPPStan = real(CFieldPPStan_save); RFieldPPStan = real(CFieldPPStan_save);
CFieldPPStan0h = std::complex<double>(0.0,0.0); CFieldPPStan0h = std::complex<double>(0.0,0.0);
...@@ -236,7 +211,7 @@ int main(int argc, char *argv[]) ...@@ -236,7 +211,7 @@ int main(int argc, char *argv[])
timer.start(); timer.start();
// Test real<-->complex transform (simple test: forward then inverse // Test real<-->complex transform (simple test: forward then inverse
// transform, see if we get back original values. // transform, see if we get back original values.
cout << "PE " << pe << " about to invoke forward FFT::transform()" << endl; cout << "PE " << pe << " about to invoke forward FFT::transform()" << endl;
testmsg << "Forward transform ..." << endl; testmsg << "Forward transform ..." << endl;
rcfft.transform("forward", RFieldPPStan, CFieldPPStan0h, constInput); rcfft.transform("forward", RFieldPPStan, CFieldPPStan0h, constInput);
...@@ -260,14 +235,14 @@ int main(int argc, char *argv[]) ...@@ -260,14 +235,14 @@ int main(int argc, char *argv[])
timer.start(); timer.start();
// Test real<-->complex transform (simple test: forward then inverse // Test real<-->complex transform (simple test: forward then inverse
// transform, see if we get back original values. // transform, see if we get back original values.
testmsg << "Forward transform ..." << endl; testmsg << "Forward transform ..." << endl;
rcfft.transform("forward", RFieldSPStan, CFieldSPStan0h, constInput); rcfft.transform("forward", RFieldSPStan, CFieldSPStan0h, constInput);
testmsg << "Inverse transform ..." << endl; testmsg << "Inverse transform ..." << endl;
rcfft.transform("inverse", CFieldSPStan0h, RFieldSPStan, constInput); rcfft.transform("inverse", CFieldSPStan0h, RFieldSPStan, constInput);
timer.stop(); timer.stop();
diffFieldSPStan = Abs(RFieldSPStan - RFieldSPStan_save); diffFieldSPStan = Abs(RFieldSPStan - RFieldSPStan_save);
...@@ -286,13 +261,13 @@ int main(int argc, char *argv[]) ...@@ -286,13 +261,13 @@ int main(int argc, char *argv[])
timer.start(); timer.start();
// Test real<-->complex transform (simple test: forward then inverse // Test real<-->complex transform (simple test: forward then inverse
// transform, see if we get back original values. // transform, see if we get back original values.
testmsg << "Forward transform ..." << endl; testmsg << "Forward transform ..." << endl;
rcfft.transform("forward", RFieldSPStan, CFieldSPPerm0h, constInput); rcfft.transform("forward", RFieldSPStan, CFieldSPPerm0h, constInput);
testmsg << "Inverse transform ..." << endl; testmsg << "Inverse transform ..." << endl;
rcfft.transform("inverse", CFieldSPPerm0h, RFieldSPStan, constInput); rcfft.transform("inverse", CFieldSPPerm0h, RFieldSPStan, constInput);
timer.stop(); timer.stop();
diffFieldSPStan = Abs(RFieldSPStan - RFieldSPStan_save); diffFieldSPStan = Abs(RFieldSPStan - RFieldSPStan_save);
...@@ -303,17 +278,7 @@ int main(int argc, char *argv[]) ...@@ -303,17 +278,7 @@ int main(int argc, char *argv[])
} }
testmsg << "CPU time used = " << timer.cpu_time() << " secs." << endl; testmsg << "CPU time used = " << timer.cpu_time() << " secs." << endl;
timer.clear(); timer.clear();
} }
testmsg << "test is correct: " << correct << endl;
return 0; return 0;
} }
/*************************************************************************** \ No newline at end of file
* $RCSfile: TestRC.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:36 $
***************************************************************************/
/***************************************************************************
* $RCSfile: addheaderfooter,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
* IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
***************************************************************************/
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* makes any warranty, express or implied, or assumes any liability or * makes any warranty, express or implied, or assumes any liability or
* responsibility for the use of this software * responsibility for the use of this software
* *
* mpirun -np 4 ./p3m3dEquiPart Nx Ny Nz l_beam l_box particleDensity r_cut alpha dt eps iterations charge_per_part m_part printEvery * mpirun -np 4 ./p3m3dEquiPart Nx Ny Nz l_beam l_box particleDensity r_cut alpha dt eps iterations charge_per_part m_part printEvery
* alpha is the splitting parameter for pm and pp, eps is the smoothing factor and Si are the coordinates of the charged sphere center * alpha is the splitting parameter for pm and pp, eps is the smoothing factor and Si are the coordinates of the charged sphere center
* *
* *
*************************************************************************************************************************************/ *************************************************************************************************************************************/
...@@ -101,14 +101,14 @@ struct SpecializedGreensFunction<3> { ...@@ -101,14 +101,14 @@ struct SpecializedGreensFunction<3> {
template<class PL> template<class PL>
class ChargedParticles : public IpplParticleBase<PL> { class ChargedParticles : public IpplParticleBase<PL> {
public: public:
ParticleAttrib<double> Q; ParticleAttrib<double> Q;
ParticleAttrib<double> m; ParticleAttrib<double> m;
ParticleAttrib<double> Phi; //electrostatic potential ParticleAttrib<double> Phi; //electrostatic potential
ParticleAttrib<Vector_t> EF; ParticleAttrib<Vector_t> EF;
ParticleAttrib<Vector_t> v; //velocity of the particles ParticleAttrib<Vector_t> v; //velocity of the particles
ParticleAttrib<int> ID; //velocity of the particles ParticleAttrib<int> ID; //velocity of the particles
ChargedParticles(PL* pl, Vektor<double,3> nr, e_dim_tag decomp[Dim],Vektor<double,3> extend_l_, Vektor<double,3> extend_r_) : ChargedParticles(PL* pl, Vektor<double,3> nr, e_dim_tag /*decomp*/[Dim],Vektor<double,3> extend_l_, Vektor<double,3> extend_r_) :
IpplParticleBase<PL>(pl), IpplParticleBase<PL>(pl),
nr_m(nr), nr_m(nr),
extend_l(extend_l_), extend_l(extend_l_),
...@@ -198,9 +198,9 @@ public: ...@@ -198,9 +198,9 @@ public:
double loc_avg_vel[Dim]={0.0,0.0,0.0}; double loc_avg_vel[Dim]={0.0,0.0,0.0};
for(unsigned long k = 0; k < this->getLocalNum(); ++k) { for(unsigned long k = 0; k < this->getLocalNum(); ++k) {
for(unsigned i = 0; i < Dim; i++) { for(unsigned i = 0; i < Dim; i++) {
loc_avg_vel[i] += this->v[k](i); loc_avg_vel[i] += this->v[k](i);
} }
} }
reduce(&(loc_avg_vel[0]), &(loc_avg_vel[0]) + Dim, reduce(&(loc_avg_vel[0]), &(loc_avg_vel[0]) + Dim,
&(avg_vel[0]), OpAddAssign()); &(avg_vel[0]), OpAddAssign());
...@@ -213,9 +213,9 @@ public: ...@@ -213,9 +213,9 @@ public:
m << "avg_vel[0]= " << avg_vel[0] << " avg_vel[1]= " << avg_vel[1] << " avg_vel[2]= " << avg_vel[2] << endl; m << "avg_vel[0]= " << avg_vel[0] << " avg_vel[1]= " << avg_vel[1] << " avg_vel[2]= " << avg_vel[2] << endl;
for(unsigned long k = 0; k < this->getLocalNum(); ++k) { for(unsigned long k = 0; k < this->getLocalNum(); ++k) {
for(unsigned i = 0; i < Dim; i++) { for(unsigned i = 0; i < Dim; i++) {
loc_temp[i] += (this->v[k](i)-avg_vel[i])*(this->v[k](i)-avg_vel[i]); loc_temp[i] += (this->v[k](i)-avg_vel[i])*(this->v[k](i)-avg_vel[i]);
} }
} }
reduce(&(loc_temp[0]), &(loc_temp[0]) + Dim, reduce(&(loc_temp[0]), &(loc_temp[0]) + Dim,
&(temperature[0]), OpAddAssign()); &(temperature[0]), OpAddAssign());
...@@ -386,7 +386,7 @@ public: ...@@ -386,7 +386,7 @@ public:
} }
} }