X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FMEDMeshMaker.cxx;h=70245d3f2e762b8cf37aa0b7a6695b566490ed3a;hb=b832b15337be013a56e0976170e5e235b89fcb03;hp=83efbb6616bbed9f7d86c28b9190253471b2b215;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.cxx b/src/INTERP_KERNELTest/MEDMeshMaker.cxx index 83efbb661..70245d3f2 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.cxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2024 CEA, EDF // // 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. +// 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 @@ -17,85 +17,32 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "MCAuto.hxx" +#include "MEDCouplingCMesh.hxx" + #include "MEDMeshMaker.hxx" -#include "MEDMEM_Mesh.hxx" -#include "MEDMEM_Meshing.hxx" +using namespace MEDCoupling; -MEDMEM::MESH* MEDMeshMaker(int dim, int nbedge, MED_EN::medGeometryElement type) +MEDCoupling::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge) { - MEDMEM::MESHING* mesh=new MEDMEM::MESHING(); - 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(MED_EN::MED_CELL,type,conn); - delete [] conn; - return mesh; + default: + throw INTERP_KERNEL::Exception("MEDMeshMaker : only dim 2 or 3 supported !"); + } + return c->buildUnstructured(); }