LifeV
RegionMesh2DStructured.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 2D structured meshes.
30 
31  @author Iori Guido <guido.iori@mail.polimi.it>
32  @contributor -
33 
34  @date 23-05-2011
35 
36 */
37 
38 #include <lifev/core/mesh/RegionMesh2DStructured.hpp>
39 
40 namespace LifeV
41 {
42 
44  const UInt& i_y,
45  const UInt& n_x,
46  const UInt& n_y )
47 {
48  // We will use a binary representation to
49  // find the position of the point
50  // 0000 = in the rectangle ( 0)
51  // 0001 = on the y=0 axis ( 1)
52  // 0010 = on the y=l_y axis ( 2)
53  // 0100 = on the x=l_x axis ( 4)
54  // 1000 = on the x=0 axis ( 8)
55 
56  UInt pointPosition (0);
57 
58  if ( i_y == 0 )
59  {
60  pointPosition = pointPosition | 1;
61  }
62  if ( i_y == n_y - 1)
63  {
64  pointPosition = pointPosition | 2;
65  }
66  if ( i_x == n_x - 1)
67  {
68  pointPosition = pointPosition | 4;
69  }
70  if ( i_x == 0 )
71  {
72  pointPosition = pointPosition | 8;
73  }
74 
75  /*
76  // The boundary of the structured mesh
77  // labels:
78 
79  INTERNAL = 0;
80 
81  // Edges
82  LEFTEDGE = 8;
83  BOTTOMEDGE = 1;
84  TOPEDGE = 2;
85  RIGHTEDGE = 4;
86 
87  // Corners
88  BOTTOMLEFTCORNER = 9;
89  BOTTOMRIGHTCORNER = 5;
90  TOPLEFTCORNER = 10;
91  TOPRIGHTCORNER = 6;
92  */
93  switch ( pointPosition )
94  {
95  // We are inside
96  case 0:
98  // We are on 1 edge
99  case 1:
101  case 2:
102  return Structured2DLabel::TOP;
103  case 4:
105  case 8:
107  // We are on a corner
108  case 5:
110  case 6:
112  case 9:
114  case 10:
116  default:
118  }
119 
120 }
121 
122 } // Namespace LifeV
const markerID_Type TOP_LEFT
Label for the top and left boundary corner.
const markerID_Type TOP
Label for the top boundary edge.
markerID_Type regularMeshPointPosition2D(const UInt &i_x, const UInt &i_y, const UInt &n_x, const UInt &n_y)
This method gives the flags for a rectangle.
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
Definition: Marker.hpp:81
const markerID_Type BOTTOM
Label for the bottom boundary edge.
const markerID_Type BOTTOM_RIGHT
Label for the bottom and right boundary corner.
const markerID_Type LEFT
Label for the left boundary edge.
const markerID_Type RIGHT
Label for the right boundary edge.
const markerID_Type TOP_RIGHT
Label for the top and right boundary corner.
const markerID_Type INTERNAL
Label for the internal entities.
const markerID_Type BOTTOM_LEFT
Label for the bottom and left boundary corner.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191