]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
IntersectMesh with quadratic elements
authorageay <ageay>
Tue, 14 Feb 2012 09:58:46 +0000 (09:58 +0000)
committerageay <ageay>
Tue, 14 Feb 2012 09:58:46 +0000 (09:58 +0000)
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx

index 592ee26ad24e60ca7c7099d4c1b15ecfe3b52f63..fa32b10b1e9890d0e7b2d40f1f4503581d147747 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "InterpKernelGeo2DComposedEdge.hxx"
 #include "InterpKernelGeo2DElementaryEdge.hxx"
+#include "InterpKernelGeo2DEdgeArcCircle.hxx"
 #include "InterpKernelGeo2DEdgeInfLin.hxx"
 #include "InterpKernelException.hxx"
 
@@ -116,6 +117,18 @@ bool ComposedEdge::presenceOfOn() const
   return ret;
 }
 
+bool ComposedEdge::presenceOfQuadraticEdge() const
+{
+  bool ret=false;
+  for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++)
+    {
+      Edge *e=(*iter)->getPtr();
+      if(e)
+        ret=dynamic_cast<EdgeArcCircle*>(e)!=0;
+    }
+  return ret;
+}
+
 void ComposedEdge::initLocations() const
 {
   for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
index 248f9738b2ac1bdf1ee5b1d13c5d0563e85fe761..1738b353c29b077bb6297a513ce1b11786f1a9fb 100644 (file)
@@ -47,6 +47,7 @@ namespace INTERP_KERNEL
     void reverse();
     int recursiveSize() const { return (int)_sub_edges.size(); }
     bool presenceOfOn() const;
+    bool presenceOfQuadraticEdge() const;
     void initLocations() const;
     ComposedEdge *clone() const;
     bool isNodeIn(Node *n) const;
index a844c3d3ceb54fd610da012d44fd426853070017..6ebe9a53ff655b642699351138d5f5d63c277734 100644 (file)
@@ -131,6 +131,19 @@ void Node::applySimilarity(double xBary, double yBary, double dimChar)
   _coords[1]=(_coords[1]-yBary)/dimChar;
 }
 
+/*!
+ * apply the reverse Similarity transformation on this.
+ * This method is the opposite of Node::applySimilarity method to retrieve the initial state.
+ * @param xBary is the opposite of the X translation to do.
+ * @param yBary is the opposite of the Y translation to do.
+ * @param dimChar is the reduction factor.
+ */
+void Node::unApplySimilarity(double xBary, double yBary, double dimChar)
+{
+  _coords[0]=_coords[0]*dimChar+xBary;
+  _coords[1]=_coords[1]*dimChar+yBary;
+}
+
 /*!
  * Called by QuadraticPolygon::splitAbs method.
  */
index bccab067bcb5b53b214da8fd8a21d79c1d807198..0faeb239753b1f4fedff24d59f6f10cf7a9a3d59 100644 (file)
@@ -76,6 +76,7 @@ namespace INTERP_KERNEL
     //returns an angle in -Pi;Pi
     static double computeAngle(const double *pt1, const double *pt2);
     void applySimilarity(double xBary, double yBary, double dimChar);
+    void unApplySimilarity(double xBary, double yBary, double dimChar);
     static double dot(const double *vect1, const double *vect2) { return vect1[0]*vect2[0]+vect1[1]*vect2[1]; }
     static double sign(double val) { if(val>=0) return 1.; else return -1.; }
     static double norm(const double *vect) { return sqrt(vect[0]*vect[0]+vect[1]*vect[1]); }
index 1a96efa8e85d3ac0ca245f627037805f32a7e408..e2484bc186c8411a84625e1b3f810afa04b326f8 100644 (file)
@@ -25,6 +25,8 @@
 #include "InterpKernelGeo2DBounds.hxx"
 #include "InterpKernelGeo2DEdge.txx"
 
+#include "NormalizedUnstructuredMesh.hxx"
+
 #include <fstream>
 #include <iomanip>
 #include <cstring>
