Ignore:
Timestamp:
06/15/17 19:32:13 (7 years ago)
Author:
yushan
Message:

save dev. need to unify the file type when using EP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/extern/remap/src/elt.hpp

    r1016 r1172  
    5353struct Elt : Polyg 
    5454{ 
    55         Elt() {} 
    56         Elt(const double *bounds_lon, const double *bounds_lat, int max_num_vert) 
    57         { 
    58                 int k = 0; 
    59                 vertex[k++] = xyz(bounds_lon[0], bounds_lat[0]); 
    60                 for (int i = 1; i < max_num_vert; i++) 
    61                 { 
    62                         vertex[k] = xyz(bounds_lon[i], bounds_lat[i]); 
    63                         /* netCDF convention: if first vertex repeats element is finished (at least three vertices == triagle) */ 
    64                         if (k >= 3 && squaredist(vertex[k], vertex[0]) < EPS*EPS)  
    65                                 break; 
    66                         /* eliminate zero edges: move to next vertex only if it is different */ 
    67                         if (squaredist(vertex[k], vertex[k-1]) > EPS*EPS) 
    68                                 k++; 
    69                         else 
    70                                 /* cout << "Removed edge " << k << " due to zero length (coinciding endpoints)." << endl */ ; 
    71                 } 
    72                 n = k; 
    73                 x = barycentre(vertex, n); 
    74         } 
     55  Elt() {} 
     56  Elt(const double *bounds_lon, const double *bounds_lat, int max_num_vert) 
     57  { 
     58    int k = 0; 
     59    vertex[k++] = xyz(bounds_lon[0], bounds_lat[0]); 
     60    for (int i = 1; i < max_num_vert; i++) 
     61    { 
     62      vertex[k] = xyz(bounds_lon[i], bounds_lat[i]); 
     63      /* netCDF convention: if first vertex repeats element is finished (at least three vertices == triagle) */ 
     64      if (k >= 3 && squaredist(vertex[k], vertex[0]) < EPS*EPS)  
     65        break; 
     66      /* eliminate zero edges: move to next vertex only if it is different */ 
     67      if (squaredist(vertex[k], vertex[k-1]) > EPS*EPS) 
     68        k++; 
     69      //else cout << "Removed edge " << k << " due to zero length (coinciding endpoints)." << endl ; 
     70    } 
     71    n = k; 
     72    x = barycentre(vertex, n); 
     73  } 
    7574 
    7675        Elt& operator=(const Elt& rhs) 
     
    9695        } 
    9796 
    98         void delete_intersections() 
    99         { 
    100                 for (list<Polyg*>::iterator it = this->is.begin(); it != this->is.end(); it++) 
    101                 { 
    102                         Polyg* poly = *it; 
    103                         delete poly; 
    104                 } 
    105         } 
     97  void delete_intersections() 
     98  { 
     99    for (list<Polyg*>::iterator it = this->is.begin(); it != this->is.end(); it++) 
     100    { 
     101      Polyg* poly = *it; 
     102      delete poly; 
     103    } 
     104  } 
    106105 
    107106  void insert_vertex(int i, const Coord& v) 
Note: See TracChangeset for help on using the changeset viewer.