Changeset 551
- Timestamp:
- 02/11/15 16:23:02 (10 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 6 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/Version2/iodef.xml
r549 r551 20 20 21 21 <axis_definition> 22 <axis id="axis_A" zoom_size="2" zoom_end="3"/>22 <axis id="axis_A" /> 23 23 <axis id="axis_B" zoom_size="2" zoom_end="3" /> 24 24 </axis_definition> -
XIOS/trunk/src/attribute_array_decl.cpp
r501 r551 9 9 template class CAttributeArray<int,1> ; 10 10 template class CAttributeArray<int,2> ; 11 template class CAttributeArray<bool,1> ; 11 12 template class CAttributeArray<bool,2> ; 12 13 template class CAttributeArray<bool,3> ; -
XIOS/trunk/src/config/axis_attribute.conf
r540 r551 14 14 DECLARE_ATTRIBUTE(StdString, axis_ref) 15 15 16 /* LOCAL */ 17 DECLARE_ATTRIBUTE(int, data_n) 18 DECLARE_ATTRIBUTE(int, data_begin) 19 DECLARE_ARRAY(int, 1 , data_index) 16 20 21 /*LOCAL */ 22 DECLARE_ATTRIBUTE(int, ibegin) 23 DECLARE_ATTRIBUTE(int, ni) 24 25 /* LOCAL */ 26 DECLARE_ARRAY(bool, 1 , mask) -
XIOS/trunk/src/config/grid_attribute.conf
r541 r551 4 4 //DECLARE_ATTRIBUTE(StdString, axis_ref) 5 5 DECLARE_ARRAY(bool, 3 , mask) 6 //DECLARE_ARRAY(bool, 4 , mask4) 7 //DECLARE_ARRAY(bool, 5 , mask5) 8 //DECLARE_ARRAY(bool, 6 , mask6) 9 //DECLARE_ARRAY(bool, 7 , mask7) 10 6 11 7 12 // These attributes should be used privately 8 13 // An array contains order of axis and domains composing of the grid 9 DECLARE_ARRAY( int, 1 , axisDomOrder)14 DECLARE_ARRAY(bool, 1 , axisDomainOrder) -
XIOS/trunk/src/interface/c_attr/icgrid_attr.cpp
r541 r551 17 17 { 18 18 typedef xios::CGrid* grid_Ptr; 19 20 void cxios_set_grid_axisDomOrder(grid_Ptr grid_hdl, int* axisDomOrder, int extent1)19 20 void cxios_set_grid_axisDomOrder(grid_Ptr grid_hdl, bool* axisDomainOrder, int extent1) 21 21 { 22 22 CTimer::get("XIOS").resume(); 23 CArray< int,1> tmp(axisDomOrder,shape(extent1),neverDeleteData) ;24 grid_hdl->axisDom Order.reference(tmp.copy());23 CArray<bool,1> tmp(axisDomainOrder,shape(extent1),neverDeleteData) ; 24 grid_hdl->axisDomainOrder.reference(tmp.copy()); 25 25 CTimer::get("XIOS").suspend(); 26 26 } 27 28 void cxios_get_grid_axisDomOrder(grid_Ptr grid_hdl, int* axisDomOrder, int extent1)27 28 void cxios_get_grid_axisDomOrder(grid_Ptr grid_hdl, bool* axisDomainOrder, int extent1) 29 29 { 30 30 CTimer::get("XIOS").resume(); 31 CArray< int,1> tmp(axisDomOrder,shape(extent1),neverDeleteData) ;32 tmp=grid_hdl->axisDom Order.getInheritedValue() ;31 CArray<bool,1> tmp(axisDomainOrder,shape(extent1),neverDeleteData) ; 32 tmp=grid_hdl->axisDomainOrder.getInheritedValue() ; 33 33 CTimer::get("XIOS").suspend(); 34 34 } 35 35 36 36 bool cxios_is_defined_grid_axisDomOrder(grid_Ptr grid_hdl ) 37 37 { 38 38 CTimer::get("XIOS").resume(); 39 return grid_hdl->axisDom Order.hasInheritedValue();39 return grid_hdl->axisDomainOrder.hasInheritedValue(); 40 40 CTimer::get("XIOS").suspend(); 41 41 } 42 43 44 42 43 44 45 45 void cxios_set_grid_description(grid_Ptr grid_hdl, const char * description, int description_size) 46 46 { … … 51 51 CTimer::get("XIOS").suspend(); 52 52 } 53 53 54 54 void cxios_get_grid_description(grid_Ptr grid_hdl, char * description, int description_size) 55 55 { … … 59 59 CTimer::get("XIOS").suspend(); 60 60 } 61 61 62 62 bool cxios_is_defined_grid_description(grid_Ptr grid_hdl ) 63 63 { … … 66 66 CTimer::get("XIOS").suspend(); 67 67 } 68 69 70 68 69 70 71 71 void cxios_set_grid_mask(grid_Ptr grid_hdl, bool* mask, int extent1, int extent2, int extent3) 72 72 { … … 76 76 CTimer::get("XIOS").suspend(); 77 77 } 78 78 79 79 void cxios_get_grid_mask(grid_Ptr grid_hdl, bool* mask, int extent1, int extent2, int extent3) 80 80 { … … 84 84 CTimer::get("XIOS").suspend(); 85 85 } 86 86 87 87 bool cxios_is_defined_grid_mask(grid_Ptr grid_hdl ) 88 88 { … … 91 91 CTimer::get("XIOS").suspend(); 92 92 } 93 94 95 93 94 95 96 96 void cxios_set_grid_name(grid_Ptr grid_hdl, const char * name, int name_size) 97 97 { … … 102 102 CTimer::get("XIOS").suspend(); 103 103 } 104 104 105 105 void cxios_get_grid_name(grid_Ptr grid_hdl, char * name, int name_size) 106 106 { … … 110 110 CTimer::get("XIOS").suspend(); 111 111 } 112 112 113 113 bool cxios_is_defined_grid_name(grid_Ptr grid_hdl ) 114 114 { … … 117 117 CTimer::get("XIOS").suspend(); 118 118 } 119 120 121 122 119 120 121 122 123 123 } -
XIOS/trunk/src/interface/c_attr/icgridgroup_attr.cpp
r541 r551 17 17 { 18 18 typedef xios::CGridGroup* gridgroup_Ptr; 19 20 void cxios_set_gridgroup_axisDomOrder(gridgroup_Ptr gridgroup_hdl, int* axisDomOrder, int extent1)19 20 void cxios_set_gridgroup_axisDomOrder(gridgroup_Ptr gridgroup_hdl, bool* axisDomainOrder, int extent1) 21 21 { 22 22 CTimer::get("XIOS").resume(); 23 CArray< int,1> tmp(axisDomOrder,shape(extent1),neverDeleteData) ;24 gridgroup_hdl->axisDom Order.reference(tmp.copy());23 CArray<bool,1> tmp(axisDomainOrder,shape(extent1),neverDeleteData) ; 24 gridgroup_hdl->axisDomainOrder.reference(tmp.copy()); 25 25 CTimer::get("XIOS").suspend(); 26 26 } 27 28 void cxios_get_gridgroup_axisDomOrder(gridgroup_Ptr gridgroup_hdl, int* axisDomOrder, int extent1)27 28 void cxios_get_gridgroup_axisDomOrder(gridgroup_Ptr gridgroup_hdl, bool* axisDomainOrder, int extent1) 29 29 { 30 30 CTimer::get("XIOS").resume(); 31 CArray< int,1> tmp(axisDomOrder,shape(extent1),neverDeleteData) ;32 tmp=gridgroup_hdl->axisDom Order.getInheritedValue() ;31 CArray<bool,1> tmp(axisDomainOrder,shape(extent1),neverDeleteData) ; 32 tmp=gridgroup_hdl->axisDomainOrder.getInheritedValue() ; 33 33 CTimer::get("XIOS").suspend(); 34 34 } 35 35 36 36 bool cxios_is_defined_gridgroup_axisDomOrder(gridgroup_Ptr gridgroup_hdl ) 37 37 { 38 38 CTimer::get("XIOS").resume(); 39 return gridgroup_hdl->axisDom Order.hasInheritedValue();39 return gridgroup_hdl->axisDomainOrder.hasInheritedValue(); 40 40 CTimer::get("XIOS").suspend(); 41 41 } 42 43 44 42 43 44 45 45 void cxios_set_gridgroup_description(gridgroup_Ptr gridgroup_hdl, const char * description, int description_size) 46 46 { … … 51 51 CTimer::get("XIOS").suspend(); 52 52 } 53 53 54 54 void cxios_get_gridgroup_description(gridgroup_Ptr gridgroup_hdl, char * description, int description_size) 55 55 { … … 59 59 CTimer::get("XIOS").suspend(); 60 60 } 61 61 62 62 bool cxios_is_defined_gridgroup_description(gridgroup_Ptr gridgroup_hdl ) 63 63 { … … 66 66 CTimer::get("XIOS").suspend(); 67 67 } 68 69 70 68 69 70 71 71 void cxios_set_gridgroup_group_ref(gridgroup_Ptr gridgroup_hdl, const char * group_ref, int group_ref_size) 72 72 { … … 77 77 CTimer::get("XIOS").suspend(); 78 78 } 79 79 80 80 void cxios_get_gridgroup_group_ref(gridgroup_Ptr gridgroup_hdl, char * group_ref, int group_ref_size) 81 81 { … … 85 85 CTimer::get("XIOS").suspend(); 86 86 } 87 87 88 88 bool cxios_is_defined_gridgroup_group_ref(gridgroup_Ptr gridgroup_hdl ) 89 89 { … … 92 92 CTimer::get("XIOS").suspend(); 93 93 } 94 95 96 94 95 96 97 97 void cxios_set_gridgroup_mask(gridgroup_Ptr gridgroup_hdl, bool* mask, int extent1, int extent2, int extent3) 98 98 { … … 102 102 CTimer::get("XIOS").suspend(); 103 103 } 104 104 105 105 void cxios_get_gridgroup_mask(gridgroup_Ptr gridgroup_hdl, bool* mask, int extent1, int extent2, int extent3) 106 106 { … … 110 110 CTimer::get("XIOS").suspend(); 111 111 } 112 112 113 113 bool cxios_is_defined_gridgroup_mask(gridgroup_Ptr gridgroup_hdl ) 114 114 { … … 117 117 CTimer::get("XIOS").suspend(); 118 118 } 119 120 121 119 120 121 122 122 void cxios_set_gridgroup_name(gridgroup_Ptr gridgroup_hdl, const char * name, int name_size) 123 123 { … … 128 128 CTimer::get("XIOS").suspend(); 129 129 } 130 130 131 131 void cxios_get_gridgroup_name(gridgroup_Ptr gridgroup_hdl, char * name, int name_size) 132 132 { … … 136 136 CTimer::get("XIOS").suspend(); 137 137 } 138 138 139 139 bool cxios_is_defined_gridgroup_name(gridgroup_Ptr gridgroup_hdl ) 140 140 { … … 143 143 CTimer::get("XIOS").suspend(); 144 144 } 145 146 147 148 145 146 147 148 149 149 } -
XIOS/trunk/src/node/axis.cpp
r540 r551 57 57 StdSize size = this->size.getValue(); 58 58 59 if (!this->ibegin.isEmpty()) 60 { 61 StdSize ibegin = this->ibegin.getValue(); 62 if ((ibegin < 0) || (ibegin > size-1)) 63 ERROR("CAxis::checkAttributes(void)",<< "Attribut <ibegin> of the axis must be non-negative and smaller than size-1") ; 64 } 65 else this->ibegin.setValue(0); 66 67 if (!this->ni.isEmpty()) 68 { 69 StdSize ni = this->ni.getValue(); 70 if ((ni < 0) || (ni > size)) 71 ERROR("CAxis::checkAttributes(void)",<< "Attribut <ni> of the axis must be non-negative and smaller than size") ; 72 } 73 else this->ni.setValue(size); 74 59 75 StdSize zoom_begin,zoom_end, zoom_size ; 60 76 61 zoom_begin = (this->zoom_begin.isEmpty()) ? 1 : this->zoom_begin.getValue() ; 62 zoom_end = (this->zoom_end.isEmpty()) ? size : this->zoom_end.getValue() ; 77 // zoom_begin = (this->zoom_begin.isEmpty()) ? 1 : this->zoom_begin.getValue() ; 78 // zoom_end = (this->zoom_end.isEmpty()) ? size : this->zoom_end.getValue() ; 79 // zoom_size = (this->zoom_size.isEmpty()) ? size : this->zoom_size.getValue() ; 80 81 // Maybe index begins at 0 (zero) 82 zoom_begin = (this->zoom_begin.isEmpty()) ? 0 : this->zoom_begin.getValue() ; 83 zoom_end = (this->zoom_end.isEmpty()) ? size-1 : this->zoom_end.getValue() ; 63 84 zoom_size = (this->zoom_size.isEmpty()) ? size : this->zoom_size.getValue() ; 64 85 … … 66 87 if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 67 88 if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 89 // 90 // if ( (zoom_begin < 1) || (zoom_begin > size) || (zoom_end<1) || (zoom_end>size) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 91 // ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 68 92 69 if ( (zoom_begin < 1) || (zoom_begin > size) || (zoom_end<1) || (zoom_end>size) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end))93 if ( (zoom_begin < 0) || (zoom_begin > size-1) || (zoom_end<1) || (zoom_end>size-1) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 70 94 ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 95 71 96 this->zoom_begin.setValue(zoom_begin) ; 72 97 this->zoom_end.setValue(zoom_end) ; … … 78 103 << "The array \'value\' has a different size that the one defined by the \'size\' attribut") 79 104 105 this->checkData(); 106 this->checkMask(); 80 107 this->isChecked = true; 108 } 109 110 void CAxis::checkData() 111 { 112 if (data_begin.isEmpty()) data_begin.setValue(0); 113 if (!data_n.isEmpty() && data_n.getValue() <= 0) 114 { 115 ERROR("CAxis::checkData(void)", 116 << "Data dimension is negative (data_n).") ; 117 } 118 else if (data_n.isEmpty()) 119 data_n.setValue(zoom_size.getValue()); 120 121 if (data_index.isEmpty()) 122 { 123 int dn = data_n.getValue(); 124 data_index.resize(dn); 125 for (int i = 0; i < dn; ++i) data_index(i) = (i+1); 126 } 127 } 128 129 void CAxis::checkMask() 130 { 131 int begin_mask = 0, 132 end_mask = ni.getValue()-1; 133 134 if (!zoom_begin.isEmpty()) 135 { 136 int zoom_end = zoom_begin.getValue() + zoom_size.getValue() - 1; 137 138 begin_mask = std::max(ibegin.getValue(), zoom_begin.getValue()); 139 end_mask = std::min(ibegin.getValue() + ni.getValue()-1, zoom_end); 140 141 begin_mask -= ibegin.getValue(); 142 end_mask -= ibegin.getValue(); 143 } 144 145 146 if (!mask.isEmpty()) 147 { 148 if (mask.extent(0) != ni) 149 ERROR("CAxis::checkMask(void)", 150 <<"the mask has not the same size than the local axis"<<endl 151 <<"Local size is "<<ni<<"x"<<endl 152 <<"Mask size is "<<mask.extent(0)<<"x"); 153 for (int i = 0; i < ni; ++i) 154 { 155 if (i < begin_mask && i > end_mask) mask(i) = false; 156 } 157 } 158 else // (!mask.hasValue()) 159 { // Si aucun masque n'est défini, 160 // on en crée un nouveau qui valide l'intégralité du domaine. 161 mask.resize(ni) ; 162 for (int i = 0; i < ni.getValue(); ++i) 163 { 164 if (i >= begin_mask && i <= end_mask) 165 mask(i) = true; 166 else mask(i) = false; 167 } 168 } 81 169 } 82 170 -
XIOS/trunk/src/node/axis.hpp
r540 r551 70 70 71 71 private : 72 72 void checkData(); 73 void checkMask(); 73 74 bool isChecked; 74 75 std::set<StdString> relFiles; -
XIOS/trunk/src/node/domain.cpp
r540 r551 109 109 } 110 110 ni=1 ; 111 ibegin= 1;112 iend= 1;111 ibegin=0 ; 112 iend=0 ; 113 113 114 114 } … … 169 169 170 170 if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() || 171 ibegin.getValue() < 1 || iend.getValue() > ni_glo.getValue())171 ibegin.getValue() < 0 || iend.getValue() > (ni_glo.getValue()-1)) 172 172 { 173 173 … … 207 207 208 208 if (nj.getValue() < 0 || jbegin.getValue() > jend.getValue() || 209 jbegin.getValue() < 1 || jend.getValue() > nj_glo.getValue())209 jbegin.getValue() < 0 || jend.getValue() > (nj_glo.getValue()-1)) 210 210 ERROR("CDomain::checkAttributes(void)", 211 211 << "Domain is wrong defined," … … 488 488 int zoom_jend = zoom_jbegin + zoom_nj - 1; 489 489 490 if (zoom_ibegin < 1 || zoom_jbegin < 1 || zoom_iend > ni_glo || zoom_jend > nj_glo)490 if (zoom_ibegin < 0 || zoom_jbegin < 0 || zoom_iend > (ni_glo-1) || zoom_jend > (nj_glo-1)) 491 491 ERROR("CDomain::checkZoom(void)", 492 492 << "Zoom is wrong defined," … … 498 498 zoom_ni = ni_glo; 499 499 zoom_nj = nj_glo; 500 zoom_ibegin = 1;501 zoom_jbegin = 1;500 zoom_ibegin = 0; 501 zoom_jbegin = 0; 502 502 } 503 503 … … 613 613 { 614 614 int ni_srv=ni_glo.getValue() ; 615 int ibegin_srv= 1;615 int ibegin_srv=0 ; 616 616 int iend_srv=ni_glo.getValue() ; 617 617 … … 625 625 int serverRank=client->getServerLeader() ; 626 626 627 jend_srv=0 ; 627 // jend_srv=0 ; 628 jend_srv= -1 ; 628 629 for(int i=0;i<=serverRank;i++) 629 630 { … … 664 665 int ns=nj_glo%nbServer ; 665 666 int pos=ns*(blockSize+1) ; 667 // int pos=ns*(blockSize) ; 666 668 int serverNum ; 667 669 … … 674 676 for(i=0;i<ni;i++) 675 677 { 676 i_ind=ibegin+i_index(i,j) -1;677 j_ind=jbegin+j_index(i,j) -1;678 i_ind=ibegin+i_index(i,j) ; 679 j_ind=jbegin+j_index(i,j) ; 678 680 679 681 if (j_ind<pos) serverNum=j_ind/(blockSize+1) ; … … 681 683 IsConnected[serverNum]=true ; 682 684 683 if (i_ind >= zoom_ibegin -1 && i_ind <= zoom_iend-1 && j_ind >= zoom_jbegin-1 && j_ind <= zoom_jend-1)685 if (i_ind >= zoom_ibegin && i_ind <= zoom_iend && j_ind >= zoom_jbegin && j_ind <= zoom_jend) 684 686 { 685 687 mapConnectedServer(i,j)=serverNum ; … … 709 711 ns=indServer[mapConnectedServer(i,j)] ; 710 712 mapConnectedServer(i,j)= ns ; 711 i_indSrv[ns].push_back(i+ibegin -1) ;712 j_indSrv[ns].push_back(j+jbegin -1) ;713 i_indSrv[ns].push_back(i+ibegin) ; 714 j_indSrv[ns].push_back(j+jbegin) ; 713 715 } 714 716 } … … 743 745 } 744 746 747 748 // void CDomain::sendLonLat(void) 749 // { 750 // int ns,n,i,j,ind,nv ; 751 // CContext* context = CContext::getCurrent() ; 752 // CContextClient* client=context->client ; 753 // // send lon lat for each connected server 754 // 755 // CEventClient eventLon(getType(),EVENT_ID_LON) ; 756 // CEventClient eventLat(getType(),EVENT_ID_LAT) ; 757 // 758 // list<shared_ptr<CMessage> > list_msgLon ; 759 // list<shared_ptr<CMessage> > list_msgLat ; 760 // list< CArray<int,1>* > list_indi,list_indj ; 761 // list< CArray<double,1>* >list_lon,list_lat ; 762 // list< CArray<double,2>* >list_boundslon,list_boundslat ; 763 // 764 // for(int ns=0;ns<connectedServer.size();ns++) 765 // { 766 // int nbData = nbDataSrv[ns] ; 767 // CArray<int,1> indi(nbData) ; 768 // CArray<int,1> indj(nbData) ; 769 // CArray<double,1> lon(nbData) ; 770 // CArray<double,1> lat(nbData) ; 771 // CArray<double,2> boundslon(nvertex,nbData) ; 772 // CArray<double,2> boundslat(nvertex,nbData) ; 773 // 774 // for(n=0;n<nbData;n++) 775 // { 776 // i=i_indSrv[ns][n] ; 777 // j=j_indSrv[ns][n] ; 778 // ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 779 // 780 // lon(n)=lonvalue(ind) ; 781 // lat(n)=latvalue(ind) ; 782 // if (hasBounds) 783 // { 784 // for(nv=0;nv<nvertex;nv++) 785 // { 786 // boundslon(nv,n)=bounds_lon(nv,ind); 787 // boundslat(nv,n)=bounds_lat(nv,ind); 788 // } 789 // } 790 // indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1 ; 791 // indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1 ; 792 // } 793 // 794 // list_indi.push_back(new CArray<int,1>(indi.copy())) ; 795 // list_indj.push_back(new CArray<int,1>(indj.copy())) ; 796 // list_lon.push_back(new CArray<double,1>(lon.copy())) ; 797 // list_lat.push_back(new CArray<double,1>(lat.copy())) ; 798 // if (hasBounds) list_boundslon.push_back(new CArray<double,2>(boundslon.copy())) ; 799 // if (hasBounds) list_boundslat.push_back(new CArray<double,2>(boundslat.copy())) ; 800 // 801 // list_msgLon.push_back(shared_ptr<CMessage>(new CMessage)) ; 802 // list_msgLat.push_back(shared_ptr<CMessage>(new CMessage)) ; 803 // 804 // *list_msgLon.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix 805 // *list_msgLat.back()<<this->getId()<<(int)type ; 806 // *list_msgLon.back()<<isCurvilinear ; 807 // *list_msgLat.back()<<isCurvilinear ; 808 // *list_msgLon.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back() ; 809 // *list_msgLat.back()<<*list_indi.back()<<*list_indj.back()<<*list_lat.back() ; 810 // 811 // if (hasBounds) 812 // { 813 // *list_msgLon.back()<<*list_boundslon.back(); 814 // *list_msgLat.back()<<*list_boundslat.back(); 815 // } 816 // eventLon.push(connectedServer[ns],nbSenders[ns],*list_msgLon.back()) ; 817 // eventLat.push(connectedServer[ns],nbSenders[ns],*list_msgLat.back()) ; 818 // } 819 // 820 // client->sendEvent(eventLon) ; 821 // client->sendEvent(eventLat) ; 822 // 823 // 824 // for(list<CArray<int,1>* >::iterator it=list_indi.begin();it!=list_indi.end();it++) delete *it; 825 // for(list<CArray<int,1>* >::iterator it=list_indj.begin();it!=list_indj.end();it++) delete *it; 826 // for(list<CArray<double,1>* >::iterator it=list_lon.begin();it!=list_lon.end();it++) delete *it; 827 // for(list<CArray<double,1>* >::iterator it=list_lat.begin();it!=list_lat.end();it++) delete *it; 828 // if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++) delete *it; 829 // if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++) delete *it; 830 // 831 // } 745 832 746 833 void CDomain::sendLonLat(void) … … 774 861 i=i_indSrv[ns][n] ; 775 862 j=j_indSrv[ns][n] ; 776 ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 863 // ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 864 ind=(i-(zoom_ibegin_client))+(j-(zoom_jbegin_client))*zoom_ni_client ; 777 865 778 866 lon(n)=lonvalue(ind) ; … … 786 874 } 787 875 } 788 indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1 ; 789 indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1 ; 876 indi(n)=ibegin+i_index(i-ibegin,j-jbegin) ; 877 indj(n)=jbegin+j_index(i-ibegin,j-jbegin) ; 878 // indi(n)=ibegin+i_index(i-ibegin+1,j-jbegin+1)-1 ; 879 // indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1 ; 790 880 } 791 881 … … 828 918 829 919 } 830 831 920 832 921 bool CDomain::dispatchEvent(CEventServer& event) … … 884 973 if (zoom_ni_srv<=0 || zoom_nj_srv<=0) 885 974 { 886 zoom_ibegin_srv= 1; zoom_iend_srv=0 ; zoom_ni_srv=0 ;887 zoom_jbegin_srv= 1; zoom_jend_srv=0 ; zoom_nj_srv=0 ;975 zoom_ibegin_srv=0 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ; 976 zoom_jbegin_srv=0 ; zoom_jend_srv=0 ; zoom_nj_srv=0 ; 888 977 } 889 978 lonvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; … … 928 1017 { 929 1018 i=indi(ind) ; j=indj(ind) ; 930 ind_srv=(i-(zoom_ibegin_srv -1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ;1019 ind_srv=(i-(zoom_ibegin_srv))+(j-(zoom_jbegin_srv))*zoom_ni_srv ; 931 1020 lonvalue_srv(ind_srv)=lon(ind) ; 932 1021 if (hasBounds) … … 968 1057 { 969 1058 i=indi(ind) ; j=indj(ind) ; 970 ind_srv=(i-(zoom_ibegin_srv -1))+(j-(zoom_jbegin_srv-1))*zoom_ni_srv ;1059 ind_srv=(i-(zoom_ibegin_srv))+(j-(zoom_jbegin_srv))*zoom_ni_srv ; 971 1060 latvalue_srv(ind_srv)=lat(ind) ; 972 1061 if (hasBounds) -
XIOS/trunk/src/node/domain.hpp
r540 r551 151 151 bool isChecked; 152 152 std::set<StdString> relFiles; 153 bool isClientChecked; // Verify whether all attributes of domain on the client side isgood153 bool isClientChecked; // Verify whether all attributes of domain on the client side are good 154 154 155 155 DECLARE_REF_FUNC(Domain,domain) -
XIOS/trunk/src/node/field.cpp
r542 r551 152 152 list< CArray<double,1>* > list_data ; 153 153 154 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++)154 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 155 155 { 156 156 int rank=(*it).first ; 157 157 CArray<int,1>& index = *(it->second) ; 158 158 CArray<double,1> data_tmp(index.numElements()) ; 159 160 159 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 161 160 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; … … 193 192 if (data_srv.empty()) 194 193 { 195 for(map<int, CArray<int, 1>* >::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++) 194 // for(map<int, CArray<int, 1>* >::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++) 195 for(map<int, CArray<size_t, 1>* >::iterator it=grid->outIndexFromClient.begin();it!=grid->outIndexFromClient.end();++it) 196 196 { 197 197 int rank=it->first ; … … 683 683 map<int, CArray<double,1>* >::iterator it; 684 684 for(it=data_srv.begin();it!=data_srv.end();it++) 685 { 686 grid->outputField(it->first,*it->second, fieldOut.dataFirst()) ; 687 } 688 689 // grid->outputField(it->first,*it->second, fieldOut.) ; 690 691 } 692 693 void CField::outputField(CArray<double,2>& fieldOut) 694 { 695 map<int, CArray<double,1>* >::iterator it; 696 697 for(it=data_srv.begin();it!=data_srv.end();it++) 698 { 685 699 grid->outputField(it->first,*it->second, fieldOut) ; 686 687 } 688 689 void CField::outputField(CArray<double,2>& fieldOut) 690 { 691 map<int, CArray<double,1>* >::iterator it; 692 693 for(it=data_srv.begin();it!=data_srv.end();it++) 694 { 695 grid->outputField(it->first,*it->second, fieldOut) ; 696 } 697 } 700 } 701 } 702 698 703 ///------------------------------------------------------------------- 699 704 -
XIOS/trunk/src/node/grid.cpp
r540 r551 21 21 , withAxis(false), isChecked(false), isDomainAxisChecked(false), axis(), domain() 22 22 , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 23 , vDomainGroup_(), vAxisGroup_(), axis Order_(), axisList_(), isAxisListSet(false), isDomListSet(false)23 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 24 24 { 25 25 setVirtualDomainGroup(); … … 31 31 , withAxis(false), isChecked(false), isDomainAxisChecked(false), axis(), domain() 32 32 , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 33 , vDomainGroup_(), vAxisGroup_(), axis Order_(), axisList_(), isAxisListSet(false), isDomListSet(false)33 , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 34 34 { 35 35 setVirtualDomainGroup(); … … 51 51 for(map<int,CArray<int,1>* >::iterator it=out_j_fromClient.begin();it!=out_j_fromClient.end();it++) delete it->second ; 52 52 for(map<int,CArray<int,1>* >::iterator it=out_l_fromClient.begin();it!=out_l_fromClient.end();it++) delete it->second ; 53 54 for(map<int,CArray<size_t,1>* >::iterator it=outIndexFromClient.begin();it!=outIndexFromClient.end();++it) delete (it->second); 55 56 if (0 != clientDistribution_) delete clientDistribution_; 53 57 54 58 } … … 176 180 std::map<int, StdSize> CGrid::getConnectedServerDataSize() 177 181 { 182 double secureFactor = 2.5 * sizeof(double) * CXios::bufferServerFactorSize; 183 StdSize retVal; 178 184 std::map<int, StdSize> ret; 179 std::map<int, int>::const_iterator it = domConnectedServerSide_.begin(), 180 itE = domConnectedServerSide_.end(); 181 std::vector<int> nData = domain->nbDataSrv; 182 std::vector<int>::const_iterator itData = nData.begin(); 183 StdSize retVal = StdSize(0.0); 184 for (; it != itE; ++it, ++itData) 185 const std::map<int, std::vector<int> >& distribution = clientDistribution_->getLocalIndexSendToServer(); 186 std::map<int, std::vector<int> >::const_iterator it = distribution.begin(), itE = distribution.end(); 187 for (; it != itE; ++it) 185 188 { 186 retVal = (it->second < *itData) ? *itData : it->second; 187 if (this->withAxis) retVal *= this->axis->size.getValue(); 188 retVal *= sizeof(double); 189 retVal *= 2.5 * CXios::bufferServerFactorSize; // Secure factor, myterious number 190 ret.insert(make_pair(it->first, retVal)); 189 retVal = it->second.size(); 190 retVal *= secureFactor; 191 ret.insert(std::make_pair<int,StdSize>(it->first, retVal)); 191 192 } 193 192 194 return ret; 193 195 } … … 235 237 236 238 if (context->hasClient) 237 if (this->isChecked && doSendingIndex ) sendIndex();239 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndex(); this->isIndexSent = true; } 238 240 239 241 if (this->isChecked) return; … … 397 399 void CGrid::computeIndex(void) 398 400 { 399 401 CContext* context = CContext::getCurrent() ; 402 CContextClient* client=context->client ; 403 clientDistribution_ = new CDistributionClient(client->clientRank, this); 404 clientDistribution_->computeServerIndexMapping(client->serverSize); 405 nbSenders = clientDistribution_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm); 406 407 storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().numElements()); 408 storeIndex_client = (clientDistribution_->getLocalDataIndexOnClient()); 409 410 /* 400 411 const int ni = domain->ni.getValue() , 401 412 nj = domain->nj.getValue() , … … 476 487 } 477 488 } 478 computeDomConServer(); 489 */ 490 // computeDomConServer(); 479 491 // sendIndex() ; 480 492 … … 520 532 grid->setDomainList(domains); 521 533 grid->setAxisList(axis); 534 535 //By default, domains are always the first ones of a grid 536 if (grid->axisDomainOrder.isEmpty()) 537 { 538 int size = domains.size()+axis.size(); 539 grid->axisDomainOrder.resize(size); 540 for (int i = 0; i < size; ++i) 541 { 542 if (i < domains.size()) grid->axisDomainOrder(i) = true; 543 else grid->axisDomainOrder(i) = false; 544 } 545 } 546 522 547 return (grid); 523 548 } … … 561 586 for(StdSize n = 0; n < stored.numElements(); n++) 562 587 field(out_i(n)) = stored(n) ; 588 } 589 590 void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field) 591 { 592 CArray<size_t,1>& out_i=*outIndexFromClient[rank]; 593 StdSize numElements = stored.numElements(); 594 for (StdSize n = 0; n < numElements; ++n) 595 { 596 *(field+out_i(n)) = stored(n); 597 } 563 598 } 564 599 … … 599 634 // if (domain->mapConnectedServer(i,j)==ns) nb++ ; 600 635 // } 601 //602 636 // CArray<int,1> storeIndex(nb) ; 603 637 // CArray<int,1> out_i(nb) ; … … 676 710 int rank ; 677 711 list<shared_ptr<CMessage> > list_msg ; 678 list< CArray<int,1>* > list_out_i,list_out_j,list_out_l ; 679 712 list< CArray<size_t,1>* > listOutIndex; 713 714 const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientDistribution_->getGlobalIndexOnServer(); 715 const std::map<int, std::vector<int> >& localIndexSendToServer = clientDistribution_->getLocalIndexSendToServer(); 716 717 std::map<int, std::vector<size_t> >::const_iterator iteMap, itbMap, itGlobal; 718 std::map<int, std::vector<int> >::const_iterator itLocal; 719 itbMap = itGlobal = globalIndexOnServer.begin(); 720 iteMap = globalIndexOnServer.end(); 721 itLocal = localIndexSendToServer.begin(); 722 723 724 for (int ns = 0; itGlobal != iteMap; ++itGlobal, ++itLocal, ++ns) 725 { 726 rank = itGlobal->first; 727 int nb = (itGlobal->second).size(); 728 729 CArray<size_t, 1> outGlobalIndexOnServer(nb); 730 CArray<int, 1> outLocalIndexToServer(nb); 731 for (int k = 0; k < nb; ++k) 732 { 733 outGlobalIndexOnServer(k) = itGlobal->second.at(k); 734 outLocalIndexToServer(k) = itLocal->second.at(k); 735 } 736 737 storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(outLocalIndexToServer) )); 738 listOutIndex.push_back(new CArray<size_t,1>(outGlobalIndexOnServer)); 739 740 list_msg.push_back(shared_ptr<CMessage>(new CMessage)); 741 *list_msg.back()<<getId()<<*listOutIndex.back(); 742 event.push(rank, nbSenders[rank], *list_msg.back()); 743 } 744 client->sendEvent(event); 745 for(list<CArray<size_t,1>* >::iterator it=listOutIndex.begin();it!=listOutIndex.end();++it) delete *it ; 746 747 /* 680 748 if (!isDomConServerComputed_) computeDomConServer(); 681 749 … … 721 789 for(list<CArray<int,1>* >::iterator it=list_out_j.begin();it!=list_out_j.end();it++) delete *it ; 722 790 for(list<CArray<int,1>* >::iterator it=list_out_l.begin();it!=list_out_l.end();it++) delete *it ; 723 791 */ 724 792 } 725 793 … … 731 799 int rank=it->rank; 732 800 CBufferIn* buffer=it->buffer; 733 string domainId ;734 *buffer>> domainId ;735 get( domainId)->recvIndex(rank,*buffer) ;801 string gridId ; 802 *buffer>>gridId ; 803 get(gridId)->recvIndex(rank,*buffer) ; 736 804 } 737 805 } … … 739 807 void CGrid::recvIndex(int rank, CBufferIn& buffer) 740 808 { 809 CArray<size_t,1> outIndex; 810 buffer>>outIndex; 811 outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex))); 812 813 /* 741 814 CArray<int,1> out_i ; 742 815 CArray<int,1> out_j ; … … 751 824 out_j_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_j) )) ; 752 825 out_l_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_l) )) ; 826 */ 753 827 } 754 828 … … 947 1021 } 948 1022 1023 /*! 1024 \brief Solve domain and axis references 1025 As field, domain and axis can refer to other domains or axis. In order to inherit correctly 1026 all attributes from their parents, they should be processed with this function 1027 \param[in] apply inherit all attributes of parents (true) 1028 */ 949 1029 void CGrid::solveDomainAxisRefInheritance(bool apply) 950 1030 { … … 963 1043 if ((!pDom->domain_ref.isEmpty()) && (pDom->name.isEmpty())) 964 1044 pDom->name.setValue(pDom->getBaseDomainReference()->getId()); 965 966 1045 } 967 1046 } … … 982 1061 } 983 1062 1063 /*! 1064 \brief Get the list of domain pointers 1065 \return list of domain pointers 1066 */ 984 1067 std::vector<CDomain*> CGrid::getDomains() 985 1068 { … … 992 1075 } 993 1076 1077 /*! 1078 \brief Get the list of axis pointers 1079 \return list of axis pointers 1080 */ 994 1081 std::vector<CAxis*> CGrid::getAxis() 995 1082 { … … 1001 1088 } 1002 1089 1090 /*! 1091 \brief Set domain(s) of a grid from a list 1092 \param[in] domains list of domains 1093 */ 1003 1094 void CGrid::setDomainList(const std::vector<CDomain*> domains) 1004 1095 { … … 1019 1110 } 1020 1111 1112 /*! 1113 \brief Set axis(s) of a grid from a list 1114 \param[in] axis list of axis 1115 */ 1021 1116 void CGrid::setAxisList(const std::vector<CAxis*> axis) 1022 1117 { … … 1036 1131 } 1037 1132 1133 /*! 1134 \brief Get list of id of domains 1135 \return id list of domains 1136 */ 1038 1137 std::vector<StdString> CGrid::getDomainList() 1039 1138 { … … 1042 1141 } 1043 1142 1143 /*! 1144 \brief Get list of id of axis 1145 \return id list of axis 1146 */ 1044 1147 std::vector<StdString> CGrid::getAxisList() 1045 1148 { … … 1074 1177 { 1075 1178 SuperClass::parse(node); 1179 // List order of axis and domain in a grid, if there is a domain, it will take value 1 (true), axis 0 (false) 1180 // std::vector<int> axisOrder; 1181 std::vector<bool> order; 1076 1182 1077 1183 if (node.goToChildElement()) 1078 1184 { 1079 int domainIdx = -1;1080 int posAxis = 0;1081 1185 StdString domainName("domain"); 1082 1186 StdString axisName("axis"); … … 1084 1188 { 1085 1189 if (node.getElementName() == domainName) { 1086 axisOrder_.push_back(domainIdx);1190 order.push_back(true); 1087 1191 this->getVirtualDomainGroup()->parseChild(node); 1088 1192 } 1089 1193 if (node.getElementName() == axisName) { 1090 axisOrder_.push_back(posAxis); 1091 ++posAxis; 1194 order.push_back(false); 1092 1195 this->getVirtualAxisGroup()->parseChild(node); 1093 1196 } … … 1096 1199 } 1097 1200 1098 if (! axisOrder_.empty())1099 { 1100 int sizeOrd = axisOrder_.size();1101 axisDom Order.resize(sizeOrd);1201 if (!order.empty()) 1202 { 1203 int sizeOrd = order.size(); 1204 axisDomainOrder.resize(sizeOrd); 1102 1205 for (int i = 0; i < sizeOrd; ++i) 1103 1206 { 1104 axisDom Order(i) = axisOrder_[i];1207 axisDomainOrder(i) = order[i]; 1105 1208 } 1106 1209 } -
XIOS/trunk/src/node/grid.hpp
r540 r551 11 11 #include "array_new.hpp" 12 12 #include "attribute_array.hpp" 13 #include "distribution_client.hpp" 13 14 14 15 namespace xios { … … 21 22 class CAxisGroup; 22 23 class CGrid; 24 class CDistributionClient; 23 25 24 26 ///-------------------------------------------------------------- … … 97 99 void outputField(int rank, const CArray<double,1>& stored, CArray<double,2>& field) ; 98 100 void outputField(int rank, const CArray<double,1>& stored, CArray<double,1>& field) ; 101 void outputField(int rank, const CArray<double,1>& stored, double* field); 99 102 100 103 virtual void parse(xml::CXMLNode & node); … … 154 157 std::vector<CDomain*> getDomains(); 155 158 std::vector<CAxis*> getAxis(); 159 std::vector<int> getAxisOrder(); 156 160 157 161 public: … … 161 165 bool isChecked; 162 166 bool isDomainAxisChecked; 167 bool isIndexSent; 163 168 164 169 CAxis* axis ; … … 184 189 map<int, CArray<int, 1>* > out_j_fromClient ; 185 190 map<int, CArray<int, 1>* > out_l_fromClient ; 191 192 map<int, CArray<size_t, 1>* > outIndexFromClient; 186 193 void checkMask(void) ; 187 194 … … 209 216 std::vector<std::string> axisList_, domList_; 210 217 bool isAxisListSet, isDomListSet; 211 212 // List order of axis in a grid, if there is a domain, it will take value -1 213 std::vector<int> axisOrder_; 218 CDistributionClient* clientDistribution_; 214 219 }; // class CGrid 215 220 -
XIOS/trunk/src/test/test_new_features.f90
r549 r551 56 56 ENDDO 57 57 ENDDO 58 ni=ni_glo ; ibegin= 158 ni=ni_glo ; ibegin=0 59 59 60 jbegin= 160 jbegin=0 61 61 DO n=0,size-1 62 62 nj=nj_glo/size … … 72 72 lon(:,:)=lon_glo(ibegin:iend,jbegin:jend) 73 73 lat(:,:)=lat_glo(ibegin:iend,jbegin:jend) 74 field_A(1:ni,1:nj,:)=field_A_glo(ibegin :iend,jbegin:jend,:)74 field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 75 75 76 76 CALL xios_context_initialize("test",comm)
Note: See TracChangeset
for help on using the changeset viewer.