From: ageay Date: Mon, 6 Dec 2010 16:55:47 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: MEDPartitioner_first_compilable_version~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba8cd4e0f77590e0492a2bd0733cb325af861936;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx b/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx new file mode 100644 index 000000000..5851a249f --- /dev/null +++ b/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2007-2010 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __INTERPKERNELAUTOPTR_HXX__ +#define __INTERPKERNELAUTOPTR_HXX__ + +namespace INTERP_KERNEL +{ + template + class AutoPtr + { + public: + AutoPtr(T *ptr=0):_ptr(ptr) { } + ~AutoPtr() { destroyPtr(); } + AutoPtr &operator=(T *ptr) { destroyPtr(); _ptr=ptr; return *this; } + T *operator->() { return _ptr ; } + const T *operator->() const { return _ptr; } + T& operator*() { return *_ptr; } + const T& operator*() const { return *_ptr; } + operator T *() { return _ptr; } + operator const T *() const { return _ptr; } + private: + void destroyPtr() { delete [] _ptr; } + private: + T *_ptr; + }; +} + +#endif diff --git a/src/INTERP_KERNEL/Bases/Makefile.am b/src/INTERP_KERNEL/Bases/Makefile.am index fc89569bc..4b74948f3 100755 --- a/src/INTERP_KERNEL/Bases/Makefile.am +++ b/src/INTERP_KERNEL/Bases/Makefile.am @@ -32,7 +32,8 @@ NormalizedUnstructuredMesh.hxx \ InterpKernelStlExt.hxx \ InterpKernelHashMap.hxx \ InterpKernelHashTable.hxx \ -InterpKernelHashFun.hxx +InterpKernelHashFun.hxx \ +InterpKernelAutoPtr.hxx # Libraries targets diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index 4982c2e7a..e522b1462 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -160,6 +160,10 @@ namespace ParaMEDMEM CPPUNIT_TEST( testExtrudedMesh7 ); CPPUNIT_TEST( testSimplexize1 ); CPPUNIT_TEST( testSimplexize2 ); + CPPUNIT_TEST( testDAMeld1 ); + CPPUNIT_TEST( testFieldMeld1 ); + CPPUNIT_TEST( testMergeNodes2 ); + CPPUNIT_TEST( testMergeField2 ); //MEDCouplingBasicsTestInterp.cxx CPPUNIT_TEST( test2DInterpP0P0_1 ); CPPUNIT_TEST( test2DInterpP0P0PL_1 ); @@ -348,6 +352,10 @@ namespace ParaMEDMEM void testExtrudedMesh7(); void testSimplexize1(); void testSimplexize2(); + void testDAMeld1(); + void testFieldMeld1(); + void testMergeNodes2(); + void testMergeField2(); //MEDCouplingBasicsTestInterp.cxx void test2DInterpP0P0_1(); void test2DInterpP0P0PL_1(); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 25119adda..fff780c0c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -5165,6 +5165,179 @@ class MEDCouplingBasicsTest(unittest.TestCase): pass # pass + + def testDAMeld1(self): + da1=DataArrayDouble.New(); + da1.alloc(7,2); + da2=DataArrayDouble.New(); + da2.alloc(7,1); + # + da1.fillWithValue(7.); + da2.iota(0.); + da3=da2.applyFunc(3,"10*x*IVec+100*x*JVec+1000*x*KVec"); + # + da1.setInfoOnComponent(0,"c0da1"); + da1.setInfoOnComponent(1,"c1da1"); + da3.setInfoOnComponent(0,"c0da3"); + da3.setInfoOnComponent(1,"c1da3"); + da3.setInfoOnComponent(2,"c2da3"); + # + da1C=da1.deepCpy(); + da1.meldWith(da3); + self.assertEqual(5,da1.getNumberOfComponents()); + self.assertEqual(7,da1.getNumberOfTuples()); + self.assertTrue(da1.getInfoOnComponent(0)=="c0da1"); + self.assertTrue(da1.getInfoOnComponent(1)=="c1da1"); + self.assertTrue(da1.getInfoOnComponent(2)=="c0da3"); + self.assertTrue(da1.getInfoOnComponent(3)=="c1da3"); + self.assertTrue(da1.getInfoOnComponent(4)=="c2da3"); + # + expected1=[7.,7.,0.,0.,0., 7.,7.,10.,100.,1000., 7.,7.,20.,200.,2000., 7.,7.,30.,300.,3000., 7.,7.,40.,400.,4000.,7.,7.,50.,500.,5000.,7.,7.,60.,600.,6000.] + for i in xrange(35): + self.assertAlmostEqual(expected1[i],da1.getIJ(0,i),10); + pass + # + dai1=da1C.convertToIntArr(); + dai3=da3.convertToIntArr(); + dai1.meldWith(dai3); + self.assertEqual(5,dai1.getNumberOfComponents()); + self.assertEqual(7,dai1.getNumberOfTuples()); + self.assertTrue(dai1.getInfoOnComponent(0)=="c0da1"); + self.assertTrue(dai1.getInfoOnComponent(1)=="c1da1"); + self.assertTrue(dai1.getInfoOnComponent(2)=="c0da3"); + self.assertTrue(dai1.getInfoOnComponent(3)=="c1da3"); + self.assertTrue(dai1.getInfoOnComponent(4)=="c2da3"); + for i in xrange(35): + self.assertEqual(int(expected1[i]),dai1.getIJ(0,i)); + pass + # test of static method DataArrayDouble::meld + da4=DataArrayDouble.meld(da1C,da3); + tmp=DataArrayDouble.meld([da1C,da3]); + self.assertTrue(da4.isEqual(tmp,1e-10)) + self.assertEqual(5,da4.getNumberOfComponents()); + self.assertEqual(7,da4.getNumberOfTuples()); + self.assertTrue(da4.getInfoOnComponent(0)=="c0da1"); + self.assertTrue(da4.getInfoOnComponent(1)=="c1da1"); + self.assertTrue(da4.getInfoOnComponent(2)=="c0da3"); + self.assertTrue(da4.getInfoOnComponent(3)=="c1da3"); + self.assertTrue(da4.getInfoOnComponent(4)=="c2da3"); + for i in xrange(35): + self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),10); + pass + # test of static method DataArrayInt::meld + dai1=da1C.convertToIntArr(); + dai4=DataArrayInt.meld(dai1,dai3); + tmp=DataArrayInt.meld([dai1,dai3]); + self.assertTrue(dai4.isEqual(tmp)) + self.assertEqual(5,dai4.getNumberOfComponents()); + self.assertEqual(7,dai4.getNumberOfTuples()); + self.assertTrue(dai4.getInfoOnComponent(0)=="c0da1"); + self.assertTrue(dai4.getInfoOnComponent(1)=="c1da1"); + self.assertTrue(dai4.getInfoOnComponent(2)=="c0da3"); + self.assertTrue(dai4.getInfoOnComponent(3)=="c1da3"); + self.assertTrue(dai4.getInfoOnComponent(4)=="c2da3"); + for i in xrange(35): + self.assertEqual(int(expected1[i]),dai4.getIJ(0,i)); + pass + pass + + def testFieldMeld1(self): + m=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); + f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); + f1.setMesh(m); + da1=DataArrayDouble.New(); + arr1=[12.,23.,34.,45.,56.] + da1.setValues(arr1,5,1); + da1.setInfoOnComponent(0,"aaa"); + f1.setArray(da1); + f1.setTime(3.4,2,1); + f1.checkCoherency(); + # + f2=f1.deepCpy(); + f2.setMesh(f1.getMesh()); + f2.checkCoherency(); + f2.changeNbOfComponents(2,5.); + f2.assign(5.); + f2.getArray().setInfoOnComponent(0,"bbb"); + f2.getArray().setInfoOnComponent(1,"ccc"); + f2.checkCoherency(); + # + f3=MEDCouplingFieldDouble.meldFields(f2,f1); + f3.checkCoherency(); + self.assertEqual(5,f3.getNumberOfTuples()); + self.assertEqual(3,f3.getNumberOfComponents()); + self.assertTrue(f3.getArray().getInfoOnComponent(0)=="bbb"); + self.assertTrue(f3.getArray().getInfoOnComponent(1)=="ccc"); + self.assertTrue(f3.getArray().getInfoOnComponent(2)=="aaa"); + expected1=[5.,5.,12.,5.,5.,23.,5.,5.,34.,5.,5.,45.,5.,5.,56.] + for i in xrange(15): + self.assertAlmostEqual(expected1[i],f3.getIJ(0,i),12); + pass + time,dt,it=f3.getTime(); + self.assertAlmostEqual(3.4,time,14); + self.assertEqual(2,dt); + self.assertEqual(1,it); + # + f4=f2.buildNewTimeReprFromThis(NO_TIME,False); + f5=f1.buildNewTimeReprFromThis(NO_TIME,False); + f6=MEDCouplingFieldDouble.meldFields(f4,f5); + f6.checkCoherency(); + self.assertEqual(5,f6.getNumberOfTuples()); + self.assertEqual(3,f6.getNumberOfComponents()); + self.assertTrue(f6.getArray().getInfoOnComponent(0)=="bbb"); + self.assertTrue(f6.getArray().getInfoOnComponent(1)=="ccc"); + self.assertTrue(f6.getArray().getInfoOnComponent(2)=="aaa"); + for i in xrange(15): + self.assertAlmostEqual(expected1[i],f6.getIJ(0,i),12); + pass + # + pass + + def testMergeNodes2(self): + m1=MEDCouplingDataForTest.build2DTargetMesh_1(); + m2=MEDCouplingDataForTest.build2DTargetMesh_1(); + vec=[0.002,0.] + m2.translate(vec); + # + m3=MEDCouplingUMesh.mergeUMeshes([m1,m2]); + da,b,newNbOfNodes=m3.mergeNodes2(0.01); + self.assertEqual(9,m3.getNumberOfNodes()); + expected1=[-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7] + for i in xrange(18): + self.assertAlmostEqual(expected1[i],m3.getCoords().getIJ(0,i),13); + pass + # + pass + + def testMergeField2(self): + m=MEDCouplingDataForTest.build2DTargetMesh_1(); + f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); + f1.setMesh(m); + arr=DataArrayDouble.New(); + arr.alloc(5,2); + arr.fillWithValue(2.); + f1.setArray(arr); + f2=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); + f2.setMesh(m); + arr=DataArrayDouble.New(); + arr.alloc(5,2); + arr.fillWithValue(5.); + f2.setArray(arr); + f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); + f3.setMesh(m); + arr=DataArrayDouble.New(); + arr.alloc(5,2); + arr.fillWithValue(7.); + f3.setArray(arr); + # + f4=MEDCouplingFieldDouble.mergeFields([f1,f2,f3]); + self.assertEqual(15,f4.getMesh().getNumberOfCells()); + expected1=[2.,2.,2.,2.,2.,2.,2.,2.,2.,2., 5.,5.,5.,5.,5.,5.,5.,5.,5.,5., 7.,7.,7.,7.,7.,7.,7.,7.,7.,7.] + for i in xrange(30): + self.assertAlmostEqual(expected1[i],f4.getIJ(0,i),13); + pass + # + pass def setUp(self): pass diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index d1af65ba8..3236a3d15 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -250,7 +250,7 @@ void convertPyObjToVecUMeshes(PyObject *ms, std::vector& v) +{ + if(PyList_Check(ms)) + { + int size=PyList_Size(ms); + v.resize(size); + for(int i=0;i(argp); + v[i]=arg; + } + } + else + { + PyErr_SetString(PyExc_TypeError,"convertPyObjToVecUMeshesCst : not a list"); + PyErr_Print(); + } +} + +void convertPyObjToVecDataArrayDblCst(PyObject *ms, std::vector& v) +{ + if(PyList_Check(ms)) + { + int size=PyList_Size(ms); + v.resize(size); + for(int i=0;i(argp); + v[i]=arg; + } + } + else + { + PyErr_SetString(PyExc_TypeError,"convertPyObjToVecDataArrayDblCst : not a list"); + PyErr_Print(); + } +} + +void convertPyObjToVecFieldDblCst(PyObject *ms, std::vector& v) +{ + if(PyList_Check(ms)) + { + int size=PyList_Size(ms); + v.resize(size); + for(int i=0;i(argp); + v[i]=arg; + } + } + else + { + PyErr_SetString(PyExc_TypeError,"convertPyObjToVecFieldDblCst : not a list"); + PyErr_Print(); + } +} + void convertPyObjToVecDataArrayInt(PyObject *ms, std::vector& v) { if(PyList_Check(ms)) @@ -292,3 +376,31 @@ void convertPyObjToVecDataArrayInt(PyObject *ms, std::vector& v) +{ + if(PyList_Check(ms)) + { + int size=PyList_Size(ms); + v.resize(size); + for(int i=0;i(argp); + v[i]=arg; + } + } + else + { + PyErr_SetString(PyExc_TypeError,"convertPyObjToVecDataArrayInt : not a list"); + PyErr_Print(); + } +} diff --git a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i index 65112f642..dc31f1d85 100644 --- a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i +++ b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i @@ -62,6 +62,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField; %newobject ParaMEDMEM::MEDCouplingFieldDouble::New; %newobject ParaMEDMEM::MEDCouplingFieldDouble::mergeFields; +%newobject ParaMEDMEM::MEDCouplingFieldDouble::meldFields; %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct; %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant; %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues; @@ -88,10 +89,12 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingFieldDouble::operator/; %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone; %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh; +%newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy; %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis; %newobject ParaMEDMEM::DataArrayInt::New; %newobject ParaMEDMEM::DataArrayInt::convertToDblArr; %newobject ParaMEDMEM::DataArrayInt::deepCopy; +%newobject ParaMEDMEM::DataArrayInt::deepCpy; %newobject ParaMEDMEM::DataArrayInt::performCpy; %newobject ParaMEDMEM::DataArrayInt::substr; %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents; @@ -105,13 +108,16 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::DataArrayInt::getIdsEqual; %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList; %newobject ParaMEDMEM::DataArrayInt::aggregate; +%newobject ParaMEDMEM::DataArrayInt::meld; %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace; %newobject ParaMEDMEM::DataArrayInt::toNoInterlace; %newobject ParaMEDMEM::DataArrayDouble::New; %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr; %newobject ParaMEDMEM::DataArrayDouble::deepCopy; +%newobject ParaMEDMEM::DataArrayDouble::deepCpy; %newobject ParaMEDMEM::DataArrayDouble::performCpy; %newobject ParaMEDMEM::DataArrayDouble::aggregate; +%newobject ParaMEDMEM::DataArrayDouble::meld; %newobject ParaMEDMEM::DataArrayDouble::dot; %newobject ParaMEDMEM::DataArrayDouble::crossProduct; %newobject ParaMEDMEM::DataArrayDouble::add; @@ -149,8 +155,11 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic; %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField; %newobject ParaMEDMEM::MEDCouplingMesh::simplexize; +%newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured; %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer; %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh; +%newobject ParaMEDMEM::MEDCouplingPointSet::mergeNodesArray; +%newobject ParaMEDMEM::MEDCouplingPointSet::buildInstanceFromMeshType; %newobject ParaMEDMEM::MEDCouplingUMesh::New; %newobject ParaMEDMEM::MEDCouplingUMesh::clone; %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer; @@ -169,7 +178,6 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New; %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; %newobject ParaMEDMEM::MEDCouplingCMesh::New; -%newobject ParaMEDMEM::MEDCouplingCMesh::buildUnstructured; %feature("unref") DataArrayDouble "$this->decrRef();" %feature("unref") MEDCouplingPointSet "$this->decrRef();" %feature("unref") MEDCouplingMesh "$this->decrRef();" @@ -218,6 +226,7 @@ namespace ParaMEDMEM class DataArrayInt; class DataArrayDouble; + class MEDCouplingUMesh; class MEDCouplingFieldDouble; class MEDCouplingMesh : public RefCountObject, public TimeLabel @@ -246,6 +255,7 @@ namespace ParaMEDMEM virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0; virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0; + virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception) = 0; virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception); @@ -391,7 +401,7 @@ namespace ParaMEDMEM 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; - static DataArrayDouble *mergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); + static DataArrayDouble *mergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception); static MEDCouplingPointSet *buildInstanceFromMeshType(MEDCouplingMeshType type); virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0; virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; @@ -473,6 +483,13 @@ namespace ParaMEDMEM self->renumberNodes(tmp,newNbOfNodes); delete [] tmp; } + void renumberNodes2(PyObject *li, int newNbOfNodes) + { + int size; + int *tmp=convertPyToNewIntArr2(li,&size); + self->renumberNodes2(tmp,newNbOfNodes); + delete [] tmp; + } PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception) { std::vector nodes; @@ -606,6 +623,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception); + static MEDCouplingUMesh *mergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const { @@ -638,6 +656,17 @@ namespace ParaMEDMEM PyList_SetItem(res,2,SWIG_From_int(ret2)); return res; } + PyObject *mergeNodes2(double precision) + { + bool ret1; + int ret2; + DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_From_bool(ret1)); + PyList_SetItem(res,2,SWIG_From_int(ret2)); + return res; + } PyObject *checkButterflyCells() { std::vector cells; @@ -797,11 +826,17 @@ namespace ParaMEDMEM std::copy(pos,pos+3,vals+3); return convertDblArrToPyListOfTuple(vals,3,2); } + + static MEDCouplingUMesh *mergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyObjToVecUMeshesCst(li,tmp); + return MEDCouplingUMesh::mergeUMeshes(tmp); + } } void convertToPolyTypes(const std::vector& cellIdsToConvert); void unPolyze(); MEDCouplingUMesh *buildExtrudedMeshFromThis(const MEDCouplingUMesh *mesh1D, int policy); - static MEDCouplingUMesh *mergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception); }; class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh @@ -843,7 +878,6 @@ namespace ParaMEDMEM DataArrayDouble *coordsY=0, DataArrayDouble *coordsZ=0); void setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception); - MEDCouplingUMesh *buildUnstructured() const; %extend { std::string __str__() const { @@ -1046,6 +1080,20 @@ namespace ParaMEDMEM convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(a,tmp); } + + static DataArrayDouble *aggregate(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyObjToVecDataArrayDblCst(li,tmp); + return DataArrayDouble::aggregate(tmp); + } + + static DataArrayDouble *meld(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyObjToVecDataArrayDblCst(li,tmp); + return DataArrayDouble::meld(tmp); + } }; %extend ParaMEDMEM::DataArrayInt @@ -1182,6 +1230,13 @@ namespace ParaMEDMEM convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(a,tmp); } + + static DataArrayInt *meld(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyObjToVecDataArrayIntCst(li,tmp); + return DataArrayInt::meld(tmp); + } }; namespace ParaMEDMEM @@ -1263,6 +1318,7 @@ namespace ParaMEDMEM std::string advancedRepr() const; MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; + MEDCouplingFieldDouble *deepCpy() const; MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const; TypeOfTimeDiscretization getTimeDiscretization() const; void checkCoherency() const throw(INTERP_KERNEL::Exception); @@ -1287,6 +1343,7 @@ namespace ParaMEDMEM void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception); void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception); bool mergeNodes(double eps) throw(INTERP_KERNEL::Exception); + bool mergeNodes2(double eps) throw(INTERP_KERNEL::Exception); bool zipCoords() throw(INTERP_KERNEL::Exception); bool zipConnectivity(int compType) throw(INTERP_KERNEL::Exception); bool simplexize(int policy) throw(INTERP_KERNEL::Exception); @@ -1319,14 +1376,15 @@ namespace ParaMEDMEM DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildSubPart(const DataArrayInt *part) const throw(INTERP_KERNEL::Exception); static MEDCouplingFieldDouble *mergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); - static MEDCouplingFieldDouble *dotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); - MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const; - static MEDCouplingFieldDouble *crossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); - MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const; - static MEDCouplingFieldDouble *maxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); - MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const; - static MEDCouplingFieldDouble *minFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); - MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const; + static MEDCouplingFieldDouble *meldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); + static MEDCouplingFieldDouble *dotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); + static MEDCouplingFieldDouble *crossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); + static MEDCouplingFieldDouble *maxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); + static MEDCouplingFieldDouble *minFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception); @@ -1546,6 +1604,13 @@ namespace ParaMEDMEM convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(f,tmp); } + + static MEDCouplingFieldDouble *mergeFields(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyObjToVecFieldDblCst(li,tmp); + return MEDCouplingFieldDouble::mergeFields(tmp); + } } }; }