Changeset 660 for XIOS/trunk/src/transformation
- Timestamp:
- 07/30/15 15:18:00 (9 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/domain_algorithm_interpolate_from_file.cpp
r657 r660 13 13 #include "distribution_client.hpp" 14 14 #include "client_server_mapping_distributed.hpp" 15 #include "netcdf.hpp" 15 16 16 17 namespace xios { … … 34 35 std::string filename = interpDomain_->file.getValue(); 35 36 std::map<int,std::vector<std::pair<int,double> > > interpMapValue; 36 //readInterpolationInfo(filename, interpMapValue);37 38 randomizeInterpolationInfo(interpMapValue);37 readInterpolationInfo(filename, interpMapValue); 38 39 //randomizeInterpolationInfo(interpMapValue); 39 40 boost::unordered_map<size_t,int> globalIndexOfDomainDest; 40 41 int ni = domainDest_->ni.getValue(); … … 232 233 std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 233 234 { 234 235 } 236 237 } 235 int ncid ; 236 int weightDimId ; 237 size_t nbWeightGlo ; 238 239 CContext* context = CContext::getCurrent(); 240 CContextClient* client=context->client; 241 int clientRank = client->clientRank; 242 int clientSize = client->clientSize; 243 244 nc_open(filename.c_str(),NC_NOWRITE, &ncid) ; 245 nc_inq_dimid(ncid,"n_weight",&weightDimId) ; 246 nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ; 247 248 size_t nbWeight ; 249 size_t start ; 250 size_t div = nbWeightGlo/clientSize ; 251 size_t mod = nbWeightGlo%clientSize ; 252 if (clientRank < mod) 253 { 254 nbWeight=div+1 ; 255 start=clientRank*(div+1) ; 256 } 257 else 258 { 259 nbWeight=div ; 260 start= mod * (div+1) + (clientRank-mod) * div ; 261 } 262 263 264 265 double* weight=new double[nbWeight] ; 266 int weightId ; 267 nc_inq_varid (ncid, "weight", &weightId) ; 268 nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ; 269 270 long* srcIndex=new long[nbWeight] ; 271 int srcIndexId ; 272 nc_inq_varid (ncid, "src_idx", &srcIndexId) ; 273 nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ; 274 275 long* dstIndex=new long[nbWeight] ; 276 int dstIndexId ; 277 nc_inq_varid (ncid, "dst_idx", &dstIndexId) ; 278 nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ; 279 280 for(size_t ind=0; ind<nbWeight;++ind) 281 interpMapValue[dstIndex[ind]].push_back(make_pair(srcIndex[ind],weight[ind])); 282 } 283 284 } -
XIOS/trunk/src/transformation/grid_transformation.cpp
r657 r660 17 17 #include "transformation_mapping.hpp" 18 18 #include "axis_algorithm_transformation.hpp" 19 #include "distribution_client.hpp" 19 20 20 21 namespace xios {
Note: See TracChangeset
for help on using the changeset viewer.