std::vector<int> tmp(2*lgth);
std::vector<int>::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
{
std::vector<int> tmp(lgth);
std::vector<int>::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);
std::vector<int> tmp(2*p);
std::vector<int>::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);
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;
+ 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;
protected:
Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
}
void EdgeArcCircle::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
+ std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& 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);
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;
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;
+ 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
}
void EdgeLin::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
+ std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& 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);
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;
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;
+ 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);
};
}
* unsorted because the "other" mesh is not subdivided yet.
*/
void ElementaryEdge::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
+ std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
{
_ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesOther,addCoo,mapAddCoo);
}
void fillGlobalInfoAbs(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;
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;
+ std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
static ElementaryEdge *BuildEdgeFromCrudeDataArray(bool isQuad, bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
private:
bool _direction;
* Called by QuadraticPolygon::splitAbs method.
*/
void Node::fillGlobalInfoAbs(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<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo, int *nodeId) const
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, int *nodeId) const
{
std::map<INTERP_KERNEL::Node *,int>::const_iterator it=mapThis.find(const_cast<Node *>(this));
if(it!=mapThis.end())
}
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<Node *>(this)]=offset2+id;
}
* Called by QuadraticPolygon::splitAbs method.
*/
void Node::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<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo, std::vector<int>& pointsOther) const
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, std::vector<int>& pointsOther) const
{
int tmp;
std::size_t sz1=addCoo.size();
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<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<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo, int *nodeId) const;
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, int *nodeId) 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<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo, std::vector<int>& pointsOther) const;
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo, std::vector<int>& pointsOther) const;
protected:
~Node();
protected:
ElementaryEdge* curE3=it3.current();
otherTmp.pushBack(new ElementaryEdge(curE3->getPtr(),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())
bool direct=descBg[i]>0;
int edgeId=abs(descBg[i])-1;
const std::vector<int>& subEdge=intersectEdges[edgeId];
- int nbOfSubEdges=subEdge.size()-1;
+ int nbOfSubEdges=subEdge.size()/2;
for(int j=0;j<nbOfSubEdges;j++)
{
- Node *start=(*mapp.find(direct?subEdge[j]:subEdge[nbOfSubEdges-j])).second;
- Node *end=(*mapp.find(direct?subEdge[j+1]:subEdge[nbOfSubEdges-j-1])).second;
- ElementaryEdge *e=ElementaryEdge::BuildEdgeFromCrudeDataArray(isQuad,direct,start,end);
+ 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(isQuad,true,start,end);
pushBack(e);
}
}
void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,int>& mapp, std::vector<int>& conn, std::vector<int>& connI)
{
- int nbOfNodesInPg=0,i=0;
- for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,i++)
+ int nbOfNodesInPg=0;
+ conn.push_back(5);
+ for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
{
Node *tmp=0;
- if(i==0)
- {
- tmp=(*it)->getStartNode();
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it=mapp.find(tmp);
- conn.push_back((*it).second);
- nbOfNodesInPg++;
- }
- tmp=(*it)->getEndNode();
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it=mapp.find(tmp);
- conn.push_back((*it).second);
+ tmp=(*it)->getStartNode();
+ std::map<INTERP_KERNEL::Node *,int>::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);
}
/*!
normalizeExt(&other, xBaryBB, yBaryBB);
//Locate 'this' relative to 'other'
other.performLocatingOperation(*this);
- dumpInXfigFileWithOther(other,"tony.fig");
- std::vector<QuadraticPolygon *> res=other.buildIntersectionPolygons(*this,other);
+ std::vector<QuadraticPolygon *> res=buildIntersectionPolygons(other,*this);
for(std::vector<QuadraticPolygon *>::iterator it=res.begin();it!=res.end();it++)
{
(*it)->appendCrudeData(mapp,conn,connI);
#include <set>
#include <map>
+#include "INTERPKERNELDefines.hxx"
#include "Interpolation.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
* 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<Interpolation3D2D>
+ class INTERPKERNEL_EXPORT Interpolation3D2D : public Interpolation<Interpolation3D2D>
{
public:
typedef std::map<int,std::set<int> > DuplicateFacesType;
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);
* @param isOutside bool[8] which indicate the results of earlier checks.
*/
template<class MyMeshType>
- inline void SplitterTetra<MyMeshType>::checkIsOutside(const double* pt, bool* isOutside) const
+ inline void SplitterTetra<MyMeshType>::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<class MyMeshType>
}
checkIsStrictlyOutside(_nodes[globalNodeNum], isStrictlyOutside, precision);
- checkIsOutside(_nodes[globalNodeNum], isOutside);
+ checkIsOutside(_nodes[globalNodeNum], isOutside, precision);
}
// halfspace filtering check
class DataArrayDoubleTuple;
- class DataArrayDoubleIterator
+ class MEDCOUPLING_EXPORT DataArrayDoubleIterator
{
public:
DataArrayDoubleIterator(DataArrayDouble *da);
int _nb_tuple;
};
- class DataArrayDoubleTuple
+ class MEDCOUPLING_EXPORT DataArrayDoubleTuple
{
public:
DataArrayDoubleTuple(DataArrayDouble *da);
class DataArrayIntTuple;
- class DataArrayIntIterator
+ class MEDCOUPLING_EXPORT DataArrayIntIterator
{
public:
DataArrayIntIterator(DataArrayInt *da);
int _nb_tuple;
};
- class DataArrayIntTuple
+ class MEDCOUPLING_EXPORT DataArrayIntTuple
{
public:
DataArrayIntTuple(DataArrayInt *da);
*/
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
int eltId2=abs(*desc2)-1;
for(std::vector<int>::const_iterator it2=intesctEdges2[eltId2].begin();it2!=intesctEdges2[eltId2].end();it2++)
{
- std::map<int,INTERP_KERNEL::Node *>::const_iterator it=mappRev.find(*it2);
+ int curNodeId2=*it2;
+ std::map<int,INTERP_KERNEL::Node *>::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<int,INTERP_KERNEL::Node *>::const_iterator it=mappRev.begin();it!=mappRev.end();it++)
+ (*it).second->decrRef();
}
}
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<int> > intersectEdge1, 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<int> 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<DataArrayDouble> addCooDa=DataArrayDouble::New();
addCooDa->alloc(addCoo.size()/2,2);
std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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
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<double> bbox1,bbox2;
m1Desc->getBoundingBoxForBBTree(bbox1);
m2Desc->getBoundingBoxForBBTree(bbox2);
{
std::map<INTERP_KERNEL::Node *,int> 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]);
}
}
* 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.
*/
void MEDCouplingUMesh::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)
{
- 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<ncell;i++,cI++)
{
INTERP_KERNEL::Node *nn=new INTERP_KERNEL::Node(coo[2*c[(*cI)+j+1]],coo[2*c[(*cI)+j+1]+1]);
int nnid=c[(*cI)+j+1];
mapp2[nnid]=nn;
- mapp22[nn]=nnid;
+ mapp22[nn]=nnid+offset1;
}
INTERP_KERNEL::Edge *e=MEDCouplingUMeshBuildQPFromEdge((INTERP_KERNEL::NormalizedCellType)c[*cI],mapp2,c+(*cI)+1);
for(std::map<int, INTERP_KERNEL::Node *>::const_iterator it=mapp2.begin();it!=mapp2.end();it++)
(*it).second->decrRef();
std::vector<INTERP_KERNEL::Node *> addNodes(divs.size());
std::map<INTERP_KERNEL::Node *,int> mapp3;
- for(std::size_t j=0;j<divs.size();i++)
+ for(std::size_t j=0;j<divs.size();j++)
{
int id=divs[j];
INTERP_KERNEL::Node *tmp=0;
if(id<offset1)
tmp=new INTERP_KERNEL::Node(cooBis[2*id],cooBis[2*id+1]);
else if(id<offset2)
- tmp=new INTERP_KERNEL::Node(coo[2*(id-offset1)],cooBis[2*(id-offset1)+1]);//if it happens, bad news mesh 'm2' is non conform.
+ tmp=new INTERP_KERNEL::Node(coo[2*(id-offset1)],coo[2*(id-offset1)+1]);//if it happens, bad news mesh 'm2' is non conform.
else
tmp=new INTERP_KERNEL::Node(addCoo[2*(id-offset2)],addCoo[2*(id-offset2)+1]);
addNodes[j]=tmp;
class MEDCouplingUMeshCell;
- class MEDCouplingUMeshCellIterator
+ class MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator
{
public:
MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh);
class MEDCouplingUMeshCellByTypeIterator;
- class MEDCouplingUMeshCellByTypeEntry
+ class MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry
{
public:
MEDCouplingUMeshCellByTypeEntry(MEDCouplingUMesh *mesh);
MEDCouplingUMesh *_mesh;
};
- class MEDCouplingUMeshCellEntry
+ class MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry
{
public:
MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, int bg, int end);
int _end;
};
- class MEDCouplingUMeshCellByTypeIterator
+ class MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeIterator
{
public:
MEDCouplingUMeshCellByTypeIterator(MEDCouplingUMesh *mesh);
int _nb_cell;
};
- class MEDCouplingUMeshCell
+ class MEDCOUPLING_EXPORT MEDCouplingUMeshCell
{
public:
MEDCouplingUMeshCell(MEDCouplingUMesh *mesh);
#ifndef __MEDFILEFIELD_HXX__
#define __MEDFILEFIELD_HXX__
+#include "MEDLoaderDefines.hxx"
+
#include "MEDFileUtilities.hxx"
#include "MEDCouplingAutoRefCountObjectPtr.hxx"
class MEDFileFieldLoc : public RefCountObject
{
public:
- void simpleRepr(std::ostream& oss) const;
- const std::string& getName() const { return _name; }
+ void MEDLOADER_EXPORT simpleRepr(std::ostream& oss) const;
+ const MEDLOADER_EXPORT std::string& getName() const { return _name; }
static MEDFileFieldLoc *New(med_idt fid, const char *locName);
static MEDFileFieldLoc *New(med_idt fid, int id);
static MEDFileFieldLoc *New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& 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<double>& getRefCoords() const { return _ref_coo; }
- const std::vector<double>& getGaussCoords() const { return _gs_coo; }
- const std::vector<double>& 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<double>& getRefCoords() const { return _ref_coo; }
+ const MEDLOADER_EXPORT std::vector<double>& getGaussCoords() const { return _gs_coo; }
+ const MEDLOADER_EXPORT std::vector<double>& 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);
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
_families.erase(it);
+ for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
+ {
+ std::vector<std::string>& v=(*it3).second;
+ std::vector<std::string>::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)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::string nname(newName);
- it=_families.find(nname);
- if(it!=_families.end())
+ std::map<std::string, int >::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());
int cpy=(*it).second;
_families.erase(it);
_families[newName]=cpy;
+ for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
+ {
+ std::vector<std::string>& v=(*it3).second;
+ std::vector<std::string>::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
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();
THROW_IK_EXCEPTION("Invalid nb of named objects: " << nbNamedObjects << lineNb() );
if ( nbObjects<0)
THROW_IK_EXCEPTION("Invalid nb of objects: " << nbObjects << lineNb() );
- if ( nbObjects<nbNamedObjects)
- THROW_IK_EXCEPTION("In PILE " << pileNumber <<
- " nb of objects is less than nb of named objects" << lineNb() );
+ // It appears to be a valid case
+ // if ( nbObjects<nbNamedObjects)
+ // THROW_IK_EXCEPTION("In PILE " << pileNumber <<
+ // " nb of objects is less than nb of named objects" << lineNb() );
return pileNumber;
}
int nbReals = getIntNext();
if ( nbReals < (int)(_iMed->_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));
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
{
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