From 83ce887d3debbfa8dc8734abc991b5e66230dbc8 Mon Sep 17 00:00:00 2001 From: Amaury Johnan <amjohnen@gmail.com> Date: Fri, 14 Jun 2013 15:14:27 +0000 Subject: [PATCH] add BasisFactory::clearAll() --- Numeric/BasisFactory.cpp | 21 +++++++++++++++++++++ Numeric/BasisFactory.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/Numeric/BasisFactory.cpp b/Numeric/BasisFactory.cpp index 9f15a203d4..bb02b93b86 100644 --- a/Numeric/BasisFactory.cpp +++ b/Numeric/BasisFactory.cpp @@ -71,3 +71,24 @@ const JacobianBasis* BasisFactory::getJacobianBasis(int elementType) if (J) js.insert(std::make_pair(elementType, J)); return J; } + +void BasisFactory::clearAll() +{ + std::map<int, nodalBasis*>::iterator itF = fs.begin(); + while (itF != fs.end()) { + delete itF->second; + } + fs.clear(); + + std::map<int, JacobianBasis*>::iterator itJ = js.begin(); + while (itJ != js.end()) { + delete itJ->second; + } + js.clear(); + + std::map<int, bezierBasis*>::iterator itB = bs.begin(); + while (itB != bs.end()) { + delete itB->second; + } + bs.clear(); +} diff --git a/Numeric/BasisFactory.h b/Numeric/BasisFactory.h index af4f6d7e98..61d34fd548 100644 --- a/Numeric/BasisFactory.h +++ b/Numeric/BasisFactory.h @@ -24,6 +24,8 @@ class BasisFactory static const nodalBasis* getNodalBasis(int elementType); static const bezierBasis* getBezierBasis(int elementType); static const JacobianBasis* getJacobianBasis(int elementType); + + static void clearAll(); }; #endif -- GitLab