Skip to content

Commit be1c447

Browse files
author
Daniel
committed
removed first version of run_scalar_sdc function from scalar_sdc.cpp; instead, the main routine sets default values and calls the run function with these as parameter
1 parent bf914b5 commit be1c447

File tree

1 file changed

+7
-34
lines changed

1 file changed

+7
-34
lines changed

examples/scalar/scalar_sdc.cpp

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,7 @@
1616
/*
1717
* A simple run routine with preset parameters
1818
*/
19-
double run_scalar_sdc()
20-
{
21-
pfasst::SDC<> sdc;
22-
23-
const size_t nsteps = 2;
24-
const double dt = 1.0;
25-
const size_t nnodes = 4;
26-
const size_t niters = 6;
27-
const complex<double> lambda = complex<double>(-1.0, 1.0);
28-
const complex<double> y0 = complex<double>(1.0, 0.0);
29-
30-
// so far, only lobatto nodes appear to be working
31-
auto nodes = pfasst::compute_nodes(nnodes, "gauss-lobatto");
32-
auto factory = make_shared<pfasst::encap::VectorFactory<complex<double>>>(1);
33-
auto sweeper = make_shared<ScalarSweeper<>>(lambda, y0);
34-
35-
sweeper->set_nodes(nodes);
36-
sweeper->set_factory(factory);
37-
38-
sdc.add_level(sweeper);
39-
sdc.set_duration(0.0, dt * nsteps, dt, niters);
40-
sdc.setup();
4119

42-
auto q0 = sweeper->get_state(0);
43-
sweeper->exact(q0, 0.0);
44-
45-
sdc.run();
46-
47-
return sweeper->get_errors();
48-
}
49-
50-
/*
51-
* Overloaded run routine, which requires necessary parameters to be passed as arguments
52-
*/
5320
double run_scalar_sdc(const size_t nsteps, const double dt, const size_t nnodes,
5421
const size_t niters, const complex<double> lambda)
5522
{
@@ -79,6 +46,12 @@ double run_scalar_sdc(const size_t nsteps, const double dt, const size_t nnodes,
7946
#ifndef PFASST_UNIT_TESTING
8047
int main(int /*argc*/, char** /*argv*/)
8148
{
82-
run_scalar_sdc();
49+
const size_t nsteps = 2;
50+
const double dt = 1.0;
51+
const size_t nnodes = 4;
52+
const size_t niters = 6;
53+
const complex<double> lambda = complex<double>(-1.0, 1.0);
54+
55+
run_scalar_sdc(nsteps, dt, nnodes, niters, lambda);
8356
}
8457
#endif

0 commit comments

Comments
 (0)