Ignore:
Timestamp:
07/20/17 09:18:34 (7 years ago)
Author:
yushan
Message:

test_remap_omp tested on ADA except two fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/remap/src/polyg.cpp

    r1205 r1220  
    77 
    88#include "polyg.hpp" 
     9#include <stdio.h> 
    910 
    1011namespace sphereRemap { 
     
    4546Coord barycentre(const Coord *x, int n) 
    4647{ 
     48 
    4749        if (n == 0) return ORIGIN; 
    4850        Coord bc = ORIGIN; 
    4951        for (int i = 0; i < n; i++) 
     52        { 
    5053                bc = bc + x[i]; 
     54        }        
    5155        /* both distances can be equal down to roundoff when norm(bc) < mashineepsilon  
    5256           which can occur when weighted with tiny area */ 
    53  
    54         assert(squaredist(bc, proj(bc)) <= squaredist(bc, proj(bc * (-1.0)))); 
    55         //if (squaredist(bc, proj(bc)) > squaredist(bc, proj(bc * (-1.0)))) return proj(bc * (-1.0)); 
     57   
     58         
     59  //assert(squaredist(bc, proj(bc)) <= squaredist(bc, proj(bc * (-1.0))));       
    5660 
    5761        return proj(bc); 
     
    173177                t[1] = x[i]; 
    174178                t[2] = x[ii]; 
    175                 double sc=scalarprod(crossprod(t[1] - t[0], t[2] - t[0]), t[0]) ; 
     179    double sc=scalarprod(crossprod(t[1] - t[0], t[2] - t[0]), t[0]) ; 
    176180                assert(sc >= -1e-10); // Error: tri a l'env (wrong orientation) 
    177181                double area_gc = triarea(t[0], t[1], t[2]); 
     182                if(area_gc<=0) printf("area_gc = %e\n", area_gc); 
    178183                double area_sc_gc_moon = 0; 
    179184                if (d[i]) /* handle small circle case */ 
     
    183188                        char sgl = (mext > 0) ? -1 : 1; 
    184189                        area_sc_gc_moon = sgl * alun(arcdist(t[1], t[2]), fabs(scalarprod(t[1], pole))); 
     190                        //if(area_sc_gc_moon<=0) printf("area_sc_gc_moon = %e\n", area_sc_gc_moon); 
    185191                        gg_exact = gg_exact + sc_gc_moon_normalintegral(t[1], t[2], pole); 
    186192                } 
    187193                area += area_gc + area_sc_gc_moon; /* for "spherical circle segment" sum triangular part (at) and "small moon" and => account for small circle */ 
    188194                g[i] = barycentre(t, 3) * (area_gc + area_sc_gc_moon); 
     195                //printf("g[%d] = (%e,%e,%e) * (%e+%e) = (%e,%e,%e) norm = %e\n", i, barycentre(t, 3).x, barycentre(t, 3).y, barycentre(t, 3).z, area_gc,  area_sc_gc_moon, g[i].x, g[i].y, g[i].z, norm(g[i])); 
    189196        } 
    190197        gg = barycentre(g, N); 
Note: See TracChangeset for help on using the changeset viewer.