Changeset 1460 for XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp
- Timestamp:
- 03/22/18 10:43:20 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp
r1338 r1460 188 188 listDimSize.push_front(*itMap); 189 189 */ 190 for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it) 191 listDimSize.push_front(*dimSizeMap.find(*it)); 190 191 if (!SuperClassWriter::isRectilinear(fieldId)) 192 { 193 for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it) 194 listDimSize.push_front(*dimSizeMap.find(*it)); 195 } 196 else 197 { 198 std::list<StdString> coords = SuperClassWriter::getCoordinatesIdList(fieldId); 199 std::list<StdString>::const_iterator itCoord = coords.begin(); 200 for (; itCoord != coords.end(); itCoord++) 201 { 202 const StdString& coord = *itCoord; 203 if (SuperClassWriter::hasVariable(coord) && !SuperClassWriter::isTemporal(coord)) 204 { 205 std::map<StdString, StdSize> dimsTmp = SuperClassWriter::getDimensions(&coord); 206 StdString dimNameTmp = dimsTmp.begin()->first; 207 StdSize dimSizeTmp = dimsTmp.begin()->second; 208 listDimSize.push_front(make_pair(coord, dimSizeTmp)); 209 dimSizeMap.erase(dimNameTmp); 210 dimList.remove(dimNameTmp); 211 } 212 } 213 for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it) 214 listDimSize.push_front(*dimSizeMap.find(*it)); 215 } 192 216 193 217 // Now process domain and axis … … 268 292 if ((CDomain::type_attr::rectilinear == domain->type)) 269 293 { 270 // Ok, try to read some f..attributes such as longitude and latitude294 // Ok, try to read some attributes such as longitude and latitude 271 295 bool hasLat = SuperClassWriter::hasVariable(itMapNj->first); 272 296 if (hasLat) … … 287 311 else if ((CDomain::type_attr::curvilinear == domain->type)) 288 312 { 289 int ni = domain->ni; 290 int nj = domain->nj; 313 // Make sure that if there is no local domain defined on a process, the process still reads just one value. 314 int ni, nj, ibegin, jbegin; 315 if (domain->ni == 0) 316 { 317 ni = 1; 318 ibegin = 0; 319 } 320 else 321 { 322 ni = domain->ni; 323 ibegin = domain->ibegin; 324 } 325 if (domain->nj == 0) 326 { 327 nj = 1; 328 jbegin = 0; 329 } 330 else 331 { 332 nj = domain->nj; 333 jbegin = domain->jbegin; 334 } 335 291 336 std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2); 292 nBeginLatLon[0] = 0; nBeginLatLon[1] = 0;293 nSizeLatLon[0] = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue();337 nBeginLatLon[0] = jbegin; nBeginLatLon[1] = ibegin; 338 nSizeLatLon[0] = nj; nSizeLatLon[1] = ni; 294 339 295 340 StdString latName = this->getLatCoordName(fieldId); 296 341 if (SuperClassWriter::hasVariable(latName)) 297 342 { 298 domain->latvalue_curvilinear_read_from_file.resize( domain->ni_glo,domain->nj_glo);343 domain->latvalue_curvilinear_read_from_file.resize(ni, nj); 299 344 readFieldVariableValue(domain->latvalue_curvilinear_read_from_file, latName, nBeginLatLon, nSizeLatLon); 300 345 } … … 302 347 if (SuperClassWriter::hasVariable(lonName)) 303 348 { 304 domain->lonvalue_curvilinear_read_from_file.resize( domain->ni_glo,domain->nj_glo);349 domain->lonvalue_curvilinear_read_from_file.resize(ni, nj); 305 350 readFieldVariableValue(domain->lonvalue_curvilinear_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 306 351 } … … 309 354 StdString boundsLonName = this->getBoundsId(lonName); 310 355 311 int nbVertex = this->getNbVertex(fieldId);356 int nbVertex = 4; //this->getNbVertex(fieldId); 312 357 if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex)) 313 358 { … … 324 369 325 370 std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 326 nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue();327 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue();371 nBeginBndsLatLon[0] = jbegin; nSizeBndsLatLon[0] = nj; 372 nBeginBndsLatLon[1] = ibegin; nSizeBndsLatLon[1] = ni; 328 373 nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 329 374 330 375 if (SuperClassWriter::hasVariable(boundsLatName)) 331 376 { 332 domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex, domain->ni_glo,domain->nj_glo);377 domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex, ni, nj); 333 378 readFieldVariableValue(domain->bounds_latvalue_curvilinear_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 334 379 … … 336 381 if (SuperClassWriter::hasVariable(boundsLonName)) 337 382 { 338 domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex, domain->ni_glo,domain->nj_glo);383 domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex, ni, nj); 339 384 readFieldVariableValue(domain->bounds_lonvalue_curvilinear_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 340 385 } … … 342 387 else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId))) 343 388 { 389 // Make sure that if there is no local domain defined on a process, the process still reads just one value. 390 int ni, ibegin; 391 if (domain->ni == 0) 392 { 393 ni = 1; 394 ibegin = 0; 395 } 396 else 397 { 398 ni = domain->ni; 399 ibegin = domain->ibegin; 400 } 401 344 402 std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0); 345 n SizeLatLon[0] = domain->ni_glo.getValue();346 CArray<double,1> globalLonLat(domain->ni_glo.getValue());403 nBeginLatLon[0] = ibegin; 404 nSizeLatLon[0] = ni; 347 405 348 406 StdString latName = this->getLatCoordName(fieldId); 349 407 if (SuperClassWriter::hasVariable(latName)) 350 408 { 351 domain->latvalue_unstructured_read_from_file.resize( domain->ni_glo);409 domain->latvalue_unstructured_read_from_file.resize(ni); 352 410 readFieldVariableValue(domain->latvalue_unstructured_read_from_file, latName, nBeginLatLon, nSizeLatLon); 353 411 } … … 356 414 if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare("")) 357 415 { 358 // readFieldVariableValue(globalLonLat, lonName, nBeginLatLon, nSizeLatLon); 359 domain->lonvalue_unstructured_read_from_file.resize(domain->ni_glo); 416 domain->lonvalue_unstructured_read_from_file.resize(ni); 360 417 readFieldVariableValue(domain->lonvalue_unstructured_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 361 418 } … … 379 436 380 437 std::vector<StdSize> nBeginBndsLatLon(2), nSizeBndsLatLon(2); 381 nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue();438 nBeginBndsLatLon[0] = ibegin; nSizeBndsLatLon[0] = ni; 382 439 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex; 383 440 … … 496 553 497 554 { // Read axis value 498 std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second); 499 CArray<double,1> readAxisValue(itMapN->second); 500 readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true); 501 int begin = 0, n = itMapN->second; 502 if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); 503 if (!axis->n.isEmpty()) n = axis->n.getValue(); 504 axis->value.resize(n); 505 for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); 555 bool hasValue = SuperClassWriter::hasVariable(itMapN->first); 556 if (hasValue) 557 { 558 std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second); 559 CArray<double,1> readAxisValue(itMapN->second); 560 readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true); 561 int begin = 0, n = itMapN->second; 562 if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); 563 if (!axis->n.isEmpty()) n = axis->n.getValue(); 564 axis->value.resize(n); 565 for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); 566 } 506 567 } 507 568 }
Note: See TracChangeset
for help on using the changeset viewer.