tmp=0;
if(!new_elems_left.empty())
tmp=&(new_elems_left[0]);
- _left=new BBTreeDst(bbs, tmp, level+1, (mcIdType)new_elems_left.size());
+ _left=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_left.size()));
tmp=0;
if(!new_elems_right.empty())
tmp=&(new_elems_right[0]);
- _right=new BBTreeDst(bbs, tmp, level+1, (mcIdType)new_elems_right.size());
+ _right=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_right.size()));
}
~BBTreeDst()
/*!
* Equivalent to getNumberOfSons except that this method deals with dynamic type.
*/
- unsigned CellModel::getNumberOfSons2(const mcIdType *conn, int lgth) const
+ unsigned CellModel::getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const
{
if(!isDynamic())
return getNumberOfSons();
return std::count(conn,conn+lgth,-1)+1;
}
- unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, int lgth) const
+ unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const
{
if(!isDynamic())
return _nb_of_little_sons;
return nbOfTurnLoop;
}
- unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
typeOfSon=getSonType2(sonId);
if(!isDynamic())
/*!
* Equivalent to CellModel::fillSonCellNodalConnectivity2 except for HEXA8 where the order of sub faces is not has MED file numbering for transformation HEXA8->HEXA27
*/
- unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(_type==NORM_HEXA8)
{
return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon);
}
- unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
+ unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const
{
if(!isDynamic())
{
*/
//================================================================================
- unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, int lgth) const
+ unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const
{
if(!isDynamic())
return getNumberOfNodesConstituentTheSon(sonId);
* If not an exception will be thrown.
* @return True if two cells have same orientation, false if not.
*/
- bool CellModel::getOrientationStatus(unsigned lgth, const mcIdType *conn1, const mcIdType *conn2) const
+ bool CellModel::getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const
{
if(_dim!=1 && _dim!=2)
throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : invalid dimension ! Must be 1 or 2 !");
//! sonId is in C format.
INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sons_con[sonId]; }
INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheLittleSon(unsigned littleSonId) const { return _little_sons_con[littleSonId]; }
- INTERPKERNEL_EXPORT bool getOrientationStatus(unsigned lgth, const mcIdType *conn1, const mcIdType *conn2) const;
+ INTERPKERNEL_EXPORT bool getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const;
INTERPKERNEL_EXPORT unsigned getNumberOfNodes() const { return _nb_of_pts; }
INTERPKERNEL_EXPORT unsigned getNumberOfSons() const { return _nb_of_sons; }
- INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, int lgth) const;
- INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, int lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const;
INTERPKERNEL_EXPORT unsigned getNumberOfMicroEdges() const;
INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; }
- INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, int lgth) const;
+ INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const;
INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; }
INTERPKERNEL_EXPORT NormalizedCellType getCorrespondingPolyType() const;
INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; }
INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; }
INTERPKERNEL_EXPORT NormalizedCellType getSonType2(unsigned sonId) const;
INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const;
- INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
- INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
+ INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const;
INTERPKERNEL_EXPORT void changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const;
INTERPKERNEL_EXPORT void changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0],
- ToConnType(CoordsT.size())/SPACEDIM, ToConnType(CoordsS.size())/SPACEDIM);
+ int(CoordsT.size())/SPACEDIM, int(CoordsS.size())/SPACEDIM);
double area[SPACEDIM];
int nb_inter =((int)inter.size())/SPACEDIM;
for(int i = 1; i<nb_inter-1; i++)
bool isSourceQuad)
{
double result = 0;
- int nbOfNodesS=ToConnType(sourceCoords.size())/SPACEDIM;
+ int nbOfNodesS=int(sourceCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(quadrangle, &sourceCoords[0],
- 4, nbOfNodesS);
+ 4, nbOfNodesS);
double area[SPACEDIM];
int nb_inter =((int)inter.size())/SPACEDIM;
for(int i = 1; i<nb_inter-1; i++)
const std::vector<double>& sourceCoords)
{
double result = 0;
- ConnType nbOfNodesS=ToConnType(sourceCoords.size())/SPACEDIM;
- ConnType nbOfNodesT=ToConnType(targetCoords.size())/SPACEDIM;
+ int nbOfNodesS=int(sourceCoords.size())/SPACEDIM;
+ int nbOfNodesT=int(targetCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0],
struct TDualSegment
{
std::vector<double> _coords;
- int _nodeId; // in mesh mode
+ ConnType _nodeId; // in mesh mode
};
static void getDualSegments(ConnType icell,
const MyMeshType& mesh,
int ibox=0;
for(long icell=0; icell<nbelems; icell++)
{
- int nb_nodes_per_elem = conn_index[icell+1]-conn_index[icell];
+ ConnType nb_nodes_per_elem = conn_index[icell+1]-conn_index[icell];
//initializing bounding box limits
for(int idim=0; idim<SPACEDIM; idim++)
{
bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits<double>::max();
}
//updating the bounding box with each node of the element
- for (int j=0; j<nb_nodes_per_elem; j++)
+ for (ConnType j=0; j<nb_nodes_per_elem; j++)
{
const double* coord_node = coords +
SPACEDIM*OTT<ConnType,numPol>
template<class MyMeshType, class MyMatrix>
bool CurveIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
{
- int nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
+ ConnType nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iT=0; iT<nbNodesT; iT++)
{
template<class MyMeshType, class MyMatrix>
typename MyMeshType::MyConnType CurveIntersector<MyMeshType,MyMatrix>::getNodeIdOfTargetCellAt(ConnType icellT, ConnType nodeIdInCellT) const
{
- int nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
+ ConnType nbNodesT(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1] - _connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]);
if(nodeIdInCellT>=0 && nodeIdInCellT<nbNodesT)
return OTT<ConnType,numPol>::coo2C(_connectT[OTT<ConnType,numPol>::conn2C(_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)]+nodeIdInCellT)]);
else
template<class MyMeshType, class MyMatrix>
bool CurveIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
{
- int nbNodesS = _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS = _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for(ConnType iS=0; iS<nbNodesS; iS++)
{
template<class MyMeshType, class MyMatrix>
typename MyMeshType::MyConnType CurveIntersector<MyMeshType,MyMatrix>::getNodeIdOfSourceCellAt(ConnType icellS, ConnType nodeIdInCellS) const
{
- int nbNodesS(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]);
+ ConnType nbNodesS(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1] - _connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]);
if(nodeIdInCellS>=0 && nodeIdInCellS<nbNodesS)
return OTT<ConnType,numPol>::coo2C(_connectS[OTT<ConnType,numPol>::conn2C(_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)]+nodeIdInCellS)]);
else
std::vector<TDualSegment>& segments)
{
// get coordinates of cell nodes
- int nbNodes;
- std::vector<double> ncoords;
- std::vector<int> nodeIds;
+ ConnType nbNodes;
+ std::vector<double> ncoords;
+ std::vector<ConnType> nodeIds;
{
const ConnType *connect = mesh.getConnectivityPtr();
const ConnType *connIndex = mesh.getConnectivityIndexPtr();
ncoords.resize(SPACEDIM*nbNodes);
nodeIds.resize(nbNodes);
- for(int i=0; i<nbNodes; i++)
+ for(ConnType i=0; i<nbNodes; i++)
for(int idim=0; idim<SPACEDIM; idim++)
{
nodeIds[i] = connect[OTT<ConnType,numPol>::conn2C(connIndex[OTT<ConnType,numPol>::ind2C(icell)]+i)];
// fill segments
segments.clear();
segments.reserve( 2*nbNodes );
- for(int i=0; i<nbNodes-1; i++)
+ for(ConnType i=0; i<nbNodes-1; i++)
{
segments.push_back(TDualSegment());
TDualSegment& seg1 = segments.back();
void GaussCoords::addGaussInfo( NormalizedCellType theGeometry,
int coordDim,
const double* theGaussCoord,
- int theNbGauss,
+ mcIdType theNbGauss,
const double* theReferenceCoord,
- int theNbRef)
+ mcIdType theNbRef)
{
GaussInfoVector::iterator it = _my_gauss_info.begin();
for( ; it != _my_gauss_info.end(); it++ )
double* GaussCoords::calculateCoords( NormalizedCellType theGeometry,
const double *theNodeCoords,
const int theSpaceDim,
- const int *theIndex)
+ const mcIdType *theIndex)
{
const GaussInfo *info = getInfoGivenCellType(theGeometry);
int nbCoords = theSpaceDim * info->getNbGauss();
}
-void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const int *theIndex, double *result)
+void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result)
{
const GaussInfo *info = getInfoGivenCellType(theGeometry);
calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,result);
}
-void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, double *result)
+void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result)
{
int aConn = info->getNbRef();
#include "INTERPKERNELDefines.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
+#include "MCIdType.hxx"
#include <vector>
INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry,
int coordDim,
const double* theGaussCoord,
- int theNbGauss,
+ mcIdType theNbGauss,
const double* theReferenceCoord,
- int theNbRef);
+ mcIdType theNbRef);
INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry,
const double* theNodeCoords,
const int theSpaceDim,
- const int* theIndex);
+ const mcIdType* theIndex);
INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry,
const double* theNodeCoords,
const int theSpaceDim,
- const int* theIndex,
+ const mcIdType* theIndex,
double *result);
private:
const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
- void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
+ void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex,
double *result);
private:
typedef std::vector<GaussInfo*> GaussInfoVector;
return ret;
}
-void MergePoints::PushInMap(int key, int value, std::map<int,int>& mergedNodes)
+void MergePoints::PushInMap(mcIdType key, mcIdType value, std::map<mcIdType,mcIdType>& mergedNodes)
{
if(key!=-1 && value!=-1)
mergedNodes[key]=value;
}
-void MergePoints::updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map<int,int>& mergedNodes)
+void MergePoints::updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map<mcIdType,mcIdType>& mergedNodes)
{
unsigned subTot(_ass1Start1+_ass1End1+_ass1Start2+_ass1End2);
if(subTot!=0)
* \param [in,out] subNodes to be sorted
* \return true if a reordering was necessary false if not.
*/
-bool Edge::sortSubNodesAbs(const double *coo, std::vector<int>& subNodes)
+bool Edge::sortSubNodesAbs(const double *coo, std::vector<mcIdType>& subNodes)
{
Bounds b;
b.prepareForAggregation();
//
std::size_t sz(subNodes.size()),i(0);
std::vector< std::pair<double,Node *> > an2(sz);
- std::map<Node *, int> m;
- for(std::vector<int>::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++)
+ std::map<Node *, mcIdType> m;
+ for(std::vector<mcIdType>::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++)
{
Node *n(new Node(coo[2*(*it)],coo[2*(*it)+1]));
n->applySimilarity(xBary,yBary,dimChar);
bool ret(false);
for(i=0;i<sz;i++)
{
- int id(m[an2[i].second]);
+ mcIdType id(m[an2[i].second]);
if(id!=subNodes[i])
{ subNodes[i]=id; ret=true; }
}
//
- for(std::map<INTERP_KERNEL::Node *,int>::const_iterator it2=m.begin();it2!=m.end();it2++)
+ for(std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it2=m.begin();it2!=m.end();it2++)
(*it2).first->decrRef();
return ret;
}
/**
* Sort nodes so that they all lie consecutively on the edge that has been cut.
*/
-void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1,
- const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
+void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp1,
+ const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp2, std::vector<mcIdType>& edgesThis)
{
- int startId=(*mapp1.find(_start)).second;
- int endId=(*mapp1.find(_end)).second;
+ mcIdType startId=(*mapp1.find(_start)).second;
+ mcIdType endId=(*mapp1.find(_end)).second;
if (! addNodes.size()) // quick way out, no new node to add.
{
edgesThis.push_back(startId);
for(std::size_t i=0;i<sz;i++)
an2[i]=std::pair<double,Node *>(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]);
std::sort(an2.begin(),an2.end());
- std::vector<int> tmpp;
+ std::vector<mcIdType> tmpp;
for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=an2.end();it++)
{
- int idd=(*mapp2.find((*it).second)).second;
+ mcIdType idd=(*mapp2.find((*it).second)).second;
tmpp.push_back(idd);
}
- std::vector<int> tmpp2(tmpp.size()+2);
+ std::vector<mcIdType> tmpp2(tmpp.size()+2);
tmpp2[0]=startId;
std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1);
tmpp2[tmpp.size()+1]=endId;
- std::vector<int>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
+ std::vector<mcIdType>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
tmpp2.resize(std::distance(tmpp2.begin(),itt));
int nbOfEdges=tmpp2.size()-1;
for(int i=0;i<nbOfEdges;i++)
}
}
-void Edge::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 Edge::fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const
{
- int tmp[2];
+ mcIdType tmp[2];
_start->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp);
_end->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp+1);
if(direction)
}
}
-void Edge::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,
+void Edge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const
{
if (skipStartOrEnd != -1) // see meaning in splitAbs()
_start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
#include "InterpKernelException.hxx"
#include "InterpKernelGeo2DBounds.hxx"
#include "InterpKernelGeo2DNode.hxx"
+#include "MCIdType.hxx"
#include <iostream>
#include <vector>
bool isEnd2(unsigned rk) const;
void clear();
unsigned getNumberOfAssociations() const;
- void updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map<int,int>& mergedNodes);
+ void updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map<mcIdType,mcIdType>& mergedNodes);
private:
- static void PushInMap(int key, int value, std::map<int,int>& mergedNodes);
+ static void PushInMap(mcIdType key, mcIdType value, std::map<mcIdType,mcIdType>& mergedNodes);
private:
unsigned _ass1Start1 : 1;
unsigned _ass1End1 : 1;
void dumpToCout(const std::map<INTERP_KERNEL::Node *,int>& mapp, int index) const;
bool isEqual(const Edge& other) const;
public:
- bool sortSubNodesAbs(const double *coo, std::vector<int>& subNodes);
- 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);
+ bool sortSubNodesAbs(const double *coo, std::vector<mcIdType>& subNodes);
+ void sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp1, const std::map<INTERP_KERNEL::Node *, mcIdType>& mapp2, std::vector<mcIdType>& edgesThis);
virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0;
- 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,
+ void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const;
+ void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const;
protected:
Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
* @param angle0 in ]-Pi;Pi[
* @param deltaAngle in ]-2.*Pi;2.*Pi[
*/
-EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle(deltaAngle),
- _angle0(angle0),_radius(radius)
+EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle0(angle0),_angle(deltaAngle),
+ _radius(radius)
{
_center[0]=center[0];
_center[1]=center[1];
* 'conn' is of size 3. conn[0] is start id, conn[1] is end id and conn[2] is middle id.
* 'offset' is typically the number of nodes already existing in global 2D curve mesh. Additional coords 'addCoo' ids will be put after the already existing.
*/
-void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vector<int>& newConn, std::vector<double>& addCoo) const
+void EdgeArcCircle::tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector<mcIdType>& newConn, std::vector<double>& addCoo) const
{
newConn.push_back(INTERP_KERNEL::NORM_POLYL);
int nbOfSubDiv=(int)(fabs(_angle)/eps);
return ;
}
double signOfAngle=_angle>0.?1.:-1.;
- int offset2=offset+((int)addCoo.size())/2;
+ mcIdType offset2=offset+(ToIdType(addCoo.size()))/2;
newConn.push_back(conn[0]);
for(int i=1;i<nbOfSubDiv;i++,offset2++)
{
#include "INTERPKERNELDefines.hxx"
#include "InterpKernelGeo2DEdge.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
double getAngle0() const { return _angle0; }
double getRadius() const { return _radius; }
double getAngle() const { return _angle; }
- void tesselate(const int *conn, int offset, double eps, std::vector<int>& newConn, std::vector<double>& addCoo) const;
+ void tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector<mcIdType>& newConn, std::vector<double>& addCoo) const;
static EdgeArcCircle *BuildFromNodes(Node *start, Node *middle, Node *end);
static double GetAbsoluteAngle(const double *vect, double& normVect);
static double GetAbsoluteAngleOfNormalizedVect(double ux, double uy);
/*!
* Called by QuadraticPolygon::splitAbs method.
*/
-void ElementaryEdge::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 ElementaryEdge::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const
{
_ptr->fillGlobalInfoAbs(_direction,mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesThis,addCoo,mapAddCoo);
}
* Called by QuadraticPolygon::splitAbs method. Close to ElementaryEdge::fillGlobalInfoAbs method expect that here edgesOther (that replace edgesThis) is here an in/out parameter that only contains nodes
* 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,
+void ElementaryEdge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const
{
if (!_direction)
skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs()
INTERPKERNEL_EXPORT bool intresincEqCoarse(const Edge *other) const;
INTERPKERNEL_EXPORT bool isEqual(const ElementaryEdge& other) const;
public:
- INTERPKERNEL_EXPORT 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;
- INTERPKERNEL_EXPORT 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,
+ INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<mcIdType>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo) const;
+ INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
short skipStartOrEnd,
- std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
+ std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const;
INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(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
+void Node::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, mcIdType *nodeId) const
{
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it=mapOther.find(const_cast<Node *>(this));
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it=mapOther.find(const_cast<Node *>(this));
if(it!=mapOther.end()) // order matters, try in mapOther first.
{
*nodeId=(*it).second+offset1;
/*!
* 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
+void Node::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, std::vector<mcIdType>& pointsOther) const
{
- int tmp;
+ mcIdType tmp;
std::size_t sz1=addCoo.size();
fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp);
if(sz1!=addCoo.size() // newly created point
pointsOther.push_back(tmp);
return ;
}
- std::vector<int>::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
+ std::vector<mcIdType>::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp);
if(it!=pointsOther.end())
return ;
pointsOther.push_back(tmp);
#include "InterpKernelGeo2DPrecision.hxx"
#include "INTERPKERNELDefines.hxx"
+#include "MCIdType.hxx"
#include <map>
#include <cmath>
static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); }
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;
- 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;
+ void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, mcIdType *nodeId) const;
+ void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY,
+ std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo, std::vector<mcIdType>& pointsOther) const;
protected:
~Node();
protected:
* the cell id in global other mesh.
*/
void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
- const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther,
- int offset1, int offset2 ,
- const std::vector<int>& otherEdgeIds,
- std::vector<int>& edgesThis, int cellIdThis,
- std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
- std::vector<double>& addCoo, std::map<int,int>& mergedNodes)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther,
+ mcIdType offset1, mcIdType offset2 ,
+ const std::vector<mcIdType>& otherEdgeIds,
+ std::vector<mcIdType>& edgesThis, mcIdType cellIdThis,
+ std::vector< std::vector<mcIdType> >& edgesInOtherColinearWithThis, std::vector< std::vector<mcIdType> >& subDivOther,
+ std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes)
{
double xBaryBB, yBaryBB;
double fact=normalizeExt(&other, xBaryBB, yBaryBB);
ComposedEdge *cThis=new ComposedEdge;
ComposedEdge *cOther=new ComposedEdge;
int i=0;
- std::map<INTERP_KERNEL::Node *,int> mapAddCoo;
+ std::map<INTERP_KERNEL::Node *,mcIdType> mapAddCoo;
for(itOther.first();!itOther.finished();itOther.next(),i++)
{
// For each edge of 'other', proceed with intersections: the edge might split into sub-edges, 'otherTmp' will hold the final split result.
ElementaryEdge* curThis=itThis.current();
merge.clear();
//
- std::map<INTERP_KERNEL::Node *,int>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode()));
int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1);
* orientation of edge (see buildDescendingConnectivity2() method).
* See appendEdgeFromCrudeDataArray() for params description.
*/
-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)
+void QuadraticPolygon::buildFromCrudeDataArray(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges)
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)
}
}
-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)
+void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad,
+ const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges)
{
if(!isQuad)
{
bool direct=descBg[edgePos]>0;
- int edgeId=abs(descBg[edgePos])-1; // back to C indexing mode
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ mcIdType edgeId=abs(descBg[edgePos])-1; // back to C indexing mode
+ const std::vector<mcIdType>& 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);
delete e1; delete e2;
//
bool direct=descBg[edgePos]>0;
- int edgeId=abs(descBg[edgePos])-1;
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ mcIdType edgeId=abs(descBg[edgePos])-1;
+ const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
if(colinearity)
{
}
}
-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)
+void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp)
{
std::size_t nbOfSubEdges=subEdge.size()/2;
if(!baseEdge)
* 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 *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges2,
- 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,
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2)
+void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges2,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1,
+ const std::vector< std::vector<mcIdType> >& colinear1,
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2)
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- int edgeId=abs(descBg[i])-1;//current edge id of pol2
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
+ mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end())
{
bool sameDir=(it1!=alreadyExistingIn2.end());
continue;
}
bool directos=colinear1[edgeId].empty();
- std::vector<std::pair<int,std::pair<bool,int> > > idIns1;
- int offset1=0;
+ std::vector<std::pair<mcIdType,std::pair<bool,mcIdType> > > idIns1;
+ mcIdType offset1=0;
if(!directos)
{// if the current edge of pol2 has one or more colinear edges part into pol1
- const std::vector<int>& c=colinear1[edgeId];
+ const std::vector<mcIdType>& c=colinear1[edgeId];
std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- int edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
- idIns1.push_back(std::pair<int,std::pair<bool,int> >(edgeId1,std::pair<bool,int>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
+ idIns1.push_back(std::pair<mcIdType,std::pair<bool,mcIdType> >(edgeId1,std::pair<bool,mcIdType>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
//std::pair<edgeId1); direct1=descBg1[j]>0;
}
offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2
}
else
{//there is subpart of edge 'edgeId' of pol2 inside pol1
- const std::vector<int>& subEdge=intersectEdges2[edgeId];
+ const std::vector<mcIdType>& subEdge=intersectEdges2[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
{
- int idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
- int idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
+ mcIdType idBg=direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1];
+ mcIdType idEnd=direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2];
bool direction11,found=false;
bool direct1;//store if needed the direction in 1
- int offset2;
+ mcIdType offset2;
std::size_t nbOfSubEdges1;
- for(std::vector<std::pair<int,std::pair<bool,int> > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++)
+ for(std::vector<std::pair<mcIdType,std::pair<bool,mcIdType> > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++)
{
- int idIn1=(*it).first;//store if needed the cell id in 1
+ mcIdType idIn1=(*it).first;//store if needed the cell id in 1
direct1=(*it).second.first;
offset1=(*it).second.second;
- const std::vector<int>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
+ const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2;
offset2=0;
for(std::size_t k=0;k<nbOfSubEdges1 && !found;k++)
* Method expected to be called on pol2. Every params not suffixed by numbered are supposed to refer to pol2 (this).
* Method to find edges that are ON.
*/
-void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(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) const
+void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1,
+ const std::vector<std::vector<mcIdType> >& intersectEdges1, const std::vector< std::vector<mcIdType> >& colinear1) const
{
std::size_t nbOfSeg=std::distance(descBg,descEnd);
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- int edgeId=abs(descBg[i])-1;//current edge id of pol2
- const std::vector<int>& c=colinear1[edgeId];
+ mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2
+ const std::vector<mcIdType>& c=colinear1[edgeId];
if(c.empty())
continue;
- const std::vector<int>& subEdge=intersectEdges[edgeId];
+ const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
//
std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
- int offset1=0;
+ mcIdType offset1=0;
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- int edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
for(std::size_t k=0;k<nbOfSubEdges;k++)
{
- int idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
- int idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
- int idIn1=edgeId1;
+ mcIdType idBg=direct?subEdge[2*k]:subEdge[2*nbOfSubEdges-2*k-1];
+ mcIdType idEnd=direct?subEdge[2*k+1]:subEdge[2*nbOfSubEdges-2*k-2];
+ mcIdType idIn1=edgeId1;
bool direct1=descBg1[j]>0;
- const std::vector<int>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
+ const std::vector<mcIdType>& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1];
std::size_t nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2;
- int offset2=0;
+ mcIdType offset2=0;
bool found=false;
for(std::size_t kk=0;kk<nbOfSubEdges1 && !found;kk++)
{
}
}
-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
+void QuadraticPolygon::appendCrudeData(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI) const
{
int nbOfNodesInPg=0;
bool presenceOfQuadratic=presenceOfQuadraticEdge();
{
Node *tmp=0;
tmp=(*it)->getStartNode();
- std::map<INTERP_KERNEL::Node *,int>::const_iterator it1=mapp.find(tmp);
+ std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator it1=mapp.find(tmp);
conn.push_back((*it1).second);
nbOfNodesInPg++;
}
if(presenceOfQuadratic)
{
int j=0;
- int off=offset+((int)addCoordsQuadratic.size())/2;
+ mcIdType off=offset+ToIdType(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();
* @param [in,out] edgesBoundaryOther, parameter that stores all edges in result of intersection that are not
*/
void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther,
- 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)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI,
+ std::vector<mcIdType>& nbThis, std::vector<mcIdType>& nbOther)
{
double xBaryBB, yBaryBB;
double fact=normalizeExt(&other, xBaryBB, yBaryBB);
* intersecting cells
*/
void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary,
- const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn,
- std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2)
+ const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType offset, mcIdType idThis,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn,
+ std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2)
{
// Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1.
pol1.initLocations();
INTERPKERNEL_EXPORT double intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear);
//! Before intersecting as intersectWith a normalization is done.
INTERPKERNEL_EXPORT double intersectWithAbs(QuadraticPolygon& other, double* barycenter);
- INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, const std::vector<int>& otherEdgeIds,
- std::vector<int>& edgesThis, int cellIdThis, std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther, std::vector<double>& addCoo, std::map<int,int>& mergedNodes);
- INTERPKERNEL_EXPORT 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);
- INTERPKERNEL_EXPORT 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,
- std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2);
- INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(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) const;
- INTERPKERNEL_EXPORT 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);
- INTERPKERNEL_EXPORT 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);
- INTERPKERNEL_EXPORT 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;
- INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther, 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);
+ INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapThis, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapOther, mcIdType offset1, mcIdType offset2, const std::vector<mcIdType>& otherEdgeIds,
+ std::vector<mcIdType>& edgesThis, mcIdType cellIdThis, std::vector< std::vector<mcIdType> >& edgesInOtherColinearWithThis, std::vector< std::vector<mcIdType> >& subDivOther, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes);
+ INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges);
+ INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges,
+ const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1,
+ const std::vector< std::vector<mcIdType> >& colinear1,
+ std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >& alreadyExistingIn2);
+ INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector<std::vector<mcIdType> >& intersectEdges1, const std::vector< std::vector<mcIdType> >& colinear1) const;
+ INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords,
+ const mcIdType *descBg, const mcIdType *descEnd, const std::vector<std::vector<mcIdType> >& intersectEdges);
+ INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector<mcIdType>& subEdge, const std::map<mcIdType,INTERP_KERNEL::Node *>& mapp);
+ INTERPKERNEL_EXPORT void appendCrudeData(const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI) const;
+ INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set<INTERP_KERNEL::Edge *>& edgesThis, std::set<INTERP_KERNEL::Edge *>& edgesBoundaryOther, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2);
//
INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other) const;
INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other, double* barycenter) const;
INTERPKERNEL_EXPORT std::vector<QuadraticPolygon *> buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const;
INTERPKERNEL_EXPORT bool haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1NotSplitted, const QuadraticPolygon& pol2Splitted,
bool& direction, bool& needCleaning) const;
- INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary, const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
- std::vector<double>& addCoordsQuadratic, std::vector<int>& conn, std::vector<int>& connI, std::vector<int>& nb1, std::vector<int>& nb2);
+ INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary, const std::map<INTERP_KERNEL::Node *,mcIdType>& mapp, mcIdType offset, mcIdType idThis,
+ std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& conn, std::vector<mcIdType>& connI, std::vector<mcIdType>& nb1, std::vector<mcIdType>& nb2);
INTERPKERNEL_EXPORT void cleanDegeneratedConsecutiveEdges();
protected:
std::list<QuadraticPolygon *> zipConsecutiveInSegments() const;
* It retrieves the same cell with a potentially different type (in return) whose connectivity is defined by (retConn,retLgth)
* \b WARNING for optimization reason the arrays 'retConn' and 'conn' can overlapped !
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
std::set<mcIdType> c(conn,conn+lgth);
c.erase(-1);
- bool isObviousNonDegeneratedCell=((int)c.size()==lgth);
+ bool isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth);
if((cm.getDimension()==3 && cm.isQuadratic()) || isObviousNonDegeneratedCell)
{//quadratic 3D, do nothing for the moment.
retLgth=lgth;
}
if(cm.getDimension()==3)
{
- int nbOfFaces,lgthOfPolyhConn;
+ mcIdType nbOfFaces,lgthOfPolyhConn;
mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn);
INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth);
delete [] zipFullReprOfPolyh;
* This static method tries to unpolygonize a cell whose connectivity is given by 'conn' and 'lgth'.
* Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
retLgth=lgth;
std::copy(conn,conn+lgth,retConn);
* The format of output array is the following :
* 1,2,3,-1,3,4,2,-1,3,4,1,-1,1,2,4,NORM_TRI3,NORM_TRI3,NORM_TRI3 (faces type at the end of classical polyhedron nodal description)
*/
-mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth,
- int& retNbOfFaces, int& retLgth)
+mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth,
+ mcIdType& retNbOfFaces, mcIdType& retLgth)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth);
//
mcIdType *tmp2=new mcIdType[offset];
tmp2[0]=work[0];
- int newPos=1;
+ mcIdType newPos=1;
for(unsigned k=1;k<offset;k++)
if(std::find(tmp2,tmp2+newPos,work[k])==tmp2+newPos)
tmp2[newPos++]=work[k];
delete [] tmp2;
continue;
}
- int tmp3;
+ mcIdType tmp3;
faces.push_back(tryToUnPoly2D(CellModel::GetCellModel(type2).isQuadratic(),tmp2,newPos,work,tmp3));
delete [] tmp2;
//
* method INTERP_KERNEL::CellSimplify::getFullPolyh3DCell ) and 'lgth'+'nbOfFaces'.
* Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
std::set<mcIdType> nodes(conn,conn+lgth);
nodes.erase(-1);
}
}
-bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace)
+bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
std::vector<mcIdType> tmp2;
std::set<mcIdType> bases(baseFace,baseFace+lgthBaseFace);
std::vector< std::pair<mcIdType,mcIdType> > baseEdges(lgthBaseFace);
std::vector< std::pair<mcIdType,mcIdType> > oppEdges(lgthBaseFace);
std::vector< std::pair<mcIdType,mcIdType> > sideEdges(4);
- for(int i=0;i<lgthBaseFace;i++)
+ for(mcIdType i=0;i<lgthBaseFace;i++)
{
baseEdges[i]=std::pair<mcIdType,mcIdType>(baseFace[i],baseFace[(i+1)%lgthBaseFace]);
oppEdges[i]=std::pair<mcIdType,mcIdType>(retConn[i],retConn[(i+1)%lgthBaseFace]);
return true;
}
-bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace)
+bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace)
{
return true;
}
* k_th node in retConnOfOppFace. Excluded faces 'baseFace' and 'oppFace' all the other faces in 'conn' must be QUAD4 faces.
* If the arrangement process succeeds true is returned and retConnOfOppFace is filled.
*/
-bool CellSimplify::tryToArrangeOppositeFace(const mcIdType *conn, int lgth, int lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFace, int nbOfFaces, mcIdType *retConnOfOppFace)
+bool CellSimplify::tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFace, mcIdType nbOfFaces, mcIdType *retConnOfOppFace)
{
retConnOfOppFace[0]=oppFace[0];
- for(int j=1;j<lgthBaseFace;j++)
+ for(mcIdType j=1;j<lgthBaseFace;j++)
retConnOfOppFace[j]=oppFace[lgthBaseFace-j];
const mcIdType *curFace=conn;
int sideFace=0;
* This method is only callable if in 'conn' there is 8 nodes and 6 faces.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),(mcIdType)INTERP_KERNEL::NORM_QUAD4))==conn+lgth+nbOfFaces)
+ if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces)
{//6 faces are QUAD4.
int oppositeFace=-1;
std::set<mcIdType> conn1(conn,conn+4);
return INTERP_KERNEL::NORM_POLYHED;
}
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON);
- std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
+ std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfQuad==6 && nbOfHexagon==2)
{
- const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON);
+ const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
std::size_t hexg0Id=std::distance(conn+lgth,hexag0);
- const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON);
+ const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON));
std::size_t hexg1Id=std::distance(conn+lgth,hexag1);
const mcIdType *connHexag0=conn+5*hexg0Id;
std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PENTA6 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3);
- std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==2 && nbOfQuadFace==3)
{
- std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3));
- std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3));
+ std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
+ std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)));
const mcIdType *tri_0=0,*tri_1=0;
const mcIdType *w=conn;
for(std::size_t i=0;i<5;i++)
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PYRA5 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3);
- std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3));
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4));
if(nbOfTriFace==4 && nbOfQuadFace==1)
{
- std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4));
+ std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)));
const mcIdType *quad4=0;
const mcIdType *w=conn;
for(std::size_t i=0;i<5 && quad4==0;i++)
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_TETRA4 is returned.
* If fails a POLYHED is returned.
*/
-INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth)
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth)
{
- if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),(mcIdType)INTERP_KERNEL::NORM_TRI3))==conn+lgth+nbOfFaces)
+ if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces)
{
std::set<mcIdType> tribase(conn,conn+3);
int point=-1;
* - fully degenerated polygons (polygon with 1 point, or 2 if quadratic)
* - quad polygon with 2 points and two identical quad points
*/
-bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, int lgth, NormalizedCellType type)
+bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if ( lgth <= 2 ) // a polygon with a single, or two points has been returned. This check also captures degenerated quadratics
class INTERPKERNEL_EXPORT CellSimplify
{
public:
- static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth);
- static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth,
- int& retNbOfFaces, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth);
- static bool tryToArrangeOppositeFace(const mcIdType *conn, int lgth, int lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, int nbOfFaces, mcIdType *retConnOfOppFace);
- static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace);
- static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace);
- static bool isFlatCell(const mcIdType* conn, mcIdType pos, int lgth, NormalizedCellType type);
+ static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth,
+ mcIdType& retNbOfFaces, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth);
+ static bool tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, mcIdType nbOfFaces, mcIdType *retConnOfOppFace);
+ static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace);
+ static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace);
+ static bool isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type);
};
}
if(nbMailleS!=0)
{
diagonalS=getDistanceBtw2Pts<SPACEDIM>(BoxS+SPACEDIM,BoxS);
- dimCaracteristicS=diagonalS/nbMailleS;
+ dimCaracteristicS=diagonalS/(double)nbMailleS;
}
double diagonalT,dimCaracteristicT=std::numeric_limits<double>::max();
if(nbMailleT!=0)
{
diagonalT=getDistanceBtw2Pts<SPACEDIM>(BoxT+SPACEDIM,BoxT);
- dimCaracteristicT=diagonalT/nbMailleT;
+ dimCaracteristicT=diagonalT/(double)nbMailleT;
}
if (printLevel>=1)
{
Interpolation1D0D();
Interpolation1D0D(const InterpolationOptions& io);
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
private:
void adjustBoundingBoxes(std::vector<double>& bbox);
};
* adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB()
**/
template<class MyMeshType, class MatrixType>
- int Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
{
constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM;
using ConnType=typename MyMeshType::MyConnType;
// create BBTree structure
// - get bounding boxes
std::vector<double> bboxes(2*SPACEDIM*numSrcElems);
- int* srcElemIdx = new int[numSrcElems];
+ ConnType* srcElemIdx = new ConnType[numSrcElems];
for(ConnType i = 0; i < numSrcElems ; ++i)
{
// get source bboxes in right order
class Interpolation2D1D : public Interpolation<Interpolation2D1D>
{
public:
- typedef std::map<int,std::set<int> > DuplicateFacesType;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
Interpolation2D1D() { setOrientation(2); }
Interpolation2D1D(const InterpolationOptions& io):Interpolation<Interpolation2D1D>(io) { }
// Main function to interpolate triangular and quadratic meshes
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
DuplicateFacesType retrieveDuplicateFaces() const
{
return _duplicate_faces;
*
*/
template<class MyMeshType, class MatrixType>
- int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
+ typename MyMeshType::MyConnType Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
{
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
typedef typename MyMeshType::MyConnType ConnType;
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbelem_type; iT++)
{
- int nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
+ ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
#include "Interpolation.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
+#include "MCIdType.hxx"
namespace INTERP_KERNEL
{
class Interpolation2D3D : public Interpolation<Interpolation2D3D>
{
public:
- typedef std::map<int,std::set<int> > DuplicateFacesType;
+ typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
INTERPKERNEL_EXPORT Interpolation2D3D();
INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io);
InterpolationCC();
InterpolationCC(const InterpolationOptions& io);
template<class MyMeshType, class MatrixType>
- int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method);
+ typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method);
private:
};
*/
//================================================================================
- template <class MyMeshType, class MatrixType, int dim>
+ template <class MyMeshType, int dim, class MatrixType, class ConnType>
void fillMatrix(const std::list< Interference > inter_of_axis[dim],
MatrixType& result,
- const int src_nb_cells[dim],
- const int tgt_nb_cells[dim],
- const int src_i_cell = 0,
- const int tgt_i_cell = 0,
- const int src_prev_area = 1,
- const int tgt_prev_area = 1,
+ const ConnType src_nb_cells[dim],
+ const ConnType tgt_nb_cells[dim],
+ const ConnType src_i_cell = 0,
+ const ConnType tgt_i_cell = 0,
+ const ConnType src_prev_area = 1,
+ const ConnType tgt_prev_area = 1,
const int axis = 0,
const double prev_value = 1.0)
{
{
for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i )
{
- double value = i->_length * prev_value;
- int src_i = i->_src_index * src_prev_area + src_i_cell;
- int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
+ double value = i->_length * prev_value;
+ ConnType src_i = i->_src_index * src_prev_area + src_i_cell;
+ ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
result[ tgt_i ].insert( std::make_pair( _TMI( src_i ), value ));
}
}
else
{
- int src_prev_area_next = src_prev_area * src_nb_cells[ axis ];
- int tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ];
+ ConnType src_prev_area_next = src_prev_area * src_nb_cells[ axis ];
+ ConnType tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ];
for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i )
{
- double value = i->_length * prev_value;
- int src_i = i->_src_index * src_prev_area + src_i_cell;
- int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
+ double value = i->_length * prev_value;
+ ConnType src_i = i->_src_index * src_prev_area + src_i_cell;
+ ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell;
// call for the next axis
- fillMatrix<MyMeshType, MatrixType, dim>(inter_of_axis, result,
- src_nb_cells, tgt_nb_cells, src_i, tgt_i,
- src_prev_area_next, tgt_prev_area_next,
- axis+1, value );
+ fillMatrix<MyMeshType, dim>(inter_of_axis, result,
+ src_nb_cells, tgt_nb_cells, src_i, tgt_i,
+ src_prev_area_next, tgt_prev_area_next,
+ axis+1, value );
}
}
}
//================================================================================
template<class MyMeshType, class MatrixType>
- int InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh,
+ typename MyMeshType::MyConnType InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh,
const MyMeshType& tgt_mesh,
MatrixType& result,
const char * method)
// create empty maps for all target elements
result.resize( tgt_mesh.getNumberOfElements() );
- const int ret = ToConnType(src_mesh.getNumberOfElements());
+ typedef typename MyMeshType::MyConnType ConnType;
+ const ConnType ret = src_mesh.getNumberOfElements();
const double eps = getPrecision();
const int dim = MyMeshType::MY_MESHDIM;
const double* src_coords[ dim ];
const double* tgt_coords[ dim ];
- int src_nb_cells[ dim ];
- int tgt_nb_cells[ dim ];
+ ConnType src_nb_cells[ dim ];
+ ConnType tgt_nb_cells[ dim ];
for ( int j = 0; j < dim; ++j )
{
- src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j ));
- tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j ));
- src_nb_cells[ j ] = ToConnType(src_mesh.nbCellsAlongAxis( _TMI( j )));
- tgt_nb_cells[ j ] = ToConnType(tgt_mesh.nbCellsAlongAxis( _TMI( j )));
+ int axis = static_cast<int>( _TMI( j ));
+ src_coords[ j ] = src_mesh.getCoordsAlongAxis( axis );
+ tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( axis );
+ src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( axis );
+ tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( axis );
}
// ============================================
switch ( dim )
{
case 3:
- fillMatrix<MyMeshType,MatrixType,3>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,3>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
case 2:
- fillMatrix<MyMeshType,MatrixType,2>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,2>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
case 1:
- fillMatrix<MyMeshType,MatrixType,1>( interferences, result, src_nb_cells,tgt_nb_cells );
+ fillMatrix<MyMeshType,1>( interferences, result, src_nb_cells,tgt_nb_cells );
break;
}
std::map< double, CConnType> src_coord_to_index[ dim ];
for ( int j = 0; j < dim; ++j )
{
- src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j ));
- src_nb_coords[j] = static_cast<CConnType>(src_mesh.nbCellsAlongAxis ( _TMIC( j ))) + 1;
+ int axis = static_cast<int>( _TMIC( j ));
+ src_coords [j] = src_mesh.getCoordsAlongAxis( axis );
+ src_nb_coords[j] = static_cast<CConnType>(src_mesh.nbCellsAlongAxis( axis )) + 1;
for (CConnType i = 0; i < src_nb_coords[j]; ++i )
src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i ));
}
const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbMailleT; iT++)
{
- int nb_nodesT = connIndxT[iT+1] - connIndxT[iT];
+ ConnType nb_nodesT = connIndxT[iT+1] - connIndxT[iT];
std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
if(nbMailleS!=0)
{
diagonalS=getDistanceBtw2Pts<SPACEDIM>(BoxS+SPACEDIM,BoxS);
- dimCaracteristicS=diagonalS/nbMailleS;
+ dimCaracteristicS=diagonalS/(double)(nbMailleS);
}
double diagonalT,dimCaracteristicT=std::numeric_limits<double>::max();
if(nbMailleT!=0)
{
diagonalT=getDistanceBtw2Pts<SPACEDIM>(BoxT+SPACEDIM,BoxT);
- dimCaracteristicT=diagonalT/nbMailleT;
+ dimCaracteristicT=diagonalT/(double)(nbMailleT);
}
_dim_caracteristic=std::min(dimCaracteristicS, dimCaracteristicT);
const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr();
for(ConnType iT=0; iT<nbelem_type; iT++)
{
- int nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
+ ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT];
std::vector<ConnType> intersecting_elems;
double bb[2*SPACEDIM];
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
* @param quadOut is a 8 doubles array filled after the following call.
*/
template<int SPACEDIM>
- inline void fillDualCellOfPolyg(const double *polygIn, int nPtsPolygonIn, double *polygOut)
+ inline void fillDualCellOfPolyg(const double *polygIn, mcIdType nPtsPolygonIn, double *polygOut)
{
//1st point
std::copy(polygIn,polygIn+SPACEDIM,polygOut);
std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind2nd(std::multiplies<double>(),0.5));
double tmp[SPACEDIM];
//
- for(int i=0;i<nPtsPolygonIn-2;i++)
+ for(mcIdType i=0;i<nPtsPolygonIn-2;i++)
{
std::transform(polygIn,polygIn+SPACEDIM,polygIn+(i+2)*SPACEDIM,tmp,std::plus<double>());
std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind2nd(std::multiplies<double>(),0.5));
template<class MyMeshType, class MyMatrix>
void Intersector3D<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
{
- int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
+ ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
coordsT.resize(SPACEDIM*nbNodesT);
std::vector<double>::iterator iter=coordsT.begin();
for (ConnType iT=0; iT<nbNodesT; iT++)
template<class MyMeshType, class MyMatrix>
void Intersector3D<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
{
- int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
+ ConnType nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
coordsS.resize(SPACEDIM*nbNodesS);
std::vector<double>::iterator iter=coordsS.begin();
for (ConnType iS=0; iS<nbNodesS; iS++)
const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
ConnType start=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
ConnType end=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1];
- int nbNodesS=end-start;
+ ConnType nbNodesS=end-start;
res.resize(nbNodesS);
std::copy(myConectS+OTT<ConnType,numPol>::conn2C(start),myConectS+OTT<ConnType,numPol>::conn2C(end),res.begin());
}
void getUElemBB(double* bb, UConnType iP);
void getUCoordinates(UConnType icell, std::vector<double>& coords);
- UConnType getNumberOfRowsOfResMatrix() const;
+ CConnType getNumberOfRowsOfResMatrix() const;
CConnType getNumberOfColsOfResMatrix() const;
void intersectCells(CConnType icellU, const std::vector<CConnType>& icellC, MyMatrix& res);
double intersectGeometry(CConnType icellT, const std::vector<CConnType>& icellC) { return asLeaf().intersectGeometry(icellT,icellC); }
for ( int j = 0; j < SPACEDIM; ++j )
{
- _coordsC [ j ] = _meshC.getCoordsAlongAxis( _TMIC( j ));
- _nbCellsC[ j ] = static_cast<CConnType>(_meshC.nbCellsAlongAxis ( _TMIC( j )));
+ int axis = static_cast<int>( _TMIC( j ));
+ _coordsC [ j ] = _meshC.getCoordsAlongAxis( axis );
+ _nbCellsC[ j ] = static_cast<CConnType>(_meshC.nbCellsAlongAxis( axis ));
}
}
}
_CU_TEMPLATE
- typename MyUMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const
+ typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const
{
return _meshU.getNumberOfElements();
}
public:
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=3;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const NumberingPolicy My_numPol=ALL_C_MODE;
_Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {}
- void setHexa(int I, int J, int K) // indices in C mode
+ void setHexa(mcIdType I, mcIdType J, mcIdType K) // indices in C mode
{
double* pCoord = _coordsU;
- for ( int k = K; k < K+2; ++k )
- for ( int j = J; j < J+2; ++j )
- for ( int i = I; i < I+2; ++i )
+ for ( mcIdType k = K; k < K+2; ++k )
+ for ( mcIdType j = J; j < J+2; ++j )
+ for ( mcIdType i = I; i < I+2; ++i )
{
*pCoord++ = _coordsC[0][i];
*pCoord++ = _coordsC[1][j];
*pCoord++ = _coordsC[2][k];
}
}
- const int *getConnectivityPtr() const
+ const mcIdType *getConnectivityPtr() const
{
- static int conn[] = { 1,0,2,3,5,4,6,7 };
+ static mcIdType conn[] = { 1,0,2,3,5,4,6,7 };
return conn;
}
- const int *getConnectivityIndexPtr() const
+ const mcIdType *getConnectivityIndexPtr() const
{
- static int conInd[] = { 0,8 };
+ static mcIdType conInd[] = { 0,8 };
return conInd;
}
void getBoundingBox(double *boundingBox) const
boundingBox[BoundingBox::ZMIN] = _coordsU[2];
boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM];
}
- NormalizedCellType getTypeOfElement(int eltId) const { return NORM_HEXA8; }
- unsigned char getNumberOfNodesOfElement(int eltId) const { return 8; }
- unsigned long getNumberOfElements() const { return 1; }
- unsigned long getNumberOfNodes() const { return 8; }
+ NormalizedCellType getTypeOfElement(mcIdType eltId) const { return NORM_HEXA8; }
+ mcIdType getNumberOfNodesOfElement(mcIdType eltId) const { return 8; }
+ mcIdType getNumberOfElements() const { return 1; }
+ mcIdType getNumberOfNodes() const { return 8; }
const double *getCoordinatesPtr() const { return _coordsU; }
void releaseTempArrays() {}
private:
{
return static_cast<mcIdType>(val);
}
+template <class T> inline T FromIdType(mcIdType val)
+{
+ return static_cast<T>(val);
+}
+
#endif
void adjustBoundingBoxes(std::vector<double>& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs);
inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes);
static int Projection(double *Coords_A, double *Coords_B,
- int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate);
+ ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate);
virtual const DuplicateFacesType* getIntersectFaces() const
{
return NULL;
}
protected :
- int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB);
+ int projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB);
void getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT);
void getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS);
- void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT);
- void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS);
+ void getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector<double>& coordsT);
+ void getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector<double>& coordsS);
void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector<double>& coordsT, std::vector<double>& coordsS, int& orientation);
double getValueRegardingOption(double val) const;
static void Rotate3DTriangle( double* PP1, double*PP2, double*PP3,
int ibox=0;
for(long icell=0; icell<nbelems; icell++)
{
- int nb_nodes_per_elem =conn_index[icell+1]-conn_index[icell];
+ ConnType nb_nodes_per_elem =conn_index[icell+1]-conn_index[icell];
//initializing bounding box limits
for(int idim=0; idim<SPACEDIM; idim++)
{
bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits<double>::max();
}
//updating the bounding box with each node of the element
- for (int j=0; j<nb_nodes_per_elem; j++)
+ for (ConnType j=0; j<nb_nodes_per_elem; j++)
{
const double* coord_node=coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(conn[OTT<ConnType,numPol>::conn2C(conn_index[icell]+j)]);
for(int idim=0; idim<SPACEDIM; idim++)
template<class MyMeshType, class MyMatrix>
void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT)
{
- int nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
+ ConnType nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iT=0; iT<nbNodesT; iT++)
for(int idim=0; idim<SPACEDIM; idim++)
template<class MyMeshType, class MyMatrix>
void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS)
{
- int nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for (ConnType iS=0; iS<nbNodesS; iS++)
for(int idim=0; idim<SPACEDIM; idim++)
* @param coordsT output val that stores coordinates of the target cell automatically resized to the right length.
*/
template<class MyMeshType, class MyMatrix>
- void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector<double>& coordsT)
+ void PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector<double>& coordsT)
{
- int nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
+ ConnType nbNodesT=_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)+1]-_connIndexT[OTT<ConnType,numPol>::ind2C(icellT)];
coordsT.resize(SPACEDIM*nbNodesT);
for (ConnType iTTmp=0; iTTmp<nbNodesT; iTTmp++)
{
* @param coordsS output val that stores coordinates of the source cell automatically resized to the right length.
*/
template<class MyMeshType, class MyMatrix>
- void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector<double>& coordsS)
+ void PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector<double>& coordsS)
{
- int nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
+ ConnType nbNodesS=_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1]-_connIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
coordsS.resize(SPACEDIM*nbNodesS);
for (ConnType iSTmp=0; iSTmp<nbNodesS; iSTmp++)
{
}
template<class MyMeshType, class MyMatrix>
- int PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB)
+ int PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB)
{
return Projection(Coords_A,Coords_B,nb_NodesA,nb_NodesB,_dim_caracteristic*_precision,_max_distance_3Dsurf_intersect,_min_dot_btw_3Dsurf_intersect,_median_plane,_do_rotate);
}
template<class MyMeshType, class MyMatrix>
int PlanarIntersector<MyMeshType,MyMatrix>::Projection(double *Coords_A, double *Coords_B,
- int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate)
+ ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate)
{
double normal_A[3]={0,0,0};
double normal_B[3]={0,0,0};
bool same_orientation;
//Find the normal to cells A and B
- int i_A1(1);
+ ConnType i_A1(1);
while(i_A1<nb_NodesA && distance2<SPACEDIM>(Coords_A,&Coords_A[SPACEDIM*i_A1])< epsilon)
i_A1++;
- int i_A2(i_A1+1);
+ ConnType i_A2(i_A1+1);
crossprod<SPACEDIM>(Coords_A, &Coords_A[SPACEDIM*i_A1], &Coords_A[SPACEDIM*i_A2],normal_A);
double normA(sqrt(dotprod<SPACEDIM>(normal_A,normal_A)));
while(i_A2<nb_NodesA && normA < epsilon)
normA = sqrt(dotprod<SPACEDIM>(normal_A,normal_A));
}
- int i_B1(1);
+ ConnType i_B1(1);
while(i_B1<nb_NodesB && distance2<SPACEDIM>(Coords_B,Coords_B+SPACEDIM*i_B1)< epsilon)
i_B1++;
- int i_B2(i_B1+1);
+ ConnType i_B2(i_B1+1);
crossprod<SPACEDIM>(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2,normal_B);
double normB(sqrt(dotprod<SPACEDIM>(normal_B,normal_B)));
while(i_B2<nb_NodesB && normB < epsilon)
coords_GA[i]=0.;
for (int j=0;j<nb_NodesA;j++)
coords_GA[i]+=Coords_A[3*j+i];
- coords_GA[i]/=nb_NodesA;
+ coords_GA[i]/=(double)nb_NodesA;
}
double G1[3],G2[3],G3[3];
for(int i=0;i<3;i++)
linear_comb[idim]/=norm;
//Project the nodes of A and B on the median plane
- for(int i_A=0; i_A<nb_NodesA; i_A++)
+ for(ConnType i_A=0; i_A<nb_NodesA; i_A++)
{
proj = dotprod<SPACEDIM>(&Coords_A[SPACEDIM*i_A],linear_comb);
for(int idim =0; idim< SPACEDIM; idim++)
Coords_A[SPACEDIM*i_A+idim] -= proj*linear_comb[idim];
}
- for(int i_B=0; i_B<nb_NodesB; i_B++)
+ for(ConnType i_B=0; i_B<nb_NodesB; i_B++)
{
proj = dotprod<SPACEDIM>(Coords_B+SPACEDIM*i_B,linear_comb);
for(int idim =0; idim< SPACEDIM; idim++)
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
ConnType iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS]);
- for(int nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
+ for(ConnType nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
{
ConnType curNodeSInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdS]);
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+curNodeSInCmode*SPACEDIM,
PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+curNodeSInCmode*SPACEDIM+SPACEDIM,triangle);
- for(int subTriS=1;subTriS<=nbNodesS-2;subTriS++)
+ for(ConnType subTriS=1;subTriS<=nbNodesS-2;subTriS++)
{
std::copy(PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM,
PlanarIntersector<MyMeshType,MyMatrix>::_coordsS+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM+SPACEDIM,
template<class MyMeshType, class MyMatrix, class ConcreteP1P1Intersector>
void PlanarIntersectorP1P1<MyMeshType,MyMatrix,ConcreteP1P1Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
{
- int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
+ ConnType nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
int orientation=1;
const ConnType *startOfCellNodeConn=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
std::vector<double> polygT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),polygT);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ for(ConnType nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdT]);
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(OTT<ConnType,numPol>::indFC(icellT),nodeIdT,polygT);
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
ConnType iS=*iter;
- int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
+ ConnType nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
const ConnType *startOfCellNodeConnS=PlanarIntersector<MyMeshType,MyMatrix>::_connectS+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS]);
- for(int nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
+ for(ConnType nodeIdS=0;nodeIdS<nbNodesS;nodeIdS++)
{
ConnType curNodeSInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnS[nodeIdS]);
std::vector<double> polygS;
{
public:
virtual ~GenericPointLocatorAlgos() { }
- virtual std::list<int> locates(const double* x, double eps) = 0;
+ virtual std::list<mcIdType> locates(const double* x, double eps) = 0;
};
template<class MyMeshType>
return retlist;
}
- static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, int nbEdges, double eps)
+ static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, mcIdType nbEdges, double eps)
{
/* with dimension 2, it suffices to check all the edges
and see if the sign of double products from the point
here XA^XC and XC^XB have different signs*/
const int SPACEDIM=MyMeshType::MY_SPACEDIM;
int* sign = new int[nbEdges];
- for (int iedge=0; iedge<nbEdges; iedge++)
+ for (mcIdType iedge=0; iedge<nbEdges; iedge++)
{
const double* A=cellPts+SPACEDIM*iedge;
const double* B=cellPts+SPACEDIM*((iedge+1)%nbEdges);
int nbfaces = cmType.getNumberOfSons2(conn_elem,conn_elem_sz);
int *sign = new int[nbfaces];
- int *connOfSon = new int[conn_elem_sz];
+ ConnType *connOfSon = new ConnType[conn_elem_sz];
for (int iface=0; iface<nbfaces; iface++)
{
NormalizedCellType typeOfSon;
return isElementContainsPoint(x,type,coords,conn_elem,conn_elem_sz,eps);
}
- static bool decideFromSign(const int* sign, int nbelem)
+ static bool decideFromSign(const int* sign, mcIdType nbelem)
{
int min_sign = 1;
int max_sign = -1;
template<class MyMeshType, class MyMatrixType>
class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0<MyMeshType,MyMatrixType>
{
- typedef typename std::map<int,std::set<int> > DuplicateFacesType;
+ typedef typename std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
public:
static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
const std::vector<ConnType>& srcCells,
MyMatrixType& matrix)
{
- int nbOfNodesT=Intersector3D<MyMeshType,MyMatrixType>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
+ ConnType nbOfNodesT=Intersector3D<MyMeshType,MyMatrixType>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
releaseArrays();
_split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
// calculate the coordinates of the nodes
typename MyMeshType::MyConnType cellSrc = *iterCellS;
- int cellSrcIdx = OTT<ConnType,numPol>::indFC(cellSrc);
+ ConnType cellSrcIdx = OTT<ConnType,numPol>::indFC(cellSrc);
NormalizedCellType normCellType=Intersector3D<MyMeshType,MyMatrixType>::_src_mesh.getTypeOfElement(cellSrcIdx);
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
const MyMeshType& src_mesh = Intersector3D<MyMeshType,MyMatrixType>::_src_mesh;
- unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes();
+ ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes();
mcIdType *polyNodes=new mcIdType[nbOfNodes4Type];
double **polyCoords = new double*[nbOfNodes4Type];
for(int i = 0;i<(int)nbOfNodes4Type;++i)
}
else
{
- std::set<int> targetCellSet;
+ std::set<ConnType> targetCellSet;
targetCellSet.insert(targetCell);
_intersect_faces.insert(std::make_pair(cellSrcIdx, targetCellSet));
}
double volume = tmp->intersectSourceCell(*iterCellS);
if(volume!=0.)
{
- int targetNodeId(tmp->getId(0));
+ ConnType targetNodeId(tmp->getId(0));
if(targetNodeId<0)
{
std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" << targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !";
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
releaseArrays();
- int nbOfNodesS=Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
+ ConnType nbOfNodesS=Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
_split.splitTargetCell(*iterCellS,nbOfNodesS,_tetra);
for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
{
{
typename MyMatrix::value_type& resRow=res[tgtCell];
- int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(tgtCell));
+ ConnType nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(tgtCell));
releaseArrays();
_split.splitTargetCell(tgtCell,nbOfNodesT,_tetra);
UnitTetraIntersectionBary b; b.init();
#endif
// split the targetCell into dual cells
- std::pair< int, std::vector<double> > subTetraNodes[24]; // a node of sub tetra and its coordinates
- const double* nodes[4]; int conn[4];
+ std::pair< ConnType, std::vector<double> > subTetraNodes[24]; // a node of sub tetra and its coordinates
+ const double* nodes[4]; ConnType conn[4];
for(int node = 0; node < 4 ; ++node)
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),
Intersector3D<MyMeshType,MyMatrix>::_target_mesh,conn[node]);
namespace INTERP_KERNEL
{
- void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords)
+ void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords)
{
if(std::distance(nodalConnBg,nodalConnEnd)!=8)
throw INTERP_KERNEL::Exception("SplitHexa8IntoTetras : input hexa do not have 8 nodes !");
case PLANAR_FACE_5:
{
tetrasNodalConn.resize(20);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[SPLIT_NODES_5_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_5_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_5_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_5_WO[3]];
conn[4]=nodalConnBg[SPLIT_NODES_5_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_5_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_5_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_5_WO[7]];
conn[8]=nodalConnBg[SPLIT_NODES_5_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_5_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_5_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_5_WO[11]];
case PLANAR_FACE_6:
{
tetrasNodalConn.resize(24);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[SPLIT_NODES_6_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_6_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_6_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_6_WO[3]];
conn[4]=nodalConnBg[SPLIT_NODES_6_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_6_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_6_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_6_WO[7]];
conn[8]=nodalConnBg[SPLIT_NODES_6_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_6_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_6_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_6_WO[11]];
{
addCoords.resize(7*3);
tetrasNodalConn.resize(24*4);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
double *tmp(&addCoords[18]);
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
double *tmp2(&addCoords[0]);
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
for(int j=0;j<4;j++,conn+=4)
{
- int tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
+ mcIdType tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]);
tmp2[0]+=coords[3*tmp3+0];
tmp2[1]+=coords[3*tmp3+1];
tmp2[2]+=coords[3*tmp3+2];
tmp2[1]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+1]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+1])/2.;
tmp2[2]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+2]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+2])/2.;
}
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
std::vector<double> dummy;
for(int i=0;i<8;i++)
{
- std::vector<int> c;
+ std::vector<mcIdType> c;
SplitHexa8IntoTetras(PLANAR_FACE_6,GENERAL_48_SUBZONES_2+i*8,GENERAL_48_SUBZONES_2+(i+1)*8,coords,c,dummy);
- int *conn2(&c[0]);
+ mcIdType *conn2(&c[0]);
for(int j=0;j<6;j++,conn+=4,conn2+=4)
{
conn[0]=conn2[0]>=0?nodalConnBg[conn2[0]]:conn2[0];
}
}
- void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords,
- std::vector<int>& tetrasNodalConn, std::vector<double>& addCoords)
+ void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords,
+ std::vector<mcIdType>& tetrasNodalConn, std::vector<double>& addCoords)
{
switch(gt)
{
if(sz!=5)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input pyra5 do not have 5 nodes !");
tetrasNodalConn.resize(8);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[4];
conn[4]=nodalConnBg[0]; conn[5]=nodalConnBg[2]; conn[6]=nodalConnBg[3]; conn[7]=nodalConnBg[4];
return ;
if(sz!=6)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input penta6 do not have 6 nodes !");
tetrasNodalConn.resize(12);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[3];
conn[4]=nodalConnBg[3]; conn[5]=nodalConnBg[5]; conn[6]=nodalConnBg[4]; conn[7]=nodalConnBg[2];
conn[8]=nodalConnBg[4]; conn[9]=nodalConnBg[2]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[3];
if(sz!=12)
throw INTERP_KERNEL::Exception("SplitIntoTetras : input octa12 (hexagone prism) do not have 12 nodes !");
tetrasNodalConn.resize(48);
- int *conn(&tetrasNodalConn[0]);
+ mcIdType *conn(&tetrasNodalConn[0]);
conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[5]; conn[3]=nodalConnBg[6];
conn[4]=nodalConnBg[6]; conn[5]=nodalConnBg[11]; conn[6]=nodalConnBg[7]; conn[7]=nodalConnBg[5];
conn[8]=nodalConnBg[7]; conn[9]=nodalConnBg[5]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[6];
}
case NORM_POLYHED:
{
- std::size_t nbOfFaces(std::count(nodalConnBg,nodalConnEnd,-1)+1);
+ mcIdType nbOfFaces(ToIdType(std::count(nodalConnBg,nodalConnEnd,-1)+1));
std::size_t nbOfTetra(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1);
addCoords.resize((nbOfFaces+1)*3);
tetrasNodalConn.resize(nbOfTetra*4);
- int *conn(&tetrasNodalConn[0]);
- const int *work(nodalConnBg);
+ mcIdType *conn(&tetrasNodalConn[0]);
+ const mcIdType *work(nodalConnBg);
double *tmp(&addCoords[0]),*tmp2(&addCoords[3*nbOfFaces]);
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
- for(std::size_t i=0;i<nbOfFaces;i++,tmp+=3)
+ for(mcIdType i=0;i<nbOfFaces;i++,tmp+=3)
{
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
- std::size_t nbOfNodesOfFace(std::distance(work,std::find(work,nodalConnEnd,-1)));
- for(std::size_t j=0;j<nbOfNodesOfFace;j++,conn+=4)
+ mcIdType nbOfNodesOfFace(ToIdType(std::distance(work,std::find(work,nodalConnEnd,-1))));
+ for(mcIdType j=0;j<nbOfNodesOfFace;j++,conn+=4)
{
- conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-((int)i+1); conn[3]=-((int)nbOfFaces+1);
+ conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=-(nbOfFaces+1);
tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2];
}
- tmp[0]/=(int)nbOfNodesOfFace; tmp[1]/=(int)nbOfNodesOfFace; tmp[2]/=(int)nbOfNodesOfFace;
+ tmp[0]/=nbOfNodesOfFace; tmp[1]/=nbOfNodesOfFace; tmp[2]/=nbOfNodesOfFace;
tmp2[0]+=tmp[0]; tmp2[1]+=tmp[1]; tmp2[2]+=tmp[2];
work+=nbOfNodesOfFace+1;
}
- tmp2[0]/=(int)nbOfFaces; tmp2[1]/=(int)nbOfFaces; tmp2[2]/=(int)nbOfFaces;
+ tmp2[0]/=nbOfFaces; tmp2[1]/=nbOfFaces; tmp2[2]/=nbOfFaces;
return ;
}
default:
26,23,18,25,24,15,6,19
};
- static const int GENERAL_48_SUBZONES_2[64] =
+ static const mcIdType GENERAL_48_SUBZONES_2[64] =
{
0,-1,-14,-5,-2,-13,-19,-15,
-1,1,-6,-14,-13,-3,-16,-19,
*
* @return a hash value for the object
*/
- int hashVal() const
+ mcIdType hashVal() const
{
return _hashVal;
}
mcIdType _nodes[3];
/// hash value for the object, calculated in the constructor
- int _hashVal;
+ mcIdType _hashVal;
};
/**
* @param key a TriangleFaceKey object
* @return an integer hash value for key
*/
- int operator()(const INTERP_KERNEL::TriangleFaceKey& key) const
+ mcIdType operator()(const INTERP_KERNEL::TriangleFaceKey& key) const
{
return key.hashVal();
}
template<class MyMeshType>
class SplitterTetra
{
- public:
+ public:
+ typedef typename MyMeshType::MyConnType ConnType;
SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId);
- SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn = 0);
+ SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn = 0);
~SplitterTetra();
double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0);
double intersectSourceFace(const NormalizedCellType polyType,
- const int polyNodesNbr,
- const mcIdType *const polyNodes,
+ const ConnType polyNodesNbr,
+ const ConnType *const polyNodes,
const double *const *const polyCoords,
const double dimCaracteristic,
const double precision,
double intersectTetra(const double** tetraCorners);
- typename MyMeshType::MyConnType getId(mcIdType id) { return _conn[id]; }
+ ConnType getId(mcIdType id) { return _conn[id]; }
void splitIntoDualCells(SplitterTetra<MyMeshType> **output);
- void splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId);
+ void splitMySelfForDual(double* output, int i, ConnType& nodeId);
void clearVolumesCache();
private:
inline static void CheckIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL);
inline static void CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL);
- inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum);
- inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node);
+ inline void calculateNode(ConnType globalNodeNum);
+ inline void calculateNode2(ConnType globalNodeNum, const double* node);
inline void calculateVolume(TransformedTriangle& tri, const TriangleFaceKey& key);
inline void calculateSurface(TransformedTriangle& tri, const TriangleFaceKey& key);
TetraAffineTransform* _t;
/// HashMap relating node numbers to transformed nodes, used for caching
- HashMap< typename MyMeshType::MyConnType , double* > _nodes;
+ HashMap< ConnType , double* > _nodes;
/// HashMap relating triangular faces to calculated volume contributions, used for caching
HashMap< TriangleFaceKey, double > _volumes;
const MyMeshType& _src_mesh;
// node id of the first node in target mesh in C mode.
- typename MyMeshType::MyConnType _conn[4];
+ ConnType _conn[4];
double _coords[12];
inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);//to suppress
inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress
//template<int n>
- inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);//to suppress
+ inline void calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts);//to suppress
private:
const MyMeshTypeT& _target_mesh;
const MyMeshTypeS& _src_mesh;
*/
template<class MyMeshTypeT, class MyMeshTypeS>
//template<int n>
- inline void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts)
+ inline void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts)
{
barycenter[0] = barycenter[1] = barycenter[2] = 0.0;
for(int i = 0; i < n ; ++i)
barycenter[2] += pt[2];
}
- barycenter[0] /= n;
- barycenter[1] /= n;
- barycenter[2] /= n;
+ barycenter[0] /= (double)n;
+ barycenter[1] /= (double)n;
+ barycenter[2] /= (double)n;
}
/**
* \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z).
*/
template<class MyMeshType>
- SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn): _t(0),_src_mesh(srcMesh)
+ SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(0),_src_mesh(srcMesh)
{
if(!conn)
{ _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; }
SplitterTetra<MyMeshType>::~SplitterTetra()
{
delete _t;
- for(HashMap< int, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter)
+ for(typename HashMap< ConnType, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter)
delete[] iter->second;
}
// get type of cell
NormalizedCellType normCellType=_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(element));
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
- unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(element)) : cellModelCell.getNumberOfNodes();
+ ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(element)) : cellModelCell.getNumberOfNodes();
// halfspace filtering
bool isOutside[8] = {true, true, true, true, true, true, true, true};
bool isTargetOutside = false;
// calculate the coordinates of the nodes
ConnType *cellNodes=new ConnType[nbOfNodes4Type];
- for(int i = 0;i<(int)nbOfNodes4Type;++i)
+ for(ConnType i = 0;i<nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT<ConnType,numPol>::indFC(element), _src_mesh);
// get nb of sons of a cell
const ConnType* rawCellConn = _src_mesh.getConnectivityPtr() + OTT<ConnType,numPol>::conn2C( _src_mesh.getConnectivityIndexPtr()[ element ]);
- const int rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ];
+ const ConnType rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ];
unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes);
for(unsigned ii = 0 ; ii < nbOfSons; ++ii)
{
// get sons connectivity
NormalizedCellType faceType;
- mcIdType *faceNodes, nbFaceNodes=-1;
+ ConnType *faceNodes, nbFaceNodes=-1;
if ( cellModelCell.isDynamic() )
{
- faceNodes=new mcIdType[nbOfNodes4Type];
+ faceNodes=new ConnType[nbOfNodes4Type];
nbFaceNodes = cellModelCell.fillSonCellNodalConnectivity2(ii,rawCellConn,rawNbCellNodes,faceNodes,faceType);
- for ( int i = 0; i < nbFaceNodes; ++i )
+ for ( ConnType i = 0; i < nbFaceNodes; ++i )
faceNodes[i] = OTT<ConnType,numPol>::coo2C(faceNodes[i]);
}
else
case NORM_POLYGON:
{
- int nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles
- for ( int iTri = 0; iTri < nbTria; ++iTri )
+ ConnType nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles
+ for ( ConnType iTri = 0; iTri < nbTria; ++iTri )
{
TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1+iTri], faceNodes[2+iTri]);
if(_volumes.find(key) == _volumes.end())
*/
template<class MyMeshType>
double SplitterTetra<MyMeshType>::intersectSourceFace(const NormalizedCellType polyType,
- const int polyNodesNbr,
- const mcIdType *const polyNodes,
+ const ConnType polyNodesNbr,
+ const ConnType *const polyNodes,
const double *const *const polyCoords,
const double dimCaracteristic,
const double precision,
bool isTargetOutside = false;
// calculate the coordinates of the nodes
- for(int i = 0;i<(int)polyNodesNbr;++i)
+ for(ConnType i = 0;i<polyNodesNbr;++i)
{
- const int globalNodeNum = polyNodes[i];
+ const ConnType globalNodeNum = polyNodes[i];
if(_nodes.find(globalNodeNum) == _nodes.end())
{
calculateNode2(globalNodeNum, polyCoords[i]);
double planeConstant = dot(planeNormal, coordsTetraTriNode1);
if (IsFacesCoplanar(planeNormal, planeConstant, polyCoords, precision))
{
- int nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
- for (int iTri = 0; iTri < nbrPolyTri; ++iTri)
+ ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
+ for (ConnType iTri = 0; iTri < nbrPolyTri; ++iTri)
{
double volume = CalculateIntersectionSurfaceOfCoplanarTriangles(planeNormal,
planeConstant,
case NORM_POLYGON:
{
- int nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
- for (int iTri = 0; iTri < nbrPolyTri; ++iTri)
+ ConnType nbrPolyTri = polyNodesNbr - 2; // split polygon into nbrPolyTri triangles
+ for (ConnType iTri = 0; iTri < nbrPolyTri; ++iTri)
{
TriangleFaceKey key = TriangleFaceKey(polyNodes[0], polyNodes[1 + iTri], polyNodes[2 + iTri]);
if (_volumes.find(key) == _volumes.end())
if(!isTargetOutside)
{
const CellModel& cellModelCell=CellModel::GetCellModel(NORM_TETRA4);
- mcIdType cellNodes[4] = { 0, 1, 2, 3 }, faceNodes[3];
+ ConnType cellNodes[4] = { 0, 1, 2, 3 }, faceNodes[3];
for(unsigned ii = 0 ; ii < 4 ; ++ii)
{
template<class MyMeshTypeT, class MyMeshTypeS>
void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
{
- const int *refConn(_target_mesh.getConnectivityPtr());
- const int *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]);
+ typedef typename MyMeshTypeT::MyConnType TConnType;
+ const TConnType *refConn(_target_mesh.getConnectivityPtr());
+ const TConnType *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]);
INTERP_KERNEL::NormalizedCellType gt(_target_mesh.getTypeOfElement(targetCell));
- std::vector<int> tetrasNodalConn;
+ std::vector<TConnType> tetrasNodalConn;
std::vector<double> addCoords;
const double *coords(_target_mesh.getCoordinatesPtr());
SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords);
std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras);
double tmp[12];
- int tmp2[4];
+ typename MyMeshTypeS::MyConnType tmp2[4];
for(std::size_t i=0;i<nbTetras;i++)
{
for(int j=0;j<4;j++)
{
- int cellId(tetrasNodalConn[4*i+j]);
+ TConnType cellId(tetrasNodalConn[4*i+j]);
tmp2[j]=cellId;
if(cellId>=0)
{
_node_ids.resize(8);
tetra.reserve(1);
const double *nodes[4];
- int conn[4];
+ ConnType conn[4];
for(int node = 0; node < 4 ; ++node)
{
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),_target_mesh,conn[node]);
for(int i = 0; i < 5; ++i)
{
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int j = 0; j < 4; ++j)
{
conn[j] = subZone[ SPLIT_NODES_5[4*i+j] ];
for(int i = 0; i < 6; ++i)
{
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int j = 0; j < 4; ++j)
{
conn[j] = subZone[SPLIT_NODES_6[4*i+j]];
// nodes to use for tetrahedron
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
// get the cell center
conn[0] = 14;
nodes[0] = getCoordsOfSubNode(conn[0]);
// create tetrahedra
const double* nodes[4];
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 4; ++j)
// get type of cell and nb of cell nodes
NormalizedCellType normCellType=_target_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(targetCell));
const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
- unsigned nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell)) : cellModelCell.getNumberOfNodes();
+ ConnType nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell)) : cellModelCell.getNumberOfNodes();
// get nb of cell sons (faces)
const ConnType* rawCellConn = _target_mesh.getConnectivityPtr() + OTT<ConnType,numPol>::conn2C( _target_mesh.getConnectivityIndexPtr()[ targetCell ]);
- const int rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ];
+ const ConnType rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ];
unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes);
// indices of nodes of a son
static std::vector<ConnType> allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1
- while ( allNodeIndices.size() < nbOfCellNodes )
+ while ( allNodeIndices.size() < (std::size_t)nbOfCellNodes )
allNodeIndices.push_back( static_cast<ConnType>(allNodeIndices.size()) );
- std::vector<int> classicFaceNodes(4);
+ std::vector<ConnType> classicFaceNodes(4);
if(cellModelCell.isQuadratic())
throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !");
- int* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0];
+ ConnType* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0];
// nodes of tetrahedron
- int conn[4];
+ typename MyMeshTypeS::MyConnType conn[4];
const double* nodes[4];
nodes[3] = getCoordsOfSubNode2( nbOfCellNodes,conn[3]); // barycenter
#include "InterpKernelGeo2DEdgeLin.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "MCIdType.hxx"
#include <sstream>
#include <cmath>
namespace INTERP_KERNEL
{
- inline void calculateBarycenterDyn(const double **pts, int nbPts,
+ inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts,
int dim, double *bary);
- inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim);
- inline double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim);
inline double calculateLgthForSeg2(const double *p1, const double *p2, int spaceDim)
// ===================================
// Calculate Normal Vector for Polygon
// ===================================
- inline void calculateNormalForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline void calculateNormalForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
double *normal)
{
double coordOfBary[3];
// ==========================
// Calculate Area for Polygon
// ==========================
- inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs,
+ inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs,
int spaceDim)
{
double ret=0.;
double coordOfBary[3];
calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary);
- for ( int i=0; i<nbOfPtsInPolygs; i++ )
+ for ( mcIdType i=0; i<nbOfPtsInPolygs; i++ )
{
double tmp = calculateAreaForTria(coords[i],coords[(i+1)%nbOfPtsInPolygs],
coordOfBary,spaceDim);
return ret;
}
- double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs, int spaceDim)
+ double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim)
{
if(nbOfPtsInPolygs%2==0)
if(spaceDim==2)
{
std::vector<Node *> nodes(nbOfPtsInPolygs);
- for(int i=0;i<nbOfPtsInPolygs;i++)
+ for(mcIdType i=0;i<nbOfPtsInPolygs;i++)
nodes[i]=new Node(coords[i][0],coords[i][1]);
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
double ret=pol->getArea();
* polyhedron
*/
template<class ConnType, NumberingPolicy numPol>
- inline double calculateVolumeForPolyh2(const ConnType *connec, int lgth, const double *coords)
+ inline double calculateVolumeForPolyh2(const ConnType *connec, mcIdType lgth, const double *coords)
{
std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1;
double volume=0.;
* @param res must be of size at least 3 to store the result.
*/
template<class ConnType, NumberingPolicy numPol>
- inline void areaVectorOfPolygon(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void areaVectorOfPolygon(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int ptId=0;ptId<lgth;ptId++)
+ for(mcIdType ptId=0;ptId<lgth;ptId++)
{
const double *pti=coords+3*OTT<ConnType,numPol>::coo2C(connec[ptId]);
const double *pti1=coords+3*OTT<ConnType,numPol>::coo2C(connec[(ptId+1)%lgth]);
}
template<class ConnType, NumberingPolicy numPol>
- inline void computePolygonBarycenter3D(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void computePolygonBarycenter3D(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
double area[3];
areaVectorOfPolygon<ConnType,numPol>(connec,lgth,coords,area);
{
area[0]/=norm; area[1]/=norm; area[2]/=norm;
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int i=1;i<lgth-1;i++)
+ for(mcIdType i=1;i<lgth-1;i++)
{
double v[3];
double tmpArea[3];
throw INTERP_KERNEL::Exception("computePolygonBarycenter3D : lgth of polygon is < 1 !");
norm=0.;
double v[3];
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
v[0]=coords[3*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])]-coords[3*OTT<ConnType,numPol>::coo2C(connec[i])];
v[1]=coords[3*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])+1]-coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+1];
else
{
res[0]=0.; res[1]=0.; res[2]=0.;
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
res[0]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])];
res[1]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+1];
res[2]+=coords[3*OTT<ConnType,numPol>::coo2C(connec[i])+2];
}
- res[0]/=lgth; res[1]/=lgth; res[2]/=lgth;
+ res[0]/=FromIdType<double>(lgth); res[1]/=FromIdType<double>(lgth); res[2]/=FromIdType<double>(lgth);
return;
}
}
}
template<class ConnType, NumberingPolicy numPol>
- inline void barycenterOfPolyhedron(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void barycenterOfPolyhedron(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1;
res[0]=0.; res[1]=0.; res[2]=0.;
{
}
- inline void calculateBarycenterDyn(const double **pts, int nbPts,
+ inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts,
int dim, double *bary)
{
for(int i=0;i<dim;i++)
{
double temp=0.;
- for(int j=0;j<nbPts;j++)
+ for(mcIdType j=0;j<nbPts;j++)
{
temp+=pts[j][i];
}
- bary[i]=temp/nbPts;
+ bary[i]=temp/FromIdType<double>(nbPts);
}
}
template<int SPACEDIM>
- inline void calculateBarycenterDyn2(const double *pts, int nbPts, double *bary)
+ inline void calculateBarycenterDyn2(const double *pts, mcIdType nbPts, double *bary)
{
for(int i=0;i<SPACEDIM;i++)
{
double temp=0.;
- for(int j=0;j<nbPts;j++)
+ for(mcIdType j=0;j<nbPts;j++)
{
temp+=pts[j*SPACEDIM+i];
}
- bary[i]=temp/nbPts;
+ bary[i]=temp/FromIdType<double>(nbPts);
}
}
- inline void computePolygonBarycenter2DEngine(double **coords, int lgth, double *res)
+ inline void computePolygonBarycenter2DEngine(double **coords, mcIdType lgth, double *res)
{
double area=0.;
res[0]=0.; res[1]=0.;
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
{
double cp=coords[i][0]*coords[(i+1)%lgth][1]-coords[i][1]*coords[(i+1)%lgth][0];
area+=cp;
}
template<class ConnType, NumberingPolicy numPol>
- inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res)
+ inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
double **coords2=new double *[lgth];
- for(int i=0;i<lgth;i++)
+ for(mcIdType i=0;i<lgth;i++)
coords2[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
computePolygonBarycenter2DEngine(coords2,lgth,res);
delete [] coords2;
}
- inline void computeQPolygonBarycenter2D(double **coords, int nbOfPtsInPolygs, int spaceDim, double *res)
+ inline void computeQPolygonBarycenter2D(double **coords, mcIdType nbOfPtsInPolygs, int spaceDim, double *res)
{
if(nbOfPtsInPolygs%2==0)
{
if(spaceDim==2)
{
std::vector<Node *> nodes(nbOfPtsInPolygs);
- for(int i=0;i<nbOfPtsInPolygs;i++)
+ for(mcIdType i=0;i<nbOfPtsInPolygs;i++)
nodes[i]=new Node(coords[i][0],coords[i][1]);
QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
pol->getBarycenter(res);
return sqrt(sDist);
}
- double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords)
+ double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords)
{
std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd);
if(nbOfEdges<3)
namespace INTERP_KERNEL
{
template<class ConnType, NumberingPolicy numPolConn, int SPACEDIM>
- double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords);
+ double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords);
template<class ConnType, NumberingPolicy numPolConn>
- double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim);
+ double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim);
template<class ConnType, NumberingPolicy numPolConn, int SPACEDIM>
- void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res);
+ void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res);
template<class ConnType, NumberingPolicy numPolConn>
- void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res);
+ void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res);
double INTERPKERNEL_EXPORT OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3);
namespace INTERP_KERNEL
{
template<class ConnType, NumberingPolicy numPol, int SPACEDIM>
- double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords)
+ double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords)
{
switch(type)
{
}
template<class ConnType, NumberingPolicy numPolConn>
- double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim)
+ double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim)
{
if(spaceDim==3)
return computeVolSurfOfCell<ConnType,numPolConn,3>(type,connec,lgth,coords);
template<class ConnType, NumberingPolicy numPol,int SPACEDIM>
- void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res)
+ void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res)
{
switch(type)
{
}
template<class ConnType, NumberingPolicy numPolConn>
- void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res)
+ void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res)
{
if(spaceDim==3)
return computeBarycenter<ConnType,numPolConn,3>(type,connec,lgth,coords,res);
#define ERR_TOL 1.0e-8
-typedef std::vector<std::map<int,double> > IntersectionMatrix;
+typedef std::vector<std::map<mcIdType,double> > IntersectionMatrix;
namespace INTERP_KERNEL
{
{
if(iter->count(i) != 0.0)
{
- std::map<int, double>::const_iterator iter2 = iter->find(i);
+ std::map<mcIdType, double>::const_iterator iter2 = iter->find(i);
vol += fabs(iter2->second);
}
}
double MeshTestToolkit<SPACEDIM,MESHDIM>::sumCol(const IntersectionMatrix& m, int i) const
{
double vol = 0.0;
- const std::map<int, double>& col = m[i];
- for(std::map<int, double>::const_iterator iter = col.begin() ; iter != col.end() ; ++iter)
+ const std::map<mcIdType, double>& col = m[i];
+ for(std::map<mcIdType, double>::const_iterator iter = col.begin() ; iter != col.end() ; ++iter)
{
vol += fabs(iter->second);
}
std::vector<double> volumes;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
volumes.push_back(fabs(iter2->second));
}
int i = 0;
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
if(m2.at(j).count(i) == 0)
{
if(!epsilonEqual(iter2->second, 0.0, _precision))
for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
const double v1 = fabs(iter2->second);
//if(m2[j - 1].count(i+1) > 0)
// {
- std::map<int, double> theMap = m2.at(j);
+ std::map<mcIdType, double> theMap = m2.at(j);
const double v2 = fabs(theMap[i]);
if(v1 != v2)
{
bool isDiagonal = true;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
- int j = iter2->first;
+ mcIdType j = iter2->first;
const double vol = iter2->second;
if(vol != 0.0 && (i != j))
{
std::cout << "Intersection matrix is " << std::endl;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl;
}
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
numElems += iter->size();
- for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
+ for(std::map<mcIdType, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
if(!INTERP_KERNEL::epsilonEqual(iter2->second, 0.0, VOL_PREC))
{
#include "ThreeDSurfProjectionTest.hxx"
#include "PlanarIntersector.txx"
+#include "MCIdType.hxx"
class MyMeshType
{
static const int MY_SPACEDIM=3;
static const int MY_MESHDIM=3;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
};
class MyMatrixType
#include "TetraAffineTransform.hxx"
#include "InterpolationUtils.hxx"
#include "SplitterTetra.txx"
+#include "MCIdType.hxx"
#include <iostream>
{
struct __MESH_DUMMY
{
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
static const int MY_SPACEDIM=3;
};
static SplitterTetra<__MESH_DUMMY>* buildSplitterTetra()
{
- const int conn[4] = { 0,1,2,3 };
+ const mcIdType conn[4] = { 0,1,2,3 };
const double targetCoords[] = { -20., 0.,10.,
-20.,10.,10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_1()
{
- const int conn[4] = { 0,1,2 };
+ const mcIdType conn[4] = { 0,1,2 };
const double sourceCoords[] = { -20., 0., 10.,
-12., 0., 10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_2()
{
- const int conn[4] = { 0,1,2,3 };
+ const mcIdType conn[4] = { 0,1,2,3 };
const double sourceCoords[] = { -20., 0., 10.,
-12., 0., 10.,
void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_3()
{
- const int conn[4] = { 0,1,2 };
+ const mcIdType conn[4] = { 0,1,2 };
const double sourceCoords[] = { -20., 0., 16.,
-18., 0., 16.,
#include "TetraAffineTransform.hxx"
#include "InterpolationUtils.hxx"
#include "SplitterTetra.txx"
+#include "MCIdType.hxx"
#include <iostream>
struct __MESH_DUMMY
{
- typedef int MyConnType;
+ typedef mcIdType MyConnType;
};
void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13()
75,150,75,
100,100,100};
- int conn[4] = { 0,1,2,3 };
+ mcIdType conn[4] = { 0,1,2,3 };
const double* tnodes[4]={ T, T+3, T+6, T+9 };
const double* snodes[4]={ S, S+3, S+6, S+9 };