Changeset 2505 for XIOS3/branches
- Timestamp:
- 05/23/23 16:20:10 (13 months ago)
- Location:
- XIOS3/branches/xios-3.0-beta
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/branches/xios-3.0-beta/extern/remap/src/meshutil.cpp
r2468 r2505 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 of polygons on gnomonic plan => if <0 then switch barycenter and invert vertex numbering 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 delete [] a_gno ; 64 return area_a_gno ; 75 65 76 } 66 77 … … 68 79 void cptEltGeom(Elt& elt, const Coord &pole) 69 80 { 70 orient(elt.n, elt.vertex, elt.edge, elt.d, elt.x);71 normals(elt, pole);72 Coord gg;73 elt.area = airbar(elt.n, elt.vertex, elt.edge, elt.d, pole, gg);74 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; 75 86 // overwrite area computation 76 87 77 elt.area = computePolygoneArea(elt, pole) ; 88 computePolygonGeometry(elt, pole, elt.area, elt.x) ; 89 normals(elt, pole); 90 78 91 } 79 92 -
XIOS3/branches/xios-3.0-beta/extern/remap/src/polyg.cpp
r2282 r2505 18 18 (because computing intersection area requires both polygons to have same orientation) 19 19 */ 20 20 21 void orient(int N, Coord *vertex, Coord *edge, double *d, const Coord &g) 21 22 { … … 24 25 Coord vertical = crossprod(ga, gb); 25 26 if (N > 2 && scalarprod(g, vertical) < 0) // (GAxGB).G 26 { 27 for (int i = 0; i < N/2; i++) 28 swap(vertex[i], vertex[N-1-i]); 29 30 for (int i = 0; i < (N-1)/2; i++) 31 { 32 swap(edge[N-2-i], edge[i]); 33 swap(d[i], d[N-2-i]); 34 } 35 } 36 } 37 27 switchOrientation(N, vertex, edge, d) ; 28 29 } 30 31 void switchOrientation(int N, Coord *vertex, Coord *edge, double *d) 32 { 33 for (int i = 0; i < N/2; i++) swap(vertex[i], vertex[N-1-i]); 34 35 for (int i = 0; i < (N-1)/2; i++) 36 { 37 swap(edge[N-2-i], edge[i]); 38 swap(d[i], d[N-2-i]); 39 } 40 41 } 38 42 39 43 void normals(Coord *x, int n, Coord *a) … … 94 98 { 95 99 return proj(gc_normalintegral(x, n)); 100 //return new_barycentre(x,n) ; 96 101 } 97 102 else if (n == 0) return ORIGIN; 98 103 else if (n == 2) return midpoint(x[0], x[1]); 99 104 else if (n == 1) return x[0]; 100 101 error_exit( "Missing return in : Coord exact_barycentre(const Coord *x, int n)" ); 102 return ORIGIN; 103 } 105 } 106 107 /* other methode to compute barycenter of spherical polygon 108 for a spherical polygon, the moment is half the sum of (a x b) / ||a x b|| * (angle between a and b) 109 for each pair of consecutive vertices a,b. 110 */ 111 112 Coord new_barycentre(const Coord *x, int n) 113 { 114 if (n >= 3) 115 { 116 Coord sum=ORIGIN ; 117 for (int i = 0; i < n; i++) 118 { 119 sum=sum+crossprod(x[i],x[(i+1)%n])*(1./norm(crossprod(x[i],x[(i+1)%n]))*2.*atan2(norm(x[i]-x[(i+1)%n]),norm(x[i]+x[(i+1)%n]))) ; 120 } 121 return proj(sum) ; 122 } 123 else if (n == 0) return ORIGIN; 124 else if (n == 2) return midpoint(x[0], x[1]); 125 else if (n == 1) return x[0]; 126 } 127 128 104 129 105 130 Coord sc_gc_moon_normalintegral(Coord a, Coord b, Coord pole) -
XIOS3/branches/xios-3.0-beta/extern/remap/src/polyg.hpp
r1579 r2505 7 7 8 8 void orient(int n, Coord *vertex, Coord *edge, double *d, const Coord &g); 9 9 void switchOrientation(int N, Coord *vertex, Coord *edge, double *d) ; 10 10 void normals(Coord *x, int n, Coord *a); 11 11 … … 16 16 double polygonarea(Coord *x, int n); 17 17 Coord exact_barycentre(const Coord *x, int n) ; 18 Coord new_barycentre(const Coord *x, int n) ; 18 19 19 20 int packedPolygonSize(const Elt& e); -
XIOS3/branches/xios-3.0-beta/src/client.cpp
r2427 r2505 520 520 report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 521 521 report(100)<<CTimer::getAllCumulatedTime()<<endl ; 522 report(100)<<CMemChecker::getAllCumulatedMem()<<endl ; 522 if (CXios::reportMemory) 523 { 524 report(100)<<CMemChecker::getAllCumulatedMem()<<endl ; 525 } 523 526 CWorkflowGraph::drawWorkFlowGraph_client(); 524 527 -
XIOS3/branches/xios-3.0-beta/src/cxios.cpp
r2427 r2505 55 55 bool CXios::checkSumSend=false ; 56 56 bool CXios::logMemory=false ; 57 bool CXios::reportMemory=true ; 57 58 58 59 CDaemonsManager* CXios::daemonsManager_=nullptr ; … … 118 119 119 120 logMemory = getin<bool>("log_memory", false); 121 reportMemory = getin<bool>("memory_report", true); 120 122 121 123 globalComm=MPI_COMM_WORLD ; -
XIOS3/branches/xios-3.0-beta/src/cxios.hpp
r2427 r2505 68 68 static bool checkSumRecv; //!< For debugging, compute a checksum of fields received by the model through the XIOS client 69 69 70 static bool logMemory; //!< Activate memory monitoring for all XIOS process 70 static bool logMemory; //!< Activate memory monitoring for all XIOS process (generate CSV file for https://forge.ipsl.jussieu.fr/ioserver/chrome/site/XIOS_TOOLS/xios_memory.html) 71 static bool reportMemory; //!< Activate memory reporting for all XIOS process (report in log files) 71 72 72 73 static const string defaultPoolId ; -
XIOS3/branches/xios-3.0-beta/src/mem_checker.cpp
r2427 r2505 44 44 { 45 45 std::vector<double> memories(0); 46 if ( !CXios::reportMemory ) return memories ; 46 47 memories.clear(); 47 48 -
XIOS3/branches/xios-3.0-beta/src/node/variable.cpp
r2495 r2505 77 77 "log_type", 78 78 "max_buffer_size", 79 "memory_report", 79 80 "memtrack_blocks", 80 81 "memtrack_size", -
XIOS3/branches/xios-3.0-beta/src/server.cpp
r2463 r2505 442 442 report(0)<<"Performance report : Ratio : "<<CTimer::get("Process events").getCumulatedTime()/CTimer::get("XIOS server").getCumulatedTime()*100.<<"%"<<endl ; 443 443 report(100)<<CTimer::getAllCumulatedTime()<<endl ; 444 report(100)<<CMemChecker::getAllCumulatedMem()<<endl ; 444 if (CXios::reportMemory) 445 { 446 report(100)<<CMemChecker::getAllCumulatedMem()<<endl ; 447 } 445 448 446 449 CWorkflowGraph::drawWorkFlowGraph_server();
Note: See TracChangeset
for help on using the changeset viewer.