2 // C++ : Tests unitaires sur les creations h'hexaedres
4 // Copyright (C) 2009-2016 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, or (at your option) any later version.
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/ or email : webmaster.salome@opencascade.com
26 #include "HexDocument.hxx"
27 #include "HexElements.hxx"
29 #include "HexHexa.hxx"
30 #include "HexQuad.hxx"
31 #include "HexEdge.hxx"
32 #include "HexVertex.hxx"
34 #include "HexCramer.hxx"
36 // ======================================================== test_hexa_quads_5
37 int test_replace5 (int nbargs, cpchar tabargs[])
44 double decal = lgcell/sqrt (2.0);
47 cpchar son_nom = "replace5";
50 Hex::Document* doc = mon_ex.addDocument (son_nom);
52 Hex::Vector* vx = doc->addVector (3,0,0);
53 Hex::Vector* vz = doc->addVector (0,0,1);
55 Hex::Elements* grid1 = doc->makeCartesianTop (size_x,size_y,size_z);
56 doc->saveVtk (son_nom, nvtk);
58 for (int nz=0 ; nz<=size_z ; ++nz)
60 grid1->getVertexIJK (1, 1, nz)->setX (-decal);
61 grid1->getVertexIJK (1, 1, nz)->setY (-decal);
63 grid1->getVertexIJK (1, 3, nz)->setX (-decal);
64 grid1->getVertexIJK (1, 3, nz)->setY ( decal);
66 grid1->getVertexIJK (3, 1, nz)->setX ( decal);
67 grid1->getVertexIJK (3, 1, nz)->setY (-decal);
69 grid1->getVertexIJK (3, 3, nz)->setX ( decal);
70 grid1->getVertexIJK (3, 3, nz)->setY ( decal);
73 doc->saveVtk (son_nom, nvtk);
75 Hex::Vertex* ori0 = doc->addVertex (0,-10,0);
76 Hex::Vertex* ori2 = doc->addVertex (0,0,0);
77 const double da = 360;
84 Hex::Elements* grid0 = doc->makePipeUni (ori0, vx, vz,
85 1.0,5.0, da, dl, nr, na, nl);
87 doc->saveVtk (son_nom, nvtk);
89 // Hex::Elements* grid2 =
90 doc->makePipeUni (ori2, vx, vz, 1.0,5.0, da, dl, nr, na, nl);
92 doc->saveVtk (son_nom, nvtk);
94 doc->saveVtk (son_nom, nvtk);
97 // ======================================================== test_get
98 int test_get (int nbargs, cpchar tabargs[])
100 const int size_x = 2;
101 const int size_y = 2;
102 const int size_z = 2;
105 cpchar son_nom = "test_get";
108 Hex::Document* doc = mon_ex.addDocument (son_nom);
110 Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z);
111 doc->saveVtk (son_nom, nvtk);
112 grid->getVertexIJK (2, 1, 1)->setColor (4);
113 doc->saveVtk (son_nom, nvtk);
115 grid->getVertexIJK (2, 1, 1)->setColor (0);
116 grid->getEdgeK (1, 0, 1)->setColor (4);
117 doc->saveVtk (son_nom, nvtk);
119 grid->getEdgeK (1, 0, 1)->setColor (0);
120 grid->getQuadIJ (1, 0, 2)->setColor (4);
121 doc->saveVtk (son_nom, nvtk);
123 grid->getHexaIJK (1, 0, 1)->setColor (4);
124 doc->saveVtk (son_nom, nvtk);
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);
134 // ======================================================== test_dump
135 int test_dump (int nbargs, cpchar tabargs[])
137 const int size_x = 4;
138 const int size_y = 4;
139 const int size_z = 2;
142 cpchar son_nom = "test_dump";
145 Hex::Document* doc = mon_ex.addDocument (son_nom);
147 doc->makeCartesianTop (size_x,size_y,size_z);
148 doc->saveVtk (son_nom, nvtk);