From 35135d83f56b3e9ebca751e4299f61e2d38c5438 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 5 Dec 2011 10:46:32 +0000 Subject: [PATCH] Merge from V6_4_BR 05/12/2011 --- src/INTERP_KERNEL/CellModel.cxx | 16 +++++--- .../Geometric2D/InterpKernelGeo2DEdge.hxx | 2 +- .../InterpKernelGeo2DEdgeArcCircle.cxx | 2 +- .../InterpKernelGeo2DEdgeArcCircle.hxx | 2 +- .../Geometric2D/InterpKernelGeo2DEdgeLin.cxx | 2 +- .../Geometric2D/InterpKernelGeo2DEdgeLin.hxx | 2 +- .../InterpKernelGeo2DElementaryEdge.cxx | 2 +- .../InterpKernelGeo2DElementaryEdge.hxx | 2 +- .../Geometric2D/InterpKernelGeo2DNode.cxx | 7 ++-- .../Geometric2D/InterpKernelGeo2DNode.hxx | 4 +- .../InterpKernelGeo2DQuadraticPolygon.cxx | 33 +++++++--------- src/INTERP_KERNEL/Interpolation3D2D.hxx | 3 +- src/INTERP_KERNEL/SplitterTetra.hxx | 20 +++++----- src/INTERP_KERNEL/SplitterTetra.txx | 2 +- src/MEDCoupling/MEDCouplingMemArray.hxx | 8 ++-- src/MEDCoupling/MEDCouplingUMesh.cxx | 39 ++++++++++--------- src/MEDCoupling/MEDCouplingUMesh.hxx | 10 ++--- src/MEDLoader/MEDFileField.hxx | 28 ++++++------- src/MEDLoader/MEDFileMesh.cxx | 18 ++++++++- src/MEDLoader/SauvReader.cxx | 37 ++++++++---------- src/MEDLoader/SauvUtilities.hxx | 6 +-- src/MEDLoader/Test/SauvLoaderTest.cxx | 4 +- 22 files changed, 131 insertions(+), 118 deletions(-) diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index d3681de82..da006cbb6 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -421,8 +421,12 @@ namespace INTERP_KERNEL std::vector tmp(2*lgth); std::vector::iterator it=std::copy(conn1,conn1+lgth,tmp.begin()); std::copy(conn1,conn1+lgth,it); - it=std::find_first_of(tmp.begin(),tmp.end(),conn2,conn2+lgth); - return it!=tmp.end(); + it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); + if(it==tmp.begin()) + return true; + if(it!=tmp.end()) + return false; + throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : Request of orientation status of non equal connectively cells !"); } else { @@ -431,13 +435,13 @@ namespace INTERP_KERNEL std::vector tmp(lgth); std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); std::copy(conn1,conn1+lgth/2,it); - it=std::find_first_of(tmp.begin(),tmp.end(),conn2,conn2+lgth/2); + it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2); int d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin()); std::copy(conn1+lgth/2,conn1+lgth,it); - it=std::find_first_of(tmp.begin(),tmp.end(),conn2,conn2+lgth); + it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.end()) return false; int d2=std::distance(tmp.begin(),it); @@ -449,14 +453,14 @@ namespace INTERP_KERNEL std::vector tmp(2*p); std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); std::copy(conn1,conn1+p,it); - it=std::find_first_of(tmp.begin(),tmp.end(),conn2,conn2+p); + it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p); int d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; tmp.resize(2*p-2); it=std::copy(conn1+p,conn1+lgth,tmp.begin()); std::copy(conn1+p,conn1+lgth,it); - it=std::find_first_of(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); + it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); if(it==tmp.end()) return false; int d2=std::distance(tmp.begin(),it); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index 0c539f596..16c7c5e79 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -260,7 +260,7 @@ namespace INTERP_KERNEL virtual void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const = 0; virtual void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const = 0; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const = 0; virtual void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) = 0; protected: Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index fc978933b..06e2d053b 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -714,7 +714,7 @@ void EdgeArcCircle::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx index 5d2e80f5f..e7397c71a 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx @@ -114,7 +114,7 @@ namespace INTERP_KERNEL void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); protected: //!Value between -2Pi and 2Pi diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx index e31aa3cc5..0b883b3b8 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx @@ -313,7 +313,7 @@ void EdgeLin::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx index 1c7e901dd..715ac0328 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx @@ -77,7 +77,7 @@ namespace INTERP_KERNEL void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); }; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx index ff5a98a4f..0294997f2 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx @@ -215,7 +215,7 @@ void ElementaryEdge::fillGlobalInfoAbs(const std::map * unsorted because the "other" mesh is not subdivided yet. */ void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { _ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesOther,addCoo,mapAddCoo); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index 5a23a6d96..7c0fb77dc 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -69,7 +69,7 @@ namespace INTERP_KERNEL void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesOther, std::vector& addCoo, std::map mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; static ElementaryEdge *BuildEdgeFromCrudeDataArray(bool isQuad, bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end); private: bool _direction; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index 7e336ade2..a62faf266 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -135,7 +135,7 @@ void Node::applySimilarity(double xBary, double yBary, double dimChar) * Called by QuadraticPolygon::splitAbs method. */ void Node::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map mapAddCoo, int *nodeId) const + std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const { std::map::const_iterator it=mapThis.find(const_cast(this)); if(it!=mapThis.end()) @@ -157,7 +157,8 @@ void Node::fillGlobalInfoAbs(const std::map& mapThis, } int id=addCoo.size()/2; addCoo.push_back(fact*_coords[0]+baryX); - addCoo.push_back(fact*_coords[0]+baryX); + addCoo.push_back(fact*_coords[1]+baryY); + *nodeId=offset2+id; mapAddCoo[const_cast(this)]=offset2+id; } @@ -165,7 +166,7 @@ void Node::fillGlobalInfoAbs(const std::map& mapThis, * Called by QuadraticPolygon::splitAbs method. */ void Node::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map mapAddCoo, std::vector& pointsOther) const + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const { int tmp; std::size_t sz1=addCoo.size(); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx index c8ed49e8b..f7585596c 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx @@ -86,9 +86,9 @@ namespace INTERP_KERNEL static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); } // void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map mapAddCoo, int *nodeId) const; + std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map mapAddCoo, std::vector& pointsOther) const; + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const; protected: ~Node(); protected: diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 845e9fc5d..9dd449755 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -235,7 +235,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::mapgetPtr(),curE3->getDirection())); curE3->getPtr()->incrRef(); IteratorOnComposedEdge it2(&otherTmp); - for(it2.first();it2.finished();it2.next()) + for(it2.first();!it2.finished();it2.next()) { ElementaryEdge* curE2=it2.current(); if(!curE2->isThereStartPoint()) @@ -297,12 +297,12 @@ void QuadraticPolygon::buildFromCrudeDataArray(const std::map0; int edgeId=abs(descBg[i])-1; const std::vector& subEdge=intersectEdges[edgeId]; - int nbOfSubEdges=subEdge.size()-1; + int nbOfSubEdges=subEdge.size()/2; for(int j=0;j& mapp, std::vector& conn, std::vector& connI) { - int nbOfNodesInPg=0,i=0; - for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,i++) + int nbOfNodesInPg=0; + conn.push_back(5); + for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++) { Node *tmp=0; - if(i==0) - { - tmp=(*it)->getStartNode(); - std::map::const_iterator it=mapp.find(tmp); - conn.push_back((*it).second); - nbOfNodesInPg++; - } - tmp=(*it)->getEndNode(); - std::map::const_iterator it=mapp.find(tmp); - conn.push_back((*it).second); + tmp=(*it)->getStartNode(); + std::map::const_iterator it1=mapp.find(tmp); + conn.push_back((*it1).second); nbOfNodesInPg++; } - connI.push_back(connI.back()+nbOfNodesInPg); + connI.push_back(connI.back()+nbOfNodesInPg+1); } /*! @@ -339,8 +333,7 @@ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, const std::ma normalizeExt(&other, xBaryBB, yBaryBB); //Locate 'this' relative to 'other' other.performLocatingOperation(*this); - dumpInXfigFileWithOther(other,"tony.fig"); - std::vector res=other.buildIntersectionPolygons(*this,other); + std::vector res=buildIntersectionPolygons(other,*this); for(std::vector::iterator it=res.begin();it!=res.end();it++) { (*it)->appendCrudeData(mapp,conn,connI); diff --git a/src/INTERP_KERNEL/Interpolation3D2D.hxx b/src/INTERP_KERNEL/Interpolation3D2D.hxx index aebe27d77..f4fc8997b 100644 --- a/src/INTERP_KERNEL/Interpolation3D2D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D2D.hxx @@ -23,6 +23,7 @@ #include #include +#include "INTERPKERNELDefines.hxx" #include "Interpolation.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" @@ -38,7 +39,7 @@ namespace INTERP_KERNEL * more than one 3D target cell, and the value of '_duplicate_faces' * the 3D target cells. The size of the value of '_duplicate_faces' is more than or equal to 2. */ - class Interpolation3D2D : public Interpolation + class INTERPKERNEL_EXPORT Interpolation3D2D : public Interpolation { public: typedef std::map > DuplicateFacesType; diff --git a/src/INTERP_KERNEL/SplitterTetra.hxx b/src/INTERP_KERNEL/SplitterTetra.hxx index 893d8c3c2..808520cc2 100644 --- a/src/INTERP_KERNEL/SplitterTetra.hxx +++ b/src/INTERP_KERNEL/SplitterTetra.hxx @@ -219,7 +219,7 @@ namespace INTERP_KERNEL private: // member functions inline void createAffineTransform(const double** corners); - inline void checkIsOutside(const double* pt, bool* isOutside) const; + inline void checkIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL) const; inline void checkIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL) const; inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum); inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node); @@ -286,16 +286,16 @@ namespace INTERP_KERNEL * @param isOutside bool[8] which indicate the results of earlier checks. */ template - inline void SplitterTetra::checkIsOutside(const double* pt, bool* isOutside) const + inline void SplitterTetra::checkIsOutside(const double* pt, bool* isOutside, const double errTol) const { - isOutside[0] = isOutside[0] && (pt[0] <= 0.0); - isOutside[1] = isOutside[1] && (pt[0] >= 1.0); - isOutside[2] = isOutside[2] && (pt[1] <= 0.0); - isOutside[3] = isOutside[3] && (pt[1] >= 1.0); - isOutside[4] = isOutside[4] && (pt[2] <= 0.0); - isOutside[5] = isOutside[5] && (pt[2] >= 1.0); - isOutside[6] = isOutside[6] && (1.0 - pt[0] - pt[1] - pt[2] <= 0.0); - isOutside[7] = isOutside[7] && (1.0 - pt[0] - pt[1] - pt[2] >= 1.0); + isOutside[0] = isOutside[0] && (pt[0] < errTol); + isOutside[1] = isOutside[1] && (pt[0] > (1.0-errTol) ); + isOutside[2] = isOutside[2] && (pt[1] < errTol); + isOutside[3] = isOutside[3] && (pt[1] > (1.0-errTol)); + isOutside[4] = isOutside[4] && (pt[2] < errTol); + isOutside[5] = isOutside[5] && (pt[2] > (1.0-errTol)); + isOutside[6] = isOutside[6] && (1.0 - pt[0] - pt[1] - pt[2] < errTol); + isOutside[7] = isOutside[7] && (1.0 - pt[0] - pt[1] - pt[2] > (1.0-errTol) ); } template diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 956242740..f11b49b95 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -636,7 +636,7 @@ namespace INTERP_KERNEL } checkIsStrictlyOutside(_nodes[globalNodeNum], isStrictlyOutside, precision); - checkIsOutside(_nodes[globalNodeNum], isOutside); + checkIsOutside(_nodes[globalNodeNum], isOutside, precision); } // halfspace filtering check diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 7af85fbd8..d93191e93 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -260,7 +260,7 @@ namespace ParaMEDMEM class DataArrayDoubleTuple; - class DataArrayDoubleIterator + class MEDCOUPLING_EXPORT DataArrayDoubleIterator { public: DataArrayDoubleIterator(DataArrayDouble *da); @@ -273,7 +273,7 @@ namespace ParaMEDMEM int _nb_tuple; }; - class DataArrayDoubleTuple + class MEDCOUPLING_EXPORT DataArrayDoubleTuple { public: DataArrayDoubleTuple(DataArrayDouble *da); @@ -423,7 +423,7 @@ namespace ParaMEDMEM class DataArrayIntTuple; - class DataArrayIntIterator + class MEDCOUPLING_EXPORT DataArrayIntIterator { public: DataArrayIntIterator(DataArrayInt *da); @@ -436,7 +436,7 @@ namespace ParaMEDMEM int _nb_tuple; }; - class DataArrayIntTuple + class MEDCOUPLING_EXPORT DataArrayIntTuple { public: DataArrayIntTuple(DataArrayInt *da); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 907ef66b3..eab8240ce 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -551,7 +551,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayInt *de */ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception) { - return buildDescendingConnectivityGen(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer); + return buildDescendingConnectivityGen(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer); } /// @cond INTERNAL @@ -2575,18 +2575,21 @@ namespace ParaMEDMEM int eltId2=abs(*desc2)-1; for(std::vector::const_iterator it2=intesctEdges2[eltId2].begin();it2!=intesctEdges2[eltId2].end();it2++) { - std::map::const_iterator it=mappRev.find(*it2); + int curNodeId2=*it2; + std::map::const_iterator it=mappRev.find(curNodeId2); if(it==mappRev.end()) { - INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it2,coo1,offset1,coo2,offset2,addCoo); - mapp[node]=*it2; - mappRev[*it2]=node; + INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(curNodeId2,coo1,offset1,coo2,offset2,addCoo); + mapp[node]=curNodeId2; + mappRev[curNodeId2]=node; } } } // pol1.buildFromCrudeDataArray(mappRev,isQuad1,desc1Bg,desc1End,intesctEdges1); pol2.buildFromCrudeDataArray(mappRev,isQuad2,desc2Bg,desc2End,intesctEdges2); + for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) + (*it).second->decrRef(); } } @@ -4777,7 +4780,6 @@ std::string MEDCouplingUMesh::getVTKDataSetType() const throw(INTERP_KERNEL::Exc MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2) throw(INTERP_KERNEL::Exception) { - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes : functionnality not finished yet ! Will come soon !"); std::vector< std::vector > intersectEdge1, subDiv2; MEDCouplingUMesh *m1Desc=0,*m2Desc=0; DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0; @@ -4795,8 +4797,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 std::vector cNb1,cNb2; BuildIntersecting2DCellsFromEdges(eps,m1,b1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,m2,b2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo, /* outputs -> */cr,crI,cNb1,cNb2); -#if 0 - //tony + // MEDCouplingAutoRefCountObjectPtr addCooDa=DataArrayDouble::New(); addCooDa->alloc(addCoo.size()/2,2); std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer()); @@ -4810,11 +4811,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 MEDCouplingAutoRefCountObjectPtr c2=DataArrayInt::New(); c2->alloc(cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); cellNb2=c2; ret->setConnectivity(conn,connI,true); ret->setCoords(coo); - ret->incrRef(); c1->incrRef(); c2->incrRef(); + ret->incrRef(); c1->incrRef(); c2->incrRef(); desc1->decrRef(); descIndx1->decrRef(); desc2->decrRef(); descIndx2->decrRef(); return ret; -#endif - desc1->decrRef(); descIndx1->decrRef(); desc2->decrRef(); descIndx2->decrRef(); - return 0; } /// @endcond @@ -4867,6 +4865,8 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c desc2=DataArrayInt::New(); descIndx2=DataArrayInt::New(); revDesc2=DataArrayInt::New(); revDescIndx2=DataArrayInt::New(); m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1); m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2); + const int *c1=m1Desc->getNodalConnectivity()->getConstPointer(); + const int *ci1=m1Desc->getNodalConnectivityIndex()->getConstPointer(); std::vector bbox1,bbox2; m1Desc->getBoundingBoxForBBTree(bbox1); m2Desc->getBoundingBoxForBBTree(bbox2); @@ -4886,11 +4886,14 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c { std::map map1,map2; INTERP_KERNEL::QuadraticPolygon *pol2=MEDCouplingUMeshBuildQPFromMesh(m2Desc,candidates2,map2); + candidates1[0]=i; INTERP_KERNEL::QuadraticPolygon *pol1=MEDCouplingUMeshBuildQPFromMesh(m1Desc,candidates1,map1); pol1->splitAbs(*pol2,map1,map2,offset1,offset2,candidates2,intersectEdge1[i],subDiv2,addCoo); delete pol2; delete pol1; } + else + intersectEdge1[i].insert(intersectEdge1[i].end(),c1+ci1[i]+1,c1+ci1[i+1]); } } @@ -4899,7 +4902,7 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c * This method has 4 inputs : * - a mesh 'm1' with meshDim==1 and a SpaceDim==2 * - a mesh 'm2' with meshDim==1 and a SpaceDim==2 - * - subDiv of size 'm->getNumberOfCells()' that lists for each seg cell in 'm' the splitting node ids in randomly sorted. + * - subDiv of size 'm2->getNumberOfCells()' that lists for each seg cell in 'm' the splitting node ids in randomly sorted. * The aim of this method is to sort the splitting nodes, if any, and to put in 'intersectEdge' output paramter based on edges of mesh 'm2' * @param m1 is expected to be a mesh of meshDimension equal to 1 and spaceDim equal to 2. No check of that is performed by this method. Only present for its coords in case of 'subDiv' shares some nodes of 'm1' * @param m2 is expected to be a mesh of meshDimension equal to 1 and spaceDim equal to 2. No check of that is performed by this method. @@ -4907,13 +4910,13 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c */ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) throw(INTERP_KERNEL::Exception) { - int offset1=m1->getNumberOfCells(); + int offset1=m1->getNumberOfNodes(); int ncell=m2->getNumberOfCells(); const int *c=m2->getNodalConnectivity()->getConstPointer(); const int *cI=m2->getNodalConnectivityIndex()->getConstPointer(); const double *coo=m2->getCoords()->getConstPointer(); const double *cooBis=m1->getCoords()->getConstPointer(); - int offset2=offset1+ncell; + int offset2=offset1+m2->getNumberOfNodes(); intersectEdge.resize(ncell); for(int i=0;i::const_iterator it=mapp2.begin();it!=mapp2.end();it++) (*it).second->decrRef(); std::vector addNodes(divs.size()); std::map mapp3; - for(std::size_t j=0;j& refCoo, const std::vector& gsCoo, const std::vector& w); - int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } - void writeLL(med_idt fid) const; - std::string repr() const; - bool isName(const char *name) const { return _name==name; } - int getDimension() const { return _dim; } - int getNumberOfGaussPoints() const { return _nb_gauss_pt; } - int getNumberOfPointsInCells() const { return _nb_node_per_cell; } - const std::vector& getRefCoords() const { return _ref_coo; } - const std::vector& getGaussCoords() const { return _gs_coo; } - const std::vector& getGaussWeights() const { return _w; } - bool isEqual(const MEDFileFieldLoc& other, double eps) const; + int MEDLOADER_EXPORT getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } + void MEDLOADER_EXPORT writeLL(med_idt fid) const; + std::string MEDLOADER_EXPORT repr() const; + bool MEDLOADER_EXPORT isName(const char *name) const { return _name==name; } + int MEDLOADER_EXPORT getDimension() const { return _dim; } + int MEDLOADER_EXPORT getNumberOfGaussPoints() const { return _nb_gauss_pt; } + int MEDLOADER_EXPORT getNumberOfPointsInCells() const { return _nb_node_per_cell; } + const MEDLOADER_EXPORT std::vector& getRefCoords() const { return _ref_coo; } + const MEDLOADER_EXPORT std::vector& getGaussCoords() const { return _gs_coo; } + const MEDLOADER_EXPORT std::vector& getGaussWeights() const { return _w; } + bool MEDLOADER_EXPORT isEqual(const MEDFileFieldLoc& other, double eps) const; private: MEDFileFieldLoc(med_idt fid, const char *locName); MEDFileFieldLoc(med_idt fid, int id); diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 42287be6c..dbef046d0 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -362,6 +362,13 @@ void MEDFileMesh::removeFamily(const char *name) throw(INTERP_KERNEL::Exception) throw INTERP_KERNEL::Exception(oss.str().c_str()); } _families.erase(it); + for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) + { + std::vector& v=(*it3).second; + std::vector::iterator it4=std::find(v.begin(),v.end(),oname); + if(it4!=v.end()) + v.erase(it4); + } } void MEDFileMesh::changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception) @@ -413,8 +420,8 @@ void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName) thr throw INTERP_KERNEL::Exception(oss.str().c_str()); } std::string nname(newName); - it=_families.find(nname); - if(it!=_families.end()) + std::map::iterator it2=_families.find(nname); + if(it2!=_families.end()) { std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -422,6 +429,13 @@ void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName) thr int cpy=(*it).second; _families.erase(it); _families[newName]=cpy; + for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) + { + std::vector& v=(*it3).second; + std::vector::iterator it4=std::find(v.begin(),v.end(),oname); + if(it4!=v.end()) + (*it4)=nname; + } } bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) const diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index f9e150a43..c3f41d87d 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -125,23 +125,17 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS() throw(INTERP_KERNEL::Exc recordNumber = getInt(); // read the record - switch ( recordNumber ) - { - case 2: - readRecord2(); - break; - case 4: - readRecord4(); - break; - case 7: - readRecord7(); - break; - case 5: - break; - default: - if ( !isASCII() ) - THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); - } + if ( recordNumber == 2 ) + readRecord2(); + else if (recordNumber == 4 ) + readRecord4(); + else if (recordNumber == 7 ) + readRecord7(); + else if (recordNumber == 5 ) + break; // stop reading + else + if ( !isASCII() ) + THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); } ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS(); @@ -245,9 +239,10 @@ int SauvReader::readPileNumber(int& nbNamedObjects, int& nbObjects) THROW_IK_EXCEPTION("Invalid nb of named objects: " << nbNamedObjects << lineNb() ); if ( nbObjects<0) THROW_IK_EXCEPTION("Invalid nb of objects: " << nbObjects << lineNb() ); - if ( nbObjects_nbNodes*(_iMed->_spaceDim+1)) ) - THROW_IK_EXCEPTION("Erroor of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() ); + THROW_IK_EXCEPTION("Error of reading PILE NUMERO " << PILE_COORDONNEES << lineNb() ); // there are coordinates + density for each node _iMed->_coords.resize( nbReals - nbReals/(_iMed->_spaceDim+1)); diff --git a/src/MEDLoader/SauvUtilities.hxx b/src/MEDLoader/SauvUtilities.hxx index c286f27f7..19c822f77 100644 --- a/src/MEDLoader/SauvUtilities.hxx +++ b/src/MEDLoader/SauvUtilities.hxx @@ -39,9 +39,9 @@ namespace SauvUtilities { INTERP_KERNEL::NormalizedCellType MEDLOADER_EXPORT gibi2medGeom( size_t gibiType ); - int MEDLOADER_EXPORT med2gibiGeom( INTERP_KERNEL::NormalizedCellType medGeomType ); - const int * MEDLOADER_EXPORT getGibi2MedQuadraticInterlace( INTERP_KERNEL::NormalizedCellType type ); - unsigned MEDLOADER_EXPORT getDimension( INTERP_KERNEL::NormalizedCellType type ); + int med2gibiGeom( INTERP_KERNEL::NormalizedCellType medGeomType ); + const int * getGibi2MedQuadraticInterlace( INTERP_KERNEL::NormalizedCellType type ); + unsigned getDimension( INTERP_KERNEL::NormalizedCellType type ); enum Readable_Piles { diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 5b1d848bf..42926a2d1 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -228,8 +228,8 @@ std::string SauvLoaderTest::getResourceFile( const std::string& filename ) resourceFile += filename; #ifdef WNT std::string fixedpath = resourceFile; - for ( int i=0; i < path.size(); ++i ) - if (path[i] == '/') + for ( int i=0; i < fixedpath.length(); ++i ) + if (fixedpath[i] == '/') fixedpath[i] = '\\'; return fixedpath; #endif -- 2.39.2