diff --git a/src/ASM/ASMbase.C b/src/ASM/ASMbase.C index 047a8b25..bfaf28f4 100644 --- a/src/ASM/ASMbase.C +++ b/src/ASM/ASMbase.C @@ -29,6 +29,13 @@ ASMbase::ASMbase (unsigned char n_p, unsigned char n_s, unsigned char n_f) } +ASMbase::~ASMbase () +{ + for (MPCIter it = mpcs.begin(); it != mpcs.end(); it++) + delete *it; +} + + void ASMbase::clear (bool retainGeometry) { if (retainGeometry) // Clear all FE structures, including the elements @@ -37,8 +44,12 @@ void ASMbase::clear (bool retainGeometry) for (size_t i = 0; i < MNPC.size(); i++) MNPC[i].clear(); // Erase the nodes, boundary conditions and multi-point constraints + for (MPCIter it = mpcs.begin(); it != mpcs.end(); it++) + delete *it; + MLGN.clear(); BCode.clear(); + dCode.clear(); mpcs.clear(); } diff --git a/src/ASM/ASMbase.h b/src/ASM/ASMbase.h index f51a96ae..ee6f69f0 100644 --- a/src/ASM/ASMbase.h +++ b/src/ASM/ASMbase.h @@ -75,8 +75,8 @@ protected: ASMbase(unsigned char n_p, unsigned char n_s, unsigned char n_f); public: - //! \brief Empty destructor. - virtual ~ASMbase() {} + //! \brief The destructor frees the dynamically allocated data objects. + virtual ~ASMbase(); //! \brief Checks if this patch is empty. virtual bool empty() const = 0;