Changeset 2500 for XIOS2/trunk/extern/remap/src/meshutil.cpp
- Timestamp:
- 05/12/23 11:34:43 (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS2/trunk/extern/remap/src/meshutil.cpp
r2398 r2500 11 11 using namespace std; 12 12 13 double computePolygoneArea(Elt& a, const Coord &pole)13 void computePolygonGeometry(Elt& a, const Coord &pole, double& area, Coord& bary) 14 14 { 15 15 using N = uint32_t; … … 49 49 vector<N> indices_a_gno = mapbox::earcut<N>(polyline); 50 50 51 double area_a_gno=0 ;51 area=0 ; 52 52 for(int i=0;i<indices_a_gno.size()/3;++i) 53 53 { … … 55 55 Coord x1 = Ox * polyline[0][indices_a_gno[3*i+1]][0] + Oy* polyline[0][indices_a_gno[3*i+1]][1] + Oz ; 56 56 Coord x2 = Ox * polyline[0][indices_a_gno[3*i+2]][0] + Oy* polyline[0][indices_a_gno[3*i+2]][1] + Oz ; 57 area_a_gno+=triarea(x0 * (1./norm(x0)),x1* (1./norm(x1)), x2* (1./norm(x2))) ; 58 } 59 57 area+=triarea(x0 * (1./norm(x0)),x1* (1./norm(x1)), x2* (1./norm(x2))) ; 58 } 59 60 61 bary = exact_barycentre(dstPolygon.data(),na) ; 62 63 // check signed area 64 double signedArea = 0 ; 65 for(int n=0; n<na;n++) signedArea+= a_gno[n].x*a_gno[(n+1)%na].y-a_gno[(n+1)%na].x*a_gno[n].y ; 66 if (signedArea<0) 67 { 68 bary = bary * (-1.) ; 69 switchOrientation(a.n, a.vertex,a.edge,a.d) ; 70 } 71 60 72 vect_points.clear(); 61 73 polyline.clear(); 62 74 indices_a_gno.clear(); 63 return area_a_gno ; 75 64 76 } 65 77 … … 67 79 void cptEltGeom(Elt& elt, const Coord &pole) 68 80 { 69 orient(elt.n, elt.vertex, elt.edge, elt.d, elt.x);70 normals(elt, pole);71 Coord gg;72 elt.area = airbar(elt.n, elt.vertex, elt.edge, elt.d, pole, gg);73 elt.x = gg;81 orient(elt.n, elt.vertex, elt.edge, elt.d, elt.x); 82 normals(elt, pole); 83 // Coord gg; 84 // elt.area = airbar(elt.n, elt.vertex, elt.edge, elt.d, pole, gg); 85 // elt.x = gg; 74 86 // overwrite area computation 75 87 76 elt.area = computePolygoneArea(elt, pole) ; 88 computePolygonGeometry(elt, pole, elt.area, elt.x) ; 89 normals(elt, pole); 90 77 91 } 78 92
Note: See TracChangeset
for help on using the changeset viewer.