From: ageay Date: Tue, 23 Jul 2013 15:24:44 +0000 (+0000) Subject: Target MEDReader X-Git-Tag: B4PolyhIntersect~59 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e6173a6bbb3c9120127e9243004eb54ea850c1e;p=modules%2Fmed.git Target MEDReader --- diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index ae715ec5d..7dbde2cb1 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -255,24 +255,34 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, } /*! - * Creates a new unstructured mesh (MEDCouplingUMesh) from \a this structured one. + * Creates a new unstructured mesh (MEDCoupling1SGTUMesh) from \a this structured one. * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to * delete this array using decrRef() as it is no more needed. * \throw If \a this->getMeshDimension() is not among [1,2,3]. */ -MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const throw(INTERP_KERNEL::Exception) +MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const throw(INTERP_KERNEL::Exception) { int meshDim=getMeshDimension(); if(meshDim<0 || meshDim>3) - throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::buildUnstructured : meshdim must be in [1,2,3] !"); - + throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim must be in [1,2,3] !"); MEDCouplingAutoRefCountObjectPtr coords(getCoordinatesAndOwner()); int ns[3]; getNodeGridStructure(ns); MEDCouplingAutoRefCountObjectPtr conn(Build1GTNodalConnectivity(ns,ns+meshDim)); MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName().c_str(),GetGeoTypeGivenMeshDimension(meshDim))); ret->setNodalConnectivity(conn); ret->setCoords(coords); - return ret->buildUnstructured(); + return ret.retn(); +} + +/*! + * Creates a new unstructured mesh (MEDCouplingUMesh) from \a this structured one. + * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. The caller is to + * delete this array using decrRef() as it is no more needed. + * \throw If \a this->getMeshDimension() is not among [1,2,3]. + */ +MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const throw(INTERP_KERNEL::Exception) +{ + return build1SGTUnstructured()->buildUnstructured(); } /*! diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index 97eb2650d..b4f9052c6 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -26,6 +26,8 @@ namespace ParaMEDMEM { + class MEDCoupling1SGTUMesh; + class MEDCOUPLING_EXPORT MEDCouplingStructuredMesh : public MEDCouplingMesh { public: @@ -45,6 +47,7 @@ namespace ParaMEDMEM std::vector getDistributionOfTypes() const throw(INTERP_KERNEL::Exception); DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const throw(INTERP_KERNEL::Exception); void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const throw(INTERP_KERNEL::Exception); + MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); MEDCouplingMesh *buildPart(const int *start, const int *end) const; MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 111271078..9cdf32e5c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -458,6 +458,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart; +%newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured; %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom; %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity; %newobject ParaMEDMEM::MEDCouplingCMesh::New; @@ -2935,6 +2936,7 @@ namespace ParaMEDMEM int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception); virtual std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception); std::vector getCellGridStructure() const throw(INTERP_KERNEL::Exception); + MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception); static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception); %extend {