]> SALOME platform Git repositories - tools/solverlab.git/commitdiff
Salome HOME
Avoid duplication in group name list
authormichael <michael@is242589.intra.cea.fr>
Fri, 10 Dec 2021 13:21:31 +0000 (14:21 +0100)
committermichael <michael@is242589.intra.cea.fr>
Fri, 10 Dec 2021 13:21:31 +0000 (14:21 +0100)
CDMATH/mesh/src/Face.cxx [changed mode: 0644->0755]
CDMATH/mesh/src/Node.cxx [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 64946d8..003a76e
@@ -8,7 +8,7 @@
 #include "Face.hxx"
 #include "CdmathException.hxx"
 
-#include <cmath>
+#include <algorithm> 
 
 using namespace std;
 
@@ -121,8 +121,13 @@ Face::getGroupName(int igroup) const
 void
 Face::setGroupName(const string groupName)
 {
-       _groupNames.insert(_groupNames.begin(),groupName);
-       _region=0;
+       if(std::find(_groupNames.begin(), _groupNames.end(), groupName) == _groupNames.end())//No group named groupName
+       {
+               _groupNames.insert(_groupNames.begin(),groupName);
+               _region=0;
+       }
+       else
+               cout<<"Warning Face::setGroupName, group name "<< groupName <<" is already present. No duplication"<<endl;
 }
 
 bool
old mode 100644 (file)
new mode 100755 (executable)
index ab5b8e1..847213a
@@ -161,8 +161,13 @@ Node::getGroupName(int igroup) const
 void
 Node::setGroupName(const std::string groupName)
 {
-       _groupNames.insert(_groupNames.begin(),groupName);
-       _region=0;
+       if(std::find(_groupNames.begin(), _groupNames.end(), groupName) == _groupNames.end())//No group named groupName
+       {
+               _groupNames.insert(_groupNames.begin(),groupName);
+               _region=0;
+       }
+       else
+               std::cout<<"Warning Node::setGroupName, group name "<< groupName <<" is already present. No duplication"<<std::endl;
 }
 
 bool