Changeset 679 for XIOS/trunk/src/node/axis.cpp
- Timestamp:
- 09/01/15 17:15:41 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/axis.cpp
r676 r679 135 135 { 136 136 if (this->n_glo.isEmpty()) 137 ERROR("CAxis::checkAttributes(void)", 138 << "Attribute <n_glo> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); 137 ERROR("CAxis::checkAttributes(void)", 138 << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 139 << "The axis is wrongly defined, attribute 'n_glo' must be specified"); 139 140 StdSize size = this->n_glo.getValue(); 140 141 … … 143 144 if (!this->begin.isEmpty()) 144 145 { 145 StdSize ibegin = this->begin.getValue(); 146 if ((ibegin < 0) || (ibegin > size-1)) 146 if (begin < 0 || begin > size - 1) 147 147 ERROR("CAxis::checkAttributes(void)", 148 << "Attribute <ibegin> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size-1"); 148 << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 149 << "The axis is wrongly defined, attribute 'begin' (" << begin.getValue() << ") must be non-negative and smaller than size-1 (" << size - 1 << ")."); 149 150 } 150 151 else this->begin.setValue(0); … … 152 153 if (!this->n.isEmpty()) 153 154 { 154 StdSize ni = this->n.getValue(); 155 if ((ni < 0) || (ni > size)) 155 if (n < 0 || n > size) 156 156 ERROR("CAxis::checkAttributes(void)", 157 << "Attribute <ni> of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be non-negative and smaller than size"); 157 << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 158 << "The axis is wrongly defined, attribute 'n' (" << n.getValue() << ") must be non-negative and smaller than size (" << size << ")."); 158 159 } 159 160 else this->n.setValue(size); … … 161 162 StdSize true_size = value.numElements(); 162 163 if (this->n.getValue() != true_size) 163 ERROR("CAxis::checkAttributes(void)", 164 << "The array \'value\' of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] has a different size that the one defined by the \'size\' attribute"); 164 ERROR("CAxis::checkAttributes(void)", 165 << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 166 << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 165 167 166 168 this->checkData(); … … 173 175 { 174 176 if (data_begin.isEmpty()) data_begin.setValue(0); 175 if (!data_n.isEmpty() && data_n.getValue() <= 0) 177 178 if (data_n.isEmpty()) 179 { 180 data_n.setValue(n); 181 } 182 else if (data_n.getValue() < 0) 176 183 { 177 184 ERROR("CAxis::checkData(void)", 178 << "Data dimension is negative (data_n)."); 179 } 180 else if (data_n.isEmpty()) 181 data_n.setValue(n.getValue()); 185 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 186 << "The data size should be strictly positive ('data_n' = " << data_n.getValue() << ")."); 187 } 182 188 183 189 if (data_index.isEmpty()) 184 190 { 185 int dn = data_n.getValue(); 186 data_index.resize(dn); 187 for (int i = 0; i < dn; ++i) data_index(i) = i; 191 data_index.resize(data_n); 192 for (int i = 0; i < data_n; ++i) data_index(i) = i; 188 193 } 189 194 } … … 199 204 { 200 205 if (mask.extent(0) != n) 201 202 << "the mask has not the same size than the local axis" << endl203 << "Local size is " << n << "x" <<endl204 << "Mask size is " << mask.extent(0) << "x");205 }206 else // (!mask.hasValue())207 { // Si aucun masque n'est défini,208 // on en crée un nouveau qui valide l'intégralité du domaine.206 ERROR("CAxis::checkMask(void)", 207 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 208 << "The mask does not have the same size as the local domain." << std::endl 209 << "Local size is " << n.getValue() << "." << std::endl 210 << "Mask size is " << mask.extent(0) << "."); 211 } 212 else // (mask.isEmpty()) 213 { // If no mask was defined, we create a default one without any masked point. 209 214 mask.resize(n); 210 for (int i = 0; i < n .getValue(); ++i)215 for (int i = 0; i < n; ++i) 211 216 { 212 217 mask(i) = true; … … 221 226 if (bounds.extent(0) != n || bounds.extent(1) != 2) 222 227 ERROR("CAxis::checkAttributes(void)", 223 << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension axis size x 2 " <<endl224 << "Axis size is " << n <<endl225 << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) );228 << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension axis size x 2." << std::endl 229 << "Axis size is " << n.getValue() << "." << std::endl 230 << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << "."); 226 231 hasBounds_ = true; 227 232 } … … 259 264 break; 260 265 default : 261 ERROR("bool C Context::dispatchEvent(CEventServer& event)",266 ERROR("bool CAxis::dispatchEvent(CEventServer& event)", 262 267 << "Unknown Event"); 263 268 return false;
Note: See TracChangeset
for help on using the changeset viewer.