Changeset 1269
- Timestamp:
- 09/15/17 16:51:16 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/config/interpolate_domain_attribute.conf
r1264 r1269 9 9 DECLARE_ATTRIBUTE(StdString, weight_filename) 10 10 DECLARE_ATTRIBUTE(bool, write_weight) 11 DECLARE_ENUM2(read_write_convention, c, fortran) -
XIOS/dev/XIOS_DEV_CMIP6/src/node/interpolate_domain.cpp
r1264 r1269 63 63 if (this->write_weight.isEmpty()) this->write_weight.setValue(false); 64 64 65 StdString weightFile; 66 switch (this->mode) 67 { 68 case mode_attr::read: 69 if (this->weight_filename.isEmpty()) 70 { 71 if (!this->write_weight) 72 ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 73 << "Read mode is activated but there is no file specified." << std::endl 74 << "Please define a correct file containing interpolation weights with option 'file'. "); 75 } 76 else 77 { 78 weightFile = this->weight_filename; 79 ifstream f(weightFile.c_str()); 80 if (!f.good()) 81 ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 82 << "Read mode is activated but file " << weightFile << " doesn't exist." << std::endl 83 << "Please check this file "); 84 } 85 break; 86 case mode_attr::compute: 87 break; 88 case mode_attr::read_or_compute: 89 if (!this->weight_filename.isEmpty() && !this->write_weight) 90 { 91 weightFile = this->weight_filename; 92 ifstream f(weightFile.c_str()); 93 if (!f.good()) 94 ERROR("void CInterpolateDomain::checkValid(CDomain* domainSrc)", 95 << "read_or_compute mode is activated but file " << weightFile << " doesn't exist." << std::endl 96 << "Please check this file "); 97 } 98 break; 99 default: 100 break; 101 } 65 if (this->read_write_convention.isEmpty()) this->read_write_convention.setValue(read_write_convention_attr::fortran); 102 66 103 67 } -
XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_interpolate.cpp
r1268 r1269 56 56 renormalize = interpDomain_->renormalize ; 57 57 quantity = interpDomain_->quantity ; 58 59 if (interpDomain_->read_write_convention == CInterpolateDomain::read_write_convention_attr::fortran) fortranConvention=true ; 60 else fortranConvention=false ; 58 61 59 62 fileToReadWrite_ = "xios_interpolation_weights_"; … … 768 771 769 772 int index = 0; 773 int indexOffset=0 ; 774 if (fortranConvention) indexOffset=1 ; 770 775 for (it = itb; it !=ite; ++it) 771 776 { … … 773 778 for (int idx = 0; idx < tmp.size(); ++idx) 774 779 { 775 dst_idx(index) = it->first + 1;776 src_idx(index) = tmp[idx].first + 1;780 dst_idx(index) = it->first + indexOffset; 781 src_idx(index) = tmp[idx].first + indexOffset; 777 782 weights(index) = tmp[idx].second; 778 783 ++index; … … 884 889 nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ; 885 890 886 for(size_t ind=0; ind<nbWeight;++ind) 887 interpMapValue[dstIndex[ind]-1].push_back(make_pair(srcIndex[ind]-1,weight[ind])); 888 } 891 int indexOffset=0 ; 892 if (fortranConvention) indexOffset=1 ; 893 for(size_t ind=0; ind<nbWeight;++ind) 894 interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind])); 895 } 889 896 890 897 void CDomainAlgorithmInterpolate::apply(const std::vector<std::pair<int,double> >& localIndex, -
XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_interpolate.hpp
r1264 r1269 63 63 bool readFromFile_; 64 64 StdString fileToReadWrite_; 65 bool fortranConvention ; 65 66 66 67 // class WriteNetCdf;
Note: See TracChangeset
for help on using the changeset viewer.