TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Pave.h
1/****************************************************************************
2* Copyright (c) 2025, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Pave_included
17#define Pave_included
18#include <Domaine.h>
19
20
21/*! @brief Class Pave A domain that is particularly easy to mesh!
22 *
23 * The data set structure to specify a Pave is:
24 * Pave nom_pave
25 * {
26 * Origine OX OY (OZ)
27 * Longueurs LX LY (LZ)
28 * Nombre_de_noeuds NX NY (NZ)
29 * Facteurs Fx Fy (Fz)
30 * (Symx)
31 * (Symy)
32 * (Symz)
33 * }
34 * {
35 * (Bord) nom X = X0 Y0 <= Y <= Y1 Z0 <= Z <= Z1
36 * ...
37 * (Raccord) local homogene nom X = X0 Y0 <= Y <= Y1 Z0 <= Z <= Z1
38 * ...
39 * (Internes) nom X = X0 Y0 <= Y <= Y1 Z0 <= Z <= Z1
40 * ...
41 * (Joint) nom X = X0 Y0 <= Y <= Y1 Z0 <= Z <= Z1 PE_voisin
42 * ...
43 * }
44 *
45 * @sa Domaine Mailler, Currently this is the only object type recognized by TRUST for meshing a domain
46 */
47template <typename _SIZE_>
48class Pave_32_64 : public Domaine_32_64<_SIZE_>
49{
50 Declare_instanciable_32_64(Pave_32_64);
51public :
52 using int_t = _SIZE_;
53 using IntVect_t = IntVect_T<_SIZE_>;
54 using IntTab_t = IntTab_T<_SIZE_>;
55 using DoubleVect_t = DoubleVect_T<_SIZE_>;
56 using DoubleTab_t = DoubleTab_T<_SIZE_>;
59
60protected:
61 inline int_t numero_maille(int i);
62 inline int_t numero_maille(int i, int j);
63 inline int_t numero_maille(int i, int j, int k);
64
65 inline int_t numero_sommet(int i);
66 inline int_t numero_sommet(int i, int j);
67 inline int_t numero_sommet(int i, int j, int k);
68
69 inline int_t& maille_sommet(int i,int l);
70 inline int_t& maille_sommet(int i, int j, int l);
71 inline int_t& maille_sommet(int i, int j, int k, int l);
72
73 inline double& coord_noeud(int i);
74 inline double& coord_noeud(int i, int j, int l);
75 inline double& coord_noeud(int i, int j, int k, int l);
76
77 void maille2D();
78 void maille3D();
79
80 void typer_();
81
85
86
88 IntVect symetrique_; // which directions (x,y,z) are symetrical?
89 IntVect nb_noeuds_;
90
91 int Nx = -1, Ny = -1, Nz = -1, Mx = -1, My = -1, Mz = -1;
92 double a_tanh= 10.; // a for the tanh mesh in the y direction!!
93 int tanh_dilatation=0; // can be -1,0 or 1
94 double xa_tanh= 10.; // xa for the tanh mesh in the x direction!!
95 int xtanh_dilatation=0; // can be -1,0 or 1
96 double za_tanh= 10.; // za for the tanh mesh in the z direction!!
97 int ztanh_dilatation=0; // can be -1,0 or 1
98 bool rep_VEF=false;
99 bool tour_complet = false;
100};
101
102/*! @brief Returns the index of the i-th cell (along X)
103 *
104 * @param (int i) the rank of the cell along X whose index is requested
105 * @return (int) the index of the requested cell
106 */
107template <typename _SIZE_>
109{
110 assert(this->dimension == 1);
111 assert(i < Nx);
112 return i;
113}
114
115/*! @brief Returns the index of the (i,j)-th cell (along (X,Y)).
116 *
117 * @param (int i) the rank of the cell along X
118 * @param (int j) the rank of the cell along Y
119 * @return (int) the index of the requested cell
120 */
121template <typename _SIZE_>
123{
124 assert(this->dimension == 2);
125 assert(i < Nx);
126 assert(j < Ny);
127 return j*Nx+i;
128}
129
130/*! @brief Returns the index of the (i,j,k)-th cell (along (X,Y,Z)).
131 *
132 * @param (int i) the rank of the cell along X
133 * @param (int j) the rank of the cell along Y
134 * @param (int k) the rank of the cell along Z
135 * @return (int) the index of the requested cell
136 */
137template <typename _SIZE_>
139{
140 assert(this->dimension == 3);
141 assert(i < Nx);
142 assert(j < Ny);
143 assert(k < Nz);
144 return k*Ny*Nx+j*Nx+i;
145}
146
147/*! @brief Returns the index of the i-th vertex (along X)
148 *
149 * @param (int i) the rank of the vertex along X whose index is requested
150 * @return (int) the index of the requested vertex
151 */
152template <typename _SIZE_>
154{
155 assert(this->dimension == 1 && i < Mx);
156 return i;
157}
158
159/*! @brief Returns the index of the (i,j)-th vertex (along (X,Y)).
160 *
161 * @param (int i) the rank of the vertex along X
162 * @param (int j) the rank of the vertex along Y
163 * @return (int) the index of the requested vertex
164 */
165template <typename _SIZE_>
167{
168 assert(this->dimension == 2);
169 assert(i < Mx);
170 if((tour_complet) && (j==My))
171 j=0;
172 return j*Mx+i;
173}
174
175/*! @brief Returns the index of the (i,j,k)-th vertex (along (X,Y,Z)).
176 *
177 * @param (int i) the rank of the vertex along X
178 * @param (int j) the rank of the vertex along Y
179 * @param (int k) the rank of the vertex along Z
180 * @return (int) the index of the requested vertex
181 */
182template <typename _SIZE_>
184{
185 assert(this->dimension == 3);
186 assert(i < Mx);
187 if((tour_complet) && (j==My))
188 j=0;
189 assert(j < My);
190 assert(k < Mz);
191 return k*My*Mx+j*Mx+i;
192}
193
194/*! @brief Returns a reference to the index of the l-th vertex of the i-th cell (along X) of the pave.
195 *
196 * @param (int i) the rank of the cell along X
197 * @param (int l) the rank of the requested vertex
198 * @return (int&) reference to the index of the requested vertex
199 */
200template <typename _SIZE_>
202{
203 assert(this->dimension == 1);
204 return this->mes_elems_(numero_maille(i),l);
205}
206
207/*! @brief Returns a reference to the index of the l-th vertex of the (i,j)-th cell (along (X,Y)) of the pave.
208 *
209 * @param (int i) the rank of the cell along X
210 * @param (int j) the rank of the cell along Y
211 * @param (int l) the rank of the requested vertex
212 * @return (int&) reference to the index of the requested vertex
213 */
214template <typename _SIZE_>
216{
217 assert(this->dimension == 2);
218 return this->mes_elems_(numero_maille(i, j),l);
219}
220
221/*! @brief Returns a reference to the index of the l-th vertex of the (i,j,k)-th cell (along (X,Y,Z)) of the pave.
222 *
223 * @param (int i) the rank of the cell along X
224 * @param (int j) the rank of the cell along Y
225 * @param (int k) the rank of the cell along Z
226 * @param (int l) the rank of the requested vertex
227 * @return (int&) reference to the index of the requested vertex
228 */
229template <typename _SIZE_>
230inline typename Pave_32_64<_SIZE_>::int_t& Pave_32_64<_SIZE_>::maille_sommet(int i, int j, int k, int l)
231{
232 assert(this->dimension == 3);
233 return this->mes_elems_(numero_maille(i, j, k), l);
234}
235
236/*! @brief Returns a reference to the coordinates of the i-th node.
237 *
238 * @param (int i) the rank of the node along X
239 * @return (double&) reference to the coordinates of the requested node
240 */
241template <typename _SIZE_>
243{
244 assert(this->dimension == 1);
245 return this->sommets_(numero_sommet(i));
246}
247
248/*! @brief Returns a reference to the coordinates of the (i,j)-th node.
249 *
250 * @param (int i) the rank of the node along X
251 * @param (int j) the rank of the node along Y
252 * @return (double&) reference to the coordinates of the requested node
253 */
254template <typename _SIZE_>
255inline double& Pave_32_64<_SIZE_>::coord_noeud(int i, int j, int l)
256{
257 assert(this->dimension == 2);
258 return this->sommets_(numero_sommet(i, j),l);
259}
260
261/*! @brief Returns a reference to the coordinates of the (i,j,k)-th node.
262 *
263 * @param (int i) the rank of the node along X
264 * @param (int j) the rank of the node along Y
265 * @param (int k) the rank of the node along Z
266 * @return (double&) reference to the coordinates of the requested node
267 */
268template <typename _SIZE_>
269inline double& Pave_32_64<_SIZE_>::coord_noeud(int i, int j, int k, int l)
270{
271 assert(this->dimension == 3);
272 return this->sommets_(numero_sommet(i, j, k),l);
273}
274
275using Pave = Pave_32_64<int>;
276using Pave_64 = Pave_32_64<trustIdType>;
277
278#endif
DoubleTab_t sommets_
Definition Domaine.h:386
IntTab_t mes_elems_
Definition Domaine.h:391
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Class Frontiere.
Definition Frontiere.h:32
static int dimension
Definition Objet_U.h:94
Class Pave A domain that is particularly easy to mesh!
Definition Pave.h:49
int_t numero_sommet(int i, int j, int k)
Returns the index of the (i,j,k)-th vertex (along (X,Y,Z)).
Definition Pave.h:183
double a_tanh
Definition Pave.h:92
int_t & maille_sommet(int i, int l)
Returns a reference to the index of the l-th vertex of the i-th cell (along X) of the pave.
Definition Pave.h:201
int ztanh_dilatation
Definition Pave.h:97
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Pave.h:56
IntVect_T< _SIZE_ > IntVect_t
Definition Pave.h:53
int tanh_dilatation
Definition Pave.h:93
double za_tanh
Definition Pave.h:96
_SIZE_ int_t
Definition Pave.h:52
int_t numero_maille(int i, int j, int k)
Returns the index of the (i,j,k)-th cell (along (X,Y,Z)).
Definition Pave.h:138
int_t numero_sommet(int i)
Returns the index of the i-th vertex (along X).
Definition Pave.h:153
int_t numero_sommet(int i, int j)
Returns the index of the (i,j)-th vertex (along (X,Y)).
Definition Pave.h:166
DoubleVect facteurs_
Definition Pave.h:87
bool tour_complet
Definition Pave.h:99
int_t & maille_sommet(int i, int j, int l)
Returns a reference to the index of the l-th vertex of the (i,j)-th cell (along (X,...
Definition Pave.h:215
void maille3D()
Performs a 3D meshing of the box with the values of the parameters read by ReadOn.
Definition Pave.cpp:844
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Pave.h:55
double xa_tanh
Definition Pave.h:94
double & coord_noeud(int i, int j, int k, int l)
Returns a reference to the coordinates of the (i,j,k)-th node.
Definition Pave.h:269
void lire_noeuds(Entree &is)
Reads the number of nodes from the data set input stream and builds the nodes.
Definition Pave.cpp:1342
DoubleVect longueurs_
Definition Pave.h:87
void maille2D()
Performs a 1D meshing of the pave using the parameter values read by ReadOn.
Definition Pave.cpp:580
int_t numero_maille(int i)
Returns the index of the i-th cell (along X).
Definition Pave.h:108
Frontiere_32_64< _SIZE_ > Frontiere_t
Definition Pave.h:58
double & coord_noeud(int i)
Returns a reference to the coordinates of the i-th node.
Definition Pave.h:242
int xtanh_dilatation
Definition Pave.h:95
void typer_()
Types the pave according to the space dimension and the requested coordinate system (cylindrical.
Definition Pave.cpp:1278
double & coord_noeud(int i, int j, int l)
Returns a reference to the coordinates of the (i,j)-th node.
Definition Pave.h:255
IntTab_T< _SIZE_ > IntTab_t
Definition Pave.h:54
Domaine_32_64< _SIZE_ > Domaine_t
Definition Pave.h:57
int_t numero_maille(int i, int j)
Returns the index of the (i,j)-th cell (along (X,Y)).
Definition Pave.h:122
DoubleVect origine_
Definition Pave.h:87
void lire_front(Entree &, Frontiere_t &)
Reads the specifications of a boundary from the data set input stream and builds it.
Definition Pave.cpp:1456
IntVect nb_noeuds_
Definition Pave.h:89
int_t & maille_sommet(int i, int j, int k, int l)
Returns a reference to the index of the l-th vertex of the (i,j,k)-th cell (along (X,...
Definition Pave.h:230
IntVect symetrique_
Definition Pave.h:88
void lire_longueurs(Entree &is)
Reads the lengths LX LY [LZ] from the data set input stream.
Definition Pave.cpp:1315
DoubleVect pas_
Definition Pave.h:87