From 766712de8979f9149507179e1a05184ff250bc24 Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Thu, 20 Nov 2014 19:33:45 +0000 Subject: [PATCH] FunctionSpace is able to remove keys --- FunctionSpace/FunctionSpace.cpp | 25 +++++++++++++++++++++++++ FunctionSpace/FunctionSpace.h | 11 ++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp index eab464d147..5e3aa76178 100644 --- a/FunctionSpace/FunctionSpace.cpp +++ b/FunctionSpace/FunctionSpace.cpp @@ -260,3 +260,28 @@ FunctionSpace::getKeys(const GroupOfElement& goe) const{ // Return vector // return it->second; } + +void FunctionSpace::delKeys(const GroupOfElement& goe, + std::set<Dof>& dof) const{ + // Get Dofs // + const vector<vector<Dof> >& allDofs = getKeys(goe); + + // Remove them from map // + const size_t size = allDofs.size(); + + set<Dof>::iterator end; + set<Dof>::iterator it; + size_t nDof; + + for(size_t i = 0; i < size; i++){ + nDof = allDofs[i].size(); + + for(size_t j = 0; j < nDof; j++){ + end = dof.end(); + it = dof.find(allDofs[i][j]); + + if(it != end) + dof.erase(it); + } + } +} diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index c7a42b7de3..442bcb17aa 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -72,6 +72,8 @@ class FunctionSpace{ void getKeys(const GroupOfElement& goe, std::set<Dof>& dof) const; const std::vector<std::vector<Dof> >& getKeys(const GroupOfElement& goe)const; + void delKeys(const GroupOfElement& goe, std::set<Dof>& dof) const; + protected: FunctionSpace(void); void build(const GroupOfElement& goe, std::string family); @@ -136,8 +138,15 @@ class FunctionSpace{ @param goe A GroupOfElement @return Returns a vector of vector of Dof such that: dof[i][j] is the jth Dof of the ith element of the given GroupOfElement -*/ + ** + + @fn void FunctionSpace::delKeys(const GroupOfElement&, std::set<Dof>&) const + @param goe A GroupOfElement + @param dof A set of Dof%s + Removes from the given set the Dof%s associated to the MElement%s + of the given GroupOfElement +*/ ////////////////////// // Inline Functions // -- GitLab