36 #ifndef COMPUTE_FINESCALEPRESSURE_ELEMENT_HPP 37 #define COMPUTE_FINESCALEPRESSURE_ELEMENT_HPP 39 #include <lifev/core/LifeV.hpp> 41 #include <lifev/core/fem/QuadratureRule.hpp> 42 #include <lifev/eta/fem/ETCurrentFE.hpp> 43 #include <lifev/eta/fem/MeshGeometricMap.hpp> 44 #include <lifev/eta/fem/QRAdapterBase.hpp> 46 #include <lifev/eta/expression/ExpressionToEvaluation.hpp> 47 #include <lifev/eta/expression/EvaluationPhiI.hpp> 49 #include <lifev/eta/array/ETVectorElemental.hpp> 54 namespace ExpressionAssembly
62 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
63 class ComputeFineScalePressure
71 typedef typename ExpressionToEvaluation < ExpressionType,
72 TestSpaceType::field_dim,
74 MeshType::S_geoDimensions >::evaluation_Type evaluation_Type;
83 ComputeFineScalePressure (
const std::shared_ptr<MeshType>& mesh,
84 const QRAdapterType& qrAdapter,
85 const std::shared_ptr<TestSpaceType>& testSpace,
86 const ExpressionType& expression,
87 const UInt offset = 0);
90 ComputeFineScalePressure (
const IntegrateVectorElement < MeshType, TestSpaceType, ExpressionType, QRAdapterType>& integrator);
93 ~ComputeFineScalePressure();
102 template <
typename VectorType>
103 inline void operator>> (VectorType& vector)
114 void check (std::ostream& out = std::cout);
124 template <
typename VectorType>
125 void compute (VectorType& vec);
135 ComputeFineScalePressure();
140 std::shared_ptr<MeshType> M_mesh;
143 QRAdapterType M_qrAdapter;
146 std::shared_ptr<TestSpaceType> M_testSpace;
149 evaluation_Type M_evaluation;
151 ETCurrentFE<MeshType::S_geoDimensions, 1>* M_globalCFE_std;
152 ETCurrentFE<MeshType::S_geoDimensions, 1>* M_globalCFE_adapted;
154 ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim>* M_testCFE_std;
155 ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim>* M_testCFE_adapted;
157 ETVectorElemental M_elementalVector;
172 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
173 ComputeFineScalePressure < MeshType, TestSpaceType, ExpressionType, QRAdapterType>::
174 ComputeFineScalePressure (
const std::shared_ptr<MeshType>& mesh,
175 const QRAdapterType& qrAdapter,
176 const std::shared_ptr<TestSpaceType>& testSpace,
177 const ExpressionType& expression,
180 M_qrAdapter (qrAdapter),
181 M_testSpace (testSpace),
182 M_evaluation (expression),
184 M_testCFE_std (
new ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim> (testSpace->refFE(), testSpace->geoMap(), qrAdapter.standardQR() ) ),
185 M_testCFE_adapted (
new ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim> (testSpace->refFE(), testSpace->geoMap(), qrAdapter.standardQR() ) ),
187 M_elementalVector (TestSpaceType::field_dim * testSpace->refFE().nbDof() ),
191 switch (MeshType::geoShape_Type::BasRefSha::S_shape)
194 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feSegP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
195 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feSegP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
198 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTriaP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
199 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTriaP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
202 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feQuadQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
203 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feQuadQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
206 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTetraP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
207 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTetraP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
210 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feHexaQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
211 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feHexaQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
214 ERROR_MSG (
"Unrecognized element shape");
216 M_evaluation.setQuadrature ( qrAdapter.standardQR() );
218 M_evaluation.setGlobalCFE (M_globalCFE_std);
219 M_evaluation.setTestCFE (M_testCFE_std);
223 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
224 ComputeFineScalePressure < MeshType, TestSpaceType, ExpressionType, QRAdapterType>::
225 ComputeFineScalePressure (
const IntegrateVectorElement < MeshType, TestSpaceType, ExpressionType, QRAdapterType>& integrator)
226 : M_mesh (integrator.M_mesh),
227 M_qrAdapter (integrator.M_qrAdapter),
228 M_testSpace (integrator.M_testSpace),
229 M_evaluation (integrator.M_evaluation),
231 M_testCFE_std (
new ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim> (M_testSpace->refFE(), M_testSpace->geoMap(), integrator.M_qrAdapter.standardQR() ) ),
232 M_testCFE_adapted (
new ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim> (M_testSpace->refFE(), M_testSpace->geoMap(), integrator.M_qrAdapter.standardQR() ) ),
234 M_elementalVector (integrator.M_elementalVector),
235 M_offset (integrator.M_offset)
237 switch (MeshType::geoShape_Type::BasRefSha::S_shape)
240 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feSegP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
241 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feSegP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
244 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTriaP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
245 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTriaP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
248 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feQuadQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
249 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feQuadQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
252 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTetraP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
253 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feTetraP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
256 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feHexaQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
257 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (feHexaQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
260 ERROR_MSG (
"Unrecognized element shape");
262 M_evaluation.setQuadrature (integrator.M_qrAdapter.standardQR() );
263 M_evaluation.setGlobalCFE (M_globalCFE_std);
264 M_evaluation.setTestCFE (M_testCFE_std);
268 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
269 ComputeFineScalePressure < MeshType, TestSpaceType, ExpressionType, QRAdapterType>::
270 ~ComputeFineScalePressure()
272 delete M_globalCFE_std;
273 delete M_globalCFE_adapted;
274 delete M_testCFE_std;
275 delete M_testCFE_adapted;
282 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
284 ComputeFineScalePressure < MeshType, TestSpaceType, ExpressionType, QRAdapterType>::
285 check (std::ostream& out)
287 out <<
" Checking the integration : " << std::endl;
288 M_evaluation.display (out);
290 out <<
" Elemental vector : " << std::endl;
291 M_elementalVector.showMe (out);
295 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
296 template <
typename VectorType>
298 ComputeFineScalePressure < MeshType, TestSpaceType, ExpressionType, QRAdapterType>::
299 compute (VectorType& vec)
301 UInt nbElements (M_mesh->numElements() );
302 UInt nbQuadPt_std (M_qrAdapter.standardQR().nbQuadPt() );
303 UInt nbTestDof (M_testSpace->refFE().nbDof() );
306 bool isPreviousAdapted (
true);
308 Real elementalFinePressure;
310 for (UInt iElement (0); iElement < nbElements; ++iElement)
314 M_qrAdapter.update (iElement);
317 if (isPreviousAdapted)
319 M_evaluation.setQuadrature ( M_qrAdapter.standardQR() );
320 M_evaluation.setGlobalCFE ( M_globalCFE_std );
321 M_evaluation.setTestCFE ( M_testCFE_std );
323 isPreviousAdapted =
false;
327 M_globalCFE_std->update (M_mesh->element (iElement), evaluation_Type::S_globalUpdateFlag | ET_UPDATE_WDET);
328 M_testCFE_std->update (M_mesh->element (iElement), evaluation_Type::S_testUpdateFlag);
331 M_evaluation.update (iElement);
333 elementalFinePressure = M_evaluation.value_qi (0, 0);
335 vec[M_mesh->element(iElement).id() ] = elementalFinePressure;
337 elementalFinePressure = 0;