1 // Copyright (C) 2010-2015 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 * TestMedDescendingPolyhedron.cxx
23 * Created on: 3 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 = 12;
42 const med_float coordinates[3 * 12] =
55 const med_int nodeIndexSize = 20;
56 const med_int nodeindex[20] = {
57 MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3,
58 MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3,
59 MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3,
60 MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3, MED_TRIA3 };
61 const med_int faceIndexSize = 2;
62 /* connectivity : 1 icosahedron */
63 const med_int faceindex[2] = { 1, 21 };
65 const med_int connectivity[20] = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10,
66 11,12,13,14,15,16,17,18,19,20 };
68 const med_int ntria3 = 20;
69 const med_int triaConnectivity[60] = { 1, 9, 5,
91 fid = MEDfileOpen("UsesCase_MEDmesh_17.med",
94 MESSAGE("ERROR : file creation ...");
98 /* write a comment in the file */
99 if (MEDfileCommentWr(fid,
100 "A 3D unstructured mesh : 1 icosahedron") < 0) {
101 MESSAGE("ERROR : write file description ...");
105 /* mesh creation : a 3D unstructured mesh */
110 MED_UNSTRUCTURED_MESH,
111 "A 3D mesh with 1 icosahedron in DESCENDING connectivity",
117 MESSAGE("ERROR : mesh creation ...");
121 /* nodes coordinates in a cartesian axis in full interlace mode
122 (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
124 if (MEDmeshNodeCoordinateWr(fid,
132 MESSAGE("ERROR : nodes coordinates ...");
136 // cells connectiviy is defined in nodal mode
137 // it is later in the polyhedron thet the connectivity is descending
138 if (MEDmeshElementConnectivityWr(fid,
148 triaConnectivity) < 0) {
149 MESSAGE("ERROR : triangular cells connectivity ...");
153 // cells connectiviy is defined in descending mode
155 if (MEDmeshPolyhedronWr(fid,
167 MESSAGE("ERROR : polyhedron connectivity ...");
171 /* create family 0 : by default, all mesh entities family number is 0 */
178 MESSAGE("ERROR : quadrangular cells connectivity ...");
183 if (MEDfileClose(fid) < 0) {
184 MESSAGE("ERROR : close file ...");