From: ageay Date: Wed, 9 Oct 2013 15:30:21 +0000 (+0000) Subject: MEDCouplingUMesh::computePlaneEquationOf3DFaces method to localize warpped faces X-Git-Tag: V7_3_1b1~116 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=16ddf4d3bafeaca631af3d29470ddb17b4eb0419;p=tools%2Fmedcoupling.git MEDCouplingUMesh::computePlaneEquationOf3DFaces method to localize warpped faces DataArrayDouble::sumPerTuple, DataArrayInt::sumPerTuple --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index ca8343508..fec8fe9db 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -3818,6 +3818,28 @@ DataArrayDouble *DataArrayDouble::magnitude() const return ret; } +/*! + * Computes for each tuple the sum of number of components values in the tuple and return it. + * + * \return DataArrayDouble * - the new instance of DataArrayDouble containing the + * same number of tuples as \a this array and one component. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If \a this is not allocated. + */ +DataArrayDouble *DataArrayDouble::sumPerTuple() const +{ + checkAllocated(); + int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples()); + MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + ret->alloc(nbOfTuple,1); + const double *src(getConstPointer()); + double *dest(ret->getPointer()); + for(int i=0;i ret(DataArrayInt::New()); + ret->alloc(nbOfTuple,1); + const int *src(getConstPointer()); + int *dest(ret->getPointer()); + for(int i=0;igetNumberOfComponents() < 1. diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 9fcd96654..1fa5194fb 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -324,6 +324,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT DataArrayDouble *trace() const; MEDCOUPLING_EXPORT DataArrayDouble *deviator() const; MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const; + MEDCOUPLING_EXPORT DataArrayDouble *sumPerTuple() const; MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const; MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const; MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const; @@ -448,6 +449,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const; MEDCOUPLING_EXPORT bool isFittingWith(const std::vector& v) const; MEDCOUPLING_EXPORT DataArrayInt *buildPermutationArr(const DataArrayInt& other) const; + MEDCOUPLING_EXPORT DataArrayInt *sumPerTuple() const; MEDCOUPLING_EXPORT void sort(bool asc=true); MEDCOUPLING_EXPORT void reverse(); MEDCOUPLING_EXPORT void checkMonotonic(bool increasing) const; diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index b2b572045..f3e7a7655 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -67,6 +67,7 @@ %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual; %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList; %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList; +%newobject ParaMEDMEM::DataArrayInt::sumPerTuple; %newobject ParaMEDMEM::DataArrayInt::negate; %newobject ParaMEDMEM::DataArrayInt::getIdsInRange; %newobject ParaMEDMEM::DataArrayInt::Aggregate; @@ -160,6 +161,7 @@ %newobject ParaMEDMEM::DataArrayDouble::deviator; %newobject ParaMEDMEM::DataArrayDouble::magnitude; %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple; +%newobject ParaMEDMEM::DataArrayDouble::sumPerTuple; %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple; %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix; %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith; @@ -553,6 +555,7 @@ namespace ParaMEDMEM DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception); DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception); DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception); + DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception); DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception); DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception); void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception); @@ -2488,6 +2491,7 @@ namespace ParaMEDMEM bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception); bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception); DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception); + DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception); void sort(bool asc=true) throw(INTERP_KERNEL::Exception); void reverse() throw(INTERP_KERNEL::Exception); void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);