From: ageay Date: Thu, 14 Jun 2012 13:52:25 +0000 (+0000) Subject: Duplication of nodes. X-Git-Tag: V6_main_FINAL~650 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=209af316b015ec68c2b4504cabe23d3543c4958f;p=tools%2Fmedcoupling.git Duplication of nodes. --- diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 597f71a00..55e61ee1e 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -457,6 +457,22 @@ void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, setCoords(other._coords); } +/*! + * This method duplicates the nodes whose ids are in [\b nodeIdsToDuplicateBg, \b nodeIdsToDuplicateEnd) and put the result of their duplication at the end + * of existing node ids. + * + * \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only + * \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only + */ +void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) throw(INTERP_KERNEL::Exception) +{ + if(!_coords) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !"); + MEDCouplingAutoRefCountObjectPtr newCoords=_coords->selectByTupleIdSafe(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd); + MEDCouplingAutoRefCountObjectPtr newCoords2=DataArrayDouble::Aggregate(_coords,newCoords); + setCoords(newCoords2); +} + /*! * This method is expecting to be called for meshes so that getSpaceDimension() returns 3. * This method returns in 'nodes' output all the nodes that are at a distance lower than epsilon from plane diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 09b6ef674..8f7d78993 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -81,6 +81,7 @@ namespace ParaMEDMEM void scale(const double *point, double factor); void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception); void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); + void duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) throw(INTERP_KERNEL::Exception); virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception) = 0; void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const throw(INTERP_KERNEL::Exception); void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const throw(INTERP_KERNEL::Exception); @@ -94,7 +95,7 @@ namespace ParaMEDMEM virtual MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords=true) const = 0; virtual MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0; virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0; - virtual void findBoundaryNodes(std::vector& nodes) const = 0; + virtual DataArrayInt *findBoundaryNodes() const = 0; virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0; virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); virtual void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes);