From 12d96ed810aad5afc3acbab04ecf15d3f1a416e8 Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 7 Aug 2013 12:21:39 +0000 Subject: [PATCH] Addition of the 2 new unstructured mesh types. --- idl/MEDCouplingCorbaServantTest.idl | 2 + .../MEDCouplingMeshFieldFactoryComponent.cxx | 42 +++++++++++++++++++ .../MEDCouplingMeshFieldFactoryComponent.hxx | 4 ++ ...DCouplingMeshFieldFactoryComponentServ.cxx | 21 ++++++++++ ...DCouplingMeshFieldFactoryComponentServ.hxx | 2 + .../MEDCouplingCorbaSwigTest.py | 31 ++++++++++++++ .../MEDCouplingCorbaSwigTestServ.py | 8 ++++ 7 files changed, 110 insertions(+) diff --git a/idl/MEDCouplingCorbaServantTest.idl b/idl/MEDCouplingCorbaServantTest.idl index 8671498bf..811086f39 100644 --- a/idl/MEDCouplingCorbaServantTest.idl +++ b/idl/MEDCouplingCorbaServantTest.idl @@ -38,6 +38,8 @@ module SALOME_TEST SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface getExtrudedMesh(); SALOME_MED::MEDCouplingCMeshCorbaInterface getCMesh(); SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface getCLMesh(); + SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface get1SGTUMesh(); + SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface get1DGTUMesh(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldScalarOn2DNT(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldNodeScalarOn2DNT(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface getFieldScalarOn3DNT(); diff --git a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx index b0f424693..2bcae61af 100644 --- a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx +++ b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx @@ -25,6 +25,7 @@ #include "MEDCouplingMultiFields.hxx" #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingCurveLinearMesh.hxx" @@ -239,6 +240,47 @@ namespace SALOME_TEST return targetMesh; } + ParaMEDMEM::MEDCoupling1SGTUMesh *MEDCouplingCorbaServBasicsTest::build1SGTUMesh() + { + ParaMEDMEM::MEDCoupling1SGTUMesh *targetMesh=ParaMEDMEM::MEDCoupling1SGTUMesh::New("Mesh1SGT",INTERP_KERNEL::NORM_QUAD4); + targetMesh->setTime(2.3,4,5); + targetMesh->setTimeUnit("us"); + targetMesh->setDescription("My Description of 1SGTU"); + ParaMEDMEM::DataArrayDouble *a1=ParaMEDMEM::DataArrayDouble::New(); a1->alloc(10,3); a1->setInfoOnComponent(0,"X1 [m]"); a1->setInfoOnComponent(1,"YY2 [km]"); a1->setInfoOnComponent(2,"ZZZ3 [km]"); + const double coords[30]={1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.}; + const int conn[16]={6,0,3,5,3,0,1,4,1,2,7,4,8,7,2,9}; + std::copy(coords,coords+30,a1->getPointer()); targetMesh->setCoords(a1); a1->decrRef(); + ParaMEDMEM::DataArrayInt *a2(ParaMEDMEM::DataArrayInt::New()); a2->alloc(4*4,1); + std::copy(conn,conn+16,a2->getPointer()); + targetMesh->setNodalConnectivity(a2); a2->decrRef(); + // + targetMesh->checkCoherency(); + // + return targetMesh; + } + + ParaMEDMEM::MEDCoupling1DGTUMesh *MEDCouplingCorbaServBasicsTest::build1DGTUMesh() + { + ParaMEDMEM::MEDCoupling1DGTUMesh *targetMesh=ParaMEDMEM::MEDCoupling1DGTUMesh::New("Mesh1DGT",INTERP_KERNEL::NORM_POLYGON); + targetMesh->setTime(2.3,4,5); + targetMesh->setTimeUnit("us"); + targetMesh->setDescription("My Description of 1DGTU"); + ParaMEDMEM::DataArrayDouble *a1=ParaMEDMEM::DataArrayDouble::New(); a1->alloc(10,3); a1->setInfoOnComponent(0,"X1 [m]"); a1->setInfoOnComponent(1,"YY2 [km]"); a1->setInfoOnComponent(2,"ZZZ3 [km]"); + const double coords[30]={1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.}; + const int conn[15]={6,0,3,5,3,0,1,4,1,2,7,4,8,7,2}; + const int conni[5]={0,4,8,12,15}; + std::copy(coords,coords+30,a1->getPointer()); targetMesh->setCoords(a1); a1->decrRef(); + ParaMEDMEM::DataArrayInt *a2(ParaMEDMEM::DataArrayInt::New()); a2->alloc(15,1); + std::copy(conn,conn+15,a2->getPointer()); + ParaMEDMEM::DataArrayInt *a3(ParaMEDMEM::DataArrayInt::New()); a3->alloc(5,1); + std::copy(conni,conni+5,a3->getPointer()); + targetMesh->setNodalConnectivity(a2,a3); a2->decrRef(); a3->decrRef(); + // + targetMesh->checkCoherency(); + // + return targetMesh; + } + ParaMEDMEM::MEDCouplingFieldDouble *MEDCouplingCorbaServBasicsTest::buildFieldScalarOn2DNT() { ParaMEDMEM::MEDCouplingUMesh *mesh=build2DMesh(); diff --git a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.hxx b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.hxx index b0cecbbac..655b011ea 100644 --- a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.hxx +++ b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.hxx @@ -29,6 +29,8 @@ namespace ParaMEDMEM class MEDCouplingFieldDouble; class MEDCouplingFieldTemplate; class MEDCouplingExtrudedMesh; + class MEDCoupling1DGTUMesh; + class MEDCoupling1SGTUMesh; class MEDCouplingCMesh; class MEDCouplingCurveLinearMesh; class DataArrayDouble; @@ -51,6 +53,8 @@ namespace SALOME_TEST static ParaMEDMEM::MEDCouplingExtrudedMesh *buildExtrudedMesh(ParaMEDMEM::MEDCouplingUMesh *&m2D); static ParaMEDMEM::MEDCouplingCMesh *buildCMesh(); static ParaMEDMEM::MEDCouplingCurveLinearMesh *buildCLMesh(); + static ParaMEDMEM::MEDCoupling1SGTUMesh *build1SGTUMesh(); + static ParaMEDMEM::MEDCoupling1DGTUMesh *build1DGTUMesh(); static ParaMEDMEM::MEDCouplingFieldDouble *buildFieldScalarOn2DNT(); static ParaMEDMEM::MEDCouplingFieldDouble *buildFieldNodeScalarOn2DNT(); static ParaMEDMEM::MEDCouplingFieldDouble *buildFieldScalarOn3DNT(); diff --git a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.cxx b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.cxx index 8bcaf19e7..2417ac2a5 100644 --- a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.cxx +++ b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.cxx @@ -26,6 +26,8 @@ #include "MEDCouplingFieldOverTimeServant.hxx" #include "MEDCouplingExtrudedMeshServant.hxx" #include "MEDCouplingCurveLinearMeshServant.hxx" +#include "MEDCoupling1SGTUMeshServant.hxx" +#include "MEDCoupling1DGTUMeshServant.hxx" #include "MEDCouplingCMeshServant.hxx" #include "MEDCouplingUMeshServant.hxx" #include "DataArrayDoubleServant.hxx" @@ -36,6 +38,7 @@ #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingExtrudedMesh.hxx" #include "MEDCouplingCurveLinearMesh.hxx" +#include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" @@ -140,6 +143,24 @@ namespace SALOME_TEST return ret; } + SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr MEDCouplingMeshFieldFactoryComponent::get1SGTUMesh() + { + ParaMEDMEM::MEDCoupling1SGTUMesh *m1=MEDCouplingCorbaServBasicsTest::build1SGTUMesh(); + ParaMEDMEM::MEDCoupling1SGTUMeshServant *m=new ParaMEDMEM::MEDCoupling1SGTUMeshServant(m1); + m1->decrRef(); + SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr ret=m->_this(); + return ret; + } + + SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr MEDCouplingMeshFieldFactoryComponent::get1DGTUMesh() + { + ParaMEDMEM::MEDCoupling1DGTUMesh *m1=MEDCouplingCorbaServBasicsTest::build1DGTUMesh(); + ParaMEDMEM::MEDCoupling1DGTUMeshServant *m=new ParaMEDMEM::MEDCoupling1DGTUMeshServant(m1); + m1->decrRef(); + SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr ret=m->_this(); + return ret; + } + SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr MEDCouplingMeshFieldFactoryComponent::getFieldScalarOn2DNT() { ParaMEDMEM::MEDCouplingFieldDouble *field=MEDCouplingCorbaServBasicsTest::buildFieldScalarOn2DNT(); diff --git a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.hxx b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.hxx index d9218e5f1..487d5e467 100644 --- a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.hxx +++ b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponentServ.hxx @@ -50,6 +50,8 @@ namespace SALOME_TEST SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface_ptr getExtrudedMesh(); SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr getCMesh(); SALOME_MED::MEDCouplingCurveLinearMeshCorbaInterface_ptr getCLMesh(); + SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_ptr get1SGTUMesh(); + SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_ptr get1DGTUMesh(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr getFieldScalarOn2DNT(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr getFieldNodeScalarOn2DNT(); SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr getFieldScalarOn3DNT(); diff --git a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py index 68f4f15f6..d42e5f46c 100644 --- a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py +++ b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py @@ -190,6 +190,37 @@ class MEDCouplingCorbaServBasicsTest: # return targetMesh; + def build1SGTUMesh(self): + targetMesh=MEDCoupling1SGTUMesh("Mesh1SGT",NORM_QUAD4) + targetMesh.setTime(2.3,4,5) + targetMesh.setTimeUnit("us") + targetMesh.setDescription("My Description of 1SGTU"); + a1=DataArrayDouble([1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.],10,3) + a1.setInfoOnComponents(["X1 [m]","YY2 [km]","ZZZ3 [km]"]) + targetMesh.setCoords(a1) + a2=DataArrayInt([6,0,3,5,3,0,1,4,1,2,7,4,8,7,2,9],4*4,1) + targetMesh.setNodalConnectivity(a2) + # + targetMesh.checkCoherency(); + # + return targetMesh; + + def build1DGTUMesh(self): + targetMesh=MEDCoupling1DGTUMesh("Mesh1DGT",NORM_POLYGON); + targetMesh.setTime(2.3,4,5) + targetMesh.setTimeUnit("us") + targetMesh.setDescription("My Description of 1DGTU"); + a1=DataArrayDouble([1.,1.,0.,2.,1.,0.,3.,1.,0.,1.,0.,0.,2.,0.,0.,0.,0.,0.,0.,1.,0.,3.,0.,0.,4.,0.,0.,4.,1.,0.],10,3) + a1.setInfoOnComponents(["X1 [m]","YY2 [km]","ZZZ3 [km]"]) + targetMesh.setCoords(a1) + a2=DataArrayInt([6,0,3,5,3,0,1,4,1,2,7,4,8,7,2],15,1) + a3=DataArrayInt([0,4,8,12,15],5,1) + targetMesh.setNodalConnectivity(a2,a3) + # + targetMesh.checkCoherency(); + # + return targetMesh; + def buildFieldScalarOn2DNT(self): mesh=self.build2DMesh(); fieldOnCells=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME); diff --git a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTestServ.py b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTestServ.py index 62517130c..81904317f 100644 --- a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTestServ.py +++ b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTestServ.py @@ -72,6 +72,14 @@ class MEDCouplingMeshFieldFactoryComponentPy(MEDCouplingCorbaServantTest_idl._0_ def getCLMesh(self): mesh=self._test.buildCLMesh() return MEDCouplingCurveLinearMeshServant._this(mesh) + + def get1SGTUMesh(self): + mesh=self._test.build1SGTUMesh() + return MEDCoupling1SGTUMeshServant._this(mesh) + + def get1DGTUMesh(self): + mesh=self._test.build1DGTUMesh() + return MEDCoupling1DGTUMeshServant._this(mesh) def getFieldScalarOn2DNT(self): field=self._test.buildFieldScalarOn2DNT() -- 2.39.2