Skip to content

Commit

Permalink
Weight generation for integrated bilinear generalized barycentric sch…
Browse files Browse the repository at this point in the history
…emes for meshes with holes (#114)

* Added conditional in generalized barycentric coordinates weight function.

* Integrated bilinear and generalized barycentric schemes for meshes with holes.

* The integrated schemes intbilin and intbilingb now normalize rows by default when the source mesh has holes.
  • Loading branch information
dmarsico1 authored Jun 14, 2023
1 parent 03192f6 commit 2396840
Show file tree
Hide file tree
Showing 3 changed files with 1,123 additions and 508 deletions.
38 changes: 38 additions & 0 deletions src/FiniteVolumeTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,44 @@ void GeneralizedBarycentricCoordinates(

}

//Use nearest neighbor weighting if there are too many edges. This is necessary to avoid numerical instability.

if( iEdges > 30 ){

int iNodeMin = 0;

Node nodeZero = nodesFaceI[0];

Node nodeDiffZeroQ = nodeZero - nodeQ;

double dMinDist = nodeDiffZeroQ.Magnitude();

for (int i = 0; i < iEdges; i++){

Node nodeI = nodesFaceI[i];

Node nodeDiff = nodeI - nodeQ;

double dMagNodeDiff = nodeDiff.Magnitude();

if ( dMagNodeDiff < dMinDist){

dMinDist = dMagNodeDiff;

iNodeMin = i;

}

}

std::fill(vecWeights.begin(), vecWeights.end(), 0);

vecWeights[iNodeMin] = 1;

return;

}


//Subtriangles with the sample point as a vertex (q,m,m+1) where q is the sample point
std::vector<double> vecTriangleSubAreas(iEdges);
Expand Down
Loading

0 comments on commit 2396840

Please sign in to comment.