Skip to content

Commit 9e31826

Browse files
author
Daniel
committed
in test_scalar, should now use size_t instead of int
1 parent be1c447 commit 9e31826

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/examples/scalar/test_scalar.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ TEST(ConvergenceTest, ScalarSDC)
2525

2626
const complex<double> lambda = complex<double>(-1.0, 1.0);
2727
const double Tend = 4.0;
28-
const vector<int> nsteps = { 2, 5, 10, 15, 20 };
29-
int nsteps_l = nsteps.size();
28+
const vector<size_t> nsteps = { 2, 5, 10, 15, 20 };
29+
size_t nsteps_l = nsteps.size();
3030

3131
vector<double> err(nsteps.size());
3232
vector<double> convrate(nsteps.size()-1);
@@ -36,20 +36,20 @@ TEST(ConvergenceTest, ScalarSDC)
3636

3737
// Test converge up to 6 nodes: For more nodes, errors are of the order of machine
3838
// precision and convergence can no longer be monitored
39-
for ( int nnodes = 2; nnodes<=6; ++nnodes)
39+
for ( size_t nnodes = 2; nnodes<=6; ++nnodes)
4040
{
4141
// Expect convergence rate of 2*nodes-2 from collocation formula,
4242
// doing an identical number of iteration should suffice to reach this as each
4343
// iteration should increase order by one
44-
int niters = 2*nnodes-2;
44+
size_t niters = 2*nnodes-2;
4545

46-
for ( int i = 0; i<=nsteps_l-1; ++i)
46+
for ( size_t i = 0; i<=nsteps_l-1; ++i)
4747
{
4848
dt = Tend/double(nsteps[i]);
4949
err[i] = run_scalar_sdc(nsteps[i], dt, nnodes, niters, lambda);
5050
}
5151

52-
for (int i = 0; i<=nsteps_l-2; ++i)
52+
for ( size_t i = 0; i<=nsteps_l-2; ++i)
5353
{
5454
convrate[i] = log10(err[i+1]/err[i])/log10(double(nsteps[i])/double(nsteps[i+1]));
5555
// The expected convergence rate for Lobatto nodes is 2*nnodes-2, but because

0 commit comments

Comments
 (0)