2 // C++ : Tests unitaires sur les creations h'hexaedres
4 // Copyright (C) 2009-2011 CEA/DEN, EDF R&D
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/
21 // or email : webmaster.salome@opencascade.com
27 #include "HexDocument.hxx"
28 #include "HexElements.hxx"
29 #include "HexCrossElements.hxx"
31 #include "HexHexa.hxx"
32 #include "HexQuad.hxx"
33 #include "HexEdge.hxx"
34 #include "HexVertex.hxx"
36 #include "HexCramer.hxx"
38 // ======================================================== test_hexa_quads_5
39 int test_replace5 (int nbargs, cpchar tabargs[])
46 double cray = lgcell*size_x/2;
47 double decal = lgcell/sqrt (2.0);
50 cpchar son_nom = "replace5";
53 Hex::Document* doc = mon_ex.addDocument (son_nom);
55 Hex::Vertex* ori1 = doc->addVertex (-cray, -cray, 0);
56 Hex::Vector* vx = doc->addVector (3,0,0);
57 Hex::Vector* vy = doc->addVector (0,3,0);
58 Hex::Vector* vz = doc->addVector (0,0,1);
60 Hex::Elements* grid1 = doc->makeCartesian (ori1, vx, vy, vz,
61 size_x,size_y,size_z);
62 doc->saveVtk (son_nom, nvtk);
64 /************************
65 for (int nz=0 ; nz<size_z ; ++nz)
66 for (int ny=1 ; ny<3 ; ++ny)
67 for (int nx=1 ; nx<3 ; ++nx)
68 grid1->getHexaIJK (nx,ny,nz)->remove ();
70 doc->saveVtk (son_nom, nvtk);
73 for (int nz=0 ; nz<=size_z ; ++nz)
75 grid1->getVertexIJK (1, 1, nz)->setX (-decal);
76 grid1->getVertexIJK (1, 1, nz)->setY (-decal);
78 grid1->getVertexIJK (1, 3, nz)->setX (-decal);
79 grid1->getVertexIJK (1, 3, nz)->setY ( decal);
81 grid1->getVertexIJK (3, 1, nz)->setX ( decal);
82 grid1->getVertexIJK (3, 1, nz)->setY (-decal);
84 grid1->getVertexIJK (3, 3, nz)->setX ( decal);
85 grid1->getVertexIJK (3, 3, nz)->setY ( decal);
88 doc->saveVtk (son_nom, nvtk);
90 Hex::Vertex* ori0 = doc->addVertex (0,-10,0);
91 Hex::Vertex* ori2 = doc->addVertex (0,0,0);
93 const double da = 360;
100 Hex::Elements* grid0 = doc->makeCylindrical (ori0, vx, vz,
101 dr, da, dl, nr, na, 1, false);
103 doc->saveVtk (son_nom, nvtk);
105 // Hex::Elements* grid2 =
106 doc->makeCylindrical (ori2, vx, vz, dr, da, dl, nr, na, nl, false);
108 doc->saveVtk (son_nom, nvtk);
110 doc->saveVtk (son_nom, nvtk);
113 // ======================================================== test_get
114 int test_get (int nbargs, cpchar tabargs[])
116 const int size_x = 2;
117 const int size_y = 2;
118 const int size_z = 2;
121 cpchar son_nom = "test_get";
124 Hex::Document* doc = mon_ex.addDocument (son_nom);
126 Hex::Vertex* ori1 = doc->addVertex (0,0,0);
127 Hex::Vector* vx = doc->addVector (1,0,0);
128 Hex::Vector* vy = doc->addVector (0,1,0);
129 Hex::Vector* vz = doc->addVector (0,0,1);
131 Hex::Elements* grid = doc->makeCartesian (ori1, vx, vy, vz,
132 size_x,size_y,size_z);
133 doc->saveVtk (son_nom, nvtk);
134 grid->getVertexIJK (2, 1, 1)->setColor (4);
135 doc->saveVtk (son_nom, nvtk);
137 grid->getVertexIJK (2, 1, 1)->setColor (0);
138 grid->getEdgeK (1, 0, 1)->setColor (4);
139 doc->saveVtk (son_nom, nvtk);
141 grid->getEdgeK (1, 0, 1)->setColor (0);
142 grid->getQuadIJ (1, 0, 2)->setColor (4);
143 doc->saveVtk (son_nom, nvtk);
145 grid->getHexaIJK (1, 0, 1)->setColor (4);
146 doc->saveVtk (son_nom, nvtk);
147 doc->saveVtk (son_nom, nvtk);
148 doc->saveVtk (son_nom, nvtk);
149 doc->saveVtk (son_nom, nvtk);
150 doc->saveVtk (son_nom, nvtk);
151 doc->saveVtk (son_nom, nvtk);
152 doc->saveVtk (son_nom, nvtk);
153 doc->saveVtk (son_nom, nvtk);
156 // ======================================================== test_dump
157 int test_dump (int nbargs, cpchar tabargs[])
159 const int size_x = 4;
160 const int size_y = 4;
161 const int size_z = 2;
164 double cray = lgcell*size_x/2;
165 // double decal = lgcell/sqrt (2.0);
168 cpchar son_nom = "test_dump";
171 Hex::Document* doc = mon_ex.addDocument (son_nom);
173 Hex::Vertex* ori1 = doc->addVertex (-cray, -cray, 0);
174 Hex::Vector* vx = doc->addVector (3,0,0);
175 Hex::Vector* vy = doc->addVector (0,3,0);
176 Hex::Vector* vz = doc->addVector (0,0,1);
178 //Hex::Elements* grid1 =
179 doc->makeCartesian (ori1, vx, vy, vz, size_x,size_y,size_z);
180 doc->saveVtk (son_nom, nvtk);