37 #ifndef INTEGRATEVALUEELEMENTLSADAPTED_H 38 #define INTEGRATEVALUEELEMENTLSADAPTED_H 1
40 #include <lifev/core/LifeV.hpp> 42 #include <lifev/level_set/fem/LevelSetQRAdapter.hpp> 43 #include <lifev/eta/fem/ETCurrentFE.hpp> 44 #include <lifev/eta/fem/MeshGeometricMap.hpp> 46 #include <lifev/eta/expression/ExpressionToEvaluation.hpp> 48 #include <boost/shared_ptr.hpp> 53 namespace ExpressionAssembly
63 template<
typename MeshType,
typename ExpressionType,
typename LSFESpaceType,
typename VectorType>
64 class IntegrateValueElementLSAdapted
71 typedef typename ExpressionToEvaluation < ExpressionType,
74 3 >::evaluation_Type evaluation_Type;
76 typedef LevelSetQRAdapter<LSFESpaceType, VectorType> QRAdapter_Type;
85 IntegrateValueElementLSAdapted (
const std::shared_ptr<MeshType>& mesh,
86 const QRAdapter_Type& QRAdapter,
87 const ExpressionType& expression);
89 IntegrateValueElementLSAdapted (
const IntegrateValueElementLSAdapted
90 <MeshType, ExpressionType, LSFESpaceType, VectorType>& integrator);
92 ~IntegrateValueElementLSAdapted();
101 inline void operator>> (Real& value)
112 void addTo (Real& value);
121 IntegrateValueElementLSAdapted();
126 std::shared_ptr<MeshType> M_mesh;
129 QRAdapter_Type M_QRAdapter;
132 evaluation_Type M_evaluation;
135 ETCurrentFE<3, 1>* M_globalCFE_unadapted;
136 ETCurrentFE<3, 1>* M_globalCFE_adapted;
141 template<
typename MeshType,
typename ExpressionType,
typename LSFESpaceType,
typename VectorType>
142 IntegrateValueElementLSAdapted<MeshType, ExpressionType, LSFESpaceType, VectorType>::
143 IntegrateValueElementLSAdapted (
const std::shared_ptr<MeshType>& mesh,
144 const QRAdapter_Type& QRAdapter,
145 const ExpressionType& expression)
148 M_QRAdapter (QRAdapter),
149 M_evaluation (expression),
151 M_globalCFE_unadapted (
new ETCurrentFE<3, 1> ( feTetraP0, geometricMapFromMesh<MeshType>(), QRAdapter.standardQR() ) ),
152 M_globalCFE_adapted (
new ETCurrentFE<3, 1> ( feTetraP0, geometricMapFromMesh<MeshType>(), QRAdapter.standardQR() ) )
154 M_evaluation.setQuadrature ( QRAdapter.standardQR() );
155 M_evaluation.setGlobalCFE (M_globalCFE_unadapted);
158 template<
typename MeshType,
typename ExpressionType,
typename LSFESpaceType,
typename VectorType>
159 IntegrateValueElementLSAdapted<MeshType, ExpressionType, LSFESpaceType, VectorType>::
160 IntegrateValueElementLSAdapted (
const IntegrateValueElementLSAdapted
161 <MeshType, ExpressionType, LSFESpaceType, VectorType>& integrator)
163 M_mesh ( integrator.M_mesh ),
164 M_QRAdapter ( integrator.M_QRAdapter ),
165 M_evaluation ( integrator.M_evaluation ),
167 M_globalCFE_unadapted (
new ETCurrentFE<3, 1> ( feTetraP0, geometricMapFromMesh<MeshType>(), M_QRAdapter.standardQR() ) ),
168 M_globalCFE_adapted (
new ETCurrentFE<3, 1> ( feTetraP0, geometricMapFromMesh<MeshType>(), M_QRAdapter.standardQR() ) )
170 M_evaluation.setQuadrature (M_QRAdapter.standardQR() );
171 M_evaluation.setGlobalCFE (M_globalCFE_unadapted);
175 template<
typename MeshType,
typename ExpressionType,
typename LSFESpaceType,
typename VectorType>
176 IntegrateValueElementLSAdapted<MeshType, ExpressionType, LSFESpaceType, VectorType>::
177 ~IntegrateValueElementLSAdapted()
179 delete M_globalCFE_unadapted;
180 delete M_globalCFE_adapted;
183 template<
typename MeshType,
typename ExpressionType,
typename LSFESpaceType,
typename VectorType>
185 IntegrateValueElementLSAdapted<MeshType, ExpressionType, LSFESpaceType, VectorType>::
188 const UInt nbElements (M_mesh->numElements() );
189 const UInt nbQuadPt_unadapted (M_QRAdapter.standardQR().nbQuadPt() );
194 bool isPreviousAdapted (
true);
197 for (UInt iElement (0); iElement < nbElements; ++iElement)
199 M_QRAdapter.update (iElement);
201 if ( M_QRAdapter.isAdaptedElement() )
204 M_evaluation.setQuadrature ( M_QRAdapter.adaptedQR() );
205 M_globalCFE_adapted->setQuadratureRule ( M_QRAdapter.adaptedQR() );
207 M_evaluation.setGlobalCFE ( M_globalCFE_adapted );
210 M_globalCFE_adapted->update (M_mesh->element (iElement), evaluation_Type::S_globalUpdateFlag | ET_UPDATE_WDET);
213 M_evaluation.update (iElement);
216 for (UInt iQuadPt (0); iQuadPt < M_QRAdapter.adaptedQR().nbQuadPt(); ++iQuadPt)
218 value += M_evaluation.value_q (iQuadPt)
219 * M_globalCFE_adapted->wDet (iQuadPt);
222 isPreviousAdapted =
true;
227 if (isPreviousAdapted)
229 M_evaluation.setQuadrature ( M_QRAdapter.standardQR() );
230 M_evaluation.setGlobalCFE ( M_globalCFE_unadapted );
234 M_globalCFE_unadapted->update (M_mesh->element (iElement), evaluation_Type::S_globalUpdateFlag | ET_UPDATE_WDET);
237 M_evaluation.update (iElement);
241 for (UInt iQuadPt (0); iQuadPt < nbQuadPt_unadapted; ++iQuadPt)
243 value += M_evaluation.value_q (iQuadPt)
244 * M_globalCFE_unadapted->wDet (iQuadPt);
247 isPreviousAdapted =
false;