From: ageay Date: Mon, 18 Oct 2010 07:53:32 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: Step0_WithoutSPLITTER~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=68c2a6fa3b95e71f754b4e899dd81b505db7e9a9;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 3fd5fd404..a8aeaf1ef 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -497,6 +497,12 @@ void MEDCouplingCMesh::translate(const double *vector) _z_array->getPointer(),std::bind2nd(std::plus(),vector[2])); } +void MEDCouplingCMesh::scale(const double *point, double factor) +{ + //not implemented yet ! + throw INTERP_KERNEL::Exception("Not implemented yet !"); +} + MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) const { //not implemented yet ! diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index e08226512..3cdee7c39 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -71,6 +71,7 @@ namespace ParaMEDMEM int getCellContainingPoint(const double *pos, double eps) const; void rotate(const double *center, const double *vector, double angle); void translate(const double *vector); + void scale(const double *point, double factor); MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; DataArrayDouble *getCoordinatesAndOwner() const; DataArrayDouble *getBarycenterAndOwner() const; diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 29d27ade9..d01e29149 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -562,6 +562,12 @@ void MEDCouplingExtrudedMesh::translate(const double *vector) _mesh1D->translate(vector); } +void MEDCouplingExtrudedMesh::scale(const double *point, double factor) +{ + _mesh2D->scale(point,factor); + _mesh1D->scale(point,factor); +} + MEDCouplingMesh *MEDCouplingExtrudedMesh::buildPart(const int *start, const int *end) const { // not implemented yet ! diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index e8915f4ee..39a0dbf47 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -75,6 +75,7 @@ namespace ParaMEDMEM MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v) throw(INTERP_KERNEL::Exception); void rotate(const double *center, const double *vector, double angle); void translate(const double *vector); + void scale(const double *point, double factor); MEDCouplingMesh *buildPart(const int *start, const int *end) const; MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 3a917c753..41c3029f3 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -92,14 +92,14 @@ TypeOfField MEDCouplingField::getTypeOfField() const } /*! - * This method retrieves the weighting field of 'this'. If no '_mesh' is defined an exception will be thrown. + * This method retrieves the measure field of 'this'. If no '_mesh' is defined an exception will be thrown. * Warning the retrieved field life cycle is the responsability of caller. */ -MEDCouplingFieldDouble *MEDCouplingField::buildWeightingField(bool isAbs) const throw(INTERP_KERNEL::Exception) +MEDCouplingFieldDouble *MEDCouplingField::buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception) { if(_mesh==0) - throw INTERP_KERNEL::Exception("MEDCouplingField::getWeightingField : no mesh defined !!!"); - return _type->getWeightingField(_mesh,isAbs); + throw INTERP_KERNEL::Exception("MEDCouplingField::getMeasureField : no mesh defined !!!"); + return _type->getMeasureField(_mesh,isAbs); } void MEDCouplingField::setMesh(const MEDCouplingMesh *mesh) @@ -264,7 +264,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other):_name(other._n /*! * This method returns a submesh of 'mesh' instance constituting cell ids contained in array defined as an interval [start;end). - * @ param di is an array returned that specifies entity ids (nodes, cells ids...) in mesh 'mesh' of entity in returned submesh. + * @param di is an array returned that specifies entity ids (nodes, cells ids...) in mesh 'mesh' of entity in returned submesh. */ MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const { diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index d1ed3a27f..e6eedb5bc 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -52,7 +52,7 @@ namespace ParaMEDMEM void setDescription(const char *desc) { _desc=desc; } const char *getName() const { return _name.c_str(); } TypeOfField getTypeOfField() const; - MEDCouplingFieldDouble *buildWeightingField(bool isAbs) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const; MEDCouplingFieldDiscretization *getDiscretization() const { return _type; } // Gauss point specific methods diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 8633dc1f3..cadfb04f4 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -99,11 +99,11 @@ void MEDCouplingFieldDiscretization::updateTime() /*! * Computes normL1 of DataArrayDouble instance arr. * @param res output parameter expected to be of size arr->getNumberOfComponents(); - * @throw when the field discretization fails on getWeighting fields (gauss points for example) + * @throw when the field discretization fails on getMeasure fields (gauss points for example) */ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception) { - MEDCouplingFieldDouble *vol=getWeightingField(mesh,true); + MEDCouplingFieldDouble *vol=getMeasureField(mesh,true); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); @@ -120,11 +120,11 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D /*! * Computes normL2 of DataArrayDouble instance arr. * @param res output parameter expected to be of size arr->getNumberOfComponents(); - * @throw when the field discretization fails on getWeighting fields (gauss points for example) + * @throw when the field discretization fails on getMeasure fields (gauss points for example) */ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception) { - MEDCouplingFieldDouble *vol=getWeightingField(mesh,true); + MEDCouplingFieldDouble *vol=getMeasureField(mesh,true); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); @@ -142,11 +142,11 @@ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const D /*! * Computes integral of DataArrayDouble instance arr. * @param res output parameter expected to be of size arr->getNumberOfComponents(); - * @throw when the field discretization fails on getWeighting fields (gauss points for example) + * @throw when the field discretization fails on getMeasure fields (gauss points for example) */ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception) { - MEDCouplingFieldDouble *vol=getWeightingField(mesh,isWAbs); + MEDCouplingFieldDouble *vol=getMeasureField(mesh,isWAbs); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); @@ -327,7 +327,7 @@ void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMe } } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationP0::getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationP0::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { return mesh->getMeasureField(isAbs); } @@ -358,7 +358,7 @@ void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(const int *, DataAr /*! * This method returns a submesh of 'mesh' instance constituting cell ids contained in array defined as an interval [start;end). - * @ param di is an array returned that specifies entity ids (here cells ids) in mesh 'mesh' of entity in returned submesh. + * @param di is an array returned that specifies entity ids (here cells ids) in mesh 'mesh' of entity in returned submesh. * Example : The first cell id of returned mesh has the (*di)[0] id in 'mesh' */ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const @@ -433,7 +433,7 @@ void MEDCouplingFieldDiscretizationP1::checkCoherencyBetween(const MEDCouplingMe } } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationP1::getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationP1::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { return mesh->getMeasureFieldOnNode(isAbs); } @@ -513,7 +513,7 @@ void MEDCouplingFieldDiscretizationP1::renumberValuesOnNodes(const int *old2NewP /*! * This method returns a submesh of 'mesh' instance constituting cell ids contained in array defined as an interval [start;end). -* @ param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh. +* @param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh. * Example : The first node id of returned mesh has the (*di)[0] id in 'mesh' */ MEDCouplingMesh *MEDCouplingFieldDiscretizationP1::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const @@ -826,7 +826,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin } } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } @@ -1120,7 +1120,7 @@ void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCoupl } } -MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const +MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx index 0773d13e7..0e502cc35 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.hxx @@ -62,7 +62,7 @@ namespace ParaMEDMEM const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0; virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception); virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception) = 0; - virtual MEDCouplingFieldDouble *getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const = 0; + virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0; virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0; virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0; virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const = 0; @@ -106,7 +106,7 @@ namespace ParaMEDMEM void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *partBg, const int *partEnd, DataArrayInt *&cellRest); void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const; + MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const; @@ -131,7 +131,7 @@ namespace ParaMEDMEM DataArrayInt *&cellRest); void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception); void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const; + MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; @@ -185,7 +185,7 @@ namespace ParaMEDMEM void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr); double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception); void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const; + MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; @@ -233,7 +233,7 @@ namespace ParaMEDMEM void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception); double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception); void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *getWeightingField(const MEDCouplingMesh *mesh, bool isAbs) const; + MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 81758deda..5ba6492a2 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -444,7 +444,7 @@ double MEDCouplingFieldDouble::getAverageValue() const throw(INTERP_KERNEL::Exce } /*! - * This method returns the average value in 'this' weighted by ParaMEDMEM::MEDCouplingField::buildWeightingField. + * This method returns the average value in 'this' weighted by ParaMEDMEM::MEDCouplingField::buildMeasureField. * 'This' is expected to be a field with exactly \b one component. If not an exception will be thrown. * To getAverageValue on vector field applyFunc is needed before. This method looks only \b default array \b and \b only \b default. * If default array does not exist, an exception will be thrown. @@ -453,7 +453,7 @@ double MEDCouplingFieldDouble::getWeightedAverageValue() const throw(INTERP_KERN { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !"); - MEDCouplingFieldDouble *w=buildWeightingField(true); + MEDCouplingFieldDouble *w=buildMeasureField(true); double deno=w->getArray()->accumulate(0); w->getArray()->multiplyEqual(getArray()); double res=w->getArray()->accumulate(0); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 1f60dc669..5ad1928d3 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -105,8 +105,8 @@ void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levO } /*! - * Given a nodeIds range ['partBg','partEnd'), this method returns the set of cell ids in ascendant order that are \b fully whose connectivity of - * these cells are fully included in the range. As a consequence the returned set of cell ids does not \b always fit the nodes in ['partBg','partEnd') + * Given a nodeIds range ['partBg','partEnd'), this method returns the set of cell ids in ascendant order whose connectivity of + * these cells are fully included in the range. As a consequence the returned set of cell ids does \b not \b always fit the nodes in ['partBg','partEnd') * This method returns the corresponding cells in a newly created array that the caller has the responsability. */ DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 3cdbe20a8..524c23017 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -86,6 +86,7 @@ namespace ParaMEDMEM virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0; virtual void rotate(const double *center, const double *vector, double angle) = 0; virtual void translate(const double *vector) = 0; + virtual void scale(const double *point, double factor) = 0; virtual void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0; virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const = 0; virtual MEDCouplingMesh *buildPart(const int *start, const int *end) const = 0; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index f451ea61a..87964cbdf 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -164,7 +164,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(int limitNodeId, d DataArrayInt *comm,*commI; findCommonNodes(limitNodeId,precision,comm,commI); int oldNbOfNodes=getNumberOfNodes(); - DataArrayInt *ret=buildNewNumberingFromCommNodesFrmt(comm,commI,newNbOfNodes); + DataArrayInt *ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); areNodesMerged=(oldNbOfNodes!=newNbOfNodes); comm->decrRef(); commI->decrRef(); @@ -222,8 +222,8 @@ void MEDCouplingPointSet::findCommonNodes(int limitNodeId, double prec, DataArra * @param commI in param in the same format than one returned by findCommonNodes method. * @return the old to new correspondance array. */ -DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommNodesFrmt(const DataArrayInt *comm, const DataArrayInt *commIndex, - int& newNbOfNodes) const +DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex, + int& newNbOfNodes) const { DataArrayInt *ret=DataArrayInt::New(); int nbNodesOld=getNumberOfNodes(); @@ -693,7 +693,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end /*! * This method implements pure virtual method MEDCouplingMesh::buildPartAndReduceNodes. * This method build a part of 'this' by simply keeping cells whose ids are in ['start','end') \b and potentially reduces the nodes set - * behind returned mesh. This cause an overhead but it is more little in memory. + * behind returned mesh. This cause an overhead but it is lesser in memory. * This method returns an array too. This array allows to the caller to know the mapping between nodeids in 'this' and nodeids in * returned mesh. This is quite usefull for MEDCouplingFieldDouble on nodes for example... * The returned mesh has to be managed by the caller. diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 687124fa8..87a4c04ec 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -56,8 +56,8 @@ namespace ParaMEDMEM virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) = 0; DataArrayInt *buildPermArrayForMergeNode(int limitNodeId, double precision, bool& areNodesMerged, int& newNbOfNodes) const; void findCommonNodes(int limitNodeId, double prec, DataArrayInt *&comm, DataArrayInt *&commIndex) const; - DataArrayInt *buildNewNumberingFromCommNodesFrmt(const DataArrayInt *comm, const DataArrayInt *commIndex, - int& newNbOfNodes) const; + DataArrayInt *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex, + int& newNbOfNodes) const; void getBoundingBox(double *bbox) const; void zipCoords(); double getCaracteristicDimension() const; diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index 3337b8b4e..bb494899b 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -378,8 +378,8 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou } case Integral: { - MEDCouplingFieldDouble *deno=srcField->getDiscretization()->getWeightingField(srcField->getMesh(),true); - MEDCouplingFieldDouble *denoR=trgField->getDiscretization()->getWeightingField(trgField->getMesh(),true); + MEDCouplingFieldDouble *deno=srcField->getDiscretization()->getMeasureField(srcField->getMesh(),true); + MEDCouplingFieldDouble *denoR=trgField->getDiscretization()->getMeasureField(trgField->getMesh(),true); const double *denoPtr=deno->getArray()->getConstPointer(); const double *denoRPtr=denoR->getArray()->getConstPointer(); if(trgField->getMesh()->getMeshDimension()==-1) @@ -410,8 +410,8 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou } case RevIntegral: { - MEDCouplingFieldDouble *deno=trgField->getDiscretization()->getWeightingField(trgField->getMesh(),true); - MEDCouplingFieldDouble *denoR=srcField->getDiscretization()->getWeightingField(srcField->getMesh(),true); + MEDCouplingFieldDouble *deno=trgField->getDiscretization()->getMeasureField(trgField->getMesh(),true); + MEDCouplingFieldDouble *denoR=srcField->getDiscretization()->getMeasureField(srcField->getMesh(),true); const double *denoPtr=deno->getArray()->getConstPointer(); const double *denoRPtr=denoR->getArray()->getConstPointer(); if(trgField->getMesh()->getMeshDimension()==-1) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index e27fe875c..4da00a715 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -25,6 +25,7 @@ #include "PointLocatorAlgos.txx" #include "BBTree.txx" #include "DirectedBoundingBox.hxx" +#include "InterpKernelMeshQuality.hxx" #include "MEDCouplingAutoRefCountObjectPtr.hxx" #include @@ -80,6 +81,12 @@ MEDCouplingUMesh::MEDCouplingUMesh():_iterator(-1),_mesh_dim(-2), { } +/*! + * This method checks that this is correctly designed. For example le coordinates are set, nodal connectivity. + * When this method returns without throwing any exception, 'this' is expected to be writable, exchangeable and to be + * available for most of algorithm. When a mesh has been constructed from scratch it is a good habits to call this method to check + * that all is in order in 'this'. + */ void MEDCouplingUMesh::checkCoherency() const throw(INTERP_KERNEL::Exception) { if(_mesh_dim<-1) @@ -887,44 +894,58 @@ void MEDCouplingUMesh::tryToShareSameCoordsPermute(const MEDCouplingPointSet& ot } /*! - * build a sub part of 'this'. This sub part is defined by the cell ids contained in the array in [start,end). - * @param start start of array containing the cell ids to keep. + * build a sub part of 'this'. This sub part is defined by the cell ids contained in the array in [begin,end). + * @param begin begin of array containing the cell ids to keep. * @param end end of array of cell ids to keep. \b WARNING end param is \b not included ! Idem STL standard definitions. * @param keepCoords that specifies if you want or not to keep coords as this or zip it (see zipCoords) */ -MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const +MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const { if(getMeshDimension()!=-1) { - MEDCouplingUMesh *ret=buildPartOfMySelfKeepCoords(start,end); + MEDCouplingUMesh *ret=buildPartOfMySelfKeepCoords(begin,end); if(!keepCoords) ret->zipCoords(); return ret; } else { - if(end-start!=1) + if(end-begin!=1) throw INTERP_KERNEL::Exception("-1D mesh has only one cell !"); - if(start[0]!=0) + if(begin[0]!=0) throw INTERP_KERNEL::Exception("-1D mesh has only one cell : 0 !"); incrRef(); return (MEDCouplingUMesh *)this; } } +DataArrayInt *MEDCouplingUMesh::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const +{ + std::vector cellIdsKept; + fillCellIdsToKeepFromNodeIds(partBg,partEnd,true,cellIdsKept); + DataArrayInt *ret=DataArrayInt::New(); + ret->alloc(cellIdsKept.size(),1); + std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer()); + return ret; +} + /*! - * Keeps from 'this' only cells which constituing point id are in the ids specified by ['start','end'). - * The return newly allocated mesh will share the same coordinates as 'this'. + * Keeps from 'this' only cells which constituing point id are in the ids specified by ['begin','end'). + * The resulting cell ids are stored at the end of the 'cellIdsKept' parameter. * Parameter 'fullyIn' specifies if a cell that has part of its nodes in ids array is kept or not. - * If 'fullyIn' is true only cells whose ids are \b fully contained in ['start','end') tab will be kept. + * If 'fullyIn' is true only cells whose ids are \b fully contained in ['begin','end') tab will be kept. + * + * @param begin input start of array of node ids. + * @param end input end of array of node ids. + * @param fullyIn input that specifies if all node ids must be in ['begin','end') array to consider cell to be in. + * @param cellIdsKept in/out array where all candidate cell ids are put at the end. */ -MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const +void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, std::vector& cellIdsKept) const { - std::set fastFinder(start,end); + std::set fastFinder(begin,end); + int nbOfCells=getNumberOfCells(); const int *conn=getNodalConnectivity()->getConstPointer(); const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - std::vector cellIdsKept; for(int i=0;i connOfCell(conn+connIndex[i]+1,conn+connIndex[i+1]); @@ -936,22 +957,34 @@ MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelfNode(const int *start, c if(((int)locMerge.size()==refLgth && fullyIn) || (locMerge.size()!=0 && !fullyIn)) cellIdsKept.push_back(i); } +} + +/*! + * Keeps from 'this' only cells which constituing point id are in the ids specified by ['begin','end'). + * The return newly allocated mesh will share the same coordinates as 'this'. + * Parameter 'fullyIn' specifies if a cell that has part of its nodes in ids array is kept or not. + * If 'fullyIn' is true only cells whose ids are \b fully contained in ['begin','end') tab will be kept. + */ +MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const +{ + std::vector cellIdsKept; + fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); return buildPartOfMySelf(&cellIdsKept[0],&cellIdsKept[0]+cellIdsKept.size(),true); } /*! - * Contrary to MEDCouplingUMesh::buildPartOfMySelfNode method this method a mesh with a meshDimension equal to + * Contrary to MEDCouplingUMesh::buildPartOfMySelfNode method this method builds a mesh with a meshDimension equal to * this->getMeshDimension()-1. The return newly allocated mesh will share the same coordinates as 'this'. * Parameter 'fullyIn' specifies if a face that has part of its nodes in ids array is kept or not. - * If 'fullyIn' is true only faces whose ids are \b fully contained in ['start','end') tab will be kept. + * If 'fullyIn' is true only faces whose ids are \b fully contained in ['begin','end') tab will be kept. */ -MEDCouplingPointSet *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const +MEDCouplingPointSet *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const { DataArrayInt *desc,*descIndx,*revDesc,*revDescIndx; desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); MEDCouplingUMesh *subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); desc->decrRef(); descIndx->decrRef(); revDesc->decrRef(); revDescIndx->decrRef(); - MEDCouplingUMesh *ret=(MEDCouplingUMesh *)subMesh->buildPartOfMySelfNode(start,end,fullyIn); + MEDCouplingUMesh *ret=(MEDCouplingUMesh *)subMesh->buildPartOfMySelfNode(begin,end,fullyIn); subMesh->decrRef(); return ret; } @@ -1506,10 +1539,10 @@ void MEDCouplingUMesh::unserialization(const std::vector& tinyInfo, const D /*! * This is the low algorithm of buildPartOfMySelf. - * Keeps from 'this' only cells which constituing point id are in the ids specified by ['start','end'). + * Keeps from 'this' only cells which constituing point id are in the ids specified by ['begin','end'). * The return newly allocated mesh will share the same coordinates as 'this'. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *start, const int *end) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const { checkFullyDefined(); MEDCouplingUMesh *ret=MEDCouplingUMesh::New(); @@ -1526,18 +1559,18 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *start ret->setName(getName()); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - int nbOfElemsRet=end-start; + int nbOfElemsRet=end-begin; int *connIndexRet=new int[nbOfElemsRet+1]; connIndexRet[0]=0; const int *conn=_nodal_connec->getConstPointer(); const int *connIndex=_nodal_connec_index->getConstPointer(); int newNbring=0; - for(const int *work=start;work!=end;work++,newNbring++) + for(const int *work=begin;work!=end;work++,newNbring++) connIndexRet[newNbring+1]=connIndexRet[newNbring]+connIndex[*work+1]-connIndex[*work]; int *connRet=new int[connIndexRet[nbOfElemsRet]]; int *connRetWork=connRet; std::set types; - for(const int *work=start;work!=end;work++) + for(const int *work=begin;work!=end;work++) { types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]); connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork); @@ -1674,15 +1707,15 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const } /*! - * This methods returns a vector newly created field on cells that represents the director vector of each 1D cell of this. + * This methods returns a vector newly created field on cells that represents the direction vector of each 1D cell of this. * This method is only callable on mesh with meshdim == 1 containing only SEG2. */ -MEDCouplingFieldDouble *MEDCouplingUMesh::buildLinearField() const +MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const { if(getMeshDimension()!=1) - throw INTERP_KERNEL::Exception("Expected a umesh with meshDim == 1 for buildLinearField !"); + throw INTERP_KERNEL::Exception("Expected a umesh with meshDim == 1 for buildDirectionVectorField !"); if(_types.size()!=1 || *(_types.begin())!=INTERP_KERNEL::NORM_SEG2) - throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildLinearField !"); + throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !"); MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); DataArrayDouble *array=DataArrayDouble::New(); int nbOfCells=getNumberOfCells(); @@ -1720,7 +1753,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps, throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for project1D !"); if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Expected a umesh with spaceDim==3 for project1D !"); - MEDCouplingFieldDouble *f=buildLinearField(); + MEDCouplingFieldDouble *f=buildDirectionVectorField(); const double *fPtr=f->getArray()->getConstPointer(); double tmp[3]; for(int i=0;i& cells) const { @@ -2241,10 +2276,10 @@ void MEDCouplingUMesh::orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Excepti * @param vec output of size at least 3 used to store the normal vector (with norm equal to Area ) of searched plane. * @param pos output of size at least 3 used to store a point owned of searched plane. */ -void MEDCouplingUMesh::getFastMiddlePlaneOfThis(double *vec, double *pos) const throw(INTERP_KERNEL::Exception) +void MEDCouplingUMesh::getFastAveragePlaneOfThis(double *vec, double *pos) const throw(INTERP_KERNEL::Exception) { if(getMeshDimension()!=2 || getSpaceDimension()!=3) - throw INTERP_KERNEL::Exception("Invalid mesh to apply getFastMiddlePlaneOfThis on it : must be meshDim==2 and spaceDim==3 !"); + throw INTERP_KERNEL::Exception("Invalid mesh to apply getFastAveragePlaneOfThis on it : must be meshDim==2 and spaceDim==3 !"); const int *conn=_nodal_connec->getConstPointer(); const int *connI=_nodal_connec_index->getConstPointer(); const double *coordsPtr=_coords->getConstPointer(); @@ -2252,6 +2287,222 @@ void MEDCouplingUMesh::getFastMiddlePlaneOfThis(double *vec, double *pos) const std::copy(coordsPtr+3*conn[1],coordsPtr+3*conn[1]+3,pos); } +/*! + * The returned newly created field has to be managed by the caller. + * This method returns a field on cell with no time lying on 'this'. The meshdimension and spacedimension of this are expected to be both in [2,3]. If not an exception will be thrown. + * This method for the moment only deals with NORM_TRI3, NORM_QUAD4 and NORM_TETRA4 geometric types. + * If a cell has an another type an exception will be thrown. + */ +MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + int spaceDim=getSpaceDimension(); + int meshDim=getMeshDimension(); + if(spaceDim!=2 && spaceDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : SpaceDimension must be equal to 2 or 3 !"); + if(meshDim!=2 && meshDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !"); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); + ret->setMesh(this); + int nbOfCells=getNumberOfCells(); + DataArrayDouble *arr=DataArrayDouble::New(); + arr->alloc(nbOfCells,1); + double *pt=arr->getPointer(); + ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. + arr->decrRef(); + const int *conn=_nodal_connec->getConstPointer(); + const int *connI=_nodal_connec_index->getConstPointer(); + const double *coo=_coords->getConstPointer(); + double tmp[12]; + for(int i=0;isetName("EdgeRatio"); + ret->incrRef(); + return ret; +} + +/*! + * The returned newly created field has to be managed by the caller. + * This method returns a field on cell with no time lying on 'this'. The meshdimension and spacedimension of this are expected to be both in [2,3]. If not an exception will be thrown. + * This method for the moment only deals with NORM_TRI3, NORM_QUAD4 and NORM_TETRA4 geometric types. + * If a cell has an another type an exception will be thrown. + */ +MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + int spaceDim=getSpaceDimension(); + int meshDim=getMeshDimension(); + if(spaceDim!=2 && spaceDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : SpaceDimension must be equal to 2 or 3 !"); + if(meshDim!=2 && meshDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !"); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); + ret->setMesh(this); + int nbOfCells=getNumberOfCells(); + DataArrayDouble *arr=DataArrayDouble::New(); + arr->alloc(nbOfCells,1); + double *pt=arr->getPointer(); + ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. + arr->decrRef(); + const int *conn=_nodal_connec->getConstPointer(); + const int *connI=_nodal_connec_index->getConstPointer(); + const double *coo=_coords->getConstPointer(); + double tmp[12]; + for(int i=0;isetName("AspectRatio"); + ret->incrRef(); + return ret; +} + +/*! + * The returned newly created field has to be managed by the caller. + * This method returns a field on cell with no time lying on 'this'. The meshdimension must be equal to 2 and the spacedimension must be equal to 3. If not an exception will be thrown. + * This method for the moment only deals with NORM_QUAD4 geometric type. + * If a cell has an another type an exception will be thrown. + */ +MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + int spaceDim=getSpaceDimension(); + int meshDim=getMeshDimension(); + if(spaceDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : SpaceDimension must be equal to 3 !"); + if(meshDim!=2) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !"); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); + ret->setMesh(this); + int nbOfCells=getNumberOfCells(); + DataArrayDouble *arr=DataArrayDouble::New(); + arr->alloc(nbOfCells,1); + double *pt=arr->getPointer(); + ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. + arr->decrRef(); + const int *conn=_nodal_connec->getConstPointer(); + const int *connI=_nodal_connec_index->getConstPointer(); + const double *coo=_coords->getConstPointer(); + double tmp[12]; + for(int i=0;isetName("Warp"); + ret->incrRef(); + return ret; +} + +/*! + * The returned newly created field has to be managed by the caller. + * This method returns a field on cell with no time lying on 'this'. The meshdimension must be equal to 2 and the spacedimension must be equal to 3. If not an exception will be thrown. + * This method for the moment only deals with NORM_QUAD4 geometric type. + * If a cell has an another type an exception will be thrown. + */ +MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const throw(INTERP_KERNEL::Exception) +{ + checkCoherency(); + int spaceDim=getSpaceDimension(); + int meshDim=getMeshDimension(); + if(spaceDim!=3) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : SpaceDimension must be equal to 3 !"); + if(meshDim!=2) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !"); + MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); + ret->setMesh(this); + int nbOfCells=getNumberOfCells(); + DataArrayDouble *arr=DataArrayDouble::New(); + arr->alloc(nbOfCells,1); + double *pt=arr->getPointer(); + ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. + arr->decrRef(); + const int *conn=_nodal_connec->getConstPointer(); + const int *connI=_nodal_connec_index->getConstPointer(); + const double *coo=_coords->getConstPointer(); + double tmp[12]; + for(int i=0;isetName("Skew"); + ret->incrRef(); + return ret; +} + /*! * This method aggregate the bbox of each cell and put it into bbox parameter. * @param bbox out parameter of size 2*spacedim*nbOfcells. @@ -2350,7 +2601,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No * The mesh after this call will pass the test of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder with the same inputs. * The returned array minimizes the permutations that is to say the order of cells inside same geometric type remains the same. */ -DataArrayInt *MEDCouplingUMesh::getRenumArrForConsctvCellTypesSpe(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const +DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const { checkFullyDefined(); int nbOfCells=getNumberOfCells(); @@ -2438,13 +2689,13 @@ std::vector MEDCouplingUMesh::splitByType() const for(const int *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; - int startCellId=std::distance(connI,i); + int beginCellId=std::distance(connI,i); i=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)curType)); int endCellId=std::distance(connI,i); - int sz=endCellId-startCellId; + int sz=endCellId-beginCellId; int *cells=new int[sz]; for(int j=0;j& conn) const; + MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; @@ -84,9 +85,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; MEDCOUPLING_EXPORT DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); MEDCOUPLING_EXPORT void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const; MEDCOUPLING_EXPORT void findBoundaryNodes(std::vector& nodes) const; MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const; MEDCOUPLING_EXPORT void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); @@ -96,7 +97,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildLinearField() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildDirectionVectorField() const; MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const; MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; @@ -111,11 +112,16 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void getFastMiddlePlaneOfThis(double *vec, double *pos) const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const throw(INTERP_KERNEL::Exception); + //Mesh quality + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception); //utilities for MED File RW MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const; MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsctvCellTypesSpe(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; + MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; MEDCOUPLING_EXPORT DataArrayInt *rearrange2ConsecutiveCellTypes(); MEDCOUPLING_EXPORT std::vector splitByType() const; MEDCOUPLING_EXPORT DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception); @@ -137,15 +143,17 @@ namespace ParaMEDMEM void reprConnectivityOfThisLL(std::ostringstream& stream) const; //tools void renumberNodesInConn(const int *newNodeNumbers); + void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, std::vector& cellIdsKept) const; MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const; DataArrayDouble *fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const; template void findCommonCellsBase(int compType, std::vector& res, std::vector& resI) const; bool areCellsEqualInPool(const std::vector& candidates, int compType, std::vector& result) const; - MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *start, const int *end) const; + MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; template void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, double eps, std::vector& elts, std::vector& eltsIndex) const; + static void fillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt) throw(INTERP_KERNEL::Exception); static void appendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector& ret); private: //! this iterator stores current position in _nodal_connec array. diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index 9bbdb8519..8382a9230 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -124,6 +124,7 @@ namespace ParaMEDMEM CPPUNIT_TEST( testSortPerTuple1 ); CPPUNIT_TEST( testIsEqualWithoutConsideringStr1 ); CPPUNIT_TEST( testGetNodeIdsOfCell1 ); + CPPUNIT_TEST( testGetEdgeRatioField1 ); //MEDCouplingBasicsTestInterp.cxx CPPUNIT_TEST( test2DInterpP0P0_1 ); CPPUNIT_TEST( test2DInterpP0P0PL_1 ); @@ -276,6 +277,7 @@ namespace ParaMEDMEM void testSortPerTuple1(); void testIsEqualWithoutConsideringStr1(); void testGetNodeIdsOfCell1(); + void testGetEdgeRatioField1(); //MEDCouplingBasicsTestInterp.cxx void test2DInterpP0P0_1(); void test2DInterpP0P0PL_1(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index fb96af12d..5c34f02c8 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -1163,7 +1163,7 @@ void MEDCouplingBasicsTest::testFindCommonNodes() CPPUNIT_ASSERT_EQUAL(1,commI->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(0,comm->getNumberOfTuples()); int newNbOfNodes; - DataArrayInt *o2n=targetMesh->buildNewNumberingFromCommNodesFrmt(comm,commI,newNbOfNodes); + DataArrayInt *o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes); CPPUNIT_ASSERT_EQUAL(27,o2n->getNumberOfTuples()); const int o2nExp1[27]= @@ -1186,7 +1186,7 @@ void MEDCouplingBasicsTest::testFindCommonNodes() const int commIExpected[3]={0,4,6}; CPPUNIT_ASSERT(std::equal(commExpected,commExpected+6,comm->getConstPointer())); CPPUNIT_ASSERT(std::equal(commIExpected,commIExpected+3,commI->getConstPointer())); - o2n=targetMesh->buildNewNumberingFromCommNodesFrmt(comm,commI,newNbOfNodes); + o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); CPPUNIT_ASSERT_EQUAL(31,o2n->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes); const int o2nExp2[31]= @@ -1921,13 +1921,13 @@ void MEDCouplingBasicsTest::testCheckConsecutiveCellTypes() CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypes()); CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order1,order1+2)); CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order2,order2+2)); - DataArrayInt *da=targetMesh->getRenumArrForConsctvCellTypesSpe(order1,order1+2); + DataArrayInt *da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order1,order1+2); CPPUNIT_ASSERT_EQUAL(5,da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents()); const int expected1[5]={2,0,1,3,4}; CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer())); da->decrRef(); - da=targetMesh->getRenumArrForConsctvCellTypesSpe(order2,order2+2); + da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order2,order2+2); CPPUNIT_ASSERT_EQUAL(5,da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents()); const int expected2[5]={0,3,4,1,2}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index acf8efe7d..f636313cf 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -386,11 +386,11 @@ void MEDCouplingBasicsTest::testNormL12Integ1D() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[0],f1->normL2(0),1e-9); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[1],f1->normL2(1),1e-9); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected7[2],f1->normL2(2),1e-9); - //buildWeightingField - MEDCouplingFieldDouble *f4=f1->buildWeightingField(false); + //buildMeasureField + MEDCouplingFieldDouble *f4=f1->buildMeasureField(false); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.2,f4->accumulate(0),1e-12); f4->decrRef(); - f4=f1->buildWeightingField(true); + f4=f1->buildMeasureField(true); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.62,f4->accumulate(0),1e-12); f4->decrRef(); // @@ -1977,3 +1977,28 @@ void MEDCouplingBasicsTest::testGetNodeIdsOfCell1() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.2,coords[1],1e-13); mesh1->decrRef(); } + +void MEDCouplingBasicsTest::testGetEdgeRatioField1() +{ + MEDCouplingUMesh *m1=build2DTargetMesh_1(); + MEDCouplingFieldDouble *f1=m1->getEdgeRatioField(); + CPPUNIT_ASSERT_EQUAL(m1->getNumberOfCells(),f1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); + const double expected1[5]={1.,1.4142135623730951, 1.4142135623730951,1.,1.}; + for(int i=0;i<5;i++) + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(i,0),1e-14); + f1->decrRef(); + m1->decrRef(); + // + m1=build3DSurfTargetMesh_1(); + f1=m1->getEdgeRatioField(); + CPPUNIT_ASSERT_EQUAL(m1->getNumberOfCells(),f1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); + const double expected2[5]={1.4142135623730951, 1.7320508075688772, 1.7320508075688772, 1.4142135623730951, 1.4142135623730951}; + for(int i=0;i<5;i++) + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f1->getIJ(i,0),1e-14); + f1->decrRef(); + m1->decrRef(); +} diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 103638a6a..53cd9f4df 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -771,7 +771,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): comm,commI=targetMesh.findCommonNodes(-1,1e-10); self.assertEqual(1,commI.getNumberOfTuples()); self.assertEqual(0,comm.getNumberOfTuples()); - o2n,newNbOfNodes=targetMesh.buildNewNumberingFromCommNodesFrmt(comm,commI); + o2n,newNbOfNodes=targetMesh.buildNewNumberingFromCommonNodesFormat(comm,commI); self.assertEqual(27,newNbOfNodes); self.assertEqual(27,o2n.getNumberOfTuples()); o2nExp1=range(27) @@ -786,7 +786,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): commIExpected=[0,4,6] self.assertEqual(commExpected,list(comm.getValues())); self.assertEqual(commIExpected,list(commI.getValues())); - o2n,newNbOfNodes=targetMesh.buildNewNumberingFromCommNodesFrmt(comm,commI); + o2n,newNbOfNodes=targetMesh.buildNewNumberingFromCommonNodesFormat(comm,commI); self.assertEqual(31,o2n.getNumberOfTuples()); self.assertEqual(27,newNbOfNodes); o2nExp2=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, @@ -1364,12 +1364,12 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(not targetMesh.checkConsecutiveCellTypes()); self.assertTrue(not targetMesh.checkConsecutiveCellTypesAndOrder(order1)); self.assertTrue(not targetMesh.checkConsecutiveCellTypesAndOrder(order2)); - da=targetMesh.getRenumArrForConsctvCellTypesSpe(order1); + da=targetMesh.getRenumArrForConsecutiveCellTypesSpec(order1); self.assertEqual(5,da.getNumberOfTuples()); self.assertEqual(1,da.getNumberOfComponents()); expected1=[2,0,1,3,4] self.assertTrue(expected1==list(da.getValues())); - da=targetMesh.getRenumArrForConsctvCellTypesSpe(order2); + da=targetMesh.getRenumArrForConsecutiveCellTypesSpec(order2); self.assertEqual(5,da.getNumberOfTuples()); self.assertEqual(1,da.getNumberOfComponents()); expected2=[0,3,4,1,2] @@ -2027,10 +2027,10 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(abs(expected7[0]-f1.normL2(0))<1e-9); self.assertTrue(abs(expected7[1]-f1.normL2(1))<1e-9); self.assertTrue(abs(expected7[2]-f1.normL2(2))<1e-9); - #buildWeightingField - f4=f1.buildWeightingField(False); + #buildMeasureField + f4=f1.buildMeasureField(False); self.assertTrue(abs(-0.2-f4.accumulate(0))<1e-12); - f4=f1.buildWeightingField(True); + f4=f1.buildMeasureField(True); self.assertTrue(abs(1.62-f4.accumulate(0))<1e-12); # Testing with 2D Curve m1=MEDCouplingDataForTest.build2DCurveTargetMesh_3(); @@ -3377,6 +3377,28 @@ class MEDCouplingBasicsTest(unittest.TestCase): li2=mesh1.getNodalConnectivityIndex().getValuesAsTuple() self.assertEqual(6,len(li2)) pass + + def testGetEdgeRatioField1(self): + m1=MEDCouplingDataForTest.build2DTargetMesh_1(); + f1=m1.getEdgeRatioField(); + self.assertEqual(m1.getNumberOfCells(),f1.getNumberOfTuples()); + self.assertEqual(5,f1.getNumberOfTuples()); + self.assertEqual(1,f1.getNumberOfComponents()); + expected1=[1.,1.4142135623730951, 1.4142135623730951,1.,1.] + for i in xrange(5): + self.assertAlmostEqual(expected1[i],f1.getIJ(i,0),14); + pass + # + m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); + f1=m1.getEdgeRatioField(); + self.assertEqual(m1.getNumberOfCells(),f1.getNumberOfTuples()); + self.assertEqual(5,f1.getNumberOfTuples()); + self.assertEqual(1,f1.getNumberOfComponents()); + expected2=[1.4142135623730951, 1.7320508075688772, 1.7320508075688772, 1.4142135623730951, 1.4142135623730951] + for i in xrange(5): + self.assertAlmostEqual(expected2[i],f1.getIJ(i,0),14); + pass + pass def setUp(self): pass diff --git a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i index bd343a1d1..48a7115d9 100644 --- a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i +++ b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i @@ -64,7 +64,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr; %newobject ParaMEDMEM::DataArrayInt::convertToDblArr; %newobject ParaMEDMEM::MEDCouplingUMesh::New; -%newobject ParaMEDMEM::MEDCouplingField::buildWeightingField; +%newobject ParaMEDMEM::MEDCouplingField::buildMeasureField; %newobject ParaMEDMEM::MEDCouplingFieldDouble::New; %newobject ParaMEDMEM::MEDCouplingFieldDouble::mergeFields; %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct; @@ -139,7 +139,12 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt; %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes; %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType; -%newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsctvCellTypesSpe; +%newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec; +%newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField; +%newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField; +%newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField; +%newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField; +%newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; %newobject ParaMEDMEM::MEDCouplingCMesh::New; @@ -270,6 +275,14 @@ namespace ParaMEDMEM self->getCoordinatesOfNode(nodeId,coo); return convertDblArrToPyList2(coo); } + + void scale(PyObject *point, double factor) + { + int sz; + double *p=convertPyToNewDblArr2(point,&sz); + self->scale(p,factor); + delete [] p; + } } }; } @@ -293,7 +306,6 @@ namespace ParaMEDMEM void zipCoords(); double getCaracteristicDimension() const; void translate(const double *vector); - 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); virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception) = 0; @@ -321,10 +333,10 @@ namespace ParaMEDMEM return self->simpleRepr(); } - PyObject *buildNewNumberingFromCommNodesFrmt(const DataArrayInt *comm, const DataArrayInt *commIndex) const + PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const { int newNbOfNodes; - DataArrayInt *ret0=self->buildNewNumberingFromCommNodesFrmt(comm,commIndex,newNbOfNodes); + DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes); PyObject *res = PyList_New(2); PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes)); @@ -397,13 +409,6 @@ namespace ParaMEDMEM self->translate(v); delete [] v; } - void scale(PyObject *point, double factor) - { - int sz; - double *p=convertPyToNewDblArr2(point,&sz); - self->scale(p,factor); - delete [] p; - } void renumberNodes(PyObject *li, int newNbOfNodes) { int size; @@ -476,7 +481,12 @@ namespace ParaMEDMEM MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception); bool isPresenceOfQuadratic() const; + MEDCouplingFieldDouble *buildDirectionVectorField() const; void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const { @@ -552,11 +562,11 @@ namespace ParaMEDMEM return ret; } - DataArrayInt *getRenumArrForConsctvCellTypesSpe(PyObject *li) const + DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const { int sz; INTERP_KERNEL::NormalizedCellType *order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); - DataArrayInt *ret=self->getRenumArrForConsctvCellTypesSpe(order,order+sz); + DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,order+sz); delete [] order; return ret; } @@ -666,6 +676,17 @@ namespace ParaMEDMEM self->arePolyhedronsNotCorrectlyOriented(cells); return convertIntArrToPyList2(cells); } + + PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception) + { + double vec[3]; + double pos[3]; + self->getFastAveragePlaneOfThis(vec,pos); + double vals[6]; + std::copy(vec,vec+3,vals); + std::copy(pos,pos+3,vals+3); + return convertDblArrToPyListOfTuple(vals,3,2); + } } void convertToPolyTypes(const std::vector& cellIdsToConvert); MEDCouplingUMesh *buildExtrudedMeshFromThis(const MEDCouplingUMesh *mesh1D, int policy); @@ -809,7 +830,7 @@ namespace ParaMEDMEM void setDescription(const char *desc); const char *getName() const; TypeOfField getTypeOfField() const; - MEDCouplingFieldDouble *buildWeightingField(bool isAbs) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDiscretization *getDiscretization() const; void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) throw(INTERP_KERNEL::Exception);