+MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+{
+ checkConsistencyLight();
+ int dim(getSpaceDimension());
+ std::vector<int> dims(getMeshDimension());
+ if(dim!=(int)cellPart.size())
+ {
+ std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ std::vector< std::pair<int,int> > nodePartFormat(cellPart);
+ for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+ (*it).second++;
+ MCAuto<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+ MCAuto<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCopy()));
+ const DataArrayDouble *coo(ret->getCoords());
+ if(coo)
+ {
+ MCAuto<DataArrayDouble> coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end()));
+ ret->setCoords(coo2);
+ }
+ for(int i=0;i<dim;i++)
+ {
+ dims[i]=cellPart[i].second-cellPart[i].first+1;
+ if(dims[i]<1)
+ throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::buildStructuredSubPart : invalid input cellPart !");
+ }
+ ret->setNodeGridStructure(&dims[0],&dims[0]+dims.size());
+ return ret.retn();
+}
+