#include <algorithm>
+#include <functional>
+
+
using namespace INTERP_KERNEL;
MergePoints::MergePoints():_ass1Start1(0),_ass1End1(0),_ass1Start2(0),_ass1End2(0),
}
}
-bool Edge::isEqual(const Edge& other) const
+void Edge::dumpToCout(const std::map<INTERP_KERNEL::Node *,int>& mapp, int index) const
{
- return _start->isEqual(*other._start) && _end->isEqual(*other._end);
+ auto sI(mapp.find(getStartNode())), eI(mapp.find(getEndNode()));
+ int start = (sI == mapp.end() ? -1 : sI->second), end = (eI == mapp.end() ? -1 : eI->second);
+ std::string locs;
+ switch (getLoc())
+ {
+ case FULL_IN_1: locs="FULL_IN_1"; break;
+ case FULL_ON_1: locs="FULL_ON_1"; break;
+ case FULL_OUT_1: locs="FULL_OUT_1"; break;
+ case FULL_UNKNOWN: locs="FULL_UNKNOWN"; break;
+ default: locs="oh my God! This is so wrong.";
+ }
+ std::cout << "Edge [" << index << "] : ("<< std::hex << this << std::dec << ") -> (" << start << ", " << end << ")\t" << locs << std::endl;
}
-inline bool eqpair(const std::pair<double,Node *>& p1, const std::pair<double,Node *>& p2)
+bool Edge::isEqual(const Edge& other) const
{
- return fabs(p1.first-p2.first)<QuadraticPlanarPrecision::getPrecision();
+ return _start->isEqual(*other._start) && _end->isEqual(*other._end);
}
/**
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)
{
+ int startId=(*mapp1.find(_start)).second;
+ int endId=(*mapp1.find(_end)).second;
+ if (! addNodes.size()) // quick way out, no new node to add.
+ {
+ edgesThis.push_back(startId);
+ edgesThis.push_back(endId);
+ return;
+ }
+
Bounds b;
b.prepareForAggregation();
b.aggregate(getBounds());
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());
- int startId=(*mapp1.find(_start)).second;
- int endId=(*mapp1.find(_end)).second;
std::vector<int> tmpp;
- std::vector< std::pair<double,Node *> >::const_iterator itend=std::unique(an2.begin(),an2.end(),eqpair);
- for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=itend;it++)
+ for(std::vector< std::pair<double,Node *> >::const_iterator it=an2.begin();it!=an2.end();it++)
{
int idd=(*mapp2.find((*it).second)).second;
if((*it).first<QuadraticPlanarPrecision::getPrecision())
edgesThis.push_back(tmpp2[i+1]);
}
}
+
+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
+{
+ int 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)
+ {
+ edgesThis.push_back(tmp[0]);
+ edgesThis.push_back(tmp[1]);
+ }
+ else
+ {
+ edgesThis.push_back(tmp[1]);
+ edgesThis.push_back(tmp[0]);
+ }
+}
+
+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,
+ unsigned skipStartOrEnd,
+ std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
+{
+ if (skipStartOrEnd != 1) // see meaning in splitAbs()
+ _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
+ if (skipStartOrEnd != 2)
+ _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther);
+}