]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
sortByIds is no more a virtual method of Edges.
authorageay <ageay>
Fri, 17 Feb 2012 11:11:20 +0000 (11:11 +0000)
committerageay <ageay>
Fri, 17 Feb 2012 11:11:20 +0000 (11:11 +0000)
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx

index 155f59070e7c4c0dec1577653e7b65f11ce90c36..ac1f191a06e118627a5f954ce7932638653db644 100644 (file)
@@ -854,3 +854,58 @@ bool Edge::isEqual(const Edge& other) const
 {
   return _start->isEqual(*other._start) && _end->isEqual(*other._end);
 }
+
+inline bool eqpair(const std::pair<double,Node *>& p1, const std::pair<double,Node *>& p2)
+{
+  return fabs(p1.first-p2.first)<QUADRATIC_PLANAR::_precision;
+}
+
+void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
+{
+  Bounds b;
+  b.prepareForAggregation();
+  b.aggregate(getBounds());
+  double xBary,yBary;
+  double dimChar=b.getCaracteristicDim();
+  b.getBarycenter(xBary,yBary);
+  for(std::vector<Node *>::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++)
+    (*iter)->applySimilarity(xBary,yBary,dimChar);
+  _start->applySimilarity(xBary,yBary,dimChar);
+  _end->applySimilarity(xBary,yBary,dimChar);
+  std::size_t sz=addNodes.size();
+  std::vector< std::pair<double,Node *> > an2(sz);
+  for(std::size_t i=0;i<sz;i++)
+    an2[i]=std::pair<double,Node *>(getCharactValue(*addNodes[i]),addNodes[i]);
+  std::sort(an2.begin(),an2.end());
+  int startId=(*mapp1.find(_start)).second;
+  int endId=(*mapp1.find(_end)).second;
+  std::vector<int> tmpp;
+  std::vector< std::pair<double,Node *> >::const_iterator itend=std::unique(an2.begin(),an2.end(),eqpair);
+  for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=itend;it++)
+    {
+      int idd=(*mapp2.find((*it).second)).second;
+      if((*it).first<QUADRATIC_PLANAR::_precision)
+        {
+          startId=idd;
+          continue;
+        }
+      if((*it).first>1-QUADRATIC_PLANAR::_precision)
+        {
+          endId=idd;
+          continue;
+        }
+      tmpp.push_back(idd);
+    }
+  std::vector<int> tmpp2(tmpp.size()+2);
+  tmpp2[0]=startId;
+  std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1);
+  tmpp2[tmpp.size()+1]=endId;
+  std::vector<int>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
+  tmpp2.resize(std::distance(tmpp2.begin(),itt));
+  int nbOfEdges=tmpp2.size()-1;
+  for(int i=0;i<nbOfEdges;i++)
+    {
+      edgesThis.push_back(tmpp2[i]);
+      edgesThis.push_back(tmpp2[i+1]);
+    }
+}
index 27f634cc979929fd39eeebe60a8c156d4b405898..9f2a1070322235c329083405bbb4f73261c63bcd 100644 (file)
@@ -259,11 +259,11 @@ namespace INTERP_KERNEL
     virtual void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const = 0;
     bool isEqual(const Edge& other) const;
   public:
+    void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis);
     virtual void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                                    std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const = 0;
     virtual void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                                     std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const = 0;
-    virtual void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis) = 0;
     virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0;
   protected:
     Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
index 9f5b846c7490640cf079923b43ecb6410bf68498..7f222096385e26a244c85f1ca33a3fdc3ce86f7a 100644 (file)
@@ -774,18 +774,3 @@ void EdgeArcCircle::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>
   _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
   _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
 }
-
-void EdgeArcCircle::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
-{
-  Bounds b;
-  b.prepareForAggregation();
-  b.aggregate(getBounds());
-  double xBary,yBary;
-  double dimChar=b.getCaracteristicDim();
-  b.getBarycenter(xBary,yBary);
-  applySimilarity(xBary,yBary,dimChar);
-  for(std::vector<Node *>::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++)
-    (*iter)->applySimilarity(xBary,yBary,dimChar);
-  _start->applySimilarity(xBary,yBary,dimChar);
-  _end->applySimilarity(xBary,yBary,dimChar);
-}
index 9657a816a0c406d041ca7e4468b66b889f73e63b..582631fe85a7ec3d203bfa3523723a18d2a56a37 100644 (file)
@@ -118,7 +118,6 @@ namespace INTERP_KERNEL
                            std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
     void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                             std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
