From: ageay Date: Tue, 2 Apr 2013 08:56:32 +0000 (+0000) Subject: __repr__ of MEDCouplingCurveLinearMesh X-Git-Tag: V6_main_FINAL~221 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ef638e622a1572b2aa927067240c99bd3e42e70d;p=tools%2Fmedcoupling.git __repr__ of MEDCouplingCurveLinearMesh --- diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index a7b953acf..26403d670 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -323,8 +323,17 @@ void MEDCouplingCurveLinearMesh::setCoords(const DataArrayDouble *coords) throw( void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, const int *gridStructEnd) throw(INTERP_KERNEL::Exception) { - _structure.resize(0); - _structure.insert(_structure.end(),gridStructBg,gridStructEnd); + std::size_t sz=std::distance(gridStructBg,gridStructEnd); + if(sz>=1 && sz<=3) + { + _structure.resize(0); + _structure.insert(_structure.end(),gridStructBg,gridStructEnd); + } + else + { + std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::setNodeGridStructure : size of input nodal grid structure (" << sz << ") should be in 1, 2 or 3 !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } } std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const throw(INTERP_KERNEL::Exception) @@ -880,7 +889,26 @@ void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception) { - stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << "."; + stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << "." << std::endl; + stream << "Nodal structure : ["; + for(std::size_t i=0;i<_structure.size();i++) + { + char tmp='X'+i; + stream << " " << tmp << "=" << _structure[i]; + if(i!=_structure.size()-1) + stream << ", "; + } + stream << " ]."; + const DataArrayDouble *coo(_coords); + if(!coo) + { stream << std::endl << "No coordinates set !"; return ; } + if(!coo->isAllocated()) + { stream << std::endl << "Coordinates set but not allocated !"; return ; } + int nbOfCompo=coo->getNumberOfComponents(); + if(nbOfCompo!=(int)_structure.size()) + { stream << std::endl << "Coordinates set and allocated but mismatch number of components !"; return ; } + stream << std::endl << "Coordinates ( number of tuples = " << coo->getNumberOfTuples() << " ) : "; + coo->reprQuickOverviewData(stream,200); } std::string MEDCouplingCurveLinearMesh::getVTKDataSetType() const throw(INTERP_KERNEL::Exception)