//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMemArray.txx"
#include "MEDCouplingAutoRefCountObjectPtr.hxx"
void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const char *nameInFile) const throw(INTERP_KERNEL::Exception)
{
std::string idt(indent,' ');
- ofs.precision(15);
+ ofs.precision(17);
ofs << idt << "<DataArray type=\"Float32\" Name=\"" << nameInFile << "\" NumberOfComponents=\"" << getNumberOfComponents() << "\"";
ofs << " format=\"ascii\" RangeMin=\"" << getMinValueInArray() << "\" RangeMax=\"" << getMaxValueInArray() << "\">\n" << idt;
std::copy(begin(),end(),std::ostream_iterator<double>(ofs," "));
void DataArrayDouble::reprWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- stream.precision(15);
+ stream.precision(17);
_mem.repr(getNumberOfComponents(),stream);
}
void DataArrayDouble::reprZipWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- stream.precision(15);
+ stream.precision(17);
_mem.reprZip(getNumberOfComponents(),stream);
}
}
}
-void DataArrayDouble::useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
+void DataArrayDouble::useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
{
_nb_of_tuples=nbOfTuple;
_info_on_compo.resize(nbOfCompo);
declareAsNew();
}
+void DataArrayDouble::useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo)
+{
+ _nb_of_tuples=nbOfTuple;
+ _info_on_compo.resize(nbOfCompo);
+ _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
+ declareAsNew();
+}
+
void DataArrayDouble::checkNoNullValues() const throw(INTERP_KERNEL::Exception)
{
const double *tmp=getConstPointer();
std::string DataArrayDoubleTuple::repr() const
{
- std::ostringstream oss; oss.precision(15); oss << "(";
+ std::ostringstream oss; oss.precision(17); oss << "(";
for(int i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
DataArrayDouble *ret=DataArrayDouble::New();
- ret->useArray(_pt,false,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
return ret;
}
else
declareAsNew();
}
+void DataArrayInt::useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo)
+{
+ _nb_of_tuples=nbOfTuple;
+ _info_on_compo.resize(nbOfCompo);
+ _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
+ declareAsNew();
+}
+
DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Exception)
{
if(_mem.isNull())
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
DataArrayInt *ret=DataArrayInt::New();
- ret->useArray(_pt,false,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
return ret;
}
else