Commit 0f321c54636c62f8d87787e8e7fb9859ca3f5246
1 parent
6edc9ff8
Exists in
master
and in
88 other branches
us is now ok
Showing
1 changed file
with
35 additions
and
35 deletions
Show diff stats
src/ParamGetImpl/DDServerInterface/Pusher.hh
... | ... | @@ -90,91 +90,91 @@ public: |
90 | 90 | |
91 | 91 | //ParamData is created, add data |
92 | 92 | _specParamData->getDataList().resize(data->VarNumber); |
93 | - if(_dim3CutIndex != -1 && _minSumIndex == -1 && _minSumIndex == -1){ | |
94 | - for (int index = 0; index < data->VarNumber; index++) { | |
93 | + | |
94 | + | |
95 | + | |
96 | + if(_dim3CutIndex == -1 && _minSumIndex != -1 && _maxSumIndex != -1){ | |
97 | + for (int index = 0; index < data->VarNumber; index++) { | |
95 | 98 | ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size); |
96 | 99 | elem << NotANumber(); |
97 | 100 | for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index) |
98 | 101 | { |
99 | 102 | for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index) |
100 | - { | |
103 | + { | |
104 | + BaseElemenType cumulatedElement = (BaseElemenType) 0 ; | |
105 | + for(int sumIndex=_minSumIndex; sumIndex <= _maxSumIndex; ++sumIndex){ | |
101 | 106 | int dataIndex = 0; |
102 | 107 | if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) { |
103 | - int cutIndex = (_dim3CutIndex >= 0 && _dim3CutIndex < data->Dimensions[_dim3Num]) ? _dim3CutIndex : 0; | |
108 | + int curentIndex = (sumIndex >= 0 && sumIndex < data->Dimensions[_dim3Num]) ? sumIndex : 0; | |
104 | 109 | if (_dim3Num == 0) { |
105 | - dataIndex = cutIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index; | |
110 | + dataIndex = curentIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index; | |
106 | 111 | } |
107 | 112 | else if (_dim3Num == 1) { |
108 | - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + cutIndex*data->Dimensions[_dim2Num] + dim2Index; | |
113 | + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + curentIndex*data->Dimensions[_dim2Num] + dim2Index; | |
109 | 114 | } |
110 | 115 | else { |
111 | - dataIndex = dim1Index*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim2Index*data->Dimensions[_dim1Num] + cutIndex; | |
116 | + dataIndex = dim1Index*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim2Index*data->Dimensions[_dim1Num] + curentIndex; | |
112 | 117 | } |
113 | 118 | } |
114 | 119 | else { |
115 | 120 | dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index; |
116 | 121 | } |
117 | - BaseElemenType baseElem = lData[index][dataIndex]; | |
122 | + BaseElemenType baseElem = lData[index][dataIndex]; | |
118 | 123 | if (!isnan(_fillValue)) |
119 | 124 | { |
120 | 125 | double crt_val = baseElem; |
121 | 126 | bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue); |
122 | 127 | if(is_fill_value) |
123 | - baseElem = (BaseElemenType)NAN; | |
128 | + baseElem = (BaseElemenType) 0; | |
124 | 129 | } |
125 | - elem[dim1Index][dim2Index] = baseElem; | |
130 | + cumulatedElement=cumulatedElement+baseElem; | |
131 | + } | |
132 | + elem[dim1Index][dim2Index] = cumulatedElement; | |
133 | + } | |
134 | + | |
126 | 135 | } |
136 | + _specParamData->getDataList().push_back(elem); | |
127 | 137 | } |
128 | - _specParamData->getDataList().push_back(elem); | |
129 | - } | |
130 | - | |
131 | - }else if(_dim3CutIndex == -1 && _minSumIndex != -1 && _maxSumIndex != -1){ | |
132 | - for (int index = 0; index < data->VarNumber; index++) { | |
138 | + | |
139 | + | |
140 | + | |
141 | + }else{ | |
142 | + for (int index = 0; index < data->VarNumber; index++) { | |
133 | 143 | ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size); |
134 | 144 | elem << NotANumber(); |
135 | 145 | for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index) |
136 | 146 | { |
137 | 147 | for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index) |
138 | - { | |
139 | - BaseElemenType cumulatedElement = (BaseElemenType) 0 ; | |
140 | - for(int sumIndex=_minSumIndex; sumIndex <= _maxSumIndex; ++sumIndex){ | |
148 | + { | |
141 | 149 | int dataIndex = 0; |
142 | 150 | if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) { |
143 | - int curentIndex = (sumIndex >= 0 && sumIndex < data->Dimensions[_dim3Num]) ? sumIndex : 0; | |
151 | + int cutIndex = (_dim3CutIndex >= 0 && _dim3CutIndex < data->Dimensions[_dim3Num]) ? _dim3CutIndex : 0; | |
144 | 152 | if (_dim3Num == 0) { |
145 | - dataIndex = curentIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index; | |
153 | + dataIndex = cutIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index; | |
146 | 154 | } |
147 | 155 | else if (_dim3Num == 1) { |
148 | - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + curentIndex*data->Dimensions[_dim2Num] + dim2Index; | |
156 | + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + cutIndex*data->Dimensions[_dim2Num] + dim2Index; | |
149 | 157 | } |
150 | 158 | else { |
151 | - dataIndex = dim1Index*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim2Index*data->Dimensions[_dim1Num] + curentIndex; | |
159 | + dataIndex = dim1Index*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim2Index*data->Dimensions[_dim1Num] + cutIndex; | |
152 | 160 | } |
153 | 161 | } |
154 | 162 | else { |
155 | 163 | dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index; |
156 | 164 | } |
157 | - BaseElemenType baseElem = lData[index][dataIndex]; | |
165 | + BaseElemenType baseElem = lData[index][dataIndex]; | |
158 | 166 | if (!isnan(_fillValue)) |
159 | 167 | { |
160 | 168 | double crt_val = baseElem; |
161 | 169 | bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue); |
162 | 170 | if(is_fill_value) |
163 | - baseElem = (BaseElemenType) 0; | |
171 | + baseElem = (BaseElemenType)NAN; | |
164 | 172 | } |
165 | - cumulatedElement=cumulatedElement+baseElem; | |
166 | - } | |
167 | - elem[dim1Index][dim2Index] = cumulatedElement; | |
168 | - } | |
169 | - | |
173 | + elem[dim1Index][dim2Index] = baseElem; | |
170 | 174 | } |
171 | - _specParamData->getDataList().push_back(elem); | |
172 | 175 | } |
173 | - | |
174 | - | |
175 | - | |
176 | - }else{ | |
177 | - std::cout<<"Error in calling Pusher"<<std::endl; | |
176 | + _specParamData->getDataList().push_back(elem); | |
177 | + } | |
178 | 178 | } |
179 | 179 | } |
180 | 180 | ... | ... |