From 007d3db81aefcbc3d6eb6f1edc0ab860d9088f6b Mon Sep 17 00:00:00 2001 From: Achim Gsell <achim.gsell@psi.ch> Date: Tue, 4 Apr 2023 17:53:55 +0200 Subject: [PATCH] assigned but unused variable warnings fixed --- ippl/src/Field/Assign.hpp | 52 +++++++++++-------- ippl/src/Field/BCond.hpp | 10 +++- .../HashPairBuilderPeriodicParallel.h | 3 -- ippl/src/Particle/ParticleSpatialLayout.h | 12 ----- src/Classic/FixedAlgebra/FTpsData.h | 3 -- .../AbsBeamline/DipoleFieldTest.cpp | 2 - 6 files changed, 37 insertions(+), 45 deletions(-) diff --git a/ippl/src/Field/Assign.hpp b/ippl/src/Field/Assign.hpp index 96c2f0b52..63b95b71d 100644 --- a/ippl/src/Field/Assign.hpp +++ b/ippl/src/Field/Assign.hpp @@ -159,31 +159,31 @@ public: return Expr::Child.offset(i,j,k)(Expr::Value.Arg); } - PETE_Return_t& operator*() + PETE_Return_t& operator*() { return (*Expr::Child)(Expr::Value.Arg); } - PETE_Return_t& offset(int i) + PETE_Return_t& offset(int i) { return Expr::Child.offset(i)(Expr::Value.Arg); } - PETE_Return_t& offset(int i, int j) + PETE_Return_t& offset(int i, int j) { return Expr::Child.offset(i,j)(Expr::Value.Arg); } - PETE_Return_t& offset(int i, int j, int k) + PETE_Return_t& offset(int i, int j, int k) { return Expr::Child.offset(i,j,k)(Expr::Value.Arg); } - PETE_Return_t& unit_offset(int i) + PETE_Return_t& unit_offset(int i) { return Expr::Child.unit_offset(i)(Expr::Value.Arg); } - PETE_Return_t& unit_offset(int i, int j) + PETE_Return_t& unit_offset(int i, int j) { return Expr::Child.unit_offset(i,j)(Expr::Value.Arg); } - PETE_Return_t& unit_offset(int i, int j, int k) + PETE_Return_t& unit_offset(int i, int j, int k) { return Expr::Child.unit_offset(i,j,k)(Expr::Value.Arg); } @@ -228,10 +228,10 @@ public: template<class T1, unsigned Dim, class RHS, class OP> void -assign(const IndexedBareField<T1,Dim,Dim> &aa, RHS b, OP op, ExprTag<true>, +assign(const IndexedBareField<T1,Dim,Dim> &aa, RHS b, OP op, ExprTag<true>, bool fillGC) { - IndexedBareField<T1,Dim,Dim> &a = + IndexedBareField<T1,Dim,Dim> &a = const_cast<IndexedBareField<T1,Dim,Dim>&>(aa); // debugging output macros. these are only enabled if DEBUG_ASSIGN is @@ -262,8 +262,9 @@ assign(const IndexedBareField<T1,Dim,Dim> &aa, RHS b, OP op, ExprTag<true>, a.getBareField().setDirtyFlag(); // Loop over all the local fields of the left hand side. - +#ifdef DEBUG_ASSIGN int lfcount=0; +#endif bool needFinalCompressCheck = false; while (la != aend) { @@ -361,18 +362,20 @@ assign(const IndexedBareField<T1,Dim,Dim> &aa, RHS b, OP op, ExprTag<true>, } ++la; +#ifdef DEBUG_ASSIGN ++lfcount; +#endif } - + // If we are not deferring guard cell fills, and we need to do this // now, fill the guard cells. This will also apply any boundary // conditions after the guards have been updated. if (fillGC) { ASSIGNMSG(msg << "Filling GC's at end if necessary ..." << endl); - + a.getBareField().fillGuardCellsIfNotDirty(); - + } // Try to compress the result. @@ -417,7 +420,7 @@ assign(PETE_TUTree<OpParens<TP>,A> lhs, RHS wrhs, OP op, Tag, typedef typename Expressionize<RHS>::type::Wrapped RHS_Wrapped; typename Expressionize<RHS>::type expr = Expressionize<RHS>::apply(wrhs); RHS_Wrapped & rhs = expr.PETE_unwrap(); - + // Get a reference to the BareField on the left hand side, and the // total domain we are modifying. BareField<T1,Dim>& bare = lhs.Child.getBareField(); @@ -438,7 +441,7 @@ assign(PETE_TUTree<OpParens<TP>,A> lhs, RHS wrhs, OP op, Tag, bare.setDirtyFlag(); // Loop over all the local fields of the left hand side. - + bool needFinalCompressCheck = false; while (la != aend) { @@ -458,7 +461,7 @@ assign(PETE_TUTree<OpParens<TP>,A> lhs, RHS wrhs, OP op, Tag, // the whole expression. typedef typename LField<T1,Dim>::iterator LA; typedef PETE_TUTree<OpParens<TP>,LA> LHS; - typedef BrickExpression<Dim,ParensIterator<LHS>,RHS_Wrapped,OP> + typedef BrickExpression<Dim,ParensIterator<LHS>,RHS_Wrapped,OP> ExprT; // First look and see if the arrays are sufficiently aligned @@ -524,15 +527,15 @@ assign(PETE_TUTree<OpParens<TP>,A> lhs, RHS wrhs, OP op, Tag, } ++la; } - + // Fill the guard cells on the left hand side, if we are deferring // this operation until the next time it is needed. ASSIGNMSG(msg << "Filling GC's at end if necessary ..." << endl); if (fillGC) { - + bare.fillGuardCellsIfNotDirty(); - + } // Compress the LHS. @@ -590,8 +593,9 @@ assign(const BareField<T1,Dim>& ca, RHS b, OP op, ExprTag<true>) a.setDirtyFlag(); // Loop over the LHS LFields, and assign from RHS LFields - +#ifdef DEBUG_ASSIGN int lfcount = 0; +#endif bool needFinalCompressCheck = false; while (la != aend) { @@ -635,16 +639,18 @@ assign(const BareField<T1,Dim>& ca, RHS b, OP op, ExprTag<true>) ++la; for_each(bb,NextLField(),PETE_NullCombiner()); +#ifdef DEBUG_ASSIGN ++lfcount; +#endif } - + // Fill the guard cells on the left hand side, if we are deferring // this operation until the next time it is needed. ASSIGNMSG(msg << "Filling GC's at end if necessary ..." << endl); - + a.fillGuardCellsIfNotDirty(); - + // Compress the LHS, if necessary if (needFinalCompressCheck) { diff --git a/ippl/src/Field/BCond.hpp b/ippl/src/Field/BCond.hpp index 8d35fdbde..f5646ac2e 100644 --- a/ippl/src/Field/BCond.hpp +++ b/ippl/src/Field/BCond.hpp @@ -1413,7 +1413,9 @@ void ParallelPeriodicFace<T,D,M,C>::apply( Field<T,D,M,C>& A ) // Number of nodes that will send us messages. int receive_count = 0; +#ifdef PRINT_DEBUG int send_count = 0; +#endif // Communications tag @@ -1744,7 +1746,9 @@ void ParallelPeriodicFace<T,D,M,C>::apply( Field<T,D,M,C>& A ) #endif Ippl::Comm->send(messages[iproc], iproc, bc_comm_tag); +#ifdef PRINT_DEBUG ++send_count; +#endif } @@ -2130,7 +2134,9 @@ void ParallelInterpolationFace<T,D,M,C>::apply( Field<T,D,M,C>& A ) // Number of nodes that will send us messages. int receive_count = 0; +#ifdef PRINT_DEBUG int send_count = 0; +#endif // Communications tag @@ -2467,8 +2473,9 @@ void ParallelInterpolationFace<T,D,M,C>::apply( Field<T,D,M,C>& A ) #endif Ippl::Comm->send(messages[iproc], iproc, bc_comm_tag); +#ifdef PRINT_DEBUG ++send_count; - +#endif } } @@ -6194,4 +6201,3 @@ void PatchBC<T,D,M,C>::apply( Field<T,D,M,C>& A ) //---------------------------------------------------------------------- #undef COMPONENT_APPLY_BUILTIN - diff --git a/ippl/src/Particle/PairBuilder/HashPairBuilderPeriodicParallel.h b/ippl/src/Particle/PairBuilder/HashPairBuilderPeriodicParallel.h index 93f6fd941..d0153a62c 100644 --- a/ippl/src/Particle/PairBuilder/HashPairBuilderPeriodicParallel.h +++ b/ippl/src/Particle/PairBuilder/HashPairBuilderPeriodicParallel.h @@ -104,7 +104,6 @@ public: buckets[bucket_id] = i; } - double part_count = 0; //loop over all buckets for (int bx=0+int(!parallel_dims[0]); bx<buckets_per_dim[0]-int(!parallel_dims[0]); ++bx) { for (int by=0+int(!parallel_dims[1]); by<buckets_per_dim[1]-int(!parallel_dims[1]); ++by) { @@ -168,9 +167,7 @@ public: //loop over all particles in self cell //self offset avoids double counting in self cell int self_offset = 0; - part_count = 0; while (i != END) { - part_count++; j = buckets[bucket_id_neigh]; //increase offset by number of processed particles in self cell for (int o=0;o<self_offset;o++){ diff --git a/ippl/src/Particle/ParticleSpatialLayout.h b/ippl/src/Particle/ParticleSpatialLayout.h index 4246ced6b..9bdb68257 100644 --- a/ippl/src/Particle/ParticleSpatialLayout.h +++ b/ippl/src/Particle/ParticleSpatialLayout.h @@ -631,9 +631,6 @@ protected: template < class PB > size_t short_swap_particles(size_t LocalNum, PB& PData) { - static int sent = 0; - - unsigned d, i, j; // loop variables size_t ip; unsigned N = Ippl::getNodes(); @@ -708,7 +705,6 @@ protected: // indicate we found it to quit this check foundit = true; - sent++; } } @@ -1077,7 +1073,6 @@ protected: size_t new_swap_particles(size_t LocalNum, PB& PData) { Ippl::Comm->barrier(); - static int sent = 0; unsigned N = Ippl::getNodes(); unsigned myN = Ippl::myNode(); @@ -1092,7 +1087,6 @@ protected: std::multimap<unsigned, unsigned> p2n; //<node ID, particle ID> - int particlesLeft = LocalNum; bool responsibleNodeNotFound = false; for (unsigned int ip=0; ip<LocalNum; ++ip) { @@ -1122,8 +1116,6 @@ protected: msgsend[destination] = 1; p2n.insert(std::pair<unsigned, unsigned>(destination, ip)); - sent++; - particlesLeft--; } allreduce(&responsibleNodeNotFound, @@ -1203,7 +1195,6 @@ protected: const ParticleAttrib<char>& canSwap) { Ippl::Comm->barrier(); - static int sent = 0; unsigned N = Ippl::getNodes(); unsigned myN = Ippl::myNode(); @@ -1218,7 +1209,6 @@ protected: std::multimap<unsigned, unsigned> p2n; //<node ID, particle ID> - int particlesLeft = LocalNum; bool responsibleNodeNotFound = false; for (unsigned int ip=0; ip<LocalNum; ++ip) { @@ -1251,8 +1241,6 @@ protected: msgsend[destination] = 1; p2n.insert(std::pair<unsigned, unsigned>(destination, ip)); - sent++; - particlesLeft--; } allreduce(&responsibleNodeNotFound, diff --git a/src/Classic/FixedAlgebra/FTpsData.h b/src/Classic/FixedAlgebra/FTpsData.h index 3779396d2..8f9877920 100644 --- a/src/Classic/FixedAlgebra/FTpsData.h +++ b/src/Classic/FixedAlgebra/FTpsData.h @@ -303,7 +303,6 @@ void FTpsData<N>:: build(int order) { if(topOrder < order) { topOrder = order; - int prodSize = 0; // Build array containing binomial coefficients: // binom[0 ... topOrder+1][0 ... N]. @@ -359,7 +358,6 @@ build(int order) { // use symmetry for LL half of prod array for(int j = 0; j < std::min(i, ysize); j++) { prod[i][j] = prod[j][i]; - ++prodSize; } for(int j = i; j < ysize; j++) { power = expon[i] * expon[j]; @@ -370,7 +368,6 @@ build(int order) { ind += binom[ord][vv]; } prod[i][j] = ind; - ++prodSize; } } } diff --git a/tests/classic_src/AbsBeamline/DipoleFieldTest.cpp b/tests/classic_src/AbsBeamline/DipoleFieldTest.cpp index ba5651b7d..e18037d47 100644 --- a/tests/classic_src/AbsBeamline/DipoleFieldTest.cpp +++ b/tests/classic_src/AbsBeamline/DipoleFieldTest.cpp @@ -110,7 +110,6 @@ TEST(Maxwell, Zeros) //double radius = 1; double stepSize = 1.0e-6, x, z; //int step; - int counter = 0; //ofstream fout("some_data"); for(z = 0.0; z <0.0015; z+= 0.0015) for(x = 0.; x<0.04; x += 0.04) @@ -118,7 +117,6 @@ TEST(Maxwell, Zeros) { // step = phi/(Physics::pi/20); //std::cout<<"Step #"<<step<<endl; - counter ++; Vector_t B(0.0); R(0) = (myMagnet->Bend2D::designRadius_m + x) * cos(phi); R(1) = z; -- GitLab