computeCandidateMate and isAlreadyMatched

omp-walther
StefanoPetrilli 3 years ago
parent 1140669ea7
commit b4bfdd83e5

@ -157,6 +157,25 @@ inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
MilanLongInt* verLocInd, MilanLongInt* verLocInd,
MilanReal* edgeLocWeight); MilanReal* edgeLocWeight);
inline bool isAlreadyMatched(MilanLongInt k,
MilanLongInt* verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector <MilanLongInt> &GMate,
MilanLongInt* Mate,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap);
inline MilanLongInt computeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2,
MilanReal* edgeLocWeight,
MilanLongInt k,
MilanLongInt* verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector <MilanLongInt> &GMate,
MilanLongInt* Mate,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP
( (
MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt NLVer, MilanLongInt NLEdge,

@ -443,13 +443,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
w = -1; w = -1;
heaviestEdgeWt = MilanRealMin; //Assign the smallest Value possible first LDBL_MIN heaviestEdgeWt = MilanRealMin; //Assign the smallest Value possible first LDBL_MIN
for (k = adj1; k < adj2; k++) { for (k = adj1; k < adj2; k++) {
if ((verLocInd[k] < StartIndex) || (verLocInd[k] > EndIndex)) { //Is it a ghost vertex? if (isAlreadyMatched(k, verLocInd, StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) continue;
if (GMate[Ghost2LocalMap[verLocInd[k]]] >= 0)// Already matched
continue;
} else { //A local vertex
if (Mate[verLocInd[k] - StartIndex] >= 0) // Already matched
continue;
}
if ((edgeLocWeight[k] > heaviestEdgeWt) || if ((edgeLocWeight[k] > heaviestEdgeWt) ||
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) { ((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
@ -1533,23 +1527,67 @@ inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
return w; return w;
} }
/* /**
inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1, * //TODO documentation
MilanLongInt adj2, * @param k
* @param verLocInd
* @param StartIndex
* @param EndIndex
* @param GMate
* @param Mate
* @param Ghost2LocalMap
* @return
*/
inline bool isAlreadyMatched(MilanLongInt k,
MilanLongInt* verLocInd, MilanLongInt* verLocInd,
MilanReal* edgeLocWeight) MilanLongInt StartIndex,
{ MilanLongInt EndIndex,
MilanInt w = -1; vector <MilanLongInt> &GMate,
MilanReal heaviestEdgeWt = MilanRealMin; //Assign the smallest Value possible first LDBL_MIN MilanLongInt* Mate,
for (k = adj1; k < adj2; k++) { map <MilanLongInt, MilanLongInt> &Ghost2LocalMap
) {
if ((verLocInd[k] < StartIndex) || (verLocInd[k] > EndIndex)) { //Is it a ghost vertex? if ((verLocInd[k] < StartIndex) || (verLocInd[k] > EndIndex)) { //Is it a ghost vertex?
if (GMate[Ghost2LocalMap[verLocInd[k]]] >= 0)// Already matched if (GMate[Ghost2LocalMap[verLocInd[k]]] >= 0)// Already matched
continue; return true;
} else { //A local vertex } else { //A local vertex
if (Mate[verLocInd[k] - StartIndex] >= 0) // Already matched if (Mate[verLocInd[k] - StartIndex] >= 0) // Already matched
continue; return true;
}
return false;
} }
/**
* //TODO documentation
* @param adj1
* @param adj2
* @param edgeLocWeight
* @param k
* @param verLocInd
* @param StartIndex
* @param EndIndex
* @param GMate
* @param Mate
* @param Ghost2LocalMap
* @return
*/
inline MilanLongInt computeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2,
MilanReal* edgeLocWeight,
MilanLongInt k,
MilanLongInt* verLocInd,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
vector <MilanLongInt> &GMate,
MilanLongInt* Mate,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap)
{
MilanInt w = -1;
MilanReal heaviestEdgeWt = MilanRealMin; //Assign the smallest Value possible first LDBL_MIN
for (k = adj1; k < adj2; k++) {
if (isAlreadyMatched(k, verLocInd, StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) continue;
if ((edgeLocWeight[k] > heaviestEdgeWt) || if ((edgeLocWeight[k] > heaviestEdgeWt) ||
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) { ((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
heaviestEdgeWt = edgeLocWeight[k]; heaviestEdgeWt = edgeLocWeight[k];
@ -1558,7 +1596,6 @@ inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
} //End of for loop } //End of for loop
return w; return w;
} }
*/
#endif #endif
#endif #endif
Loading…
Cancel
Save