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 * TestMedWriteOcta12.cxx
23 * Created on: 17 mars 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 = 20;
42 const med_float coordinates[3 * 20] =
64 const med_int nOcta = 2;
65 const med_int octa12Connectivity[12*2] =
66 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
67 13, 14, 15, 16, 4, 3, 17, 18, 19, 20, 10, 9 };
70 fid = MEDfileOpen("UsesCase_MEDmesh_19.med",
73 MESSAGE("ERROR : file creation ...");
77 /* write a comment in the file */
78 if (MEDfileCommentWr(fid,
79 "A 3D unstructured mesh : 2 Hexagonal Prisms") < 0) {
80 MESSAGE("ERROR : write file description ...");
84 /* mesh creation : a 3D unstructured mesh */
89 MED_UNSTRUCTURED_MESH,
90 "A 3D mesh with 1 hexagonal in NODAL connectivity",
96 MESSAGE("ERROR : mesh creation ...");
100 /* nodes coordinates in a cartesian axis in full interlace mode
101 (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
103 if (MEDmeshNodeCoordinateWr(fid,
111 MESSAGE("ERROR : nodes coordinates ...");
115 // cells connectiviy is defined in nodal mode
116 if (MEDmeshElementConnectivityWr(fid,
126 octa12Connectivity) < 0) {
127 MESSAGE("ERROR : triangular cells connectivity ...");
131 /* create family 0 : by default, all mesh entities family number is 0 */
138 MESSAGE("ERROR : quadrangular cells connectivity ...");
143 if (MEDfileClose(fid) < 0) {
144 MESSAGE("ERROR : close file ...");