Salome HOME
Copyrights update
[modules/med.git] / src / MEDMEM / test_MEDMEM_PolyConnectivity.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 // This program test the implementation of the class CONNECTIVITY for Polygons and Polyhedron. //
21
22 #include "MEDMEM_Connectivity.hxx"
23
24 using namespace std;
25 using namespace MEDMEM;
26 using namespace MED_EN;
27
28 int main(void)
29 {
30   CONNECTIVITY myNodalConnectivity;
31   CONNECTIVITY myDescendingConnectivity;
32
33   //POLYGONS
34   const med_int NumberOfPolygons = 2;
35   const med_int ConnectivitySize = 12;
36   med_int PolygonsConnectivityIndex[NumberOfPolygons+1] = {1,7,13};
37
38   //Nodal
39   med_int PolygonsNodalConnectivity[ConnectivitySize] = {1,2,3,4,5,10,10,5,6,7,8,9};
40
41   myNodalConnectivity.setPolygonsConnectivity(MED_NODAL,MED_CELL,PolygonsNodalConnectivity,PolygonsConnectivityIndex,ConnectivitySize,NumberOfPolygons);
42
43   //Descending
44   med_int PolygonsDescendingConnectivity[ConnectivitySize] = {1,2,3,4,11,10,11,5,6,7,8,9};
45
46   myDescendingConnectivity.setPolygonsConnectivity(MED_DESCENDING,MED_CELL,PolygonsDescendingConnectivity,PolygonsConnectivityIndex,ConnectivitySize,NumberOfPolygons);
47
48   //POLYHEDRON
49   const med_int NumberOfPolyhedron = 2;
50   med_int PolyhedronIndex[NumberOfPolyhedron+1] = {1,10,20};
51
52   //Nodal
53   const med_int NumberOfFaces = 19;
54   const med_int NumberOfNodes = 74;
55   med_int PolyhedronFacesIndex[NumberOfFaces+1] = {1,7,11,15,19,23,27,31,34,39,44,48,52,55,58,61,64,68,72,75};
56   med_int PolyhedronNodalConnectivity[NumberOfNodes] = {1,2,3,4,5,6,1,7,8,2,2,8,9,3,4,3,9,10,5,4,10,11,6,5,11,12,1,6,12,7,7,12,8,10,9,8,12,11,13,14,15,3,2,13,2,8,16,14,13,16,17,15,14,17,15,17,18,15,18,9,3,15,9,2,3,9,8,8,9,17,16,9,18,17};
57
58   myNodalConnectivity.setPolyhedronConnectivity(MED_NODAL,PolyhedronNodalConnectivity,PolyhedronIndex,NumberOfNodes,NumberOfPolyhedron,PolyhedronFacesIndex,NumberOfFaces);
59
60   //Descending
61   const med_int DescendingConnectivitySize = 19;
62   med_int PolyhedronDescendingConnectivity[DescendingConnectivitySize] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,3,17,18};
63
64   myDescendingConnectivity.setPolyhedronConnectivity(MED_DESCENDING,PolyhedronDescendingConnectivity,PolyhedronIndex,DescendingConnectivitySize,NumberOfPolyhedron);
65
66   cout << myNodalConnectivity;
67   cout << myDescendingConnectivity;
68
69   return 0;
70 }