LifeV
RequestLoopElement.hpp
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 File containing the classes to determine the kind of loops to be performed
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32 
33  @date 07-2011
34  */
35 
36 
37 #ifndef LOOP_REQUEST_HPP
38 #define LOOP_REQUEST_HPP
39 
40 #include <lifev/core/LifeV.hpp>
41 
42 #include <boost/shared_ptr.hpp>
43 
44 
45 namespace LifeV
46 {
47 
48 namespace ExpressionAssembly
49 {
50 
51 //! RequestLoopElement - The class to request a loop over the elements of a mesh.
52 /*!
53  @author Samuel Quinodoz
54 
55  The only role of this class is to trigger, at compile time (through its type), loops
56  on the elements of the mesh stored internally.
57 
58  <b> Template parameters </b>
59 
60  <i>MeshType</i>: The type of the mesh.
61 
62  <b> Template requirements </b>
63 
64  <i>MeshType</i>: none
65 
66  */
67 template <typename MeshType>
69 {
70 public:
71 
72  //! @name Constructors & Destructor
73  //@{
74 
75  //! Simple constructor with a shared_ptr on the mesh
76  RequestLoopElement ( const std::shared_ptr<MeshType>& mesh, const UInt regionFlag = 0,
77  const UInt numVolumes = 0, const UInt * volumeElements = nullptr,
78  const bool integrateOnSubdomains = false )
79  : M_mesh ( mesh ), M_regionFlag ( regionFlag ), M_volumeElements( volumeElements ), M_numVolumes( numVolumes ),
80  M_integrateOnSubdomains( integrateOnSubdomains )
81  { }
82 
83  //! Copy constructor
85  : M_mesh ( loop.M_mesh ), M_regionFlag ( loop.M_regionFlag ), M_numVolumes( loop.M_numVolumes ),
86  M_volumeElements( loop.M_volumeElements ), M_integrateOnSubdomains( loop.M_integrateOnSubdomains )
87  { }
88 
90  {
91  M_volumeElements = nullptr;
92  }
93  //@}
94 
95 
96  //! @name Get Methods
97  //@{
98 
99  //! Getter for the mesh pointer
100  const std::shared_ptr<MeshType>& mesh() const
101  {
102  return M_mesh;
103  }
104 
105  //! Getter for the flag of the region of integration
106  const UInt regionFlag() const
107  {
108  return M_regionFlag;
109  }
110 
111  const UInt numVolumes() const
112  {
113  return M_numVolumes;
114  }
115 
116  //! Getter for the flag of the region of integration
117  const UInt * getElementsRegionFlag() const
118  {
119  return M_volumeElements;
120  }
121 
122  const bool getIfSubDomain() const
123  {
125  }
126 
127  //@}
128 
129 private:
130 
131  //! @name Private Methods
132  //@{
133 
134  //! No empty constructor
136 
137  //@}
138 
139  // Pointer on the mesh
141 
142  // Data for integration on one subRegion, flag and elements on which iterate
147 
148 };
149 
150 
151 //! elements - A helper method to trigger the loop on the elements of a mesh
152 /*!
153  @author Samuel Quinodoz
154 
155  This method simply returns a RequestLoopElement type, so that one does not
156  need to explicitly call this type and the type of the mesh used.
157 
158  <b> Template parameters </b>
159 
160  <i>MeshType</i>: The type of the mesh.
161 
162  <b> Template requirements </b>
163 
164  <i>MeshType</i>: See in LifeV::RequestLoopElement
165 
166  */
167 template< typename MeshType >
168 RequestLoopElement<MeshType>
169 elements (const std::shared_ptr<MeshType>& mesh, const UInt flag = 0, const UInt numVolumes = 0,
170  const UInt * volumeElements = nullptr, const bool subDomain = false )
171 {
172 
173  return RequestLoopElement<MeshType> ( mesh, flag, numVolumes, volumeElements, subDomain );
174 }
175 
176 
177 } // Namespace ExpressionAssembly
178 
179 } // Namespace LifeV
180 
181 #endif
const std::shared_ptr< MeshType > & mesh() const
Getter for the mesh pointer.
RequestLoopElement(const std::shared_ptr< MeshType > &mesh, const UInt regionFlag=0, const UInt numVolumes=0, const UInt *volumeElements=nullptr, const bool integrateOnSubdomains=false)
Simple constructor with a shared_ptr on the mesh.
void updateInverseJacobian(const UInt &iQuadPt)
RequestLoopElement< MeshType > elements(const std::shared_ptr< MeshType > &mesh, const UInt flag=0, const UInt numVolumes=0, const UInt *volumeElements=nullptr, const bool subDomain=false)
elements - A helper method to trigger the loop on the elements of a mesh
RequestLoopElement(const RequestLoopElement &loop)
Copy constructor.
const UInt regionFlag() const
Getter for the flag of the region of integration.
RequestLoopElement - The class to request a loop over the elements of a mesh.
const UInt * getElementsRegionFlag() const
Getter for the flag of the region of integration.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191