Commit 2fc7e4f0 authored by Ansgar Burchardt's avatar Ansgar Burchardt

Merge branch 'bugfix/compile-error-and-warnings-with-gcc-8' into 'master'

fix compile error and several warnings with gcc 8

See merge request !216

(cherry picked from commit 33b9cb42)

ae1ec50a CompPair: make `operator()` a const method
bad3dd33 do not catch polymorphic types by value
7fea4b07 silence warnings about unused variables
parent 878bfa4f
Pipeline #10691 passed with stage
in 5 minutes and 26 seconds
......@@ -578,7 +578,7 @@ namespace Dune
cont.sparsity[column].insert(i);
}
}
catch(Dune::RangeError er) {
catch(const Dune::RangeError&) {
// Entry not present in the new index set. Ignore!
#ifdef DEBUG_REPART
typedef typename Container::LookupIndexSet GlobalLookup;
......@@ -593,7 +593,7 @@ namespace Dune
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
std::cout<<rank<<cont.aggidxset<<std::endl;
std::cout<<rank<<": row "<<i<<" (global="<<gi <<") not in index set for owner index "<<pi->global()<<std::endl;
throw er;
throw;
}
#endif
}
......@@ -657,7 +657,7 @@ namespace Dune
cont.matrix[i][column]=data.second;
}
}
catch(Dune::RangeError er) {
catch(const Dune::RangeError&) {
// This an overlap row and might therefore lack some entries!
}
......@@ -752,7 +752,7 @@ namespace Dune
{
try{
newMatrix[col.index()][row.index()];
}catch(Dune::ISTLError e) {
}catch(const Dune::ISTLError&) {
std::cerr<<newComm.communicator().rank()<<": entry ("
<<col.index()<<","<<row.index()<<") missing! for symmetry!"<<std::endl;
ret=1;
......
......@@ -164,7 +164,7 @@ namespace Dune
{
struct CompPair {
template<class G,class M>
bool operator()(const std::pair<G,M>& p1, const std::pair<G,M>& p2)
bool operator()(const std::pair<G,M>& p1, const std::pair<G,M>& p2) const
{
return p1.first<p2.first;
}
......
......@@ -965,7 +965,8 @@ namespace Dune
vtxdist[oocomm.communicator().size()],
noNeighbours, xadj, adjncy, false));
Metis::idx_t wgtflag=0, numflag=0;
DUNE_UNUSED Metis::idx_t wgtflag=0;
Metis::idx_t numflag=0;
Metis::idx_t edgecut;
#ifdef USE_WEIGHTS
wgtflag=3;
......@@ -973,7 +974,6 @@ namespace Dune
Metis::real_t *tpwgts = new Metis::real_t[nparts];
for(int i=0; i<nparts; ++i)
tpwgts[i]=1.0/nparts;
int options[5] ={ 0,1,15,0,0};
MPI_Comm comm=oocomm.communicator();
Dune::dinfo<<rank<<" vtxdist: ";
......@@ -998,6 +998,7 @@ namespace Dune
#ifdef PARALLEL_PARTITION
Metis::real_t ubvec = 1.15;
int ncon=1;
int options[5] ={ 0,1,15,0,0};
//=======================================================
// ParMETIS_V3_PartKway
......@@ -1156,7 +1157,6 @@ namespace Dune
if(verbose && oocomm.communicator().rank()==0)
std::cout<<"Creating grah one 1 process took "<<time.elapsed()<<std::endl;
time.reset();
options[0]=0; options[1]=1; options[2]=1; options[3]=3; options[4]=3;
#if METIS_VER_MAJOR >= 5
Metis::idx_t ncon = 1;
Metis::idx_t moptions[METIS_NOPTIONS];
......@@ -1165,6 +1165,7 @@ namespace Dune
METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, gadjwgt,
&nparts, NULL, NULL, moptions, &edgecut, gpart);
#else
int options[5] = {0, 1, 1, 3, 3};
// Call metis
METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, &wgtflag,
&numflag, &nparts, options, &edgecut, gpart);
......
......@@ -6,41 +6,35 @@ using namespace Dune;
int main (int argc, char** argv)
{
try
{
typedef BCRSMatrix<FieldMatrix<double,2,2> > Mat;
typedef BCRSMatrix<FieldMatrix<double,2,2> > Mat;
Mat A(1,1, Mat::random);
Mat A(1,1, Mat::random);
A.setrowsize(0,1);
A.setrowsize(0,1);
A.endrowsizes();
A.endrowsizes();
A.addindex(0, 0);
A.addindex(0, 0);
A.endindices();
A = 0;
A.endindices();
A = 0;
Mat B(2,2, Mat::random);
Mat B(2,2, Mat::random);
B.setrowsize(0,2);
B.setrowsize(1,1);
B.setrowsize(0,2);
B.setrowsize(1,1);
B.endrowsizes();
B.endrowsizes();
B.addindex(0, 0);
B.addindex(0, 1);
B.addindex(0, 0);
B.addindex(0, 1);
B.addindex(1, 1);
B.addindex(1, 1);
B.endindices();
B = 0;
B.endindices();
B = 0;
B = A;
B = A;
} catch(Exception e){
std::cout<<e<<std::endl;
return 1;
}
return 0;
return 0;
}
......@@ -5,6 +5,7 @@
#include <dune/common/fmatrix.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/test/testsuite.hh>
#include <dune/common/unused.hh>
#include <dune/istl/io.hh>
template<class M>
......@@ -12,7 +13,7 @@ std::size_t computeNNZ(M&& matrix)
{
std::size_t nnz = 0;
for (auto&& row : matrix)
for (auto&& entry : row)
for (DUNE_UNUSED auto&& entry : row)
++nnz;
return nnz;
}
......@@ -157,20 +158,15 @@ void testDoubleSetSize()
int main()
{
try{
Dune::TestSuite testSuite;
Dune::TestSuite testSuite;
Builder<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > > builder;
Builder<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > > builder;
testSuite.subTest(builder.randomBuild(5,4));
testSuite.subTest(builder.rowWiseBuild(5,4,13));
testSuite.subTest(builder.rowWiseBuild(5,4));
testSuite.subTest(builder.randomBuild(5,4));
testSuite.subTest(builder.rowWiseBuild(5,4,13));
testSuite.subTest(builder.rowWiseBuild(5,4));
testDoubleSetSize();
testDoubleSetSize();
return testSuite.exit();
}catch(Dune::Exception e) {
std::cerr << e<<std::endl;
return 1;
}
return testSuite.exit();
}
......@@ -99,7 +99,7 @@ int testRepart(int N, int coarsenTarget)
if(col.index()<=row.index())
try{
newMat[col.index()][row.index()];
}catch(Dune::ISTLError e) {
}catch(const Dune::ISTLError&) {
std::cerr<<coarseComm->communicator().rank()<<": entry ("
<<col.index()<<","<<row.index()<<") missing!"<<std::endl;
ret=1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment