-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2017 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// Author : Anthony Geay (EDF R&D)
-%module MEDCoupling
-
#ifdef WITH_DOCSTRINGS
%include MEDCoupling_doc.i
#endif
%newobject MEDCoupling::MEDCouplingUMesh::conformize2D;
%newobject MEDCoupling::MEDCouplingUMesh::conformize3D;
%newobject MEDCoupling::MEDCouplingUMesh::colinearize2D;
+%newobject MEDCoupling::MEDCouplingUMesh::colinearizeKeepingConform2D;
%newobject MEDCoupling::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
%newobject MEDCoupling::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
%newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
%newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
%newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
%newobject MEDCoupling::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
+%newobject MEDCoupling::MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes;
%newobject MEDCoupling::MEDCouplingUMeshCellByTypeEntry::__iter__;
%newobject MEDCoupling::MEDCouplingUMeshCellEntry::__iter__;
%newobject MEDCoupling::MEDCoupling1GTUMesh::New;
return ret;
}
- PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
+ PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
{
- MCAuto<DataArrayInt> elts,eltsIndex;
+ double val;
+ DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
+ int sw;
int spaceDim=self->getSpaceDimension();
- void *da=0;
- int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
- int nbOfPoints=size/spaceDim;
- if(size%spaceDim!=0)
- {
- throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
- }
- self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
- }
- else
- {
- DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
- da2->checkAllocated();
- int size=da2->getNumberOfTuples();
- int nbOfCompo=da2->getNumberOfComponents();
- if(nbOfCompo!=spaceDim)
- {
- throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
- }
- self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
- }
+ const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : ";
+ const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
+ MCAuto<DataArrayInt> elts,eltsIndex;
+ self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
+ PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPoints(a,b,c,d,e); };
+ return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
+ }
+
+ PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto<DataArrayInt>& d, MCAuto<DataArrayInt>& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); };
+ return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc);
+ }
+
PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
{
double val;
return self->checkTypeConsistencyAndContig(code,idsPerType);
}
- PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
+ PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const throw(INTERP_KERNEL::Exception)
{
std::vector<int> code;
std::vector<DataArrayInt *> idsInPflPerType;
std::vector<DataArrayInt *> idsPerType;
- self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
+ self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
PyObject *ret=PyTuple_New(3);
//
if(code.size()%3!=0)
void deletePack(const int i, const int j) throw(INTERP_KERNEL::Exception);
+ void deleteSimplePack(const int i) throw(INTERP_KERNEL::Exception);
+ void deleteSimplePacks(const DataArrayInt* idx) throw(INTERP_KERNEL::Exception);
+
%extend
{
MEDCouplingSkyLineArray() throw(INTERP_KERNEL::Exception)
self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size());
}
+ void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const DataArrayInt*> packs;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt*>(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs);
+ self->replaceSimplePacks(idx, packs);
+ }
+
void replacePack(const int superIdx, const int idx, PyObject *pack) throw(INTERP_KERNEL::Exception)
{
std::vector<int> vpack;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
- const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point.";
+ const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector.";
const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
std::vector<int> nodes;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
- const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point.";
+ const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector.";
const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
std::vector<int> nodes;
virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
{
- DataArrayInt *v0=0,*v1=0;
+ DataArrayInt *v0(nullptr),*v1(nullptr);
self->findCommonCells(compType,startCellId,v0,v1);
PyObject *res = PyList_New(2);
PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
{
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
+ void *da(nullptr);
+ {
+ int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
+ if(SWIG_IsOK(res1))
+ {
+ MapII *da2(reinterpret_cast<MapII *>(da));
+ self->renumberNodesInConn(da2->data());
+ return ;
+ }
+ }
+ int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
if (!SWIG_IsOK(res1))
{
int size;
}
else
{
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da));
if(!da2)
throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
da2->checkAllocated();
virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
{
- DataArrayInt *ret=0;
+ DataArrayInt *ret(nullptr);
//
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
DataArrayInt *conformize3D(double eps) throw(INTERP_KERNEL::Exception);
DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
+ DataArrayInt *colinearizeKeepingConform2D(double eps) throw(INTERP_KERNEL::Exception);
void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
+ DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes() throw(INTERP_KERNEL::Exception);
bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
}
}
+ void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr));
+ self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr);
+ }
+
PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
{
int sz;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
//
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
//
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,3,true);
MCAuto<MEDCouplingUMesh> ret(self->clipSingle3DCellByPlane(orig,vect,eps));
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
int sw;
- const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin.";
+ const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
return self->getCellIdsCrossingPlane(orig,vect,eps);
~MEDCouplingFieldT();
};
- %template(DTC3) MEDCoupling::MEDCouplingFieldT<double>;
+ %template(MEDCouplingFieldTdouble) MEDCoupling::MEDCouplingFieldT<double>;
%template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
%template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
double getMinValue() const throw(INTERP_KERNEL::Exception);
double getAverageValue() const throw(INTERP_KERNEL::Exception);
double norm2() const throw(INTERP_KERNEL::Exception);
- double normMax() const throw(INTERP_KERNEL::Exception);
//do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
double normL1(int compId) const throw(INTERP_KERNEL::Exception);
double normL2(int compId) const throw(INTERP_KERNEL::Exception);
+ double normMax(int compId) const throw(INTERP_KERNEL::Exception);
DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
self->normL2(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
+ PyObject *normMax() const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->normMax(tmp);
+ return convertDblArrToPyList<double>(tmp,sz);
+ }
void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
{
int szArr,sw,iTypppArr;
std::vector<double> bb,bb2;
int sw;
int spaceDim=3;
- const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
- const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
+ const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin.";
+ const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector.";
const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
//