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"
30 #include "HexHexa.hxx"
31 #include "HexQuad.hxx"
32 #include "HexEdge.hxx"
33 #include "HexVertex.hxx"
35 #include "HexCramer.hxx"
37 // ======================================================== test_hexa_quads_5
38 int test_replace5 (int nbargs, cpchar tabargs[])
45 double decal = lgcell/sqrt (2.0);
48 cpchar son_nom = "replace5";
51 Hex::Document* doc = mon_ex.addDocument (son_nom);
53 Hex::Vector* vx = doc->addVector (3,0,0);
54 Hex::Vector* vz = doc->addVector (0,0,1);
56 Hex::Elements* grid1 = doc->makeCartesianTop (size_x,size_y,size_z);
57 doc->saveVtk (son_nom, nvtk);
59 for (int nz=0 ; nz<=size_z ; ++nz)
61 grid1->getVertexIJK (1, 1, nz)->setX (-decal);
62 grid1->getVertexIJK (1, 1, nz)->setY (-decal);
64 grid1->getVertexIJK (1, 3, nz)->setX (-decal);
65 grid1->getVertexIJK (1, 3, nz)->setY ( decal);
67 grid1->getVertexIJK (3, 1, nz)->setX ( decal);
68 grid1->getVertexIJK (3, 1, nz)->setY (-decal);
70 grid1->getVertexIJK (3, 3, nz)->setX ( decal);
71 grid1->getVertexIJK (3, 3, nz)->setY ( decal);
74 doc->saveVtk (son_nom, nvtk);
76 Hex::Vertex* ori0 = doc->addVertex (0,-10,0);
77 Hex::Vertex* ori2 = doc->addVertex (0,0,0);
78 const double da = 360;
85 Hex::Elements* grid0 = doc->makePipeUni (ori0, vx, vz,
86 1.0,5.0, da, dl, nr, na, nl);
88 doc->saveVtk (son_nom, nvtk);
90 // Hex::Elements* grid2 =
91 doc->makePipeUni (ori2, vx, vz, 1.0,5.0, da, dl, nr, na, nl);
93 doc->saveVtk (son_nom, nvtk);
95 doc->saveVtk (son_nom, nvtk);
98 // ======================================================== test_get
99 int test_get (int nbargs, cpchar tabargs[])
101 const int size_x = 2;
102 const int size_y = 2;
103 const int size_z = 2;
106 cpchar son_nom = "test_get";
109 Hex::Document* doc = mon_ex.addDocument (son_nom);
111 Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z);
112 doc->saveVtk (son_nom, nvtk);
113 grid->getVertexIJK (2, 1, 1)->setColor (4);
114 doc->saveVtk (son_nom, nvtk);
116 grid->getVertexIJK (2, 1, 1)->setColor (0);
117 grid->getEdgeK (1, 0, 1)->setColor (4);
118 doc->saveVtk (son_nom, nvtk);
120 grid->getEdgeK (1, 0, 1)->setColor (0);
121 grid->getQuadIJ (1, 0, 2)->setColor (4);
122 doc->saveVtk (son_nom, nvtk);
124 grid->getHexaIJK (1, 0, 1)->setColor (4);
125 doc->saveVtk (son_nom, nvtk);
126 doc->saveVtk (son_nom, nvtk);
127 doc->saveVtk (son_nom, nvtk);
128 doc->saveVtk (son_nom, nvtk);
129 doc->saveVtk (son_nom, nvtk);
130 doc->saveVtk (son_nom, nvtk);
131 doc->saveVtk (son_nom, nvtk);
132 doc->saveVtk (son_nom, nvtk);
135 // ======================================================== test_dump
136 int test_dump (int nbargs, cpchar tabargs[])
138 const int size_x = 4;
139 const int size_y = 4;
140 const int size_z = 2;
143 cpchar son_nom = "test_dump";
146 Hex::Document* doc = mon_ex.addDocument (son_nom);
148 doc->makeCartesianTop (size_x,size_y,size_z);
149 doc->saveVtk (son_nom, nvtk);