Commit 412ca327 authored by snuverink_j's avatar snuverink_j
Browse files

Resolve "Compiler warnings from unit tests"

parent 591d0ad0
......@@ -72,8 +72,8 @@ public:
// Construct from a Tenzor.
// Extract the antisymmetric part.
AntiSymTenzor( const Tenzor<T,D>& t ) {
for (int i=1; i<D; ++i) {
for (int j=0; j<i; ++j)
for (unsigned int i=1; i<D; ++i) {
for (unsigned int j=0; j<i; ++j)
(*this)[((i-1)*i/2)+j] = (t(i,j)-t(j,i))*0.5;
}
}
......@@ -157,15 +157,15 @@ public:
: elem_m(model.elem_m), where_m(model.where_m) { }
const AssignProxy &operator=(const AssignProxy &a)
{
PAssert_EQ(where_m != 0 || a.elem_m == -a.elem_m, true);
elem_m = where_m < 0 ? -a.elem_m : a.elem_m;
return *this;
PAssert_EQ(where_m != 0 || (a.elem_m == -a.elem_m), true);
elem_m = where_m < 0 ? -a.elem_m : a.elem_m;
return *this;
}
const AssignProxy &operator=(const Element_t &e)
{
PAssert_EQ(where_m != 0 || e == -e, true);
elem_m = where_m < 0 ? -e : e;
return *this;
PAssert_EQ(where_m != 0 || (e == -e), true);
elem_m = where_m < 0 ? -e : e;
return *this;
}
operator Element_t() const
......@@ -358,13 +358,13 @@ public:
: elem_m(model.elem_m), where_m(model.where_m) {}
const AssignProxy& operator=(const AssignProxy& a)
{
PAssert_EQ(where_m != 0 || a.elem_m == -a.elem_m, true);
PAssert_EQ(where_m != 0 || (a.elem_m == -a.elem_m), true);
elem_m = where_m < 0 ? -a.elem_m : a.elem_m;
return *this;
}
const AssignProxy& operator=(const Element_t& e)
{
PAssert_EQ(where_m != 0 || e == -e, true);
PAssert_EQ(where_m != 0 || (e == -e), true);
elem_m = where_m < 0 ? -e : e;
return *this;
}
......@@ -697,9 +697,9 @@ dotdot(const SymTenzor<T1,D> &lhs, const AntiSymTenzor<T2,D> &rhs)
template<class T, unsigned D>
inline std::ostream& operator<<(std::ostream& out, const AntiSymTenzor<T,D>& rhs) {
if (D >= 1) {
for (int i=0; i<D; i++) {
for (unsigned int i=0; i<D; i++) {
out << "(";
for (int j=0; j<D-1; j++) {
for (unsigned int j=0; j<D-1; j++) {
out << rhs(i,j) << " , ";
}
out << rhs(i,D-1) << ")";
......
......@@ -78,9 +78,9 @@ public:
// Construct from a Tenzor.
// Extract the symmetric part.
SymTenzor(const Tenzor<T,D>& t) {
for (int i=0; i<D; ++i) {
for (unsigned int i=0; i<D; ++i) {
(*this)(i,i) = t(i,i);
for (int j=i+1; j<D; ++j)
for (unsigned int j=i+1; j<D; ++j)
(*this)(i,j) = (t(i,j)+t(j,i))*0.5;
}
}
......@@ -105,9 +105,9 @@ public:
return *this;
}
const SymTenzor<T,D>& operator= (const Tenzor<T,D> &rhs) {
for (int i=0; i<D; ++i) {
for (unsigned int i=0; i<D; ++i) {
(*this)(i,i) = rhs(i,i);
for (int j=i+1; j<D; ++j)
for (unsigned int j=i+1; j<D; ++j)
(*this)(i,j) = (rhs(i,j)+rhs(j,i))*0.5;
}
return *this;
......@@ -173,7 +173,7 @@ public:
// Methods
void diagonal(const T& rhs) {
for ( int i = 0 ; i < D ; i++ ) {
for (unsigned int i = 0 ; i < D ; i++ ) {
X[((i+1)*i/2) + i] = rhs;
}
}
......@@ -286,7 +286,7 @@ private:
template <class T, unsigned D>
inline T trace(const SymTenzor<T,D> &rhs) {
T result = 0.0;
for (int i = 0 ; i < D ; i++ )
for (unsigned int i = 0 ; i < D ; i++ )
result += rhs(i,i);
return result;
}
......@@ -491,9 +491,9 @@ dotdot(const Tenzor<T1,D> &lhs, const SymTenzor<T2,D> &rhs)
template<class T, unsigned D>
inline std::ostream& operator<<(std::ostream& out, const SymTenzor<T,D>& rhs) {
if (D >= 1) {
for (int i=0; i<D; i++) {
for (unsigned int i=0; i<D; i++) {
out << "(";
for (int j=0; j<D-1; j++) {
for (unsigned int j=0; j<D-1; j++) {
out << rhs(i,j) << " , ";
}
out << rhs(i,D-1) << ")";
......
......@@ -210,12 +210,12 @@ public:
}
Element_t operator()(const std::pair<int,int> i) const {
PAssert ( (i.first>=0) && (i.second>=0) && (i.first<D) && (i.second<D) );
PAssert ( (i.first>=0) && (i.second>=0) && (i.first<(int)D) && (i.second<(int)D) );
return (*this)(i.first,i.second);
}
Element_t& operator()(const std::pair<int,int> i) {
PAssert ( (i.first>=0) && (i.second>=0) && (i.first<D) && (i.second<D) );
PAssert ( (i.first>=0) && (i.second>=0) && (i.first<(int)D) && (i.second<(int)D) );
return (*this)(i.first,i.second);
}
......
......@@ -37,9 +37,17 @@
#include "DataSource/FilePtclBaseDataSource.h"
#include "DataSource/FilePtclAttribDataSource.h"
// forward declaration to avoid possible recursive inclusion
template<class T, unsigned Dim, class M, class C>
class FileFieldDataSource;
template<class T>
class FileParticleAttribDataSource;
template<class T>
class FileIpplParticleBaseDataSource;
////////////////////////////////////////////////////////////////////////////
// a version of make_DataSourceObject for Field's.
// arguments: name, connection type, transfer metohd, Field
// arguments: name, connection type, transfer method, Field
template<class T, unsigned Dim, class M, class C>
DataSourceObject *
make_DataSourceObject(const char *nm, DataConnect *dc, int t,
......
......@@ -13,6 +13,7 @@
// include files
#include "AppTypes/dcomplex.h"
#include "Utility/IpplInfo.h"
#include "Utility/RefCounted.h"
#include "Utility/vmap.h"
......@@ -166,11 +167,6 @@ public:
virtual void apply( Field<T,D,M,C>& ) = 0;
virtual BCondBase<T,D,M,C>* clone() const = 0;
// The convert_type() implementation is commented out, since it doesn't
// work in general. If nobody really needs it, it will eventually be
// eliminated; if somebody needs it, somebody needs to do a new
// implementation. --TJW
// virtual BCondBase<int,D,M,C>* convert_type(int) const = 0;
virtual void write(std::ostream&) const;
// Return component of Field element on which BC applies
......@@ -210,8 +206,6 @@ public:
iterator;
typedef typename vmap<int, RefCountedP <BCondBase<T,D,M,C> > >::const_iterator
const_iterator;
// See comments in BCondBase class definition regarding convert_type() --TJW
// BConds<int,D,M,C>* convert_type(int) const ;
void apply( Field<T,D,M,C>& a );
bool changesPhysicalCells() const;
virtual void write(std::ostream&) const;
......@@ -634,12 +628,6 @@ public:
{
return new FunctionFace<T,D,M,C>( *this );
}
// See comments in BCondBase class definition regarding convert_type() --TJW
// BCondBase<int,D,M,C>* convert_type(int) const
// {
// assert(false);
// return 0;
// }
// Print out information about the BC to a stream.
virtual void write(std::ostream& out) const;
......@@ -689,12 +677,6 @@ public:
{
return new ComponentFunctionFace<T,D,M,C>( *this );
}
// See comments in BCondBase class definition regarding convert_type() --TJW
// BCondBase<int,D,M,C>* convert_type(int) const
// {
// assert(false);
// return 0;
// }
// Print out information about the BC to a stream.
virtual void write(std::ostream& out) const;
......
......@@ -186,7 +186,7 @@ void ConstantFace<T,D,M,C>::write(std::ostream& out) const
out << "ConstantFace"
<< ", Face=" << BCondBase<T,D,M,C>::m_face
<< ", Constant=" << this->Offset
<< endl;
<< std::endl;
}
template<class T, unsigned int D, class M, class C>
......@@ -915,7 +915,7 @@ void PeriodicFaceBCApply(PeriodicFace<T,D,M,
allComponents) {
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++) { // Compare other components with 1st
for (unsigned int c=1; c<NC; c++) { // Compare other components with 1st
if (CE[c + d*NC] != centering0)
ERRORMSG("PeriodicFaceBCApply: BCond thinks all components have"
<< " same centering along direction " << d
......@@ -950,7 +950,7 @@ void PeriodicFaceBCApply(PeriodicFace<T,D,M,
allComponents) {
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++) { // Compare other components with 1st
for (unsigned int c=1; c<NC; c++) { // Compare other components with 1st
if (CE[c + d*NC] != centering0)
ERRORMSG("PeriodicFaceBCApply: BCond thinks all components have"
<< " same centering along direction " << d
......@@ -1222,7 +1222,7 @@ CalcParallelPeriodicDomain(const Field<T,D,M,CartesianCentering<CE,D,NC> >& A,
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component
// along dir d
for (int c = 1; c < NC; c++)
for (unsigned int c = 1; c < NC; c++)
{
// Compare other components with 1st
if (CE[c + d*NC] != centering0)
......@@ -1279,7 +1279,7 @@ CalcParallelPeriodicDomain(const Field<T,D,M,CartesianCentering<CE,D,NC> >& A,
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component
// along dir d
for (int c = 1; c < NC; c++)
for (unsigned int c = 1; c < NC; c++)
{ // Compare other components with 1st
if (CE[c + d*NC] != centering0)
ERRORMSG("ParallelPeriodicFaceBCApply:"
......@@ -3320,7 +3320,7 @@ void ExtrapolateFaceBCApply(ExtrapolateFace<T,D,M,
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++)
for (unsigned int c=1; c<NC; c++)
{
// Compare other components with 1st
if (CE[c + d*NC] != centering0)
......@@ -3394,7 +3394,7 @@ void ExtrapolateFaceBCApply(ExtrapolateFace<T,D,M,
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++)
for (unsigned int c=1; c<NC; c++)
{
// Compare other components with 1st
......@@ -4262,7 +4262,7 @@ void ExtrapolateAndZeroFaceBCApply(ExtrapolateAndZeroFace<T,D,M,
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++)
for (unsigned int c=1; c<NC; c++)
{
// Compare other components with 1st
if (CE[c + d*NC] != centering0)
......@@ -4349,7 +4349,7 @@ void ExtrapolateAndZeroFaceBCApply(ExtrapolateAndZeroFace<T,D,M,
// Make sure all components are really centered the same, as assumed:
CenteringEnum centering0 = CE[0 + d*NC]; // 1st component along dir d
for (int c=1; c<NC; c++)
for (unsigned int c=1; c<NC; c++)
{
// Compare other components with 1st
......
......@@ -316,7 +316,6 @@ public:
//
void write(std::ostream&);
void writeb(char*) const;
//
// PETE interface.
......
......@@ -982,90 +982,6 @@ void BareField<T,Dim>::accumGuardCells()
return;
}
//////////////////////////////////////////////////////////////////////
//
// An output function which writes out the BareField
// a vnode at a time and includes the border information
//
template< class T, unsigned Dim >
void BareField<T,Dim>::writeb(char* fname) const
{
Inform outC(0, fname, Inform::OVERWRITE);
int icount = 0;
for (const_iterator_if l_i = begin_if(); l_i != end_if(); ++l_i)
{
// find the offset within the global space
LField<T,Dim> *ldf = (*l_i).second.get();
const NDIndex<Dim> &Owned = ldf->getOwned();
outC << "vnode = " << icount++ << endl;
typename LField<T,Dim>::iterator lf_bi = ldf->begin();
if ( Dim==1 )
{
int n0 = ldf->size(0);
int l0 = -Gc.left(0);
int r0 = n0 + Gc.right(0);
for (int i0=l0; i0<r0; ++i0)
{
outC << " [" << i0;
outC << "]=" << lf_bi.offset(i0);
}
}
else if ( Dim==2 )
{
int n0 = ldf->size(0);
int n1 = ldf->size(1);
int l0 = -Gc.left(0);
int l1 = -Gc.left(1);
int r0 = n0 + Gc.right(0);
int r1 = n1 + Gc.right(1);
for (int i1=l1; i1<r1; ++i1)
{
for (int i0=l0; i0<r0; ++i0)
{
outC << " [" << i0;
outC << "][" << i1;
outC << "]=" << lf_bi.offset(i0,i1);
}
outC << endl;
}
}
else if ( Dim==3 )
{
int n0 = ldf->size(0);
int n1 = ldf->size(1);
int n2 = ldf->size(2);
int l0 = -Gc.left(0);
int l1 = -Gc.left(1);
int l2 = -Gc.left(2);
int r0 = n0 + Gc.right(0);
int r1 = n1 + Gc.right(1);
int r2 = n2 + Gc.right(2);
for (int i2=l2; i2<r2; ++i2)
{
for (int i1=l1; i1<r1; ++i1)
for (int i0=l0; i0<r0; ++i0)
{
outC << " [" << i0;
outC << "][" << i1;
outC << "][" << i2;
outC << "]=" << lf_bi.offset(i0,i1,i2);
}
outC << endl;
}
}
else
{
ERRORMSG(" can not write for larger than three dimensions " << endl);
}
outC << "------------------ " << endl;
}
}
//////////////////////////////////////////////////////////////////////
//
......
......@@ -28,7 +28,6 @@
#include "Field/LField.h"
#include "Field/FieldLoc.h"
#include "Field/CompressedBrickIterator.h"
#include "Field/BrickIterator.h"
#include "Utility/IpplInfo.h"
#include "Utility/PAssert.h"
......@@ -144,7 +143,7 @@ public:
// set the position in the current LField
beginLField();
moveBy(offloc);
this->moveBy(offloc);
} else {
IpplInfo::abort("Inconsistent FieldLoc in SetCurrentLocation.");
}
......
......@@ -2,7 +2,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -41,15 +41,15 @@ public:
public:
// constructors
LSIndex(Vnode<Dim>* vn)
: compressed(false), VN(vn)
: VN(vn), compressed(false)
{
Strides[0] = 1;
for (unsigned int d=1; d < Dim; ++d)
Strides[d] = Strides[d-1] * vn->getDomain()[d-1].length();
Strides[d] = Strides[d-1] * vn->getDomain()[d-1].length();
}
LSIndex(const LSIndex<Dim>& lsi)
: compressed(lsi.compressed), IndexList(lsi.IndexList),
VN(lsi.VN), Strides(lsi.Strides) { }
: VN(lsi.VN), IndexList(lsi.IndexList), compressed(lsi.compressed),
Strides(lsi.Strides) { }
// destructor
~LSIndex() { }
......@@ -89,9 +89,9 @@ public:
if (compressed) {
int mval = n;
for (unsigned int d=(Dim-1); d >= 1; --d) {
int dval = mval / Strides[d];
mval -= dval * Strides[d];
CompressedPoint[d] = dval + VN->getDomain()[d].first();
int dval = mval / Strides[d];
mval -= dval * Strides[d];
CompressedPoint[d] = dval + VN->getDomain()[d].first();
}
CompressedPoint[0] = mval + VN->getDomain()[0].first();
......@@ -166,7 +166,7 @@ public:
iterator find(const SOffset<Dim>& indx) {
for (iterator a = begin(); a != end(); ++a)
if (*a == indx)
return a;
return a;
return end();
}
......@@ -174,7 +174,7 @@ public:
bool hasIndex(const SOffset<Dim>& indx) const {
for (const_iterator a = begin(); a != end(); ++a)
if (*a == indx)
return true;
return true;
return false;
}
......@@ -209,6 +209,5 @@ private:
/***************************************************************************
* $RCSfile: LSIndex.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
* IPPL_VERSION_ID: $Id: LSIndex.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
* IPPL_VERSION_ID: $Id: LSIndex.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
***************************************************************************/
......@@ -279,14 +279,14 @@ private:
// to indicate whether it is zero or not.
SOffset<Dim> Offset;
// our list of indices for each local vnode
container_t IndexList;
// our 'bounding box', which is the region that is or should be iterated
// over to determine what points are in this sparse index list. By default,
// this is the domain of the FieldLayout
NDIndex<Dim> BoundingBox;
// our list of indices for each local vnode
container_t IndexList;
// a special constructor, taking another SIndex and an Offset. This
// version is almost like a copy constructor, except that the given Offset
// is added in to the offset from the copied SIndex.
......
......@@ -481,7 +481,7 @@ inline NDIndex<L>
operator+(const SOffset<L>& a, const NDIndex<L>& b)
{
NDIndex<L> retval;
for (int d=0; d < L; ++d)
for (unsigned int d=0; d < L; ++d)
retval[d] = b[d] + a[d];
return retval;
}
......@@ -491,7 +491,7 @@ inline NDIndex<L>
operator+(const NDIndex<L>& b, const SOffset<L>& a)
{
NDIndex<L> retval;
for (int d=0; d < L; ++d)
for (unsigned int d=0; d < L; ++d)
retval[d] = b[d] + a[d];
return retval;
}
......@@ -569,7 +569,7 @@ inline NDIndex<L>
operator*(const SOffset<L>& a, const NDIndex<L>& b)
{
NDIndex<L> retval;
for (int d=0; d < L; ++d)
for (unsigned int d=0; d < L; ++d)
retval[d] = b[d] * a[d];
return retval;
}
......@@ -579,7 +579,7 @@ inline NDIndex<L>
operator*(const NDIndex<L>& b, const SOffset<L>& a)
{
NDIndex<L> retval;
for (int d=0; d < L; ++d)
for (unsigned int d=0; d < L; ++d)
retval[d] = b[d] * a[d];
return retval;
}
......
This diff is collapsed.
......@@ -20,6 +20,8 @@
#ifndef CARTESIAN_CENTERING_H
#define CARTESIAN_CENTERING_H
#include "Meshes/Centering.h"
#include <iostream>
#include <string>
......@@ -41,7 +43,7 @@ template <const CenteringEnum* CE, unsigned Dim, unsigned NComponents>
void CartesianCentering<CE,Dim,NComponents>::
print_Centerings(std::ostream& out)
{
int i,j;
unsigned int i,j;
out << CenteringName << std::endl;
out << "Dim = " << Dim << " ; NComponents = " << NComponents << std::endl;
for (i=0;i<Dim;i++) {
......
......@@ -34,10 +34,11 @@
#include <cstddef>
#include <vector>
#include <functional>
#include <iostream>
#include <map>
#include <functional>
#include <memory>
#include <vector>
#include "BoxParticleCachingPolicy.h"
......
......@@ -188,7 +188,7 @@ template<class T, class S, class C, unsigned int D>
inline bool
for_each(SubFieldIter<T,D,S> &p, SameFieldID s, C)
{
return p.getBareField().get_Id() == s.fID;
return (int)p.getBareField().get_Id() == s.fID;
}
//////////////////////////////////////////////////////////////////////
......
......@@ -125,7 +125,7 @@ void SubParticleAttrib<PA,T,Dim>::write(std::ostream &o) const {
// for each lfield, print out particles
typename Index_t::const_iterator_indx lsi = (*lfi)->begin();
for ( ; lsi != (*lfi)->end(); ++lsi)
o << *lsi + MyDomain.getOffset() << " ==> " << A[i++] << endl;
o << *lsi + MyDomain.getOffset() << " ==> " << A[i++] << std::endl;
}
}
......
......@@ -259,7 +259,7 @@ void FieldDebugPrint<T,Dim>::print(BareField<T,Dim>& F,
if(Scientific)
out.setf(std::ios::scientific);
int i0, i1, i2;
unsigned int i0, i1, i2;
LFI liter = myLField.begin();
BLFI bliter = availLField.begin();
switch(Dim) {
......
......@@ -89,7 +89,7 @@ inline T
vec<T,Length>::dot(const T* l, const T* r)
{
T ret = l[0]*r[0];
for (int i=1; i<Length; ++i)
for (unsigned int i=1; i<Length; ++i)
ret += l[i]*r[i];
return ret;
}
......
Markdown is supported
0%