@@ -295,79 +297,86 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::map<INTERP_K
 void QuadraticPolygon::buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
                                                const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
 {
-  if(!isQuad)
-    {
-      std::size_t nbOfSeg=std::distance(descBg,descEnd);
-      for(std::size_t i=0;i<nbOfSeg;i++)
-        {
-          bool direct=descBg[i]>0;
-          int edgeId=abs(descBg[i])-1;
-          const std::vector<int>& subEdge=intersectEdges[edgeId];
-          std::size_t nbOfSubEdges=subEdge.size()/2;
-          for(std::size_t j=0;j<nbOfSubEdges;j++)
-            {
-              Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
-              Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
-              ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(true,start,end);
-              pushBack(e);
-            }
-        }
-    }
-  else
+  std::size_t nbOfSeg=std::distance(descBg,descEnd);
+  for(std::size_t i=0;i<nbOfSeg;i++)
     {
-      std::size_t nbOfSeg=std::distance(descBg,descEnd);
-      for(std::size_t i=0;i<nbOfSeg;i++)
-        {
-          const double *st=coords+2*(nodalBg[i]); 
-          INTERP_KERNEL::Node *st0=new INTERP_KERNEL::Node(st[0],st[1]);
-          const double *endd=coords+2*(nodalBg[(i+1)%nbOfSeg]);
-          INTERP_KERNEL::Node *endd0=new INTERP_KERNEL::Node(endd[0],endd[1]);
-          const double *middle=coords+2*(nodalBg[i+nbOfSeg]);
-          INTERP_KERNEL::Node *middle0=new INTERP_KERNEL::Node(middle[0],middle[1]);
-          EdgeLin *e1,*e2;
-          e1=new EdgeLin(st0,middle0);
-          e2=new EdgeLin(middle0,endd0);
-          SegSegIntersector inters(*e1,*e2);
-          bool colinearity=inters.areColinears();
-          delete e1; delete e2;
-          //
-          bool direct=descBg[i]>0;
-          int edgeId=abs(descBg[i])-1;
-          const std::vector<int>& subEdge=intersectEdges[edgeId];
-          std::size_t nbOfSubEdges=subEdge.size()/2;
-          if(colinearity)
-            {   
-              for(std::size_t j=0;j<nbOfSubEdges;j++)
-                {
-                  Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
-                  Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
-                  ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(true,start,end);
-                  pushBack(e);
-                }
-            }
-          else
-            {
-              Edge *e=new EdgeArcCircle(st0,middle0,endd0,direct);
-              for(std::size_t j=0;j<nbOfSubEdges;j++)
-                {
-                  Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
-                  Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
-                  Edge *ee=e->buildEdgeLyingOnMe(start,end);
-                  ElementaryEdge *eee=new ElementaryEdge(ee,true);
-                  pushBack(eee);
-                }
-              e->decrRef();
-            }
-          st0->decrRef(); endd0->decrRef(); middle0->decrRef();
-        }
-    }
+      appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges);
+    }
+}
+
+void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
+                                                    const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
+{
+   if(!isQuad)
+     {
+       bool direct=descBg[edgePos]>0;
+       int edgeId=abs(descBg[edgePos])-1;
+       const std::vector<int>& subEdge=intersectEdges[edgeId];
+       std::size_t nbOfSubEdges=subEdge.size()/2;
+       for(std::size_t j=0;j<nbOfSubEdges;j++)
+         appendSubEdgeFromCrudeDataArray(0,j,direct,edgeId,subEdge,mapp);
+     }
+   else
+     {
+       std::size_t nbOfSeg=std::distance(descBg,descEnd);
+       const double *st=coords+2*(nodalBg[edgePos]); 
+       INTERP_KERNEL::Node *st0=new INTERP_KERNEL::Node(st[0],st[1]);
+       const double *endd=coords+2*(nodalBg[(edgePos+1)%nbOfSeg]);
+       INTERP_KERNEL::Node *endd0=new INTERP_KERNEL::Node(endd[0],endd[1]);
+       const double *middle=coords+2*(nodalBg[edgePos+nbOfSeg]);
+       INTERP_KERNEL::Node *middle0=new INTERP_KERNEL::Node(middle[0],middle[1]);
+       EdgeLin *e1,*e2;
+       e1=new EdgeLin(st0,middle0);
+       e2=new EdgeLin(middle0,endd0);
+       SegSegIntersector inters(*e1,*e2);
+       bool colinearity=inters.areColinears();
+       delete e1; delete e2;
+       //
+       bool direct=descBg[edgePos]>0;
+       int edgeId=abs(descBg[edgePos])-1;
+       const std::vector<int>& subEdge=intersectEdges[edgeId];
+       std::size_t nbOfSubEdges=subEdge.size()/2;
+       if(colinearity)
+         {   
+           for(std::size_t j=0;j<nbOfSubEdges;j++)
+             appendSubEdgeFromCrudeDataArray(0,j,direct,edgeId,subEdge,mapp);
+         }
+       else
+         {
+           Edge *e=new EdgeArcCircle(st0,middle0,endd0,direct);
+           for(std::size_t j=0;j<nbOfSubEdges;j++)
+             appendSubEdgeFromCrudeDataArray(e,j,direct,edgeId,subEdge,mapp);
+           e->decrRef();
+         }
+       st0->decrRef(); endd0->decrRef(); middle0->decrRef();
+     }
+}
+
+void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector<int>& subEdge, const std::map<int,INTERP_KERNEL::Node *>& mapp)
+{
+  std::size_t nbOfSubEdges=subEdge.size()/2;
+  if(!baseEdge)
+    {//it is not a quadratic subedge
+       Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
+       Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
+       ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(true,start,end);
+       pushBack(e);
+     }
+   else
+     {//it is a quadratic subedge
+       Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
+       Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
+       Edge *ee=baseEdge->buildEdgeLyingOnMe(start,end);
+       ElementaryEdge *eee=new ElementaryEdge(ee,true);
+       pushBack(eee);
+     }
 }
 
 /*!
  * This method builds from descending conn of a quadratic polygon stored in crude mode (MEDCoupling). Descending conn is in FORTRAN relative mode in order to give the
  * orientation of edge.
  */
-void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
+void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
                                                 const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1,
                                                 const std::vector< std::vector<int> >& colinear1)
 {
@@ -377,8 +386,8 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
       bool direct=descBg[i]>0;
       int edgeId=abs(descBg[i])-1;//current edge id of pol2
       bool directos=colinear1[edgeId].empty();
-      int idIn1=-1;
-      bool direct1;//store is needed the direction in 1
+      int idIn1=-1;//store if needed the cell id in 1
+      bool direct1;//store if needed the direction in 1
       int offset1=0;
       if(!directos)
         {// if the current edge of pol2 has one or more colinear edges part into pol1
@@ -398,13 +407,7 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
       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
-          for(std::size_t j=0;j<nbOfSubEdges;j++)
-            {
-              Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
-              Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
-              ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(true,start,end);
-              pushBack(e);
-            }
+          appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges);
         }
       else
         {//there is subpart of edge 'edgeId' of pol2 inside pol1
@@ -427,6 +430,7 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
                 }
               if(!found)
                 {//the current subedge of edge 'edgeId' of pol2 is not a part of the colinear edge 'idIn1' of pol1 -> build new Edge instance
+                  //appendEdgeFromCrudeDataArray(j,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges);
                   Node *start=(*mapp.find(idBg)).second;
                   Node *end=(*mapp.find(idEnd)).second;
                   ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(true,start,end);
@@ -444,10 +448,11 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
     }
 }
 
-void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, std::vector<int>& conn, std::vector<int>& connI)
+void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, double xBary, double yBary, double fact, int offset, std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI) const
 {
   int nbOfNodesInPg=0;
-  conn.push_back(5);
+  bool presenceOfQuadratic=presenceOfQuadraticEdge();
+  conn.push_back(presenceOfQuadratic?NORM_QPOLYG:NORM_POLYGON);
   for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
     {
       Node *tmp=0;
@@ -456,6 +461,20 @@ void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>
       conn.push_back((*it1).second);
       nbOfNodesInPg++;
     }
+  if(presenceOfQuadratic)
+    {
+      int j=0;
+      int off=offset+((int)addCoordsQuadratic.size())/2;
+      for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++)
+        {
+          INTERP_KERNEL::Node *node=(*it)->getPtr()->buildRepresentantOfMySelf();
+          node->unApplySimilarity(xBary,yBary,fact);
+          addCoordsQuadratic.push_back((*node)[0]);
+          addCoordsQuadratic.push_back((*node)[1]);
+          conn.push_back(off+j);
+          node->decrRef();
+        }
+    }
   connI.push_back(connI.back()+nbOfNodesInPg+1);
 }
 
@@ -463,16 +482,16 @@ void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>
  * This method make the hypothesis that 'this' and 'other' are splited at the minimum into edges that are fully IN, OUT or ON.
  * This method returns newly created polygons in 'conn' and 'connI' and the corresponding ids ('idThis','idOther') are stored respectively into 'nbThis' and 'nbOther'.
  */
-void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nbThis, std::vector<int>& nbOther)
+void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, int offset, std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nbThis, std::vector<int>& nbOther)
 {
   double xBaryBB, yBaryBB;
-  normalizeExt(&other, xBaryBB, yBaryBB);
+  double fact=normalizeExt(&other, xBaryBB, yBaryBB);
   //Locate 'this' relative to 'other'
   other.performLocatingOperation(*this);
   std::vector<QuadraticPolygon *> res=buildIntersectionPolygons(other,*this);
   for(std::vector<QuadraticPolygon *>::iterator it=res.begin();it!=res.end();it++)
     {
-      (*it)->appendCrudeData(mapp,conn,connI);
+      (*it)->appendCrudeData(mapp,xBaryBB,yBaryBB,fact,offset,addCoordsQuadratic,conn,connI);
       nbThis.push_back(idThis);
       nbOther.push_back(idOther);
       delete *it;
index bab62ab32b44eba4ad43d242638613bc0c0b046c..931ba1d9d46cd8a1271f17abccd407d0ef356cfb 100644 (file)
@@ -58,12 +58,16 @@ namespace INTERP_KERNEL
                   std::vector<int>& edgesThis, int cellIdThis, std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther, std::vector<double>& addCoo);
     void buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
                                  const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges);
-    void buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
+    void buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
                                   const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1,
                                   const std::vector< std::vector<int> >& colinear1);
-    void appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, std::vector<int>& conn, std::vector<int>& connI);
-    void buildPartitionsAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2);
-
+    void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
+                                      const int *descBg,  const int *descEnd, const std::vector<std::vector<int> >& intersectEdges);
+    void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector<int>& subEdge, const std::map<int,INTERP_KERNEL::Node *>& mapp);
+    void appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, double xBary, double yBary, double fact, int offset, std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI) const;
+    void buildPartitionsAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapp, int idThis, int idOther, int offset,
+                            std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2);
+    //
     double intersectWith(const QuadraticPolygon& other) const;
     double intersectWith(const QuadraticPolygon& other, double* barycenter) const;
     std::vector<QuadraticPolygon *> intersectMySelfWith(const QuadraticPolygon& other) const;
index 9a517ec518834a3b524f40a61de09af54694225c..3ac6281dee867c554709cedfcd871ff110b19cf5 100644 (file)
@@ -4824,8 +4824,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1
   std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
   MEDCouplingUMesh *m1Desc=0,*m2Desc=0;
   DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0;
-  std::vector<double> addCoo;
+  std::vector<double> addCoo,addCoordsQuadratic;
   INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
+  INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
   IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
                               m2Desc,desc2,descIndx2,revDesc2,revDescIndx2,addCoo);
   revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef();
@@ -4833,18 +4834,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> dd5(m1Desc),dd6(m2Desc);
   std::vector< std::vector<int> > intersectEdge2;
   BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2);
-  std::vector<bool> b2=m1Desc->getQuadraticStatus();
   subDiv2.clear(); dd5=0; dd6=0;
   std::vector<int> cr,crI;
   std::vector<int> cNb1,cNb2;
-  BuildIntersecting2DCellsFromEdges(eps,m1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,colinear2,m2,b2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo,
-                                    /* outputs -> */cr,crI,cNb1,cNb2);
+  BuildIntersecting2DCellsFromEdges(eps,m1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,colinear2,m2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo,
+                                    /* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2);
   //
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCooDa=DataArrayDouble::New();
   addCooDa->alloc((int)(addCoo.size())/2,2);
   std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer());
-  std::vector<const DataArrayDouble *> coordss(3);
-  coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCoordsQuadraticDa=DataArrayDouble::New();
+  addCoordsQuadraticDa->alloc((int)(addCoordsQuadratic.size())/2,2);
+  std::copy(addCoordsQuadratic.begin(),addCoordsQuadratic.end(),addCoordsQuadraticDa->getPointer());
+  std::vector<const DataArrayDouble *> coordss(4);
+  coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa;
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=DataArrayDouble::Aggregate(coordss);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Intersect2D",2);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn=DataArrayInt::New(); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer());
@@ -4861,9 +4864,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1
 
 void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1,
                                                          const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
-                                                         const MEDCouplingUMesh *m2, const std::vector<bool>& b2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
+                                                         const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
                                                          const std::vector<double>& addCoords,
-                                                         std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2)
+                                                         std::vector<double>& addCoordsQuadratic, std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2)
 {
   static const int SPACEDIM=2;
   std::vector<double> bbox1,bbox2;
@@ -4872,7 +4875,10 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
   const int *connI1=m1->getNodalConnectivityIndex()->getConstPointer();
   int offset1=m1->getNumberOfNodes();
   const double *coo2=m2->getCoords()->getConstPointer();
+  const int *conn2=m2->getNodalConnectivity()->getConstPointer();
+  const int *connI2=m2->getNodalConnectivityIndex()->getConstPointer();
   int offset2=offset1+m2->getNumberOfNodes();
+  int offset3=offset2+((int)addCoords.size())/2;
   m1->getBoundingBoxForBBTree(bbox1);
   m2->getBoundingBoxForBBTree(bbox2);
   BBTree<SPACEDIM,int> myTree(&bbox2[0],0,0,m2->getNumberOfCells(),eps);
@@ -4897,10 +4903,12 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
           INTERP_KERNEL::QuadraticPolygon pol2;
           pol1.initLocations();
           MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev);
-          pol2.buildFromCrudeDataArray2(mappRev,b2[i],desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,
+          INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
+          const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2);
+          pol2.buildFromCrudeDataArray2(mappRev,cm2.isQuadratic(),conn2+connI2[*it2]+1,coo2,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,
                                         pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2);
           //MEDCouplingUMeshAssignOnLoc(pol1,pol2,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,colinear2);
-          pol1.buildPartitionsAbs(pol2,mapp,i,*it2,cr,crI,cNb1,cNb2);
+          pol1.buildPartitionsAbs(pol2,mapp,i,*it2,offset3,addCoordsQuadratic,cr,crI,cNb1,cNb2);
         }
       if(!crTmp.empty())
         {
index dc84121d8328d0bab0c1f4c60a7492cd2a2057f7..611f7bb149a566425d0af7d8cec2ef246ebca13f 100644 (file)
@@ -221,9 +221,9 @@ namespace ParaMEDMEM
                                             std::vector<double>& addCoo) throw(INTERP_KERNEL::Exception);
     static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge) throw(INTERP_KERNEL::Exception);
     static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
-                                                  const MEDCouplingUMesh *m2, const std::vector<bool>& b2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
+                                                  const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
                                                   const std::vector<double>& addCoords,
-                                                  std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2);
+                                                  std::vector<double>& addCoordsQuadratic, std::vector<int>& cr, std::vector<int>& crI, std::vector<int>& cNb1, std::vector<int>& cNb2);
     static void BuildUnionOf2DMesh(const std::vector<int>& conn2D, const std::vector<int>& connI2D, std::vector<int>& polyUnion);
 /// @endcond
   private: