36 #ifndef INTEGRATE_VECTOR_ELEMENT_HPP 37 #define INTEGRATE_VECTOR_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> 51 #include <boost/shared_ptr.hpp> 58 namespace ExpressionAssembly
70 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
80 TestSpaceType::field_dim,
92 const QRAdapterType& qrAdapter,
93 const std::shared_ptr<TestSpaceType>& testSpace,
94 const ExpressionType& expression,
95 const UInt offset = 0);
110 template <
typename VectorType>
117 template <
typename VectorType>
118 inline void operator>> (std::shared_ptr<VectorType> vector)
130 void check (std::ostream& out = std::cout);
140 template <
typename VectorType>
141 void addTo (VectorType& vec);
170 ETCurrentFE<TestSpaceType::space_dim, TestSpaceType::field_dim>*
M_testCFE_std;
188 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
191 const QRAdapterType& qrAdapter,
192 const std::shared_ptr<TestSpaceType>& testSpace,
193 const ExpressionType& expression,
207 switch (MeshType::geoShape_Type::BasRefSha::S_shape)
210 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feSegP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
211 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feSegP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
214 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTriaP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
215 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTriaP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
218 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feQuadQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
219 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feQuadQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
222 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTetraP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
223 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTetraP0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
226 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feHexaQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
227 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feHexaQ0, geometricMapFromMesh<MeshType>(), qrAdapter.standardQR() );
230 ERROR_MSG (
"Unrecognized element shape");
239 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
253 switch (MeshType::geoShape_Type::BasRefSha::S_shape)
256 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feSegP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
257 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feSegP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
260 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTriaP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
261 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTriaP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
264 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feQuadQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
265 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feQuadQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
268 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTetraP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
269 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feTetraP0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
272 M_globalCFE_std =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feHexaQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
273 M_globalCFE_adapted =
new ETCurrentFE<MeshType::S_geoDimensions, 1> (
feHexaQ0, geometricMapFromMesh<MeshType>(), integrator.M_qrAdapter.standardQR() );
276 ERROR_MSG (
"Unrecognized element shape");
278 M_evaluation.setQuadrature (integrator.M_qrAdapter.standardQR() );
284 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
298 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
303 out <<
" Checking the integration : " << std::endl;
306 out <<
" Elemental vector : " << std::endl;
307 M_elementalVector.showMe (out);
311 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType,
typename QRAdapterType>
312 template <
typename VectorType>
317 UInt nbElements (M_mesh->numElements() );
319 UInt nbTestDof (M_testSpace->refFE().nbDof() );
322 bool isPreviousAdapted (
true);
324 for (
UInt iElement (0); iElement < nbElements; ++iElement)
327 M_elementalVector.zero();
348 M_globalCFE_adapted->update (M_mesh->element (iElement), evaluation_Type::S_globalUpdateFlag | ET_UPDATE_WDET);
349 M_testCFE_adapted->update (M_mesh->element (iElement), evaluation_Type::S_testUpdateFlag);
353 for (
UInt iblock (0); iblock < TestSpaceType::field_dim; ++iblock)
356 for (
UInt i (0); i < nbTestDof; ++i)
358 M_elementalVector.setRowIndex
359 (i + iblock * nbTestDof,
360 M_testSpace->dof().localToGlobalMap (iElement, i) + iblock * M_testSpace->dof().numTotalDof() );
364 for (
UInt iQuadPt (0); iQuadPt <
M_qrAdapter.adaptedQR().nbQuadPt(); ++iQuadPt)
366 for (
UInt i (0); i < nbTestDof; ++i)
368 M_elementalVector.element (i + iblock * nbTestDof) +=
369 M_evaluation.value_qi (iQuadPt, i + iblock * nbTestDof)
370 * M_globalCFE_adapted->wDet (iQuadPt);
377 isPreviousAdapted =
true;
382 if (isPreviousAdapted)
388 isPreviousAdapted =
false;
393 M_globalCFE_std->update (M_mesh->element (iElement), evaluation_Type::S_globalUpdateFlag | ET_UPDATE_WDET);
394 M_testCFE_std->update (M_mesh->element (iElement), evaluation_Type::S_testUpdateFlag);
400 for (
UInt iblock (0); iblock < TestSpaceType::field_dim; ++iblock)
403 for (
UInt i (0); i < nbTestDof; ++i)
405 M_elementalVector.setRowIndex
406 (i + iblock * nbTestDof,
407 M_testSpace->dof().localToGlobalMap (iElement, i) + iblock * M_testSpace->dof().numTotalDof() + M_offset);
411 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt_std; ++iQuadPt)
413 for (
UInt i (0); i < nbTestDof; ++i)
415 M_elementalVector.element (i + iblock * nbTestDof) +=
416 M_evaluation.value_qi (iQuadPt, i + iblock * nbTestDof)
417 * M_globalCFE_std->wDet (iQuadPt);
425 M_elementalVector.pushToGlobal (vec);
void addTo(VectorType &vec)
Method that performs the assembly.
const ReferenceFEScalar feHexaQ0("Lagrange Q0 on a hexaedra", FE_Q0_3D, HEXA, 0, 0, 0, 1, 1, 3, fct_Q0_3D, derfct_Q0_3D, der2fct_Q0_3D, refcoor_Q0_3D, STANDARD_PATTERN, &feQuadQ0, &lagrangianTransform)
class ETVectorElemental A class for describing an elemental vector
~IntegrateVectorElement()
Destructor.
const ReferenceFEScalar feSegP0("Lagrange P0 on a segment", FE_P0_1D, LINE, 0, 1, 0, 0, 1, 1, fct_P0_1D, derfct_P0_1D, der2fct_P0_1D, refcoor_P0_1D, STANDARD_PATTERN, &fePointP0, &lagrangianTransform)
ETCurrentFE< MeshType::S_geoDimensions, 1 > * M_globalCFE_std
ETCurrentFE< TestSpaceType::space_dim, TestSpaceType::field_dim > * M_testCFE_std
ETCurrentFE< MeshType::S_geoDimensions, 1 > * M_globalCFE_adapted
void updateInverseJacobian(const UInt &iQuadPt)
QRAdapterType M_qrAdapter
const ReferenceFEScalar feTetraP0("Lagrange P0 on a tetraedra", FE_P0_3D, TETRA, 0, 0, 0, 1, 1, 3, fct_P0_3D, derfct_P0_3D, der2fct_P0_3D, refcoor_P0_3D, STANDARD_PATTERN, &feTriaP0, &lagrangianTransform)
std::shared_ptr< MeshType > M_mesh
const ReferenceFEScalar feTriaP0("Lagrange P0 on a triangle", FE_P0_2D, TRIANGLE, 0, 0, 1, 0, 1, 2, fct_P0_2D, derfct_P0_2D, der2fct_P0_2D, refcoor_P0_2D, STANDARD_PATTERN, &feSegP0, &lagrangianTransform)
void operator>>(std::shared_ptr< VectorType > vector)
Operator wrapping the addTo method (for shared_ptr)
ETVectorElemental M_elementalVector
ETCurrentFE< TestSpaceType::space_dim, TestSpaceType::field_dim > * M_testCFE_adapted
class ExpressionToEvaluation A class to pass from an Expression (Tree) to the corresponding Evaluatio...
The class to actually perform the loop over the elements to assemble a vector.
void check(std::ostream &out=std::cout)
Ouput method.
evaluation_Type M_evaluation
std::shared_ptr< TestSpaceType > M_testSpace
const ReferenceFEScalar feQuadQ0("Lagrange Q0 on a quadrangle", FE_Q0_2D, QUAD, 0, 0, 1, 0, 1, 2, fct_Q0_2D, derfct_Q0_2D, der2fct_Q0_2D, refcoor_Q0_2D, STANDARD_PATTERN, &feSegP0, &lagrangianTransform)
IntegrateVectorElement(const std::shared_ptr< MeshType > &mesh, const QRAdapterType &qrAdapter, const std::shared_ptr< TestSpaceType > &testSpace, const ExpressionType &expression, const UInt offset=0)
Full data constructor.
ExpressionToEvaluation< ExpressionType, TestSpaceType::field_dim, 0, MeshType::S_geoDimensions >::evaluation_Type evaluation_Type
Type of the Evaluation.
void operator>>(VectorType &vector)
Operator wrapping the addTo method.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
IntegrateVectorElement(const IntegrateVectorElement< MeshType, TestSpaceType, ExpressionType, QRAdapterType > &integrator)
Copy constructor.