Skip to content
Snippets Groups Projects
Commit 5aa04a09 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Fixed Memory Leak

Node and OperatorNode get virtual destructors
parent 90149bcb
Branches
No related tags found
No related merge requests found
Showing
with 152 additions and 162 deletions
#include <feature_creation/feature_space/FeatureSpace.hpp> #include <feature_creation/feature_space/FeatureSpace.hpp>
BOOST_CLASS_EXPORT(FeatureNode) BOOST_CLASS_EXPORT_GUID(FeatureNode, "FeatureNode")
BOOST_CLASS_EXPORT(AddNode) BOOST_CLASS_EXPORT_GUID(AddNode, "AddNode")
BOOST_CLASS_EXPORT(SubNode) BOOST_CLASS_EXPORT_GUID(SubNode, "SubNode")
BOOST_CLASS_EXPORT(AbsDiffNode) BOOST_CLASS_EXPORT_GUID(AbsDiffNode, "AbsDiffNode")
BOOST_CLASS_EXPORT(MultNode) BOOST_CLASS_EXPORT_GUID(MultNode, "MultNode")
BOOST_CLASS_EXPORT(DivNode) BOOST_CLASS_EXPORT_GUID(DivNode, "DivNode")
BOOST_CLASS_EXPORT(SqNode) BOOST_CLASS_EXPORT_GUID(SqNode, "SqNode")
BOOST_CLASS_EXPORT(SqrtNode) BOOST_CLASS_EXPORT_GUID(SqrtNode, "SqrtNode")
BOOST_CLASS_EXPORT(CbNode) BOOST_CLASS_EXPORT_GUID(CbNode, "CbNode")
BOOST_CLASS_EXPORT(CbrtNode) BOOST_CLASS_EXPORT_GUID(CbrtNode, "CbrtNode")
BOOST_CLASS_EXPORT(SixPowNode) BOOST_CLASS_EXPORT_GUID(SixPowNode, "SixPowNode")
BOOST_CLASS_EXPORT(ExpNode) BOOST_CLASS_EXPORT_GUID(ExpNode, "ExpNode")
BOOST_CLASS_EXPORT(NegExpNode) BOOST_CLASS_EXPORT_GUID(NegExpNode, "NegExpNode")
BOOST_CLASS_EXPORT(LogNode) BOOST_CLASS_EXPORT_GUID(LogNode, "LogNode")
BOOST_CLASS_EXPORT(AbsNode) BOOST_CLASS_EXPORT_GUID(AbsNode, "AbsNode")
BOOST_CLASS_EXPORT(InvNode) BOOST_CLASS_EXPORT_GUID(InvNode, "InvNode")
BOOST_CLASS_EXPORT(SinNode) BOOST_CLASS_EXPORT_GUID(SinNode, "SinNode")
BOOST_CLASS_EXPORT(CosNode) BOOST_CLASS_EXPORT_GUID(CosNode, "CosNode")
FeatureSpace::FeatureSpace( FeatureSpace::FeatureSpace(
std::shared_ptr<MPI_Interface> mpi_comm, std::shared_ptr<MPI_Interface> mpi_comm,
...@@ -140,6 +140,7 @@ void FeatureSpace::generate_feature_space() ...@@ -140,6 +140,7 @@ void FeatureSpace::generate_feature_space()
++feat_ind; ++feat_ind;
} }
} }
if(nn <= _n_rung_store) if(nn <= _n_rung_store)
{ {
// bool use_temp = (nn != _max_phi) || (_max_phi > _n_rung_store); // bool use_temp = (nn != _max_phi) || (_max_phi > _n_rung_store);
...@@ -153,9 +154,11 @@ void FeatureSpace::generate_feature_space() ...@@ -153,9 +154,11 @@ void FeatureSpace::generate_feature_space()
{ {
std::vector<size_t> next_phi_sizes; std::vector<size_t> next_phi_sizes;
mpi::all_gather(*_mpi_comm, next_phi.size(), next_phi_sizes); mpi::all_gather(*_mpi_comm, next_phi.size(), next_phi_sizes);
size_t n_feat = std::accumulate(next_phi_sizes.begin(), next_phi_sizes.end(), _phi.size()); size_t n_feat = std::accumulate(next_phi_sizes.begin(), next_phi_sizes.end(), _phi.size());
size_t n_feat_rank = n_feat / _mpi_comm->size(); size_t n_feat_rank = n_feat / _mpi_comm->size();
size_t n_feat_below_rank = _mpi_comm->rank() * n_feat_rank; size_t n_feat_below_rank = _mpi_comm->rank() * n_feat_rank;
if(_mpi_comm->rank() < n_feat % _mpi_comm->size()) if(_mpi_comm->rank() < n_feat % _mpi_comm->size())
{ {
++n_feat_rank; ++n_feat_rank;
...@@ -165,6 +168,7 @@ void FeatureSpace::generate_feature_space() ...@@ -165,6 +168,7 @@ void FeatureSpace::generate_feature_space()
{ {
n_feat_below_rank += n_feat % _mpi_comm->size(); n_feat_below_rank += n_feat % _mpi_comm->size();
} }
if(n_feat_below_rank + n_feat_rank <= _phi.size()) if(n_feat_below_rank + n_feat_rank <= _phi.size())
{ {
_phi.erase(_phi.begin(), _phi.begin() + n_feat_below_rank); _phi.erase(_phi.begin(), _phi.begin() + n_feat_below_rank);
...@@ -178,12 +182,14 @@ void FeatureSpace::generate_feature_space() ...@@ -178,12 +182,14 @@ void FeatureSpace::generate_feature_space()
{ {
_phi = {}; _phi = {};
} }
while((_phi.size() < n_feat_rank) && (next_phi.size() > 0)) while((_phi.size() < n_feat_rank) && (next_phi.size() > 0))
{ {
next_phi.back()->reindex(_phi.size() + n_feat_below_rank); next_phi.back()->reindex(_phi.size() + n_feat_below_rank);
_phi.push_back(next_phi.back()); _phi.push_back(next_phi.back());
next_phi.pop_back(); next_phi.pop_back();
} }
// This can be calculated without an all_gather, using it to not introduce too many things at one time // This can be calculated without an all_gather, using it to not introduce too many things at one time
std::vector<size_t> next_phi_needed; std::vector<size_t> next_phi_needed;
std::vector<size_t> next_phi_excess; std::vector<size_t> next_phi_excess;
...@@ -229,7 +235,7 @@ void FeatureSpace::generate_feature_space() ...@@ -229,7 +235,7 @@ void FeatureSpace::generate_feature_space()
} }
else else
{ {
size_t total_recv = std::accumulate(next_phi_excess.begin(), next_phi_excess.begin() + _mpi_comm->rank(), 0); size_t total_recv = std::accumulate(next_phi_needed.begin(), next_phi_needed.begin() + _mpi_comm->rank(), 0);
size_t prev_recv_sent = 0; size_t prev_recv_sent = 0;
size_t recv_size = 0; size_t recv_size = 0;
int ind = 0; int ind = 0;
......
...@@ -11,8 +11,7 @@ FeatureNode::FeatureNode(int feat_ind, std::string expr, std::vector<double> val ...@@ -11,8 +11,7 @@ FeatureNode::FeatureNode(int feat_ind, std::string expr, std::vector<double> val
std::copy_n(value.data(), value.size(), value_ptr()); std::copy_n(value.data(), value.size(), value_ptr());
} }
FeatureNode::FeatureNode(const FeatureNode &o) : FeatureNode::~FeatureNode()
Node(o)
{} {}
void FeatureNode::update_add_sub_leaves(std::map<std::string, int>& add_sub_leaves, int pl_mn, int& expected_abs_tot) void FeatureNode::update_add_sub_leaves(std::map<std::string, int>& add_sub_leaves, int pl_mn, int& expected_abs_tot)
......
...@@ -17,6 +17,19 @@ class FeatureNode: public Node ...@@ -17,6 +17,19 @@ class FeatureNode: public Node
{ {
friend class boost::serialization::access; friend class boost::serialization::access;
/**
* @brief Serialization function to send over MPI
*
* @param ar Archive representation of node
*/
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<Node>(*this);
ar & _expr;
ar & _unit;
}
protected: protected:
std::string _expr; //!< Expression of the feature std::string _expr; //!< Expression of the feature
Unit _unit; //!< Unit for the feature Unit _unit; //!< Unit for the feature
...@@ -37,12 +50,7 @@ public: ...@@ -37,12 +50,7 @@ public:
*/ */
FeatureNode(int feat_ind, std::string expr, std::vector<double> value, Unit unit); FeatureNode(int feat_ind, std::string expr, std::vector<double> value, Unit unit);
/** ~FeatureNode();
* @brief Copy constructor
*
* @param o Node to be copied
*/
FeatureNode(const FeatureNode &o);
/** /**
* @brief Get the expression for the overall descriptor (From head node down) * @brief Get the expression for the overall descriptor (From head node down)
...@@ -103,19 +111,6 @@ public: ...@@ -103,19 +111,6 @@ public:
* @param add_sub_leaves [description] * @param add_sub_leaves [description]
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
/**
* @brief Serialization function to send over MPI
*
* @param ar Archive representation of node
*/
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<Node>(*this);
ar & _expr;
ar & _unit;
}
}; };
#endif #endif
...@@ -8,9 +8,7 @@ Node::Node(int feat_ind, int n_samp) : ...@@ -8,9 +8,7 @@ Node::Node(int feat_ind, int n_samp) :
_feat_ind(feat_ind) _feat_ind(feat_ind)
{} {}
Node::Node(const Node &o) : Node::~Node()
_n_samp(o._n_samp),
_feat_ind(o._feat_ind)
{} {}
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Node) BOOST_SERIALIZATION_ASSUME_ABSTRACT(Node)
......
...@@ -21,6 +21,20 @@ ...@@ -21,6 +21,20 @@
*/ */
class Node class Node
{ {
friend class boost::serialization::access;
/**
* @brief Serialization function to send over MPI
*
* @param ar Archive representation of node
*/
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & _n_samp;
ar & _feat_ind;
}
protected: protected:
int _n_samp; //!< Number of samples in the feature int _n_samp; //!< Number of samples in the feature
int _feat_ind; //!< Index of the feature int _feat_ind; //!< Index of the feature
...@@ -40,12 +54,7 @@ public: ...@@ -40,12 +54,7 @@ public:
*/ */
Node(int feat_ind, int n_samp); Node(int feat_ind, int n_samp);
/** virtual ~Node();
* @brief Copy constructor
*
* @param o Node to be copied
*/
Node(const Node &o);
/** /**
* @brief Reindex the feature * @brief Reindex the feature
...@@ -122,18 +131,6 @@ public: ...@@ -122,18 +131,6 @@ public:
* @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves * @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves
*/ */
virtual void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot) = 0; virtual void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot) = 0;
/**
* @brief Serialization function to send over MPI
*
* @param ar Archive representation of node
*/
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & _n_samp;
ar & _feat_ind;
}
}; };
typedef std::shared_ptr<Node> node_ptr; typedef std::shared_ptr<Node> node_ptr;
......
...@@ -6,16 +6,10 @@ OperatorNode::OperatorNode() ...@@ -6,16 +6,10 @@ OperatorNode::OperatorNode()
OperatorNode::OperatorNode(std::vector<node_ptr> feats, int rung, int feat_ind) : OperatorNode::OperatorNode(std::vector<node_ptr> feats, int rung, int feat_ind) :
Node(feat_ind, feats[0]->n_samp()), Node(feat_ind, feats[0]->n_samp()),
_feats(feats) _feats(feats)
{ {}
_feats.reserve(_feats.size());
}
OperatorNode::OperatorNode(const OperatorNode &o) : OperatorNode::~OperatorNode()
Node(o), {}
_feats(o._feats)
{
_feats.reserve(_feats.size());
}
double* OperatorNode::value_ptr(int offset) double* OperatorNode::value_ptr(int offset)
{ {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/split_member.hpp> #include <boost/serialization/split_member.hpp>
#include <boost/serialization/array.hpp> #include <boost/serialization/array.hpp>
#include <boost/serialization/vector.hpp>
/** /**
...@@ -19,6 +20,13 @@ ...@@ -19,6 +20,13 @@
class OperatorNode: public Node class OperatorNode: public Node
{ {
friend class boost::serialization::access; friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<Node>(*this);
ar & _feats;
}
protected: protected:
std::vector<node_ptr> _feats; std::vector<node_ptr> _feats;
...@@ -38,11 +46,8 @@ public: ...@@ -38,11 +46,8 @@ public:
* @param feat_ind index of the feature * @param feat_ind index of the feature
*/ */
OperatorNode(std::vector<node_ptr> feats, int rung, int feat_ind); OperatorNode(std::vector<node_ptr> feats, int rung, int feat_ind);
/**
* @brief Base Constructor virtual ~OperatorNode();
* @details This is only used for serialization
*/
OperatorNode(const OperatorNode &o);
virtual std::string expr() = 0; virtual std::string expr() = 0;
...@@ -50,13 +55,6 @@ public: ...@@ -50,13 +55,6 @@ public:
virtual void set_value(int offset = -1) = 0; virtual void set_value(int offset = -1) = 0;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<Node>(*this);
ar & _feats;
}
/** /**
* @brief Get the pointer to the feature's data * @brief Get the pointer to the feature's data
* @details If the feature is not already stored in memory, then calculate the feature and return the pointer to the data * @details If the feature is not already stored in memory, then calculate the feature and return the pointer to the data
......
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
class AbsDiffNode: public OperatorNode class AbsDiffNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
AbsDiffNode(); AbsDiffNode();
...@@ -51,12 +58,6 @@ public: ...@@ -51,12 +58,6 @@ public:
* @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves * @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class AbsNode: public OperatorNode class AbsNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
AbsNode(); AbsNode();
...@@ -51,12 +57,6 @@ public: ...@@ -51,12 +57,6 @@ public:
* @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves * @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class AddNode: public OperatorNode class AddNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
AddNode(); AddNode();
...@@ -52,12 +58,6 @@ public: ...@@ -52,12 +58,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class CosNode: public OperatorNode class CosNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
CosNode(); CosNode();
...@@ -52,12 +58,6 @@ public: ...@@ -52,12 +58,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class CbNode: public OperatorNode class CbNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
CbNode(); CbNode();
...@@ -51,13 +57,6 @@ public: ...@@ -51,13 +57,6 @@ public:
* @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves * @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class CbrtNode: public OperatorNode class CbrtNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
CbrtNode(); CbrtNode();
...@@ -52,12 +58,6 @@ public: ...@@ -52,12 +58,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class DivNode: public OperatorNode class DivNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
DivNode(); DivNode();
...@@ -52,12 +58,6 @@ public: ...@@ -52,12 +58,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class ExpNode: public OperatorNode class ExpNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
ExpNode(); ExpNode();
...@@ -52,12 +58,6 @@ public: ...@@ -52,12 +58,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
class InvNode: public OperatorNode class InvNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
InvNode(); InvNode();
...@@ -52,11 +59,5 @@ public: ...@@ -52,11 +59,5 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
class LogNode: public OperatorNode class LogNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
LogNode(); LogNode();
...@@ -51,13 +57,6 @@ public: ...@@ -51,13 +57,6 @@ public:
* @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves * @param expected_abs_tot The expected absolute sum of all values in div_mult_leaves
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
class MultNode: public OperatorNode class MultNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
MultNode(); MultNode();
...@@ -52,12 +59,6 @@ public: ...@@ -52,12 +59,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
class NegExpNode: public OperatorNode class NegExpNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
NegExpNode(); NegExpNode();
...@@ -52,12 +59,6 @@ public: ...@@ -52,12 +59,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
class SinNode: public OperatorNode class SinNode: public OperatorNode
{ {
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & boost::serialization::base_object<OperatorNode>(*this);
}
public: public:
SinNode(); SinNode();
...@@ -52,12 +59,6 @@ public: ...@@ -52,12 +59,6 @@ public:
*/ */
void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot); void update_div_mult_leaves(std::map<std::string, double>& div_mult_leaves, double fact, double& expected_abs_tot);
template <typename Archive>
void serialize(Archive& ar, const unsigned int version)
{
// ar.template register_type<OperatorNode>();
ar & boost::serialization::base_object<OperatorNode>(*this);
}
}; };
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment