From: ageay Date: Tue, 14 Feb 2012 13:23:19 +0000 (+0000) Subject: IntersectMesh with quadratic elements X-Git-Tag: V6_main_FINAL~865 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1870a4a7d78c4ee29fbcd259497dd2ae7d5bd5a6;p=tools%2Fmedcoupling.git IntersectMesh with quadratic elements --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx index 5b90a0680..64dd24818 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx @@ -74,6 +74,17 @@ void Bounds::applySimilarity(double xBary, double yBary, double dimChar) _y_max=(_y_max-yBary)/dimChar; } +/*! + * See Node::unApplySimilarity to see signification of params. + */ +void Bounds::unApplySimilarity(double xBary, double yBary, double dimChar) +{ + _x_min=_x_min*dimChar+xBary; + _x_max=_x_max*dimChar+xBary; + _y_min=_y_min*dimChar+yBary; + _y_max=_y_max*dimChar+yBary; +} + void Bounds::getBarycenter(double& xBary, double& yBary) const { xBary=(_x_min+_x_max)/2.; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx index c859ddeb7..8bd084a88 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.hxx @@ -46,6 +46,7 @@ namespace INTERP_KERNEL double getDiagonal() const; void getBarycenter(double& xBary, double& yBary) const; void applySimilarity(double xBary, double yBary, double dimChar); + void unApplySimilarity(double xBary, double yBary, double dimChar); Bounds& operator=(const Bounds& other) { _x_min=other._x_min; _x_max=other._x_max; _y_min=other._y_min; _y_max=other._y_max; return *this; } Bounds(double xMin, double xMax, double yMin, double yMax):_x_min(xMin),_x_max(xMax),_y_min(yMin),_y_max(yMax) { } void setValues(double xMin, double xMax, double yMin, double yMax) { _x_min=xMin; _x_max=xMax; _y_min=yMin; _y_max=yMax; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx index fa32b10b1..b960f0aa0 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx @@ -243,6 +243,20 @@ double ComposedEdge::normalize(ComposedEdge *other, double& xBary, double& yBary return dimChar; } +/*! + * This method operates the opposite operation than ComposedEdge::applyGlobalSimilarity. + */ +void ComposedEdge::unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary, double yBary, double fact) +{ + std::set allNodes; + getAllNodes(allNodes); + other.getAllNodes(allNodes); + for(std::set::iterator iter=allNodes.begin();iter!=allNodes.end();iter++) + (*iter)->unApplySimilarity(xBary,yBary,fact); + for(std::list::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + (*iter)->unApplySimilarity(xBary,yBary,fact); +} + double ComposedEdge::normalizeExt(ComposedEdge *other, double& xBary, double& yBary) { Bounds b; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx index 1738b353c..084238793 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx @@ -58,6 +58,7 @@ namespace INTERP_KERNEL void getBarycenterGeneral(double *bary) const; double normalize(ComposedEdge *other, double& xBary, double& yBary); double normalizeExt(ComposedEdge *other, double& xBary, double& yBary); + void unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary, double yBary, double fact); void fillBounds(Bounds& output) const; void applySimilarity(double xBary, double yBary, double dimChar); void applyGlobalSimilarity(double xBary, double yBary, double dimChar); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index e3178aef5..155f59070 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -671,6 +671,11 @@ void Edge::applySimilarity(double xBary, double yBary, double dimChar) _bounds.applySimilarity(xBary,yBary,dimChar); } +void Edge::unApplySimilarity(double xBary, double yBary, double dimChar) +{ + _bounds.unApplySimilarity(xBary,yBary,dimChar); +} + bool Edge::Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersector, const Bounds *whereToFind, MergePoints& commonNode, ComposedEdge& outValForF1, ComposedEdge& outValForF2) { diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index cdd81b2c2..27f634cc9 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -229,6 +229,8 @@ namespace INTERP_KERNEL virtual double getAreaOfZone() const = 0; //! apply a similiraty transformation on 'this' virtual void applySimilarity(double xBary, double yBary, double dimChar); + //! apply the inverse similiraty transformation on 'this' + virtual void unApplySimilarity(double xBary, double yBary, double dimChar); //! return the length of arc. Value is always > 0. ! virtual double getCurveLength() const = 0; virtual void getBarycenter(double *bary) const = 0; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index 640f5b122..9cadd5ea1 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -435,6 +435,14 @@ void EdgeArcCircle::applySimilarity(double xBary, double yBary, double dimChar) _center[1]=(_center[1]-yBary)/dimChar; } +void EdgeArcCircle::unApplySimilarity(double xBary, double yBary, double dimChar) +{ + Edge::applySimilarity(xBary,yBary,dimChar); + _radius*=dimChar; + _center[0]=_center[0]*dimChar+xBary; + _center[1]=_center[1]*dimChar+yBary; +} + /*! * Given an \b NON normalized vector 'vect', returns its norm 'normVect' and its * angle in ]-Pi,Pi] relative to Ox axe. diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx index 7d546f15e..fb2efdc41 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx @@ -91,6 +91,7 @@ namespace INTERP_KERNEL void getCenter(double *center) const { center[0]=_center[0]; center[1]=_center[1]; } bool doIHaveSameDirectionAs(const Edge& other) const { return false; } void applySimilarity(double xBary, double yBary, double dimChar); + void unApplySimilarity(double xBary, double yBary, double dimChar); double getAngle0() const { return _angle0; } double getRadius() const { return _radius; } double getAngle() const { return _angle; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index 4547917be..7a2cf1f23 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -47,6 +47,7 @@ namespace INTERP_KERNEL void getBarycenterOfZone(double *bary) const; void fillBounds(Bounds& output) const; void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); } + void unApplySimilarity(double xBary, double yBary, double dimChar) { _ptr->unApplySimilarity(xBary,yBary,dimChar); } void getAllNodes(std::set& output) const; void getBarycenter(double *bary, double& weigh) const; ElementaryEdge *clone() const; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index e2484bc18..d98427222 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -343,7 +343,7 @@ void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const s } else { - Edge *e=new EdgeArcCircle(st0,middle0,endd0,direct); + Edge *e=new EdgeArcCircle(st0,middle0,endd0,true); for(std::size_t j=0;jdecrRef(); @@ -496,6 +496,7 @@ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, const std::ma nbOther.push_back(idOther); delete *it; } + unApplyGlobalSimilarityExt(other,xBaryBB,yBaryBB,fact); } /*!