1 // Copyright (C) 2010-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 * TestMedPolyhedron.cxx
23 * Created on: 15 févr. 2011
29 #include <med_utils.h>
33 int main (int argc, char **argv) {
35 const char meshname[MED_NAME_SIZE+1] = "3D unstructured mesh";
36 const med_int spacedim = 3;
37 const med_int meshdim = 3;
38 /* 12345678901234561234567890123456 */
39 const char axisname[3*MED_SNAME_SIZE+1] = "x y z ";
40 const char unitname[3*MED_SNAME_SIZE+1] = "cm cm cm ";
41 const med_int nnodes = 12;
42 const med_float coordinates[3 * 12] =
56 const med_int faceIndexSize = 2;
57 const med_int faceindex[2] = {1,22};
58 const med_int nodeIndexSize = 21;
59 /* connectivity : 1 icosahedron */
60 const med_int nodeindex[21] = { 1, 4, 7,10,13,16,19,22,25,28,
61 31,34,37,40,43,46,49,52,55,58,61 };
62 const med_int connectivity[60] = { 1, 9, 5,
84 fid = MEDfileOpen("UsesCase_MEDmesh_15.med",
87 MESSAGE("ERROR : file creation ...");
91 /* write a comment in the file */
92 if (MEDfileCommentWr(fid,
93 "A 3D unstructured mesh : 1 icosahedron") < 0) {
94 MESSAGE("ERROR : write file description ...");
98 /* mesh creation : a 3D unstructured mesh */
103 MED_UNSTRUCTURED_MESH,
104 "A 3D mesh with 1 icosahedron",
110 MESSAGE("ERROR : mesh creation ...");
114 /* nodes coordinates in a cartesian axis in full interlace mode
115 (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
117 if (MEDmeshNodeCoordinateWr(fid,
125 MESSAGE("ERROR : nodes coordinates ...");
129 /* cells connectiviy is defined in nodal mode */
131 if (MEDmeshPolyhedronWr(fid,
143 MESSAGE("ERROR : polyhedron connectivity ...");
147 /* create family 0 : by default, all mesh entities family number is 0 */
154 MESSAGE("ERROR : quadrangular cells connectivity ...");
159 if (MEDfileClose(fid) < 0) {
160 MESSAGE("ERROR : close file ...");