void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "MEDCouplingCMesh C++ instance at " << this << ".";
+ const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
+ std::ostringstream stream2[3];
+ bool isDef[3];
+ int nbOfCells=1,nbOfNodes=1;
+ for(int i=0;i<3;i++)
+ {
+ isDef[i]=thisArr[i]!=0;
+ if(isDef[i])
+ {
+ char tmp='X'+i;
+ stream2[i] << tmp << " positions array ";
+ if(!thisArr[i]->isAllocated())
+ stream2[i] << "set but not allocated.";
+ else
+ {
+ int nbCompo=thisArr[i]->getNumberOfComponents();
+ if(nbCompo==1)
+ {
+ int nbTuples=thisArr[i]->getNumberOfTuples();
+ if(nbTuples<1)
+ { stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; }
+ else
+ {
+ stream2[i] << "(length=" << nbTuples << ")" << ": ";
+ thisArr[i]->reprQuickOverviewData(stream2[i],200);
+ if(nbOfCells!=-1)
+ { nbOfNodes*=nbTuples; nbOfCells*=nbTuples-1; }
+ }
+ }
+ else
+ { stream2[i] << "set and allocated - WARNING number of components != 1 !"; nbOfCells=-1; nbOfNodes=-1; }
+ }
+ }
+ }
+ if(!isDef[0] && !isDef[1] && !isDef[2])
+ { stream << " No arrays set !"; return; }
+ if(nbOfCells>=0)
+ { stream << std::endl << "Number of cells : " << nbOfCells << ". Number of nodes : " << nbOfNodes << "."; }
+ for(int i=0;i<3;i++)
+ {
+ if(isDef[i])
+ stream << std::endl << stream2[i].str();
+ }
+
}
std::string MEDCouplingCMesh::getVTKDataSetType() const throw(INTERP_KERNEL::Exception)
{
int nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
- const double *data=begin();
- std::ostringstream oss2; oss2 << "[";
- oss2.precision(17);
- std::string oss2Str(oss2.str());
- bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
- {
- if(nbOfCompo>1)
- {
- oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
- {
- oss2 << *data;
- if(j!=nbOfCompo-1) oss2 << ", ";
- }
- oss2 << ")";
- }
- else
- oss2 << *data++;
- if(i!=nbOfTuples-1) oss2 << ", ";
- std::string oss3Str(oss2.str());
- if(oss3Str.length()<MAX_NB_OF_BYTE_IN_REPR)
- oss2Str=oss3Str;
- else
- isFinished=false;
- }
- stream << oss2Str;
- if(!isFinished)
- stream << "... ";
- stream << "]";
+ reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
else
stream << "Number of components : 0.";
stream << "*** No data allocated ****";
}
+void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+ const double *data=begin();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::ostringstream oss2; oss2 << "[";
+ oss2.precision(17);
+ std::string oss2Str(oss2.str());
+ bool isFinished=true;
+ for(int i=0;i<nbOfTuples && isFinished;i++)
+ {
+ if(nbOfCompo>1)
+ {
+ oss2 << "(";
+ for(int j=0;j<nbOfCompo;j++,data++)
+ {
+ oss2 << *data;
+ if(j!=nbOfCompo-1) oss2 << ", ";
+ }
+ oss2 << ")";
+ }
+ else
+ oss2 << *data++;
+ if(i!=nbOfTuples-1) oss2 << ", ";
+ std::string oss3Str(oss2.str());
+ if(oss3Str.length()<maxNbOfByteInRepr)
+ oss2Str=oss3Str;
+ else
+ isFinished=false;
+ }
+ stream << oss2Str;
+ if(!isFinished)
+ stream << "... ";
+ stream << "]";
+}
+
/*!
* Equivalent to DataArrayDouble::isEqual except that if false the reason of
* mismatch is given.
{
int nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
- const int *data=begin();
- std::ostringstream oss2; oss2 << "[";
- std::string oss2Str(oss2.str());
- bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
- {
- if(nbOfCompo>1)
- {
- oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
- {
- oss2 << *data;
- if(j!=nbOfCompo-1) oss2 << ", ";
- }
- oss2 << ")";
- }
- else
- oss2 << *data++;
- if(i!=nbOfTuples-1) oss2 << ", ";
- std::string oss3Str(oss2.str());
- if(oss3Str.length()<MAX_NB_OF_BYTE_IN_REPR)
- oss2Str=oss3Str;
- else
- isFinished=false;
- }
- stream << oss2Str;
- if(!isFinished)
- stream << "... ";
- stream << "]";
+ reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
else
stream << "Number of components : 0.";
stream << "*** No data allocated ****";
}
+void DataArrayInt::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+ const int *data=begin();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::ostringstream oss2; oss2 << "[";
+ std::string oss2Str(oss2.str());
+ bool isFinished=true;
+ for(int i=0;i<nbOfTuples && isFinished;i++)
+ {
+ if(nbOfCompo>1)
+ {
+ oss2 << "(";
+ for(int j=0;j<nbOfCompo;j++,data++)
+ {
+ oss2 << *data;
+ if(j!=nbOfCompo-1) oss2 << ", ";
+ }
+ oss2 << ")";
+ }
+ else
+ oss2 << *data++;
+ if(i!=nbOfTuples-1) oss2 << ", ";
+ std::string oss3Str(oss2.str());
+ if(oss3Str.length()<maxNbOfByteInRepr)
+ oss2Str=oss3Str;
+ else
+ isFinished=false;
+ }
+ stream << oss2Str;
+ if(!isFinished)
+ stream << "... ";
+ stream << "]";
+}
+
/*!
* Modifies \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ],
* i.e. a current value is used as in index to get a new value from \a indArrBg.
MEDCOUPLING_EXPORT virtual void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
MEDCOUPLING_EXPORT virtual void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception) = 0;
protected:
DataArray() { }
protected:
MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
private:
~DataArrayByte() { }
MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
private:
~DataArrayAsciiChar() { }
{
int nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
- const char *data=begin();
- std::ostringstream oss2; oss2 << "[";
- std::string oss2Str(oss2.str());
- bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
- {
- if(nbOfCompo>1)
- {
- oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
- {
- oss2 << (int)*data;
- if(j!=nbOfCompo-1) oss2 << ", ";
- }
- oss2 << ")";
- }
- else
- { oss2 << (int)*data; data++; }
- if(i!=nbOfTuples-1) oss2 << ", ";
- std::string oss3Str(oss2.str());
- if(oss3Str.length()<MAX_NB_OF_BYTE_IN_REPR)
- oss2Str=oss3Str;
- else
- isFinished=false;
- }
- stream << oss2Str;
- if(!isFinished)
- stream << "... ";
- stream << "]";
+ reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
else
stream << "Number of components : 0.";
stream << "*** No data allocated ****";
}
+void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+ const char *data=begin();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::ostringstream oss2; oss2 << "[";
+ std::string oss2Str(oss2.str());
+ bool isFinished=true;
+ for(int i=0;i<nbOfTuples && isFinished;i++)
+ {
+ if(nbOfCompo>1)
+ {
+ oss2 << "(";
+ for(int j=0;j<nbOfCompo;j++,data++)
+ {
+ oss2 << (int)*data;
+ if(j!=nbOfCompo-1) oss2 << ", ";
+ }
+ oss2 << ")";
+ }
+ else
+ { oss2 << (int)*data; data++; }
+ if(i!=nbOfTuples-1) oss2 << ", ";
+ std::string oss3Str(oss2.str());
+ if(oss3Str.length()<maxNbOfByteInRepr)
+ oss2Str=oss3Str;
+ else
+ isFinished=false;
+ }
+ stream << oss2Str;
+ if(!isFinished)
+ stream << "... ";
+ stream << "]";
+}
+
bool DataArrayByte::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
const DataArrayByte *otherC=dynamic_cast<const DataArrayByte *>(&other);
{
int nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
- const char *data=begin();
- std::ostringstream oss2; oss2 << "[";
- std::string oss2Str(oss2.str());
- bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
- {
- bool isAscii=true;
- for(int j=0;j<nbOfCompo;j++)
- if(data[j]<32) isAscii=false;
- if(isAscii)
- {
- oss2 << "\'";
- for(int j=0;j<nbOfCompo;j++,data++)
- oss2 << *data;
- oss2 << "\'";
- }
- else
- {
- oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
- {
- oss2 << (int)*data;
- if(j!=nbOfCompo-1) oss2 << ", ";
- }
- oss2 << ")";
- }
- if(i!=nbOfTuples-1) oss2 << ", ";
- std::string oss3Str(oss2.str());
- if(oss3Str.length()<MAX_NB_OF_BYTE_IN_REPR)
- oss2Str=oss3Str;
- else
- isFinished=false;
- }
- stream << oss2Str;
- if(!isFinished)
- stream << "... ";
- stream << "]";
+ reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
else
stream << "Number of components : 0.";
stream << "*** No data allocated ****";
}
+void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+ const char *data=begin();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::ostringstream oss2; oss2 << "[";
+ std::string oss2Str(oss2.str());
+ bool isFinished=true;
+ for(int i=0;i<nbOfTuples && isFinished;i++)
+ {
+ bool isAscii=true;
+ for(int j=0;j<nbOfCompo;j++)
+ if(data[j]<32) isAscii=false;
+ if(isAscii)
+ {
+ oss2 << "\'";
+ for(int j=0;j<nbOfCompo;j++,data++)
+ oss2 << *data;
+ oss2 << "\'";
+ }
+ else
+ {
+ oss2 << "(";
+ for(int j=0;j<nbOfCompo;j++,data++)
+ {
+ oss2 << (int)*data;
+ if(j!=nbOfCompo-1) oss2 << ", ";
+ }
+ oss2 << ")";
+ }
+ if(i!=nbOfTuples-1) oss2 << ", ";
+ std::string oss3Str(oss2.str());
+ if(oss3Str.length()<maxNbOfByteInRepr)
+ oss2Str=oss3Str;
+ else
+ isFinished=false;
+ }
+ stream << oss2Str;
+ if(!isFinished)
+ stream << "... ";
+ stream << "]";
+}
+
bool DataArrayAsciiChar::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
const DataArrayAsciiChar *otherC=dynamic_cast<const DataArrayAsciiChar *>(&other);