/* This file is part of MED. * * COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN * MED 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 3 of the License, or * (at your option) any later version. * * MED 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 MED. If not, see . */ /* * Use case 3 : read an unstructured mesh : generic approach */ #include #define MESGERR 1 #include #include int main (int argc, char **argv) { med_idt fid; char meshname[MED_NAME_SIZE+1]=""; char meshdescription[MED_COMMENT_SIZE+1]=""; med_int meshdim=0; med_int spacedim=0; med_sorting_type sortingtype; med_int nstep; med_mesh_type meshtype; med_axis_type axistype; char *axisname=""; char *unitname=""; char dtunit[MED_SNAME_SIZE+1]=""; med_float *coordinates = NULL; med_int nnodes = 0; med_int ngeo = 0; med_int nelt=0; med_int *connectivity = NULL; med_bool coordinatechangement; med_bool geotransformation; med_int i, j, it, nmesh; med_geometry_type geotype; med_geometry_type *geotypes = MED_GET_CELL_GEOMETRY_TYPE; char geotypename[MED_NAME_SIZE+1]; int ret=-1; /* open MED file with READ ONLY access mode */ fid = MEDfileOpen("UsesCase_MEDmesh_1.med",MED_ACC_RDONLY); if (fid < 0) { MESSAGE("ERROR : open file in READ ONLY ACCESS mode ..."); goto ERROR; } /* read how many mesh in the file */ if ((nmesh = MEDnMesh(fid)) < 0) { MESSAGE("ERROR : read how many mesh ..."); goto ERROR; } for (i=0;i