-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
/*!
* 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=mapThis.find(const_cast<Node *>(this));
- if(it!=mapThis.end())
+ 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;
+ *nodeId=(*it).second+offset1;
return;
}
- it=mapOther.find(const_cast<Node *>(this));
- if(it!=mapOther.end())
+ it=mapThis.find(const_cast<Node *>(this));
+ if(it!=mapThis.end())
{
- *nodeId=(*it).second+offset1;
+ *nodeId=(*it).second;
return;
}
it=mapAddCoo.find(const_cast<Node *>(this));
/*!
* 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())
+ if(sz1!=addCoo.size() // newly created point
+ || (tmp >= offset2 // or previously created point merged with a neighbour
+ && (pointsOther.size() == 0 || pointsOther.back() != tmp)))
{
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 ;
- if(tmp<offset1)
- pointsOther.push_back(tmp);
+ pointsOther.push_back(tmp);
}