Changeset 727
- Timestamp:
- 10/09/15 14:51:28 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_client_dht_template.hpp
r721 r727 32 32 public: 33 33 typedef T InfoType; 34 const int infoTypeSize = sizeof(InfoType);34 static const int infoTypeSize = sizeof(InfoType); 35 35 36 36 public: -
XIOS/trunk/src/config/generate_rectilinear_domain_attribute.conf
r687 r727 1 /* GLOBAL */ 2 DECLARE_ATTRIBUTE(double , bounds_lon_start) 3 DECLARE_ATTRIBUTE(double , bounds_lon_end) 4 DECLARE_ATTRIBUTE(double , bounds_lat_start) 5 DECLARE_ATTRIBUTE(double , bounds_lat_end) 1 6 7 DECLARE_ATTRIBUTE(double , lon_start) 8 DECLARE_ATTRIBUTE(double , lon_end) 9 DECLARE_ATTRIBUTE(double , lat_start) 10 DECLARE_ATTRIBUTE(double , lat_end) -
XIOS/trunk/src/node/domain.cpp
r720 r727 174 174 if (type_attr::rectilinear == type) 175 175 { 176 this->isRedistributed_ = true; 177 176 178 CContext* context = CContext::getCurrent(); 177 179 CContextClient* client = context->client; … … 271 273 // Now fill other attributes 272 274 fillInRectilinearLonLat(); 273 this->isRedistributed_ = true;274 275 } 275 276 } … … 287 288 latvalue_1d.resize(nj); 288 289 289 double lonStep = double(360/ni_glo.getValue()); 290 double latStep = double(180/nj_glo.getValue()); 290 double lonRange = lon_end - lon_start; 291 double latRange = lat_end - lat_start; 292 293 double lonStep = lonRange/double(ni_glo.getValue()); 294 double latStep = latRange/double(nj_glo.getValue()); 291 295 292 296 // Assign lon value 293 297 for (int i = 0; i < ni; ++i) 294 298 { 295 lonvalue_1d(i) = static_cast<double>(ibegin + i) * lonStep -180 + lonStep/2; 299 if (0 == (ibegin + i)) 300 { 301 lonvalue_1d(i) = lon_start; 302 } 303 else if (ni_glo == (ibegin + i + 1)) 304 { 305 lonvalue_1d(i) = lon_end; 306 } 307 else 308 { 309 lonvalue_1d(i) = (ibegin + i) * lonStep + lon_start; 310 } 296 311 } 297 312 298 313 for (int j = 0; j < nj; ++j) 299 314 { 300 latvalue_1d(j) = static_cast<double>(jbegin + j) * latStep - 90 + latStep/2; 315 if (0 == (jbegin + j)) 316 { 317 latvalue_1d(j) = lat_start; 318 } 319 else if (nj_glo == (jbegin + j + 1)) 320 { 321 latvalue_1d(j) = lat_end; 322 } 323 else 324 { 325 latvalue_1d(j) = (jbegin + j) * latStep + lat_start; 326 } 301 327 } 302 328 } … … 307 333 const int nvertexValue = 4; 308 334 335 double boundsLonRange = bounds_lon_end - bounds_lon_start; 336 double boundsLatRange = bounds_lat_end - bounds_lat_start; 337 309 338 boundsLon.resize(nvertexValue,ni*nj); 310 339 boundsLat.resize(nvertexValue,nj*ni); 311 340 312 double lonStep = double(360/ni_glo.getValue());313 double latStep = double(180/nj_glo.getValue());341 double lonStep = boundsLonRange/double(ni_glo.getValue()); 342 double latStep = boundsLatRange/double(nj_glo.getValue()); 314 343 315 344 for(j=0;j<nj;++j) … … 317 346 { 318 347 k=j*ni+i; 319 boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep -180320 : -180;321 boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep -180322 : 180;323 324 boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep - 90325 : -90;326 boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep - 90327 : +90;348 boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep + bounds_lon_start 349 : bounds_lon_start; 350 boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep + bounds_lon_start 351 : bounds_lon_end; 352 353 boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep + bounds_lat_start 354 : bounds_lat_start; 355 boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep + bounds_lat_start 356 : bounds_lat_end; 328 357 } 329 358 } -
XIOS/trunk/src/node/domain.hpp
r715 r727 103 103 int nj_srv,jbegin_srv,jend_srv ; 104 104 int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; 105 106 double bounds_lon_start, bounds_lon_end; 107 double bounds_lat_start, bounds_lat_end; 108 double lon_start, lon_end; 109 double lat_start, lat_end; 105 110 106 111 CArray<double, 1> lonvalue_srv, latvalue_srv ; -
XIOS/trunk/src/node/generate_rectilinear_domain.cpp
r687 r727 23 23 ENodeType CGenerateRectilinearDomain::GetType(void) { return eGenerateRectilinearDomain; } 24 24 25 void CGenerateRectilinearDomain::checkValid(CDomain* domain Src)25 void CGenerateRectilinearDomain::checkValid(CDomain* domainDst) 26 26 { 27 const double defaultBndsLonStart = 0; 28 const double defaultBndsLonEnd = 360; 29 30 const double defaultBndsLatStart = -90; 31 const double defaultBndsLatEnd = 90; 32 33 if ((!lon_start.isEmpty() && lon_end.isEmpty()) || 34 (lon_start.isEmpty() && !lon_end.isEmpty())) 35 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 36 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 37 << "Only longitude start or longitude end attribute is defined." << std::endl 38 << "Must define both: 'lon_start' and 'lon_end'."); 39 40 if ((!lat_start.isEmpty() && lat_end.isEmpty()) || 41 (lat_start.isEmpty() && !lat_end.isEmpty())) 42 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 43 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 44 << "Only latitude start or latitude end attribute is defined." << std::endl 45 << "Must define both: 'lat_start' and 'lat_end'."); 46 47 if ((!bounds_lon_start.isEmpty() && bounds_lon_end.isEmpty()) || 48 (bounds_lon_start.isEmpty() && !bounds_lon_end.isEmpty())) 49 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 50 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 51 << "Only longitude boundary start or longitude boundary end attribute is defined." << std::endl 52 << "Must define both: 'bounds_lon_start' and 'bounds_lon_end'."); 53 54 if ((!bounds_lat_start.isEmpty() && bounds_lat_end.isEmpty()) || 55 (bounds_lat_start.isEmpty() && !bounds_lat_end.isEmpty())) 56 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 57 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 58 << "Only latitude boundary start or latitude boundary end attribute is defined." << std::endl 59 << "Must define both: 'bounds_lat_start' and 'bounds_lat_end'."); 60 61 if (!bounds_lon_start.isEmpty() && !lon_start.isEmpty()) 62 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 63 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 64 << "Only one longitude boundary attribute or longitude can be used but both 'bounds_lon_start' and 'lon_start' are defined." << std::endl 65 << "Define only one attribute: 'bounds_lon_start' or 'lon_start'."); 66 67 if (!bounds_lat_start.isEmpty() && !lat_start.isEmpty()) 68 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 69 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 70 << "Only one latitude boundary attribute or latitude can be used but both 'bounds_lat_start' and 'lat_start' are defined." << std::endl 71 << "Define only one attribute: 'bounds_lat_start' or 'lat_start'."); 72 73 if (!bounds_lon_start.isEmpty() && !lat_start.isEmpty()) 74 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 75 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 76 << "Only one latitude boundary attribute or latitude can be used but both 'bounds_lon_start' and 'lat_start' are defined." << std::endl 77 << "Define only one pair of attributes: ('bounds_lon_start' and 'bounds_lat_start') or ('lon_start' and 'lat_start')."); 78 79 if (!bounds_lat_start.isEmpty() && !lon_start.isEmpty()) 80 ERROR("CGenerateRectilinearDomain::checkValid(CDomain* domainDst)", 81 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 82 << "Only one latitude boundary attribute or latitude can be used but both 'bounds_lat_start' and 'lon_start' are defined." << std::endl 83 << "Define only one pair of attributes: ('bounds_lon_start' and 'bounds_lat_start') or ('lon_start' and 'lat_start')."); 84 85 if (bounds_lon_start.isEmpty() && bounds_lat_start.isEmpty() && 86 lon_start.isEmpty() && lat_start.isEmpty()) 87 { 88 bounds_lon_start.setValue(defaultBndsLonStart); 89 bounds_lon_end.setValue(defaultBndsLonEnd); 90 bounds_lat_start.setValue(defaultBndsLatStart); 91 bounds_lat_end.setValue(defaultBndsLatEnd); 92 } 93 94 if (!bounds_lon_start.isEmpty()) 95 { 96 int niGlo = domainDst->ni_glo.getValue(); 97 98 double boundsLonRange = bounds_lon_end - bounds_lon_start; 99 double boundsLonStep = boundsLonRange/double(niGlo); 100 domainDst->bounds_lon_start = bounds_lon_start; 101 domainDst->bounds_lon_end = bounds_lon_end; 102 domainDst->lon_start = bounds_lon_start + boundsLonStep/2; 103 domainDst->lon_end = bounds_lon_end - boundsLonStep/2; 104 } 105 106 if (!bounds_lat_start.isEmpty()) 107 { 108 int njGlo = domainDst->nj_glo.getValue(); 109 110 double boundsLatRange = bounds_lat_end - bounds_lat_start; 111 double boundsLatStep = boundsLatRange/double(njGlo); 112 domainDst->bounds_lat_start = bounds_lat_start; 113 domainDst->bounds_lat_end = bounds_lat_end; 114 domainDst->lat_start = bounds_lat_start + boundsLatStep/2; 115 domainDst->lat_end = bounds_lat_end - boundsLatStep/2; 116 } 117 118 if (lon_start.isEmpty() && lat_start.isEmpty()) return; 119 120 if (!lon_start.isEmpty()) 121 { 122 int niGlo = domainDst->ni_glo.getValue(); 123 124 double lonRange = lon_end - lon_start; 125 double lonStep = lonRange/double(niGlo); 126 domainDst->lon_start = lon_start; 127 domainDst->lon_end = lon_end; 128 domainDst->bounds_lon_start = lon_start - lonStep/2; 129 domainDst->bounds_lon_end = lon_end + lonStep/2; 130 } 131 132 if (!lat_start.isEmpty()) 133 { 134 int njGlo = domainDst->nj_glo.getValue(); 135 136 double latRange = lat_end - lat_start; 137 double latStep = latRange/double(njGlo); 138 domainDst->lat_start = lat_start; 139 domainDst->lat_end = lat_end; 140 domainDst->bounds_lat_start = lat_start - latStep/2; 141 domainDst->bounds_lat_end = lat_end + latStep/2; 142 } 27 143 } 28 144 -
XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.cpp
r687 r727 20 20 : CDomainAlgorithmTransformation(domainDestination, domainSource), gridSrc_(gridSource), nbDomainDistributedPart_(0) 21 21 { 22 genRectDomain->checkValid(domain Source);22 genRectDomain->checkValid(domainDestination); 23 23 computeDistributionGridSource(); 24 24 fillInAttributesDomainDestination();
Note: See TracChangeset
for help on using the changeset viewer.