- Timestamp:
- 06/27/12 18:25:24 (12 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/config/axis_attribute.conf
r313 r351 6 6 7 7 DECLARE_ATTRIBUTE(int, size) 8 DECLARE_ATTRIBUTE(int, zoom_begin) 9 DECLARE_ATTRIBUTE(int, zoom_end) 10 DECLARE_ATTRIBUTE(int, zoom_size) 8 11 DECLARE_ATTRIBUTE(ARRAY(double, 1), value) 9 12 -
XIOS/trunk/src/node/axis.cpp
r345 r351 50 50 { 51 51 if (this->isChecked) return; 52 if (this->size.isEmpty()) 53 ERROR("CAxis::checkAttributes(void)",<< "Attribut <size> of the axis must be specified") ; 52 54 StdSize size = this->size.getValue(); 55 56 StdSize zoom_begin,zoom_end, zoom_size ; 57 58 zoom_begin = (this->zoom_begin.isEmpty()) ? 1 : this->zoom_begin.getValue() ; 59 zoom_end = (this->zoom_end.isEmpty()) ? size : this->zoom_end.getValue() ; 60 zoom_size = (this->zoom_size.isEmpty()) ? size : this->zoom_size.getValue() ; 61 62 if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 63 if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 64 if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 65 66 if ( (zoom_begin < 1) || (zoom_begin > size) || (zoom_end<1) || (zoom_end>size) || (zoom_size<1) || (zoom_size>size) || (zoom_begin>zoom_end)) 67 ERROR("CAxis::checkAttributes(void)",<< "One or more attribut of <zoom_begin>, <zoom_end>, <zoom_size>, are not well specified") ; 68 this->zoom_begin.setValue(zoom_begin) ; 69 this->zoom_end.setValue(zoom_end) ; 70 this->zoom_size.setValue(zoom_size) ; 71 53 72 StdSize true_size = value.getValue()->num_elements(); 54 73 if (size != true_size) -
XIOS/trunk/src/node/grid.cpp
r347 r351 101 101 //--------------------------------------------------------------- 102 102 103 /* 103 104 std::vector<StdSize> CGrid::getLocalShape(void) const 104 105 { … … 107 108 retvalue.push_back(domain->zoom_nj_loc.getValue()); 108 109 if (this->withAxis) 109 retvalue.push_back(this->axis-> size.getValue());110 retvalue.push_back(this->axis->zoom_size.getValue()); 110 111 return (retvalue); 111 112 } 113 */ 112 114 //--------------------------------------------------------------- 113 115 116 /* 114 117 StdSize CGrid::getLocalSize(void) const 115 118 { … … 120 123 return (retvalue); 121 124 } 122 123 //--------------------------------------------------------------- 124 125 */ 126 //--------------------------------------------------------------- 127 /* 125 128 std::vector<StdSize> CGrid::getGlobalShape(void) const 126 129 { … … 132 135 return (retvalue); 133 136 } 134 //--------------------------------------------------------------- 135 137 */ 138 //--------------------------------------------------------------- 139 140 /* 136 141 StdSize CGrid::getGlobalSize(void) const 137 142 { … … 142 147 return (retvalue); 143 148 } 144 149 */ 145 150 StdSize CGrid::getDataSize(void) const 146 151 { … … 224 229 const int ni = domain->ni.getValue() , 225 230 nj = domain->nj.getValue() , 226 size = (this->hasAxis()) ? axis->size.getValue() : 1 ; 231 size = (this->hasAxis()) ? axis->size.getValue() : 1 , 232 lbegin = (this->hasAxis()) ? axis->zoom_begin.getValue()-1 : 0 , 233 lend = (this->hasAxis()) ? axis->zoom_end.getValue()-1 : 0 ; 227 234 228 235 … … 254 261 : (temp_j - 1) ; 255 262 256 if ((i >= 0 && i < ni) && 263 if ((l >=lbegin && l<= lend) && 264 (i >= 0 && i < ni) && 257 265 (j >= 0 && j < nj) && (*mask)[i][j]) 258 266 indexCount++ ; … … 283 291 : (temp_j - 1) ; 284 292 285 if ((i >= 0 && i < ni) && 293 if ((l >= lbegin && l <= lend) && 294 (i >= 0 && i < ni) && 286 295 (j >= 0 && j < nj) && (*mask)[i][j]) 287 296 { … … 294 303 (*out_i_client)[indexCount]=i+domain->ibegin_client-1 ; 295 304 (*out_j_client)[indexCount]=j+domain->jbegin_client-1 ; 296 (*out_l_client)[indexCount]=l ;305 (*out_l_client)[indexCount]=l-lbegin ; 297 306 indexCount++ ; 298 307 } -
XIOS/trunk/src/node/grid.hpp
r347 r351 73 73 StdSize getDimension(void) const; 74 74 75 StdSize getLocalSize(void) const;76 StdSize getGlobalSize(void) const;75 // StdSize getLocalSize(void) const; 76 // StdSize getGlobalSize(void) const; 77 77 StdSize getDataSize(void) const; 78 std::vector<StdSize> getLocalShape(void) const;79 std::vector<StdSize> getGlobalShape(void) const;78 // std::vector<StdSize> getLocalShape(void) const; 79 // std::vector<StdSize> getGlobalShape(void) const; 80 80 81 81 /// Entrées-sorties de champs /// -
XIOS/trunk/src/output/nc4_data_output.cpp
r347 r351 225 225 if (axis->IsWritten(this->filename)) return; 226 226 axis->checkAttributes(); 227 StdSize zoom_size=axis->zoom_size.getValue() ; 228 StdSize zoom_begin=axis->zoom_begin.getValue()-1 ; 229 227 230 std::vector<StdString> dims; 228 231 StdString axisid = (!axis->name.isEmpty()) 229 232 ? axis->name.getValue() : axis->getId(); 230 SuperClassWriter::addDimension(axisid, axis->size.getValue());233 SuperClassWriter::addDimension(axisid, zoom_size); 231 234 dims.push_back(axisid); 232 235 … … 254 257 255 258 SuperClassWriter::definition_end(); 256 SuperClassWriter::writeData(axis->value.getValue(), axisid, isCollective, 0); 259 260 ARRAY(double,1) axis_value=axis->value.getValue() ; 261 ARRAY_CREATE(value,double,1,[zoom_size]) ; 262 for(StdSize i = 0 ; i < zoom_size ; i++) (*value)[i]=(*axis_value)[i+zoom_begin] ; 263 SuperClassWriter::writeData(value, axisid, isCollective, 0); 264 257 265 SuperClassWriter::definition_start(); 258 266 … … 490 498 { 491 499 CAxis* axis = grid->axis ; 492 ARRAY_CREATE(field_data3D,double,3,[domain->zoom_ni_srv][domain->zoom_nj_srv][axis-> size.getValue()]) ;500 ARRAY_CREATE(field_data3D,double,3,[domain->zoom_ni_srv][domain->zoom_nj_srv][axis->zoom_size.getValue()]) ; 493 501 field->outputField(field_data3D); 494 502 switch (SuperClass::type) … … 513 521 // start[2]=domain->zoom_ibegin_loc.getValue()-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_loc.getValue()-domain->zoom_jbegin.getValue() ; start[0]=0 ; 514 522 start[2]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [1]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; start[0]=0 ; 515 count[2]=domain->zoom_ni_srv ; count[1]=domain->zoom_nj_srv ; count[0] = axis-> size.getValue();523 count[2]=domain->zoom_ni_srv ; count[1]=domain->zoom_nj_srv ; count[0] = axis->zoom_size.getValue(); 516 524 } 517 525 SuperClassWriter::writeData(field_data3D, fieldid, isCollective, field->getNStep()-1,&start,&count ); -
XIOS/trunk/src/test/test_cs.f90
r349 r351 32 32 TYPE(xios_time) :: dtime 33 33 TYPE(xios_context) :: ctx_hdl 34 INTEGER,PARAMETER :: ni_glo=1000 35 INTEGER,PARAMETER :: nj_glo=1000 34 INTEGER,PARAMETER :: ni_glo=100 35 INTEGER,PARAMETER :: nj_glo=100 36 INTEGER,PARAMETER :: llm=3 37 DOUBLE PRECISION :: lval(llm)=(/1.0,2.0,3.0/) 36 38 TYPE(xios_field) :: field_hdl 37 39 TYPE(xios_fieldgroup) :: fieldgroup_hdl … … 39 41 40 42 41 DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo,field_A_glo 42 DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:), lonvalue(:) ; 43 DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 44 DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm) 45 DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:) ; 43 46 INTEGER :: ni,ibegin,iend,nj,jbegin,jend 44 INTEGER :: i,j, ts,n47 INTEGER :: i,j,l,ts,n 45 48 46 49 CALL init_wait 50 47 51 48 52 DO j=1,nj_glo … … 50 54 lon_glo(i,j)=(i-1)+(j-1)*ni_glo 51 55 lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo 52 field_A_glo(i,j)=(i-1)+(j-1)*ni_glo 56 DO l=1,llm 57 field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l 58 ENDDO 53 59 ENDDO 54 60 ENDDO … … 65 71 iend=ibegin+ni-1 ; jend=jbegin+nj-1 66 72 67 ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2 ),lonvalue(ni*nj))73 ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj)) 68 74 lon(:,:)=lon_glo(ibegin:iend,jbegin:jend) 69 75 lat(:,:)=lat_glo(ibegin:iend,jbegin:jend) 70 field_A(1:ni,1:nj )=field_A_glo(ibegin:iend,jbegin:jend)76 field_A(1:ni,1:nj,:)=field_A_glo(ibegin:iend,jbegin:jend,:) 71 77 72 78 … … 82 88 ! CALL xios_set_context_attr("test",start_date="01/01/2000 - 00:00:00") 83 89 CALL xios_set_context_attr("test",calendar_type="Gregorian") 90 CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ; 84 91 CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) 85 92 !CALL xios_set_domain_attr("domain_A",zoom_ni=3,zoom_ibegin=3,zoom_nj=3,zoom_jbegin=6) … … 109 116 110 117 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 111 DO ts=1,24*10 0118 DO ts=1,24*10 112 119 CALL xios_update_calendar(ts) 113 120 CALL xios_send_field("field_A",field_A)
Note: See TracChangeset
for help on using the changeset viewer.