Skip to content

Commit

Permalink
small mods
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Vascellari authored and Michele Vascellari committed Jan 24, 2018
1 parent aa83690 commit a3ad065
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cython/pkpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cdef class Reactor:
def __dealloc__(self):
del self._c_reactor

def solve(self, dt, verbose=True):
def solve(self, dt=1e-5, verbose=True):
"""
Solve reactor.
Expand Down
2 changes: 1 addition & 1 deletion src/reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace pkp{
}


void Reactor::dump(const std::string &csv, std::string sep)
void Reactor::dump(const std::string &csv, std::string sep) const
{
// std::ofstream file(csv);
// for (int i=0; i < times.size(); ++i)
Expand Down
9 changes: 5 additions & 4 deletions src/reactor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ namespace pkp {
~Reactor();
void solve(double dt=1e-4, bool verbose=false);
void solve(std::vector<std::vector<double>> points, double dt=1e-4, bool verbose=false);
dvector const getParameters(){return model->getParameters();}
const dvector & getParameters() const {return model->getParameters();}
size_t getNParameters() const {return model->getNParameters();}
void setParameters(const dvector & parameters);
std::vector<double> getTimes(){return times;}
std::vector<dvector> getStates(){return states;}
void dump(const std::string &csv, std::string sep = ",");
const std::vector<double> & getTimes() const {return times;}
const std::vector<dvector> & getStates() const {return states;}
void dump(const std::string &csv, std::string sep = ",") const;
inline void printParameters(){model->printParameters();}
void setOperatingConditions(const std::vector<dvector>&);
const std::vector<dvector> & getOperatingConditions() const;
Expand Down
5 changes: 3 additions & 2 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ namespace pkp {
TEST_F(SFORTest, getNParameters)
{
EXPECT_EQ(3, model->getNParameters());
EXPECT_EQ(sforParNames, model->getParametersNames());
std::vector<std::string> par = {"A", "E", "y0"};
EXPECT_EQ(par, model->getParametersNames());
}

TEST_F(SFORTest, setParameters)
Expand Down Expand Up @@ -163,7 +164,7 @@ namespace pkp {
std::vector<double> times = reactor->getTimes();
std::vector<dvector> states = reactor->getStates();
EXPECT_EQ(times.size(), states.size());
EXPECT_EQ(states[0].size(), sforInitState.size()+1);
EXPECT_EQ(states[0].size(), 2);
}

TEST_F(ReactorTest, setParameters)
Expand Down

0 comments on commit a3ad065

Please sign in to comment.