Commit e3f2a190 authored by kraus's avatar kraus
Browse files

fixing clang warnings

parent e7f9564b
......@@ -2,8 +2,8 @@
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
*
* 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
......@@ -17,7 +17,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -59,7 +59,7 @@ CompressedBrickIterator(const NDIndex<Dim>& o, T& compressed)
//
// The routine that checks to see if all the values are the same.
// This is a regular function so that we can do compile time recursion.
//
//
//////////////////////////////////////////////////////////////////////
//
......@@ -70,7 +70,7 @@ CompressedBrickIterator(const NDIndex<Dim>& o, T& compressed)
// If B==true then we have an explicit function available.
// If B==false we need to use the general loop.
//
// If Dim>3 we use the general loop, but it calls the
// If Dim>3 we use the general loop, but it calls the
// one for Dim-1 so the inner loops are always efficient.
//
......@@ -98,7 +98,7 @@ all_values_equal( const CompressedBrickIterator<T,Dim>& iter, T val,
CompressedLoopTag<1,true> )
//mwerks CompressedLoopTag<1> )
{
// Loop over all the elements.
int n = iter.size(0);
for (int i=0; i<n; ++i)
......@@ -120,11 +120,11 @@ all_values_equal( const CompressedBrickIterator<T,Dim>& iter, T val ,
CompressedLoopTag<2,true> )
//mwerks CompressedLoopTag<2> )
{
// Loop over all of the elements.
int n0 = iter.size(0);
int n1 = iter.size(1);
if ( (n0>0)&&(n1>0) )
for (int i1=0; i1<n1; ++i1)
for (int i0=0; i0<n0; ++i0)
......@@ -148,12 +148,12 @@ all_values_equal( const CompressedBrickIterator<T,Dim>& iter, T val ,
CompressedLoopTag<3,true> )
//mwerks CompressedLoopTag<3> )
{
// Loop over all of the elements.
int n0 = iter.size(0);
int n1 = iter.size(1);
int n2 = iter.size(2);
if ( (n0>0)&&(n1>0)&&(n2>0) )
if ( (n0>0)&&(n1>0)&&(n2>0) )
for (int i2=0; i2<n2; ++i2)
for (int i1=0; i1<n1; ++i1)
for (int i0=0; i0<n0; ++i0)
......@@ -168,7 +168,7 @@ all_values_equal( const CompressedBrickIterator<T,Dim>& iter, T val ,
// Here is the N dimensional version that checks if all the values
// in a block are the same.
//
// Note that for this one we pass iter by value instead of by
// Note that for this one we pass iter by value instead of by
// reference because we use the step() member function.
//
......@@ -177,7 +177,7 @@ inline bool
all_values_equal(CompressedBrickIterator<T,Dim1> iter, T val,
CompressedLoopTag<Dim2,false>)
{
// Loop over the outermost dimension.
int n = iter.size(Dim2-1);
for (int i=0; i<n; ++i)
......@@ -197,16 +197,16 @@ all_values_equal(CompressedBrickIterator<T,Dim1> iter, T val,
//////////////////////////////////////////////////////////////////////
//
// The function that compresses the iterator if all the
// The function that compresses the iterator if all the
// data it points to are equal to the given value.
//
//
//////////////////////////////////////////////////////////////////////
template<class T, unsigned Dim>
bool CompressedBrickIterator<T,Dim>::CanCompress(const T& val) const
{
if ( IsCompressed() )
return *CompressedData == val;
else
......@@ -253,7 +253,7 @@ template<class T, unsigned Dim>
Message& CompressedBrickIterator<T,Dim>::getMessage(Message& m)
{
// Inform msg("CBI::getMessage", INFORM_ALL_NODES);
int compressed;
int compressed = 0;
m.get(compressed);
// msg << " Compressed = " << compressed << endl;
if (compressed == 1)
......@@ -286,7 +286,7 @@ CompressedBrickIterator<T,D2>
permute(const CompressedBrickIterator<T,D1>& iter,
const NDIndex<D1>& current, const NDIndex<D2>& perm)
{
unsigned int d1, d2;
#ifdef IPPL_DEBUG
......@@ -312,7 +312,7 @@ permute(const CompressedBrickIterator<T,D1>& iter,
FoundIt:
;
}
#endif
// This is the iterator we'll be building.
......@@ -359,7 +359,7 @@ const CompressedBrickIterator<T,Dim>&
CompressedBrickIterator<T,Dim>::
operator=(const CompressedBrickIterator<T,Dim>& rhs)
{
if ( this != &rhs )
{
*(dynamic_cast<BrickIterator<T,Dim>*>(this)) = rhs;
......@@ -375,7 +375,7 @@ CompressedBrickIterator<T,Dim>::
CompressedBrickIterator(const CompressedBrickIterator<T,Dim>& X)
: BrickIterator<T,Dim>(X), CompressedData(X.CompressedData)
{
}
//////////////////////////////////////////////////////////////////////
......@@ -389,11 +389,11 @@ CompressedBrickIterator(const CompressedBrickIterator<T,Dim>& X)
// Compress with an external variable for which you can take the address
// and have 'CompressedData' point to.
template<class T, unsigned Dim>
void
void
CompressedBrickIterator<T,Dim>::Compress(T& val)
{
// Inform msg("CBI::Compress", INFORM_ALL_NODES);
// msg << "Before storing value " << val << ": ";
// msg << "CompressedData = " << (void *)CompressedData;
......@@ -415,11 +415,11 @@ CompressedBrickIterator<T,Dim>::Compress(T& val)
// Here is a version that lets the user specify a value
// to try sparsifying on.
template<class T, unsigned Dim>
bool
bool
CompressedBrickIterator<T,Dim>::TryCompress(T val)
{
// Inform msg("CBI::TryCompress", INFORM_ALL_NODES);
// msg << "Trying to compress to value " << val;
// msg << " : IsCompressed = " << IsCompressed() << endl;
......@@ -444,5 +444,5 @@ CompressedBrickIterator<T,Dim>::TryCompress(T val)
/***************************************************************************
* $RCSfile: CompressedBrickIterator.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
* IPPL_VERSION_ID: $Id: CompressedBrickIterator.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
* IPPL_VERSION_ID: $Id: CompressedBrickIterator.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
***************************************************************************/
......@@ -2,8 +2,8 @@
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
*
* 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
......@@ -17,7 +17,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -44,7 +44,7 @@
Suppose you're on the n'th split, so there are 2**n domains figured
out so far, and after the split there will be 2**(n+1) splits. In
each of those 2**n domains you need to find
each of those 2**n domains you need to find
a) The axis to split on. This is done by just finding the longest
axis in that domain.
......@@ -63,7 +63,7 @@
At every stage of the process all the processors know all the
domains. This is necessary because the weight array could be
distributed arbitrarily, so the reductions could involve any
processors.
processors.
Nevertheless, the reductions are performed efficiently. Using
DomainMaps, only the processors that need to participate in a
......@@ -81,8 +81,8 @@ template <unsigned Dim>
static int
FindCutAxis(const NDIndex<Dim> &domain, const FieldLayout<Dim> &layout)
{
// CutAxis will be the dimension to cut.
int cutAxis=-1;
......@@ -126,9 +126,9 @@ FindMedian(int nprocs,RandomIterator begin, RandomIterator end, T)
{
// First find the total weight.
T w = 0;
// Use w to find T's name
// Use w to find T's name
// If we have only one processor, cut at the left.
if ( nprocs == 1 )
return begin;
......@@ -172,7 +172,7 @@ FindMedian(int nprocs,RandomIterator begin, RandomIterator end, T)
//////////////////////////////////////////////////////////////////////
//
// Routines for doing reductions over all dimensions but one of a
// Routines for doing reductions over all dimensions but one of a
// local BrickIterator.
//
// These will only work for 1, 2 and 3 dimensions right now.
......@@ -262,8 +262,8 @@ template<unsigned Dim>
static void
LocalReduce(double *reduced, int cutAxis, BrickIterator<double,Dim> data)
{
int length = data.size(cutAxis);
for (int i=0; i<length; ++i)
......@@ -279,14 +279,14 @@ LocalReduce(double *reduced, int cutAxis, BrickIterator<double,Dim> data)
//
// The local reductions take place all across the machine.
// The reductions for each domain are finished on a single processor.
// Each of those final reductions are on different processors.
// Each of those final reductions are on different processors.
//
template<class IndexIterator, unsigned Dim>
static void
SendReduce(IndexIterator domainsBegin, IndexIterator domainsEnd,
BareField<double,Dim>& weights, int tag)
{
{
// Buffers to store up domains and blocks of reduced data.
std::vector<double*> reducedBuffer;
......@@ -367,7 +367,7 @@ ReceiveReduce(NDIndex<Dim>& domain, BareField<double,Dim>& weights,
int reduce_tag, int nprocs,
int& cutLoc, int& cutAxis)
{
// Build a place to accumulate the reduced data.
cutAxis = FindCutAxis(domain, weights.getLayout());
......@@ -406,7 +406,7 @@ ReceiveReduce(NDIndex<Dim>& domain, BareField<double,Dim>& weights,
}
// now just count up the number of messages to receive
for (i=0; i<nodes; ++i)
if (found_touch[i]) expected++;
if (found_touch[i]) expected++;
delete [] found_touch;
DEBUGMSG("ReceiveReduce, msgs expected=" << expected << endl);
......@@ -419,7 +419,7 @@ ReceiveReduce(NDIndex<Dim>& domain, BareField<double,Dim>& weights,
PAssert(mess != 0);
DEBUGMSG("ReceiveReduce: Comm->Receive from Node " << any_node << ", tag=" << reduce_tag << endl);
// Loop over all the domains in this message.
int received_domains;
int received_domains = 0;
mess->get(received_domains);
while ( --received_domains>=0 )
{
......@@ -456,7 +456,7 @@ ReceiveReduce(NDIndex<Dim>& domain, BareField<double,Dim>& weights,
inline void
BcastCuts(int cutLoc, int cutAxis, int bcast_tag)
{
// Make a message.
Message *mess = new Message();
......@@ -481,8 +481,8 @@ ReceiveCuts(std::vector< NDIndex<Dim> > &domains,
std::vector< int >& nprocs,
int bcast_tag)
{
// Make a container to hold the split domains.
int nDomains = domains.size();
......@@ -497,7 +497,7 @@ ReceiveCuts(std::vector< NDIndex<Dim> > &domains,
// The processor number will correspond to the location
// in the domains vector.
int whichDomain = COMM_ANY_NODE;
int cutLocation, cutAxis;
int cutLocation = 0, cutAxis = 0;
Message *mess = Ippl::Comm->receive_block(whichDomain,bcast_tag);
PAssert(mess != 0);
DEBUGMSG("ReceiveCuts: received bcast " << expected << endl);
......@@ -556,7 +556,7 @@ static void
CutEach(std::vector< NDIndex<Dim> >& domains,
std::vector< int >& nprocs,
BareField<double,Dim>& weights)
{
{
// Get tags for the reduction and the broadcast.
int reduce_tag = Ippl::Comm->next_tag( F_REDUCE_PERP_TAG , F_TAG_CYCLE );
......@@ -600,12 +600,12 @@ CalcBinaryRepartition(FieldLayout<Dim>& layout, BareField<double,Dim>& weights)
{
// Build a list of domains as we go.
std::vector< NDIndex<Dim> > domains; // used by TAU_TYPE_STRING
std::vector<int> procs;
std::vector<int> procs;
/*out << "Starting CalcBinaryRepartition, outstanding msgs="
<< Ippl::Comm->getReceived()
<< endl;*/
// Get the processors we'll be dealing with.
int nprocs = Ippl::Comm->getNodes();
int myproc = Ippl::Comm->myNode();
......@@ -632,13 +632,13 @@ CalcBinaryRepartition(FieldLayout<Dim>& layout, BareField<double,Dim>& weights)
if (mprocs<procs[i]) mprocs = procs[i];
}
// Return the domain on this processor.
//seriously dirty fix
//seriously dirty fix
typename std::vector< NDIndex<Dim> >::iterator i;
bool degenerated = false;
for(i = domains.begin();i!=domains.end();++i)
{
for(unsigned int d = 0;d<Dim;++d)
......@@ -650,14 +650,14 @@ CalcBinaryRepartition(FieldLayout<Dim>& layout, BareField<double,Dim>& weights)
if(degenerated)
break;
}
if(!degenerated)
return domains.begin()[myproc];
else
{
throw BinaryRepartitionFailed();
}
}
//////////////////////////////////////////////////////////////////////
......@@ -666,5 +666,5 @@ CalcBinaryRepartition(FieldLayout<Dim>& layout, BareField<double,Dim>& weights)
/***************************************************************************
* $RCSfile: BinaryBalancer.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
* IPPL_VERSION_ID: $Id: BinaryBalancer.cpp,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
* IPPL_VERSION_ID: $Id: BinaryBalancer.cpp,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
***************************************************************************/
......@@ -2,8 +2,8 @@
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
*
* 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
......@@ -17,7 +17,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -42,8 +42,8 @@
// call 'initialize' soon after (before using in any context)
template<unsigned Dim>
FieldLayout<Dim>::FieldLayout() {
// we have one more FieldLayout, indicate this
//INCIPPLSTAT(incFieldLayouts);
......@@ -65,8 +65,8 @@ FieldLayout<Dim>::FieldLayout() {
// distributed in some other manner.
template<unsigned Dim>
FieldLayout<Dim>::FieldLayout(const char *filename) {
// we have one more FieldLayout, indicate this
//INCIPPLSTAT(incFieldLayouts);
......@@ -108,8 +108,8 @@ template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const NDIndex<Dim>& domain,
e_dim_tag *p, int vnodes) {
setup(domain, p, vnodes);
}
......@@ -117,8 +117,8 @@ FieldLayout<Dim>::initialize(const NDIndex<Dim>& domain,
template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const Index& i1, e_dim_tag p1, int vnodes) {
PInsist(Dim==1,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -130,8 +130,8 @@ template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const Index& i1, const Index& i2,
e_dim_tag p1, e_dim_tag p2, int vnodes) {
PInsist(Dim==2,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -148,7 +148,7 @@ void
FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
int vnodes) {
PInsist(Dim==3,
"Number of arguments does not match dimension of FieldLayout!!");
e_dim_tag par[Dim];
......@@ -168,7 +168,7 @@ FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
e_dim_tag p4,
int vnodes) {
PInsist(Dim==4,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -248,7 +248,7 @@ FieldLayout<Dim>::initialize(const NDIndex<Dim>& domain,
e_dim_tag *p, unsigned* vnodesPerDirection,
bool recurse, int vnodes) {
// Default to correct total vnodes:
unsigned vnodesProduct = 1;
for (unsigned int d=0; d<Dim; d++) vnodesProduct *= vnodesPerDirection[d];
......@@ -259,7 +259,7 @@ FieldLayout<Dim>::initialize(const NDIndex<Dim>& domain,
<< "(vnodes != vnodesPerDirection[0]*vnodesPerDirection[1]*"
<< "...*vnodesPerDirection[" << Dim-1 << "])"
<< " ; vnodesPerDirection[0]*vnodesPerDirection[1]*"
<< "...*vnodesPerDirection[" << Dim-1 << "] = "
<< "...*vnodesPerDirection[" << Dim-1 << "] = "
<< vnodesProduct << " ; vnodes = " << vnodes << endl);
}
setup(domain, p, vnodesPerDirection,recurse,vnodes);
......@@ -267,10 +267,10 @@ FieldLayout<Dim>::initialize(const NDIndex<Dim>& domain,
template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const Index& i1, e_dim_tag p1,
FieldLayout<Dim>::initialize(const Index& i1, e_dim_tag p1,
unsigned vnodes1, bool recurse, int vnodes) {
PInsist(Dim==1,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -281,8 +281,8 @@ FieldLayout<Dim>::initialize(const Index& i1, e_dim_tag p1,
template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const Index& i1, const Index& i2,
e_dim_tag p1, e_dim_tag p2,
unsigned vnodes1, unsigned vnodes2,
e_dim_tag p1, e_dim_tag p2,
unsigned vnodes1, unsigned vnodes2,
bool recurse, int vnodes) {
PInsist(Dim==2,
......@@ -302,9 +302,9 @@ template<unsigned Dim>
void
FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3,
bool recurse, int vnodes) {
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3,
bool recurse, int vnodes) {
PInsist(Dim==3,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -328,10 +328,10 @@ FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
const Index& i4,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
e_dim_tag p4,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
bool recurse, int vnodes) {
PInsist(Dim==4,
"Number of arguments does not match dimension of FieldLayout!!");
e_dim_tag par[Dim];
......@@ -357,10 +357,10 @@ FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
const Index& i4, const Index& i5,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
e_dim_tag p4, e_dim_tag p5,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
unsigned vnodes5,
bool recurse, int vnodes) {
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
unsigned vnodes5,
bool recurse, int vnodes) {
PInsist(Dim==5,
"Number of arguments does not match dimension of FieldLayout!!");
......@@ -390,11 +390,11 @@ FieldLayout<Dim>::initialize(const Index& i1, const Index& i2, const Index& i3,
const Index& i4, const Index& i5, const Index& i6,
e_dim_tag p1, e_dim_tag p2, e_dim_tag p3,
e_dim_tag p4, e_dim_tag p5, e_dim_tag p6,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
unsigned vnodes5, unsigned vnodes6,
unsigned vnodes1, unsigned vnodes2,
unsigned vnodes3, unsigned vnodes4,
unsigned vnodes5, unsigned vnodes6,
bool recurse, int vnodes) {
PInsist(Dim==6,
"Number of arguments does not match dimension of FieldLayout!!");
e_dim_tag par[Dim];
......@@ -523,8 +523,8 @@ void
FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
e_dim_tag *userflags, int vnodes)
{
// we have one more FieldLayout, indicate this
//INCIPPLSTAT(incFieldLayouts);
......@@ -703,7 +703,7 @@ FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
// vnodes to processors.
// If it is false, hand the vnodes to the processors in a very simple
// but probably inefficient manner.
// If it is true, use a binary recursive algorithm. This will usually be
// If it is true, use a binary recursive algorithm. This will usually be
// more efficient because it will generate less communication, but
// it will sometimes fail, particularly near the case of one vnode per
// processor.
......@@ -716,7 +716,7 @@ FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
e_dim_tag *userflags, unsigned* vnodesPerDirection,
bool recurse, int vnodes)
{
// Find the number processors.
int nprocs = Ippl::getNodes();
int myproc = Ippl::myNode();
......@@ -747,7 +747,7 @@ FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
PInsist(chk,"SERIAL layout specified, yet vnodesPerDirection is not 1!");
}
}
// Make sure at least one of the parallel/serial flags is parallel
PInsist(parallel_count>0,"At least one dimension of a FieldLayout must be PARALLEL!");
......@@ -821,7 +821,7 @@ FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
// Now find what processor each vnode will end up on.
// This is done with a recursive bisection algorithm.
// This produces fairly squarish blocks -- and therefore
// less communication at the expense of each processor getting
// less communication at the expense of each processor getting
// a less balanced load.
int *vnodeProcs = new int[vnodes];
int *sizes = new int[Dim];
......@@ -889,7 +889,7 @@ FieldLayout<Dim>::setup(const NDIndex<Dim>& domain,
template<unsigned Dim>
unsigned FieldLayout<Dim>::
getVnodesPerDirection(unsigned dir) {
// If not set, then not appropriate to be calling this function. Example: