LifeV
RegionMesh3DStructured.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Contains methods which generate structured meshes.
30 
31  @author Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
32  @contributor -
33  @maintainer Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
34 
35  @date 16-04-2010
36 
37  Such methods will be usefull in order to test problems at different
38  scales.
39  */
40 
41 #include <lifev/core/LifeV.hpp>
42 #include <lifev/core/mesh/RegionMesh3DStructured.hpp>
43 
44 namespace LifeV
45 {
46 
48  const UInt& i_y,
49  const UInt& i_z,
50  const UInt& n_x,
51  const UInt& n_y,
52  const UInt& n_z )
53 {
54  // We will use a binary representation to
55  // find the position of the point
56  // 000000 = in the cube ( 0)
57  // 000001 = on the x-z plane ( 1)
58  // 000010 = on the plane x=n_x ( 2)
59  // 000100 = on the plane y=n_y ( 4)
60  // 001000 = on the plane y-z ( 8)
61  // 010000 = on the plane x-y (16)
62  // 100000 = on the plane z=n_z (32)
63  UInt pointPosition (0);
64  if ( i_y == 0 )
65  {
66  pointPosition = pointPosition | 1;
67  }
68  if ( i_x == n_x - 1)
69  {
70  pointPosition = pointPosition | 2;
71  }
72  if ( i_y == n_y - 1)
73  {
74  pointPosition = pointPosition | 4;
75  }
76  if ( i_x == 0 )
77  {
78  pointPosition = pointPosition | 8;
79  }
80  if ( i_z == 0 )
81  {
82  pointPosition = pointPosition | 16;
83  }
84  if ( i_z == n_z - 1 )
85  {
86  pointPosition = pointPosition | 32;
87  }
88 
89  switch ( pointPosition )
90  {
91  // We are inside
92  case 0:
93  return 0;
94  // We are on 1 face
95  case 1:
96  return 1;
97  case 2:
98  return 2;
99  case 4:
100  return 3;
101  case 8:
102  return 4;
103  case 16:
104  return 5;
105  case 32:
106  return 6;
107  // We are on an edge
108  case 17:
109  return 7;
110  case 18:
111  return 8;
112  case 20:
113  return 9;
114  case 24:
115  return 10;
116  case 9:
117  return 11;
118  case 3:
119  return 12;
120  case 6:
121  return 13;
122  case 12:
123  return 14;
124  case 33:
125  return 15;
126  case 34:
127  return 16;
128  case 36:
129  return 17;
130  case 40:
131  return 18;
132  // We are on a corner
133  case 25:
134  return 19;
135  case 19:
136  return 20;
137  case 22:
138  return 21;
139  case 28:
140  return 22;
141  case 41:
142  return 23;
143  case 35:
144  return 24;
145  case 38:
146  return 25;
147  case 44:
148  return 26;
149  default:
150  return 0;
151  }
152 }
153 
154 
155 } // Namespace LifeV
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
Definition: Marker.hpp:81
markerID_Type regularMeshPointPosition(const UInt &i_x, const UInt &i_y, const UInt &i_z, const UInt &n_x, const UInt &n_y, const UInt &n_z)
This method gives the flags for a parallelepiped.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191