Skip to content

Commit

Permalink
fixup,cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Sep 28, 2024
1 parent b59e24f commit f3284b2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 0 additions & 2 deletions include/amici/model_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ struct ModelStateDerived {
* We could pass the solver's context to the model during initialize() and
* only create ModelStateDerived there, but this caused issue in tests with
* FSA for unclear reasons.
* TODO: Do we need to attach an error handler here? Not sure if
* NVector and SUNMatrix would even use it.
*/
sundials::Context sunctx_;

Expand Down
20 changes: 12 additions & 8 deletions include/amici/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>

/** @file serialization.h Helper functions and forward declarations for
* boost::serialization */
/**
* @file serialization.h Helper functions and forward declarations for
* boost::serialization
*
* FIXME: Many of the serialization functions seem to be outdated and miss
* some fields.
*/
namespace boost {
namespace serialization {

Expand Down Expand Up @@ -284,6 +289,10 @@ void serialize(

/**
* @brief Serialize AmiVector to a boost archive
*
* NOTE: The deserialized AmiVector/NVector will not have a valid SUNContext.
* This needs to be set afterwards.
*
* @param ar archive
* @param v AmiVector
*/
Expand All @@ -294,14 +303,9 @@ void serialize(
if (Archive::is_loading::value) {
std::vector<amici::realtype> tmp;
ar & tmp;
// TODO: how do we get a new sunctx in here??
// for now, create one for construction of the vector, set it to
// nullptr
sundials::Context sunctx;
v = amici::AmiVector(tmp, sunctx);
if (v.getNVector()) {
v.getNVector()->sunctx = nullptr;
}
v.set_ctx(sunctx);
} else {
auto tmp = v.getVector();
ar & tmp;
Expand Down
2 changes: 1 addition & 1 deletion src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void wrapErrHandlerFn(
#ifdef NDEBUG
snprintf(msg_buffer, BUF_SIZE, "%s:%d: %s (%d)", file, line, msg, err_code);
#else
snprintf(buffer, BUF_SIZE, "%s", msg);
snprintf(msg_buffer, BUF_SIZE, "%s", msg);
#endif
// we need a matlab-compatible message ID
// i.e. colon separated and only [A-Za-z0-9_]
Expand Down

0 comments on commit f3284b2

Please sign in to comment.