Changeset 624
- Timestamp:
- 06/22/15 13:36:37 (10 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 1 added
- 2 deleted
- 15 edited
- 12 moved
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/COMPLETE/context_atmosphere.xml
r586 r624 4 4 5 5 <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 6 <field id="field_A_atm" name="field_A_atm" operation="average" freq_op="1ts" domain_ref="domain_atm" axis_ref="axis_atm" /> 6 <field id="field_A_atm" name="field_A_atm_origin" operation="average" freq_op="1ts" grid_ref="grid_A_atm" /> 7 <field id="field_A_atm_zoom" name="field_A_atm" operation="average" freq_op="1ts" field_ref="field_A_atm" grid_ref="grid_A_atm_zoom" /> 7 8 </field_definition> 8 9 9 10 <file_definition type="multiple_file" par_access="collective" output_freq="6h" sync_freq="6h" output_level="10" enabled=".TRUE."> 10 11 <file id="output_atmosphere" name="output_atmosphere"> 11 <field field_ref="field_A_atm " />12 <field field_ref="field_A_atm_zoom" /> 12 13 </file> 13 14 <file id="output_atmosphere_zoom" name="output_atmosphere_zoom"> 14 <field field_ref="field_A_atm" name="field_A_atm_zoom" domain_ref="domain_atm_zoom"/>15 <field field_ref="field_A_atm" name="field_A_atm_zoom" /> 15 16 </file> 16 17 </file_definition> 17 18 18 19 <axis_definition> 19 <axis id="axis_atm" zoom_size="2" zoom_end="2" /> 20 <axis id="axis_atm"/> 21 <axis id="axis_atm_zoom" axis_ref="axis_atm"> 22 <zoom_axis zoom_size="2" zoom_end="2" /> 23 </axis> 20 24 </axis_definition> 21 25 … … 25 29 </domain_definition> 26 30 27 <grid_definition /> 31 <grid_definition> 32 <grid id="grid_A_atm"> 33 <domain domain_ref="domain_atm" /> 34 <axis axis_ref="axis_atm" /> 35 </grid> 36 <grid id="grid_A_atm_zoom"> 37 <domain domain_ref="domain_atm" /> 38 <axis axis_ref="axis_atm_zoom" /> 39 </grid> 40 </grid_definition> 41 28 42 29 43 </context> -
XIOS/trunk/inputs/Version2/iodef.xml
r623 r624 6 6 7 7 8 <field_definition level="1" enabled=".FALSE." >8 <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 9 9 <field id="field_AA" operation="average" freq_op="3600s" domain_ref="domain_A" axis_ref="axis_A" /> 10 10 <field id="field_A" operation="average" freq_op="3600s" grid_ref="grid_A" /> 11 11 <field id="field_Axis" operation="average" freq_op="3600s" grid_ref="grid_Axis" /> 12 12 <field id="field_Two_Axis" operation="average" freq_op="3600s" grid_ref="grid_Two_Axis" /> 13 <field id="field_Axis_transformed" operation="average" freq_op="3600s" field_ref="field_ Two_Axis" grid_ref="grid_Axis_tranformed" />13 <field id="field_Axis_transformed" operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_Axis_tranformed" /> 14 14 <field id="field_All_Axis" operation="average" freq_op="3600s" grid_ref="grid_All_Axis" /> 15 15 <field id="field_Scalar" operation="average" freq_op="3600s" grid_ref="ScalarGrid" /> … … 35 35 </file_definition> 36 36 37 38 37 <axis_definition> 39 38 <axis id="axis_A" /> … … 41 40 <axis id="axis_C" /> 42 41 <axis id="axis_D" /> 43 <axis id="axis_E" axis_ref="axis_ B">44 <inverse_axis />42 <axis id="axis_E" axis_ref="axis_C"> 43 <!-- <inverse_axis />--> 45 44 46 <zoom_axis zoom_begin=" 0" zoom_size="4" />45 <zoom_axis zoom_begin="1" zoom_size="2" /> 47 46 <!-- <inverse_axis />--> 48 47 </axis> 49 48 <axis id="axis_F" axis_ref="axis_A"> 50 <!-- <inverse_axis />-->49 <inverse_axis /> 51 50 </axis> 52 51 </axis_definition> … … 71 70 </grid> 72 71 <grid id="grid_Axis_tranformed"> 73 <!-- <domain domain_ref="domain_A" />--> 74 <axis axis_ref="axis_F" /> 75 <axis axis_ref="axis_E" /> 72 <domain domain_ref="domain_A" /> 73 <axis axis_ref="axis_E" /> 74 <!-- <axis axis_ref="axis_F" />--> 75 <!-- <axis axis_ref="axis_E" />--> 76 76 </grid> 77 77 <grid id="grid_All_Axis"> -
XIOS/trunk/inputs/iodef.xml
r554 r624 7 7 8 8 <field_definition level="1" enabled=".FALSE."> 9 <field id="field_A" operation="average" freq_op="3600s" domain_ref="domain_A" axis_ref="axis_A" /> 9 <field id="field_A" operation="average" freq_op="3600s" grid_ref="grid_A"/> 10 <field id="field_A_zoom" operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_A_zoom"/> 10 11 </field_definition> 11 12 … … 13 14 <file_definition type="multiple_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE."> 14 15 <file id="output" name="output"> 15 <field field_ref="field_A " />16 <field field_ref="field_A_zoom" name="field_A" /> 16 17 </file> 17 18 </file_definition> … … 19 20 20 21 <axis_definition> 21 <axis id="axis_A" zoom_size="2" zoom_end="2" /> 22 <axis id="axis_A"/> 23 <axis id="axis_A_zoom" axis_ref="axis_A"> 24 <zoom_axis zoom_begin="1" zoom_size="2" /> 25 </axis> 22 26 </axis_definition> 23 27 … … 26 30 </domain_definition> 27 31 28 <grid_definition /> 29 32 <grid_definition> 33 <grid id="grid_A"> 34 <domain domain_ref="domain_A" /> 35 <axis axis_ref="axis_A" /> 36 </grid> 37 <grid id="grid_A_zoom"> 38 <domain domain_ref="domain_A" /> 39 <axis axis_ref="axis_A_zoom" /> 40 </grid> 41 </grid_definition> 30 42 </context> 31 43 -
XIOS/trunk/src/client_server_mapping_distributed.cpp
r623 r624 35 35 Compute mapping global index of server which client sends to. 36 36 \param [in] globalIndexOnClient global index client has 37 \param [in] localIndexOnClient local index on client38 37 */ 39 38 void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) … … 61 60 int indexClient = std::distance(itbClientHash, itClientHash)-1; 62 61 63 if (clientRank_ == indexClient)64 {65 (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient);66 ++nbIndexAlreadyOnClient;67 }68 else69 62 { 70 63 client2ClientIndexGlobal[indexClient].push_back(globalIndexClient); … … 88 81 89 82 int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 83 90 84 // Receiving demand as well as the responds from other clients 91 85 // The demand message contains global index; meanwhile the responds have server index information 92 86 // Buffer to receive demand from other clients, it can be allocated or not depending whether it has demand(s) 93 87 unsigned long* recvBuffIndexGlobal = 0; 94 int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size()) 95 ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient); 96 if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * globalIndexToServerMapping_.size(); // Not very optimal but it's general 88 // int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size()) 89 // ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient); 90 int maxNbIndexDemandedFromOthers = (globalIndexToServerMapping_.size() > nbIndexSendToOthers) 91 ? globalIndexToServerMapping_.size() : nbIndexSendToOthers; 92 93 if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * nbIndexSendToOthers; //globalIndexToServerMapping_.size(); // Not very optimal but it's general 97 94 98 95 if (0 != maxNbIndexDemandedFromOthers) … … 102 99 int* recvBuffIndexServer = 0; 103 100 int nbIndexReceivedFromOthers = nbIndexSendToOthers; 104 // int nbIndexReceivedFromOthers = globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient;105 101 if (0 != nbIndexReceivedFromOthers) 106 102 recvBuffIndexServer = new int[nbIndexReceivedFromOthers]; … … 237 233 { 238 234 int indexClient = std::distance(itbClientHash, itClientHash)-1; 239 if (clientRank_ == indexClient)240 {241 globalIndexToServerMapping_.insert(std::make_pair<size_t,int>(it->first, it->second));242 }243 else244 235 { 245 236 sendBuff[indexClient] = 1; -
XIOS/trunk/src/distribution_client.cpp
r623 r624 148 148 axisMasks_[i].resize(axisList[i]->mask.numElements()); 149 149 axisMasks_[i] = axisList[i]->mask; 150 std::cout << "axisMask " << axisMasks_[i] << std::endl;151 150 } 152 151 … … 201 200 nBeginLocal_.at(indexMap_[idx]+1) = 0; 202 201 nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; 203 //nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin;204 //nZoomEnd_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1;202 nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin; 203 nZoomEnd_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1; 205 204 206 205 dataBegin_.at(indexMap_[idx]+1) = (2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; … … 213 212 nBeginLocal_.at(indexMap_[idx]) = 0; 214 213 nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; 215 //nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin;216 //nZoomEnd_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1;214 nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin; 215 nZoomEnd_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1; 217 216 218 217 dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); -
XIOS/trunk/src/node/axis.cpp
r623 r624 95 95 } 96 96 else this->ni.setValue(size); 97 std::cout << "value " << value << std::endl; 97 98 98 // StdSize true_size = value.numElements(); 99 99 // if (this->ni.getValue() != true_size) … … 135 135 } 136 136 137 void CAxis::checkZoom(void)138 {139 StdSize zoom_begin,zoom_end, zoom_size, axisSize;140 141 zoom_begin = this->zoom_begin.isEmpty() ? 0 : this->zoom_begin.getValue();142 zoom_size = this->zoom_size.isEmpty() ? size.getValue() : this->zoom_size.getValue();143 zoom_end = this->zoom_end.isEmpty() ? (size.getValue() - 1) : this->zoom_end.getValue();144 145 if (this->zoom_begin.isEmpty()) zoom_begin = zoom_end - zoom_size + 1;146 if (this->zoom_end.isEmpty()) zoom_end = zoom_begin + zoom_size - 1;147 if (this->zoom_size.isEmpty()) zoom_size = zoom_end - zoom_begin + 1;148 axisSize = size.getValue();149 150 if ( (zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end))151 ERROR("CAxis::checkAttributes(void)",152 << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified");153 154 this->zoom_begin.setValue(zoom_begin);155 this->zoom_end.setValue(zoom_end);156 this->zoom_size.setValue(zoom_size);157 }137 // void CAxis::checkZoom(void) 138 // { 139 // StdSize zoom_begin,zoom_end, zoom_size, axisSize; 140 // 141 // zoom_begin = (this->zoom_begin.isEmpty()) ? 0 : this->zoom_begin.getValue() ; 142 // zoom_size = (this->zoom_size.isEmpty()) ? size.getValue() : this->zoom_size.getValue() ; 143 // zoom_end = (this->zoom_end.isEmpty()) ? (size.getValue() - 1) : this->zoom_end.getValue() ; 144 // 145 // if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 146 // if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 147 // if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 148 // axisSize = size.getValue(); 149 // 150 // if ( (zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end)) 151 // ERROR("CAxis::checkAttributes(void)", 152 // << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 153 // 154 // this->zoom_begin.setValue(zoom_begin) ; 155 // this->zoom_end.setValue(zoom_end) ; 156 // this->zoom_size.setValue(zoom_size) ; 157 // } 158 158 159 159 void CAxis::checkMask() -
XIOS/trunk/src/node/axis.hpp
r623 r624 107 107 void checkData(); 108 108 void checkMask(); 109 void checkZoom();109 // void checkZoom(); 110 110 void checkTransformations(); 111 111 void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, -
XIOS/trunk/src/node/field.cpp
r623 r624 13 13 #include "context_server.hpp" 14 14 #include <set> 15 #include "axis_filter.hpp"16 #include "invert_algorithm.hpp"17 15 18 16 namespace xios{ … … 29 27 , foperation(), hasInstantData(false), hasExpression(false) 30 28 , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 31 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) , filter(0)29 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 32 30 , isReadDataRequestPending(false) 33 , filterSources_() , algorithms_()31 , filterSources_() 34 32 { setVirtualVariableGroup(); } 35 33 … … 43 41 , foperation(), hasInstantData(false), hasExpression(false) 44 42 , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 45 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) , filter(0)43 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 46 44 , isReadDataRequestPending(false) 47 , filterSources_() , algorithms_()45 , filterSources_() 48 46 { setVirtualVariableGroup(); } 49 47 … … 55 53 if (hasExpression) delete expression; 56 54 if (slotUpdateDate != NULL) delete slotUpdateDate; 57 if (0 != filter) delete filter;58 55 59 56 } … … 177 174 int rank=(*it).first ; 178 175 CArray<int,1>& index = *(it->second) ; 179 std::cout << "rank " << index << std::endl;180 std::cout << "data " << data << std::endl;181 176 CArray<double,1> data_tmp(index.numElements()) ; 182 177 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; … … 784 779 fieldRef->addReference(this); 785 780 fieldRef->solveGridDomainAxisRef(false); 786 // fieldRef->solveCheckMaskIndex(false);787 781 break; 788 782 } … … 798 792 fieldRef->addReference(this); 799 793 fieldRef->solveGridDomainAxisRef(false); 800 // fieldRef->solveCheckMaskIndex(false);801 794 } 802 795 … … 826 819 { 827 820 const std::map<int, CArray<int,1>* >& localIndexToSend = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToSendFromGridSource(); 828 const std::map<int, std::vector<CArray<int,1>* > > localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest();821 const std::map<int, std::vector<CArray<int,1>* > >& localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest(); 829 822 830 823 sendAndReceiveTransformedData(localIndexToSend, dataToSend, … … 857 850 CArray<int,1>* localIndex_p = itSend->second; 858 851 int countSize = localIndex_p->numElements(); 859 std::cout << "Data Source " << dataSrc << std::endl;860 852 for (int idx = 0; idx < countSize; ++idx) 861 853 { … … 888 880 } 889 881 } 890 std::cout << "Data Destination " << dataDest << std::endl;891 882 } 892 883 -
XIOS/trunk/src/node/field.hpp
r621 r624 15 15 #include "expr_node.hpp" 16 16 #include "declare_ref_func.hpp" 17 #include "generic_filter.hpp"18 17 #include "transformation_enum.hpp" 19 18 … … 231 230 bool isReadDataRequestPending; 232 231 std::vector<CField*> filterSources_; 233 std::vector<CGenericAlgorithm*> algorithms_;234 232 DECLARE_REF_FUNC(Field,field) 235 233 -
XIOS/trunk/src/node/field_impl.hpp
r621 r624 49 49 { 50 50 (*it)->setData(_data); 51 if (hasOutputFile || hasFieldOut) updateData(_data); 52 } 53 } 54 51 } 52 } 53 if (hasOutputFile || hasFieldOut) updateData(_data); 55 54 } 56 55 } -
XIOS/trunk/src/node/grid.cpp
r623 r624 772 772 bool CGrid::doGridHaveDataToWrite() 773 773 { 774 size_t ssize = 0; 775 for (map<int, CArray<size_t, 1>* >::const_iterator it = outIndexFromClient.begin(); 776 it != outIndexFromClient.end(); ++it) 777 { 778 ssize += (it->second)->numElements(); 779 } 780 return (0 != ssize); 774 // size_t ssize = 0; 775 // for (map<int, CArray<size_t, 1>* >::const_iterator it = outIndexFromClient.begin(); 776 // it != outIndexFromClient.end(); ++it) 777 // { 778 // ssize += (it->second)->numElements(); 779 // } 780 // return (0 != ssize); 781 return (0 != writtenDataSize_); 781 782 } 782 783 -
XIOS/trunk/src/output/nc4_data_output.cpp
r623 r624 1362 1362 if (!field->prec.isEmpty() && field->prec==2) fieldData=round(fieldData) ; 1363 1363 1364 std::cout << "fieldData "<< fieldData << std::endl;1365 1364 switch (SuperClass::type) 1366 1365 { -
XIOS/trunk/src/test/test_client.f90
r554 r624 88 88 CALL xios_get_handle("output",file_hdl) 89 89 CALL xios_add_child(file_hdl,field_hdl) 90 CALL xios_set_attr(field_hdl,field_ref="field_A ",name="field_C")90 CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 91 91 92 92 dtime%second = 3600 -
XIOS/trunk/src/test/test_complete.f90
r586 r624 96 96 CALL xios_set_domain_attr("domain_atm_zoom",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 97 97 CALL xios_set_domain_attr("domain_atm_zoom",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 98 CALL xios_set_domain_attr("domain_atm_zoom",zoom_ibegin=39, zoom_ni=20, zoom_jbegin=39, zoom_nj=5)98 ! CALL xios_set_domain_attr("domain_atm_zoom",zoom_ibegin=39, zoom_ni=20, zoom_jbegin=39, zoom_nj=5) 99 99 100 100 !!! Activation du groupe field_definition … … 109 109 !!! Heritage des attributs d un autre champ 110 110 111 CALL xios_set_attr(field_hdl,field_ref="field_A_atm ",name="field_B_atm")111 CALL xios_set_attr(field_hdl,field_ref="field_A_atm_zoom",name="field_B_atm") 112 112 113 113 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom -
XIOS/trunk/src/test/test_new_features.f90
r623 r624 15 15 CHARACTER(len=15) :: calendar_type 16 16 TYPE(xios_context) :: ctx_hdl 17 INTEGER,PARAMETER :: ni_glo= 518 INTEGER,PARAMETER :: nj_glo= 519 INTEGER,PARAMETER :: llm= 217 INTEGER,PARAMETER :: ni_glo=100 18 INTEGER,PARAMETER :: nj_glo=100 19 INTEGER,PARAMETER :: llm=5 20 20 DOUBLE PRECISION :: lval(llm)=1, tsTemp 21 21 TYPE(xios_field) :: field_hdl … … 68 68 axisBegin = 0 69 69 nAxis = llm 70 DO n=0, size -171 nAxis = llm/size72 IF (n<MOD(llm,size)) nAxis=nAxis+173 IF (n==rank) exit74 axisBegin=axisBegin+nAxis75 ENDDO70 ! DO n=0, size -1 71 ! nAxis = llm/size 72 ! IF (n<MOD(llm,size)) nAxis=nAxis+1 73 ! IF (n==rank) exit 74 ! axisBegin=axisBegin+nAxis 75 ! ENDDO 76 76 axisEnd=axisBegin+nAxis-1 77 77 … … 117 117 CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 118 118 119 !CALL xios_get_handle("field_definition",fieldgroup_hdl)120 !CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")121 !CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")122 ! 123 !CALL xios_get_handle("output",file_hdl)124 !CALL xios_add_child(file_hdl,field_hdl)125 !CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C")119 CALL xios_get_handle("field_definition",fieldgroup_hdl) 120 CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 121 CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 122 123 CALL xios_get_handle("output",file_hdl) 124 CALL xios_add_child(file_hdl,field_hdl) 125 CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 126 126 ! 127 127 ! CALL xios_get_handle("output_All_Axis",file_hdl) -
XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp
r623 r624 1 /*! 2 \file axis_algorithm_inverse.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Algorithm for inversing an axis.. 8 */ 1 9 #include "axis_algorithm_inverse.hpp" 2 10 -
XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp
r623 r624 1 /*! 2 \file axis_algorithm_inverse.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Algorithm for inversing an axis.. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ … … 6 14 7 15 namespace xios { 8 16 /*! 17 \class CAxisAlgorithmInverse 18 Inversing an axis 19 */ 9 20 class CAxisAlgorithmInverse : public CAxisAlgorithmTransformation 10 21 { -
XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp
r623 r624 1 /*! 2 \file axis_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all axis transformation algorithms. 8 */ 9 1 10 #include "axis_algorithm_transformation.hpp" 2 #include "axis_ inverse.hpp"3 #include "axis_ zoom.hpp"11 #include "axis_algorithm_inverse.hpp" 12 #include "axis_algorithm_zoom.hpp" 4 13 5 14 namespace xios { … … 8 17 : CGenericAlgorithmTransformation() 9 18 { 10 // if (axisDestination->size.getValue() != axisSource->size.getValue())11 // {12 // ERROR("CAxisZoom::CAxisZoom(CAxis* axisDestination, CAxis* axisSource)",13 // << "Two axis have different size"14 // << "Size of axis source " <<axisSource->getId() << " is " << axisSource->size.getValue() << std::endl15 // << "Size of axis destionation " <<axisDestination->getId() << " is " << axisDestination->size.getValue());16 // }17 //18 //19 // axisDestGlobalSize_ = axisDestination->size.getValue();20 // int niDest = axisDestination->ni.getValue();21 // int ibeginDest = axisDestination->ibegin.getValue();22 //23 // for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx);24 19 } 25 20 26 21 CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() 27 22 { 28 // for (int idx = 0; idx < algosOfAnAxis_.size(); ++idx) delete algosOfAnAxis_[idx];29 23 } 30 24 31 25 void CAxisAlgorithmTransformation::computeIndexSourceMapping() 32 26 { 33 // if (!algosOfAnAxis_.empty())34 // {35 // algosOfAnAxis_[0]->computeIndexSourceMapping(this->transformationMapping_);36 // for (int idx = 1; idx < algosOfAnAxis_.size(); ++idx)37 // {38 // algosOfAnAxis_[idx]->computeIndexSourceMapping(algosOfAnAxis_[idx-1]->getTransformationMapping());39 // }40 // this->transformationMapping_ = algosOfAnAxis_[algosOfAnAxis_.size()-1]->getTransformationMapping();41 // }42 27 } 43 28 … … 162 147 } 163 148 } 164 165 166 149 } -
XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp
r623 r624 1 /*! 2 \file axis_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all axis transformation algorithms. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ … … 4 12 #include "generic_algorithm_transformation.hpp" 5 13 #include "axis.hpp" 6 #include "concrete_algo.hpp"7 14 8 15 namespace xios { 9 16 17 /*! 18 \class CAxisAlgorithmTransformation 19 Algorithms for axis. 20 */ 10 21 class CAxisAlgorithmTransformation : public virtual CGenericAlgorithmTransformation 11 22 { … … 24 35 std::vector<CArray<size_t,1> >& globalIndexSrcGrid); 25 36 void computeIndexSourceMapping(); 37 26 38 protected: 39 //! Global index of an axis on grid destination 27 40 std::vector<int> axisDestGlobalIndex_; 41 42 //! Size of 28 43 int axisDestGlobalSize_; 29 44 -
XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp
r623 r624 1 /*! 2 \file axis_algorithm_zoom.cpp 3 \author Ha NGUYEN 4 \since 03 June 2015 5 \date 12 June 2015 6 7 \brief Algorithm for zooming on an axis. 8 */ 1 9 #include "axis_algorithm_zoom.hpp" 2 10 … … 22 30 } 23 31 32 /*! 33 Compute the index mapping between axis on grid source and one on grid destination 34 */ 24 35 void CAxisAlgorithmZoom::computeIndexSourceMapping() 25 36 { … … 43 54 } 44 55 56 /*! 57 After a zoom on axis, it should be certain that (global) zoom begin and (global) zoom size are updated 58 */ 45 59 void CAxisAlgorithmZoom::updateZoom() 46 60 { … … 49 63 } 50 64 65 /*! 66 Update mask on axis 67 Because only zoomed region on axis is not masked, the remaining must be masked to make sure 68 correct index be extracted 69 */ 51 70 void CAxisAlgorithmZoom::updateAxisDestinationMask() 52 71 { -
XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp
r623 r624 1 /*! 2 \file axis_algorithm_zoom.hpp 3 \author Ha NGUYEN 4 \since 03 June 2015 5 \date 12 June 2015 6 7 \brief Algorithm for zooming on an axis. 8 */ 1 9 #ifndef __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ 2 10 #define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ … … 7 15 8 16 namespace xios { 9 17 /*! 18 \class CAxisAlgorithmZoom 19 Implementing zoom on axis 20 A zoomed region can be considered as region that isnt masked. 21 Only this zoomed region is extracted to write on Netcdf. 22 */ 10 23 class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation 11 24 { … … 20 33 void updateAxisDestinationMask(); 21 34 void updateZoom(); 35 22 36 private: 37 //! Global zoom begin on axis 23 38 StdSize zoomBegin_; 39 40 //! Global zoom end on axis 24 41 StdSize zoomEnd_; 42 43 //! Global zoom size on axis 25 44 StdSize zoomSize_; 26 45 27 46 private: 47 //! Axis on grid destination 28 48 CAxis* axisDest_; 49 50 //! Axis on grid source 29 51 CAxis* axisSrc_; 30 52 }; -
XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp
r623 r624 1 /*! 2 \file generic_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all transformation algorithms. 8 */ 1 9 #include "generic_algorithm_transformation.hpp" 2 10 … … 26 34 iteTransMap = transformationMapping_.end(); 27 35 std::vector<int>::const_iterator itbVec, itVec, iteVec; 28 std::vector<CArray<size_t,1> > globalIndexSrcGrid ((itTransMap->second).size());36 std::vector<CArray<size_t,1> > globalIndexSrcGrid; //((itTransMap->second).size()); 29 37 CArray<size_t,1> globalIndexDestGrid; 30 31 38 for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap) 32 39 { 40 33 41 this->computeGlobalIndexFromGlobalIndexElement(itTransMap->first, 34 42 itTransMap->second, -
XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp
r623 r624 1 /*! 2 \file generic_algorithm_transformation.hpp 3 \author Ha NGUYEN 4 \since 14 May 2015 5 \date 09 June 2015 6 7 \brief Interface for all transformation algorithms. 8 */ 1 9 #ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ 2 10 #define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ … … 7 15 8 16 namespace xios { 9 17 /*! 18 \class CGenericAlgorithmTransformation 19 This class defines the interface for all other inherted algorithms class 20 */ 10 21 class CGenericAlgorithmTransformation 11 22 { -
XIOS/trunk/src/transformation/grid_transformation.cpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Interface for all transformations. … … 62 62 } 63 63 64 /*! 65 Initialize the mapping between the first grid source and the original one 66 In a series of transformation, for each step, there is a need to "create" a new grid that plays a role of "temporary" source. 67 Because at the end of the series, we need to know about the index mapping between the final grid destination and original grid source, 68 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 69 */ 64 70 void CGridTransformation::initializeMappingOfOriginalGridSource() 65 71 { … … 100 106 } 101 107 108 /*! 109 Initialize the algorithms (transformations) 110 */ 102 111 void CGridTransformation::initializeAlgorithms() 103 112 { … … 154 163 } 155 164 165 /*! 166 Select algorithm correspoding to its transformation type and its position in each element 167 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 168 and position of axis is 2 169 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 170 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 171 */ 156 172 void CGridTransformation::selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 157 173 { … … 159 175 } 160 176 177 /*! 178 Select algorithm of an axis correspoding to its transformation type and its position in each element 179 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 180 and position of axis is 2 181 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 182 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 183 */ 161 184 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 162 185 { … … 188 211 } 189 212 213 /*! 214 Select algorithm of a domain correspoding to its transformation type and its position in each element 215 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 216 and position of axis is 2 217 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 218 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 219 */ 190 220 void CGridTransformation::selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 191 221 { 192 193 } 194 222 } 223 224 /*! 225 Assign the current grid destination to the grid source in the new transformation. 226 The current grid destination plays the role of grid source in next transformation (if any). 227 Only element on which the transformation is performed is modified 228 \param [in] elementPositionInGrid position of element in grid 229 \param [in] transType transformation type 230 */ 195 231 void CGridTransformation::setUpGrid(int elementPositionInGrid, ETranformationType transType) 196 232 { … … 211 247 } 212 248 249 /*! 250 Perform all transformations 251 For each transformation, there are some things to do: 252 -) Chose the correct algorithm by transformation type and position of element 253 -) Calculate the mapping of global index between the current grid source and grid destination 254 -) Calculate the mapping of global index between current grid DESTINATION and ORIGINAL grid SOURCE 255 -) Make current grid destination become grid source in the next transformation 256 */ 213 257 void CGridTransformation::computeAll() 214 258 { … … 234 278 const CArray<size_t,1>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 235 279 236 std::cout << "global index grid dest send to server " << globalIndexGridDestSendToServer << std::endl;237 280 // ComputeTransformation of global index of each element 238 281 std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); … … 250 293 } 251 294 252 std::cout << "global index destination 0 final " << *globalIndexOfCurrentGridSource_ << std::endl;253 std::cout << "global index destination 1 final " << *globalIndexOfOriginalGridSource_ << std::endl;254 295 updateFinalGridDestination(); 255 296 computeFinalTransformationMapping(); … … 269 310 CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 270 311 const CArray<int, 1>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 271 std::cout << "local mask " << localMaskIndexOnClientDest << std::endl;272 273 312 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 274 std::cout << "global index " << globalIndexOnClientDest << std::endl; 313 275 314 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 276 315 itbArr = globalIndexOnClientDest.begin(); … … 308 347 } 309 348 310 std::cout << "index to modify " << *maskIndexToModify << std::endl;311 349 gridDestination_->modifyMask(*maskIndexToModify); 312 350 … … 339 377 int sendBuffSize = 0; 340 378 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 341 342 std::cout << "global index destination 0 before" << *globalIndexOfCurrentGridSource_ << std::endl;343 std::cout << "global index destination 1 before" << *globalIndexOfOriginalGridSource_ << std::endl;344 379 345 380 typedef unsigned long Scalar; … … 401 436 if (globalIndexOfCurrentGridSource_->numElements() != nbCurrentGridSource) 402 437 { 403 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfCurrentGridSource_)) 404 { 405 delete globalIndexOfCurrentGridSource_; 406 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 407 } 438 delete globalIndexOfCurrentGridSource_; 439 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 408 440 } 409 441 410 442 if (globalIndexOfOriginalGridSource_->numElements() != nbCurrentGridSource) 411 443 { 412 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfOriginalGridSource_)) 413 { 414 delete globalIndexOfOriginalGridSource_; 415 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 416 } 444 delete globalIndexOfOriginalGridSource_; 445 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 417 446 } 418 447 … … 434 463 } 435 464 436 std::cout << "global index destination 0 after " << *globalIndexOfCurrentGridSource_ << std::endl;437 std::cout << "global index destination 1 after " << *globalIndexOfOriginalGridSource_ << std::endl;438 465 if (0 != sendBuffSize) delete [] sendBuff; 439 466 if (0 != recvBuffSize) delete [] recvBuff; … … 475 502 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 476 503 477 std::cout << "dest: local index " << localIndexOnClientDest << std::endl;478 std::cout << "dest: global index " << globalIndexOnClientDest << std::endl;479 504 const CArray<int, 1>& localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 480 505 const CArray<size_t,1>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 481 std::cout << "src: local index " << localIndexOnClientSrc << std::endl; 482 std::cout << "src: global index " << globalIndexOnClientSrc << std::endl; 506 483 507 std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 484 508 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; … … 506 530 { 507 531 int localIdx = std::distance(itbArr, itArr); 508 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain)509 //(*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data532 // (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 533 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 510 534 } 511 535 } 512 536 } 513 // std::cout << "local index to receive from source Rank = " << sourceRank << (*localIndexToReceiveOnGridDest_[sourceRank][i]) << std::endl;514 537 } 515 538 … … 536 559 } 537 560 } 538 std::cout << "local index to send to dest Rank = " << destRank << (*localIndexToSendFromGridSource_[destRank]) << std::endl;539 561 } 540 562 } … … 544 566 \return local index of data 545 567 */ 546 std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 568 const std::map<int, CArray<int,1>* >& CGridTransformation::getLocalIndexToSendFromGridSource() const 547 569 { 548 570 return localIndexToSendFromGridSource_; … … 553 575 \return local index of data 554 576 */ 555 std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 577 const std::map<int, std::vector<CArray<int,1>* > >& CGridTransformation::getLocalIndexToReceiveOnGridDest() const 556 578 { 557 579 return localIndexToReceiveOnGridDest_; -
XIOS/trunk/src/transformation/grid_transformation.hpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Interface for all transformations. … … 40 40 void computeAll(); 41 41 42 43 std::map<int, CArray<int,1>* > getLocalIndexToSendFromGridSource(); 44 std::map<int, std::vector<CArray<int,1>* > > getLocalIndexToReceiveOnGridDest(); 42 const std::map<int, CArray<int,1>* >& getLocalIndexToSendFromGridSource() const; 43 const std::map<int, std::vector<CArray<int,1>* > >& getLocalIndexToReceiveOnGridDest() const; 45 44 46 45 private: -
XIOS/trunk/src/transformation/transformation_mapping.cpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Take charge of communication among clients to exchange transformed data. … … 33 33 } 34 34 35 std::cout << "global index grid src " << globalIndexGridSrc << std::endl;36 35 gridIndexClientClientMapping_ = new CClientServerMappingDistributed(globalIndexOfServer, 37 36 client->intraComm, -
XIOS/trunk/src/transformation/transformation_mapping.hpp
r623 r624 47 47 //! Mapping of client rank of grid destination and global index to send from grid source 48 48 std::map<int,std::vector<size_t> > globalIndexSendToGridDestMapping_; 49 50 49 }; 51 50
Note: See TracChangeset
for help on using the changeset viewer.