- Timestamp:
- 07/27/22 11:49:51 (2 years ago)
- Location:
- XIOS3/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/io/nc4_data_output.cpp
r2387 r2389 20 20 , SuperClassWriter(filename, exist) 21 21 , filename(filename) 22 , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none), rel Elements_()22 , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none), relAxis_(), relDomains_() 23 23 { 24 24 SuperClass::type = MULTI_FILE; … … 34 34 , filename(filename) 35 35 , isCollective(isCollective) 36 , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none), rel Elements_()36 , file(file),hasTimeInstant(false),hasTimeCentered(false), timeCounterType(none), relAxis_(), relDomains_() 37 37 { 38 38 SuperClass::type = (multifile) ? MULTI_FILE : ONE_FILE; … … 79 79 { 80 80 // if yes, associate the same ids to current element 81 domain->name = it->second.second->getDomainOutputName(); 82 domain->lon_name = it->second.second->lon_name; 83 domain->lat_name = it->second.second->lat_name; 84 if (domain->type == CDomain::type_attr::unstructured) 85 { 86 domain->dim_i_name = it->second.second->dim_i_name; 87 domain->dim_j_name = it->second.second->dim_j_name; 88 } 81 domain->renameAttributesBeforeWriting( it->second.second ); 89 82 elementIsInMap = true; 90 83 } … … 93 86 if (!elementIsInMap) // ! in MAP 94 87 { 95 domain->name = domain->getId(); 96 domain->lon_name = "lon_"+domain->getId(); 97 domain->lat_name = "lat_"+domain->getId(); 98 if (domain->type == CDomain::type_attr::unstructured) 99 { 100 domain->dim_i_name = "cell_"+domain->getId(); 101 domain->dim_j_name = "nvertex_"+domain->getId(); 102 } 88 domain->renameAttributesBeforeWriting(); 103 89 relDomains_.insert( make_pair( defaultNameKey, make_pair(globalHash, domain) ) ) ; 104 90 } … … 1056 1042 1057 1043 StdString defaultNameKey = axis->getAxisOutputName(); 1058 if ( !rel Elements_.count ( defaultNameKey ) )1044 if ( !relAxis_.count ( defaultNameKey ) ) 1059 1045 { 1060 1046 // if defaultNameKey not in the map, write the element such as it is defined 1061 rel Elements_.insert( make_pair( defaultNameKey, make_pair(globalHash, defaultNameKey) ) );1047 relAxis_.insert( make_pair( defaultNameKey, make_pair(globalHash, axis) ) ); 1062 1048 } 1063 1049 else // look if a hash associated this key is equal 1064 1050 { 1065 1051 bool elementIsInMap(false); 1066 auto defaultNameKeyElements = rel Elements_.equal_range( defaultNameKey );1052 auto defaultNameKeyElements = relAxis_.equal_range( defaultNameKey ); 1067 1053 for (auto it = defaultNameKeyElements.first; it != defaultNameKeyElements.second; it++) 1068 1054 { … … 1070 1056 { 1071 1057 // if yes, associate the same ids to current element 1072 axis-> name = it->second.second;1058 axis->renameAttributesBeforeWriting( it->second.second ); 1073 1059 elementIsInMap = true; 1074 1060 } … … 1077 1063 if (!elementIsInMap) // ! in MAP 1078 1064 { 1079 axis-> name = axis->getId();1080 rel Elements_.insert( make_pair( defaultNameKey, make_pair(globalHash, axis->getAxisOutputName()) ) ) ;// = axis->getId()1065 axis->renameAttributesBeforeWriting(); 1066 relAxis_.insert( make_pair( defaultNameKey, make_pair(globalHash, axis) ) ) ;// = axis->getId() 1081 1067 } 1082 1068 } -
XIOS3/trunk/src/io/nc4_data_output.hpp
r2388 r2389 129 129 bool hasTimeCentered ; 130 130 131 std::multimap< StdString, pair<size_t, StdString> > relElements_;131 std::multimap< StdString, pair<size_t,CAxis*> > relAxis_; 132 132 std::multimap< StdString, pair<size_t,CDomain*> > relDomains_; 133 133 -
XIOS3/trunk/src/node/axis.cpp
r2388 r2389 340 340 return distributedHash + globalHash; 341 341 } 342 342 343 void CAxis::renameAttributesBeforeWriting(CAxis* writtenAxis) 344 { 345 if (writtenAxis!=NULL) 346 { 347 this->name = writtenAxis->getAxisOutputName(); 348 // + label if necessary, other attributs concerned ? 349 } 350 else 351 { 352 this->name = this->getId(); 353 // + label if necessary, other attributs concerned ? 354 } 355 } 356 343 357 void CAxis::setGeometricAttributes(const CAxis& axisSrc) 344 358 { -
XIOS3/trunk/src/node/axis.hpp
r2388 r2389 131 131 132 132 size_t computeAttributesHash( MPI_Comm comm ); 133 void renameAttributesBeforeWriting(CAxis* writtenAxis=NULL); 133 134 134 135 size_t getGlobalWrittenSize(void) ; -
XIOS3/trunk/src/node/domain.cpp
r2388 r2389 1816 1816 return distributedHash + globalHash; 1817 1817 } 1818 1819 void CDomain::renameAttributesBeforeWriting(CDomain* writtenDomain) 1820 { 1821 if (writtenDomain!=NULL) 1822 { 1823 this->name = writtenDomain->getDomainOutputName(); 1824 this->lon_name = writtenDomain->lon_name; 1825 this->lat_name = writtenDomain->lat_name; 1826 if (this->type == CDomain::type_attr::unstructured) 1827 { 1828 this->dim_i_name = writtenDomain->dim_i_name; 1829 this->dim_j_name = writtenDomain->dim_j_name; 1830 } 1831 } 1832 else 1833 { 1834 this->name = this->getId(); 1835 this->lon_name = "lon_"+this->getId(); 1836 this->lat_name = "lat_"+this->getId(); 1837 if (this->type == CDomain::type_attr::unstructured) 1838 { 1839 this->dim_i_name = "cell_"+this->getId(); 1840 this->dim_j_name = "nvertex_"+this->getId(); 1841 } 1842 } 1843 } 1818 1844 1819 1845 void CDomain::initializeLocalElement(void) -
XIOS3/trunk/src/node/domain.hpp
r2388 r2389 92 92 93 93 size_t computeAttributesHash( MPI_Comm comm ); 94 void renameAttributesBeforeWriting(CDomain* writtenDomain=NULL); 94 95 95 96 //////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.