Ignore:
Timestamp:
07/10/17 18:17:04 (4 years ago)
Author:
yushan
Message:

branch merged with trunk @1200

Location:
XIOS/dev/branch_yushan_merged/extern/remap/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/extern/remap/src/clipper.cpp

    r1146 r1205  
    10471047 
    10481048  //create a new edge array ... 
    1049   TEdge *edges = new TEdge[highI+1]; 
     1049  TEdge *edges = new TEdge [highI +1]; 
    10501050 
    10511051  bool IsFlat = true; 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/gridRemap.hpp

    r1155 r1205  
    1414Coord readPole(std::istream&); 
    1515 
    16  
     16extern CRemapGrid srcGrid; 
     17extern CRemapGrid tgtGrid; 
    1718 
    1819} 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/intersect.cpp

    r1155 r1205  
    1717using namespace std; 
    1818 
    19 extern CRemapGrid srcGrid; 
    20 #pragma omp threadprivate(srcGrid) 
    21  
    22 extern CRemapGrid tgtGrid; 
    23 #pragma omp threadprivate(tgtGrid) 
    24  
    2519/** returns index of edge of a that is shared with b, 
    2620    or NOT_FOUND if a and b do not share an edge */ 
     
    6256    for (int j = 0; j < b.n; j++) 
    6357    { 
    64       // share a full edge ? be carefull at the orientation 
    65        
    66       //if(squaredist(a.vertex[i], b.vertex[j]) > 1e-10*1e-10 || 
    67       //   squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10 ) 
    68       //{       
    69         //printf("A : squaredist(a.vertex[%d], b.vertex[%d]) = %.10e  %d\n",  
    70         //        i, j, squaredist(a.vertex[i], b.vertex[j]),  
    71         //        squaredist(a.vertex[i], b.vertex[j]) > 1e-10*1e-10 ? true : false); 
    72         //printf("B : squaredist(a.vertex[%d], b.vertex[%d]) = %.10e  %d\n",  
    73         //        (i+1)%a.n, (j+1)%b.n, squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]), 
    74         //        squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10 ? true : false); 
    75  
    76         assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > 1e-10*1e-10 || 
    77                squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10); 
    78          
    79       //} 
    80  
     58// share a full edge ? be carefull at the orientation 
     59      assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > 1e-10*1e-10 || 
     60             squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10); 
    8161      if (   squaredist(a.vertex[ i       ], b.vertex[ j           ]) < 1e-10*1e-10 && 
    8262             squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+b.n-1)%b.n]) < 1e-10*1e-10) 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/intersection_ym.cpp

    r1155 r1205  
    1616using namespace std; 
    1717using namespace ClipperLib ; 
    18  
    19 extern CRemapGrid srcGrid; 
    20 #pragma omp threadprivate(srcGrid) 
    21  
    22 extern CRemapGrid tgtGrid; 
    23 #pragma omp threadprivate(tgtGrid) 
    2418 
    2519double intersect_ym(Elt *a, Elt *b) 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/libmapper.cpp

    r1176 r1205  
    1414#include "mapper.hpp" 
    1515#include "cputime.hpp" // cputime 
    16 #include "gridRemap.hpp" 
    17  
    1816#include <stdio.h> 
    1917 
    2018using namespace sphereRemap ; 
    21  
    22 //extern CRemapGrid srcGrid; 
    23 //#pragma omp threadprivate(srcGrid) 
    24  
    25 //extern CRemapGrid tgtGrid; 
    26 //#pragma omp threadprivate(tgtGrid) 
    27  
    2819 
    2920/* mapper is a ponter to a global class instance whoes members are allocated in the first step (finding the sizes of the weight arrays) 
     
    4233                     int order, int* n_weights) 
    4334{ 
    44   printf("libmapper callded : remap_get_num_weights\n"); 
    4535  assert(src_bounds_lon); 
    4636  assert(src_bounds_lat); 
     
    125115                     double* centre_lon, double* centre_lat, double* areas) 
    126116{ 
    127   printf("libmapper callded : remap_get_barycentres_and_areas\n"); 
    128117        for (int i = 0; i < n_cell; i++) 
    129118        { 
     
    149138extern "C" void remap_get_weights(double* weights, int* src_indices, int* dst_indices) 
    150139{ 
    151   printf("libmapper callded : remap_get_weights\n"); 
    152140        memcpy(weights, mapper->remapMatrix, mapper->nWeights*sizeof(double)); 
    153141        memcpy(src_indices, mapper->srcAddress, mapper->nWeights*sizeof(int)); 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/mapper.cpp

    r1159 r1205  
    1515namespace sphereRemap { 
    1616 
    17 extern CRemapGrid srcGrid; 
    18 #pragma omp threadprivate(srcGrid) 
    19  
    20 extern CRemapGrid tgtGrid; 
    21 #pragma omp threadprivate(tgtGrid) 
    22  
    2317/* A subdivition of an array into N sub-arays 
    2418   can be represented by the length of the N arrays 
     
    275269 
    276270    MPI_Status *status = new MPI_Status[4*mpiSize]; 
    277      
     271 
     272    MPI_Waitall(nbSendRequest, sendRequest, status); 
    278273    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    279     MPI_Waitall(nbSendRequest, sendRequest, status); 
    280      
    281274 
    282275    /* for all indices that have been received from requesting ranks: pack values and gradients, then send */ 
     
    629622    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    630623    MPI_Waitall(nbSendRequest, sendRequest, status); 
    631   
     624 
    632625    int nbNeighbourNodes = 0; 
    633626    for (int rank = 0; rank < mpiSize; rank++) 
     
    699692        } 
    700693 
    701         /* 
    702            for (int i = 0; i < elt->n; i++) 
    703            { 
    704            if (elt->neighbour[i] == NOT_FOUND) 
    705            error_exit("neighbour not found"); 
    706            } 
    707            */ 
    708694    } 
    709695} 
     
    810796        } 
    811797    } 
    812   
     798 
    813799    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    814800    MPI_Waitall(nbSendRequest, sendRequest, status); 
    815      
    816      
     801 
    817802    char **sendBuffer2 = new char*[mpiSize]; 
    818803    char **recvBuffer2 = new char*[mpiSize]; 
     
    838823                    Elt *elt2 = (Elt *) ((*it)->data); 
    839824                    /* recvElt is target, elt2 is source */ 
    840                     //                                  intersect(&recvElt[j], elt2); 
    841                     intersect_ym(&recvElt[j], elt2); 
     825                    intersect(&recvElt[j], elt2); 
     826                    //intersect_ym(&recvElt[j], elt2); 
    842827                } 
    843  
    844828                if (recvElt[j].is.size() > 0) sentMessageSize[rank] += packIntersectionSize(recvElt[j]); 
    845829 
     
    860844            } 
    861845            delete [] recvElt; 
    862  
    863846        } 
    864847    } 
     
    898881    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    899882    MPI_Waitall(nbSendRequest, sendRequest, status); 
    900     
    901     
    902883 
    903884    delete [] sendRequest; 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/node.cpp

    r1172 r1205  
    472472        q->child.resize(MAX_NODE_SZ/2 + 1); 
    473473        assert(thIs->child.size() == MAX_NODE_SZ+1); 
    474         if(thIs->closest(thIs->child, FARTHEST) == 0)  
    475           thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 
    476            
    477         thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 
    478          
    479            
     474        thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre 
    480475        std::sort(thIs->child.begin(), thIs->child.end(), compareDist); 
    481476        for (int i = 0; i < MAX_NODE_SZ+1; i++) 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/parallel_tree.cpp

    r1172 r1205  
    1616 
    1717static const int assignLevel = 2; 
    18  
    19 extern CRemapGrid srcGrid; 
    20 #pragma omp threadprivate(srcGrid) 
    21  
    22 extern CRemapGrid tgtGrid; 
    23 #pragma omp threadprivate(tgtGrid) 
    2418 
    2519// only the circle is packed, rest of node will be initialized on unpacking 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/polyg.cpp

    r1176 r1205  
    33#include <cassert> 
    44#include <iostream> 
    5 #include <stdio.h> 
    65#include "elt.hpp" 
    76#include "errhandle.hpp" 
     
    175174                t[2] = x[ii]; 
    176175                double sc=scalarprod(crossprod(t[1] - t[0], t[2] - t[0]), t[0]) ; 
    177                 //assert(sc >= -1e-10); // Error: tri a l'env (wrong orientation) 
    178                 if(sc < -1e-10) 
    179                 { 
    180                   printf("N=%d, sc = %f, t[0]=(%f,%f,%f), t[1]=(%f,%f,%f), t[2]=(%f,%f,%f)\n", N, sc, 
    181                                                                                          t[0].x, t[0].y, t[0].z,  
    182                                                                                          t[1].x, t[1].y, t[1].z, 
    183                                                                                          t[2].x, t[2].y, t[2].z); 
    184                   assert(sc >= -1e-10); 
    185                 } 
     176                assert(sc >= -1e-10); // Error: tri a l'env (wrong orientation) 
    186177                double area_gc = triarea(t[0], t[1], t[2]); 
    187178                double area_sc_gc_moon = 0; 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/triple.cpp

    r1176 r1205  
    33namespace sphereRemap { 
    44 
    5 const Coord ORIGIN(0.0, 0.0, 0.0); 
     5extern const Coord ORIGIN(0.0, 0.0, 0.0); 
    66 
    77std::ostream& operator<<(std::ostream& os, const Coord& c) { 
Note: See TracChangeset for help on using the changeset viewer.