Skip to content

Commit b3f23b1

Browse files
committed
encap: Change set_q to set_state, get_pg to get_saved_state etc.
Signed-off-by: Matthew Emmett <[email protected]>
1 parent bc055d1 commit b3f23b1

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

include/pfasst/encap/encapsulation.hpp

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,51 +61,63 @@ namespace pfasst {
6161
shared_ptr<EncapsulationFactory<scalar,time>> factory;
6262

6363
public:
64-
void set_nodes(vector<time> nodes) {
64+
65+
void set_nodes(vector<time> nodes)
66+
{
6567
this->nodes = nodes;
6668
}
6769

68-
const vector<time> get_nodes() const {
70+
const vector<time> get_nodes() const
71+
{
6972
return nodes;
7073
}
7174

72-
void set_factory(EncapsulationFactory<scalar,time>* factory) {
75+
void set_factory(EncapsulationFactory<scalar,time>* factory)
76+
{
7377
this->factory = shared_ptr<EncapsulationFactory<scalar,time>>(factory);
7478
}
7579

76-
EncapsulationFactory<scalar,time>* get_factory() const {
80+
EncapsulationFactory<scalar,time>* get_factory() const
81+
{
7782
return factory.get();
7883
}
7984

80-
virtual void set_q(const Encapsulation<scalar,time>* q0, unsigned int m) {
81-
throw NotImplementedYet("sweeper");
85+
virtual void set_state(const Encapsulation<scalar,time>* q0, unsigned int m)
86+
{
87+
throw NotImplementedYet("sweeper");
8288
}
8389

84-
virtual Encapsulation<scalar,time>* get_state(unsigned int m) const {
90+
virtual Encapsulation<scalar,time>* get_state(unsigned int m) const
91+
{
8592
throw NotImplementedYet("sweeper");
8693
return NULL;
8794
}
8895

89-
virtual Encapsulation<scalar,time>* get_tau(unsigned int m) const {
96+
virtual Encapsulation<scalar,time>* get_tau(unsigned int m) const
97+
{
9098
throw NotImplementedYet("sweeper");
9199
return NULL;
92100
}
93101

94-
virtual Encapsulation<scalar,time>* get_pq(unsigned int m) const {
102+
virtual Encapsulation<scalar,time>* get_saved_state(unsigned int m) const
103+
{
95104
throw NotImplementedYet("sweeper");
96105
return NULL;
97106
}
98107

99-
virtual Encapsulation<scalar,time>* get_qend() {
108+
virtual Encapsulation<scalar,time>* get_end_state()
109+
{
100110
return this->get_state(this->get_nodes().size()-1);
101111
}
102112

103-
virtual void evaluate(int m) {
113+
virtual void evaluate(int m)
114+
{
104115
throw NotImplementedYet("sweeper");
105116
}
106117

107-
virtual void advance() {
108-
this->set_q(this->get_qend(), 0);
118+
virtual void advance()
119+
{
120+
this->set_state(this->get_end_state(), 0);
109121
}
110122

111123
virtual void integrate(Encapsulation<scalar,time>* dst, time dt) {
@@ -147,7 +159,7 @@ namespace pfasst {
147159
if (initial)
148160
crse_tmp->saxpy(-1.0, src->get_state(0));
149161
else
150-
crse_tmp->saxpy(-1.0, src->get_pq(m));
162+
crse_tmp->saxpy(-1.0, src->get_saved_state(m));
151163
interpolate(fine_tmp[m], crse_tmp);
152164
}
153165
delete crse_tmp;

include/pfasst/encap/imex.hpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ namespace pfasst {
2020

2121
public:
2222

23-
~IMEX() {
23+
~IMEX()
24+
{
2425
for (int m=0; m<Q.size(); m++) delete Q[m];
2526
for (int m=0; m<pQ.size(); m++) delete pQ[m];
2627
for (int m=0; m<S.size(); m++) delete S[m];
2728
for (int m=0; m<Fe.size(); m++) delete Fe[m];
2829
for (int m=0; m<Fi.size(); m++) delete Fi[m];
2930
}
3031

31-
void set_q(const Encapsulation<scalar,time> *q0, unsigned int m)
32+
void set_state(const Encapsulation<scalar,time> *q0, unsigned int m)
3233
{
3334
Q[m]->copy(q0);
3435
}
@@ -43,16 +44,13 @@ namespace pfasst {
4344
return T[m];
4445
}
4546

46-
Encapsulation<scalar,time>* get_pq(unsigned int m) const
47+
Encapsulation<scalar,time>* get_saved_state(unsigned int m) const
4748
{
4849
return pQ[m];
4950
}
5051

51-
void advance() const {
52-
set_q(get_state(Q.size()-1), 0);
53-
}
54-
55-
void setup(bool coarse) {
52+
void setup(bool coarse)
53+
{
5654
auto nodes = this->get_nodes();
5755

5856
Smat = compute_quadrature(nodes, nodes, 's');
@@ -115,7 +113,8 @@ namespace pfasst {
115113
delete rhs;
116114
}
117115

118-
virtual void predict(time t0, time dt) {
116+
virtual void predict(time t0, time dt)
117+
{
119118
const auto nodes = this->get_nodes();
120119
const int nnodes = nodes.size();
121120

0 commit comments

Comments
 (0)