-    void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis);
   protected:
     //!Value between -2Pi and 2Pi
     double _angle;
index 6156ce92f6828d1f2cb9f35f2642954cab860bf5..455115de8440180d458f7919d3e121490637ee9e 100644 (file)
@@ -318,58 +318,3 @@ void EdgeLin::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapT
   _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
   _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
 }
-
-inline bool eqpair(const std::pair<double,Node *>& p1, const std::pair<double,Node *>& p2)
-{
-  return fabs(p1.first-p2.first)<QUADRATIC_PLANAR::_precision;
-}
-
-void EdgeLin::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
-{
-  Bounds b;
-  b.prepareForAggregation();
-  b.aggregate(getBounds());
-  double xBary,yBary;
-  double dimChar=b.getCaracteristicDim();
-  b.getBarycenter(xBary,yBary);
-  for(std::vector<Node *>::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++)
-    (*iter)->applySimilarity(xBary,yBary,dimChar);
-  _start->applySimilarity(xBary,yBary,dimChar);
-  _end->applySimilarity(xBary,yBary,dimChar);
-  std::size_t sz=addNodes.size();
-  std::vector< std::pair<double,Node *> > an2(sz);
-  for(std::size_t i=0;i<sz;i++)
-    an2[i]=std::pair<double,Node *>(getCharactValue(*addNodes[i]),addNodes[i]);
-  std::sort(an2.begin(),an2.end());
-  int startId=(*mapp1.find(_start)).second;
-  int endId=(*mapp1.find(_end)).second;
-  std::vector<int> tmpp;
-  std::vector< std::pair<double,Node *> >::const_iterator itend=std::unique(an2.begin(),an2.end(),eqpair);
-  for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=itend;it++)
-    {
-      int idd=(*mapp2.find((*it).second)).second;
-      if((*it).first<QUADRATIC_PLANAR::_precision)
-        {
-          startId=idd;
-          continue;
-        }
-      if((*it).first>1-QUADRATIC_PLANAR::_precision)
-        {
-          endId=idd;
-          continue;
-        }
-      tmpp.push_back(idd);
-    }
-  std::vector<int> tmpp2(tmpp.size()+2);
-  tmpp2[0]=startId;
-  std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1);
-  tmpp2[tmpp.size()+1]=endId;
-  std::vector<int>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
-  tmpp2.resize(std::distance(tmpp2.begin(),itt));
-  int nbOfEdges=tmpp2.size()-1;
-  for(int i=0;i<nbOfEdges;i++)
-    {
-      edgesThis.push_back(tmpp2[i]);
-      edgesThis.push_back(tmpp2[i+1]);
-    }
-}
index 2ac39842f0b074c32c9c563a0aa0194731b76880..f75ad45fc640da4a735b6dfe0d3b57197fb1398c 100644 (file)
@@ -78,7 +78,6 @@ namespace INTERP_KERNEL
                            std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
     void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                             std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
-    void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis);
   };
 }
 
index 5618cc78ab21618651154954de0ba5070a4de3d6..696d884dab986ffcc10376ecefbce5cfa2046fdf 100644 (file)
@@ -403,14 +403,14 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
             }
           directos=(idIn1==-1);
         }
-      const std::vector<int>& subEdge=intersectEdges[edgeId];
-      std::size_t nbOfSubEdges=subEdge.size()/2;
       if(directos)
         {//no subpart of edge 'edgeId' of pol2 is in pol1 so let's operate the same thing that QuadraticPolygon::buildFromCrudeDataArray method
           appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges);
         }
       else
         {//there is subpart of edge 'edgeId' of pol2 inside pol1
+          const std::vector<int>& subEdge=intersectEdges[edgeId];
+          std::size_t nbOfSubEdges=subEdge.size()/2;
           const std::vector<int>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
           for(std::size_t j=0;j<nbOfSubEdges;j++)
             {