}
}
+/*!
+ * Simply this method checks that \b value is in [0,\b ref).
+ */
void DataArray::CheckValueInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception)
{
if(value<0 || value>=ref)
}
}
+/*!
+ * This method checks that [\b start, \b end) is compliant with ref length \b value.
+ * typicaly start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported.
+ */
+void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *msg) throw(INTERP_KERNEL::Exception)
+{
+ if(start<0 || start>=value)
+ {
+ if(value!=start || end!=start)
+ {
+ std::ostringstream oss; oss << "DataArray::CheckValueInRange : " << msg << " ! Expected start " << start << " of range in [0," << value << "[ !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(end<0 || end>value)
+ {
+ std::ostringstream oss; oss << "DataArray::CheckClosingParInRange : " << msg << " ! Expected start " << end << " of range in [0," << value << "[ !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
void DataArray::CheckClosingParInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception)
{
if(value<0 || value>ref)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
- DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
- DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
double *pt=getPointer()+bgTuples*nbComp+bgComp;
for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
for(int j=0;j<newNbOfComp;j++)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
double *pt=getPointer()+bgComp;
for(const int *w=bgTuples;w!=endTuples;w++)
for(int j=0;j<newNbOfComp;j++)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
- DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
- DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int *pt=getPointer()+bgTuples*nbComp+bgComp;
for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
for(int j=0;j<newNbOfComp;j++)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
- DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int *pt=getPointer()+bgComp;
for(const int *w=bgTuples;w!=endTuples;w++)
for(int j=0;j<newNbOfComp;j++)