X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FMEDMeshMaker.cxx;h=0fb1d48faf937d2704410d8b12c2f11ea0dadbec;hb=c4551c56aa89896595842e5b41b048044681b4e8;hp=18fd7e8735e26f564b6b39c5c279af44b9f00a7f;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.cxx b/src/INTERP_KERNELTest/MEDMeshMaker.cxx index 18fd7e873..0fb1d48fa 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.cxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.cxx @@ -1,100 +1,48 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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 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, or (at your option) any later version. // -// 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MEDMEM_Mesh.hxx" -#include "MEDMEM_Meshing.hxx" -MEDMEM::MESH* MEDMeshMaker(int dim, int nbedge, MED_EN::medGeometryElement type) +#include "MCAuto.hxx" +#include "MEDCouplingCMesh.hxx" + +#include "MEDMeshMaker.hxx" + +using namespace MEDCoupling; + +MEDCoupling::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge) { - MEDMEM::MESHING* mesh=new MEDMEM::MESHING(); - mesh->setSpaceDimension(dim); - int nbnodes; - int nbelems; - switch (dim) - { - case 2: - nbnodes=(nbedge+1)*(nbedge+1); - if(type==MED_EN::MED_QUAD4) - nbelems=(nbedge*nbedge); - else - throw MEDMEM::MEDEXCEPTION("MEDMeshMaker: type not impletmented"); - break; - case 3: - nbnodes=(nbedge+1)*(nbedge+1)*(nbedge+1); - if (type==MED_EN::MED_HEXA8) - nbelems= nbedge*nbedge*nbedge; - else - throw MEDMEM::MEDEXCEPTION("MEDMeshMaker: type not impletmented"); - break; - } - double* coords = new double[dim*nbnodes]; - int nz; - if (dim==2) nz =1; else nz=nbedge+1; + MCAuto c=MEDCouplingCMesh::New(); + MCAuto arr=DataArrayDouble::New(); + arr->alloc(nbedge+1,1); arr->iota(0.); arr->applyLin(1./double(nbedge),0.); + switch(dim) { - for (int ix=0; ix < nbedge+1; ix++) - for (int iy=0; iysetCoordinates(dim, nbnodes,coords,"CARTESIAN",MED_EN::MED_FULL_INTERLACE); - delete [] coords; - mesh->setNumberOfTypes(1,MED_EN::MED_CELL); - mesh->setTypes(&type,MED_EN::MED_CELL); - mesh->setNumberOfElements(&nbelems,MED_EN::MED_CELL); - - int* conn = new int [nbelems*(type%100)]; - if (dim==2) + case 2: { - for (int ix=0; ixsetCoords(arr,arr); + break; } - if (dim==3) + case 3: { - for (int ix=0; ixsetCoords(arr,arr,arr); + break; } - mesh->setConnectivity(conn, MED_EN::MED_CELL,type); - delete [] conn; - mesh->setMeshDimension(dim); - return mesh; + default: + throw INTERP_KERNEL::Exception("MEDMeshMaker : only dim 2 or 3 supported !"); + } + return c->buildUnstructured(); }