36 #ifndef ETCURRENTFE_HPP 37 #define ETCURRENTFE_HPP 40 #include <lifev/core/LifeV.hpp> 42 #include <lifev/core/array/VectorSmall.hpp> 43 #include <lifev/core/array/MatrixSmall.hpp> 45 #include <lifev/eta/fem/ETCurrentFlag.hpp> 47 #include <lifev/core/fem/GeometricMap.hpp> 49 #include <lifev/core/fem/ReferenceFEScalar.hpp> 50 #include <lifev/core/fem/ReferenceFEHdiv.hpp> 51 #include <lifev/core/fem/ReferenceFEHybrid.hpp> 53 #include <lifev/core/fem/QuadratureRule.hpp> 61 namespace ExpressionAssembly
138 template <
UInt spaceDim>
139 class ETCurrentFE<spaceDim, 1>
237 ETCurrentFE (
const ETCurrentFE<spaceDim, 1>& otherFE);
265 template<
typename elementType>
272 void showMe (std::ostream& out = std::cout)
const;
313 ASSERT ( i < M_nbFEDof,
"No basis function with this index");
314 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
326 ASSERT ( M_isQuadNodeUpdated,
"Quadrature nodes have not been updated");
327 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
328 ASSERT ( coord < spaceDim,
"No such coordinate index");
339 ASSERT ( M_isWDetUpdated,
"Weighted determinant has not been updated");
340 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
353 ASSERT ( M_isDphiUpdated,
"Derivative of the basis functions have not been updated");
354 ASSERT ( i < M_nbFEDof,
"No basis function with this index");
355 ASSERT ( dxi < spaceDim,
"No such coordinate index");
356 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
368 ASSERT ( M_isDphiUpdated,
"Derivative of the basis functions have not been updated");
369 ASSERT ( i < M_nbFEDof,
"No basis function with this index");
370 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
382 ASSERT ( M_isLaplacianUpdated,
"Laplacian of the basis functions have not been updated");
383 ASSERT ( i < M_nbFEDof,
"No basis function with this index");
384 ASSERT ( q < M_nbQuadPt,
"No quadrature point with this index");
394 ASSERT (M_isCellNodeUpdated,
"Cell has not been updated");
404 ASSERT (M_isDiameterUpdated,
"Diameter has not been updated");
414 ASSERT (M_isWDetUpdated,
"Determinant has not been updated");
424 ASSERT (M_isMetricUpdated,
"Metric has not been updated");
425 return M_metricTensor;
434 ASSERT (M_isMetricUpdated,
"Metric has not been updated");
482 void operator= (
const ETCurrentFE<spaceDim, 1>&);
488 template<
typename ElementType >
499 void updateCellNode (
const std::vector<VectorSmall<spaceDim> >& ptsCoordinates);
615 #ifdef HAVE_LIFEV_DEBUG 621 bool M_isCellNodeUpdated;
622 bool M_isDiameterUpdated;
623 bool M_isMetricUpdated;
624 bool M_isMeasureUpdated;
625 bool M_isQuadNodeUpdated;
626 bool M_isJacobianUpdated;
627 bool M_isDetJacobianUpdated;
628 bool M_isInverseJacobianUpdated;
629 bool M_isWDetUpdated;
631 bool M_isDphiUpdated;
632 bool M_isD2phiUpdated;
633 bool M_isLaplacianUpdated;
644 template <
UInt spaceDim>
645 const UInt ETCurrentFE<spaceDim, 1>::
648 template <
UInt spaceDim>
649 const UInt ETCurrentFE<spaceDim, 1>::
658 template<
UInt spaceDim>
659 ETCurrentFE<spaceDim, 1>::
693 #ifdef HAVE_LIFEV_DEBUG 716 template<
UInt spaceDim>
717 ETCurrentFE<spaceDim, 1>::
751 #ifdef HAVE_LIFEV_DEBUG 772 template<
UInt spaceDim>
773 ETCurrentFE<spaceDim, 1>::
791 M_phi (otherFE.M_phi),
807 #ifdef HAVE_LIFEV_DEBUG 827 template<
UInt spaceDim>
828 ETCurrentFE<spaceDim, 1>::
844 template<
typename elementType>
846 ETCurrentFE<spaceDim, 1>::
849 ASSERT (M_referenceFE != 0,
"No reference FE for the update");
850 ASSERT (M_geometricMap != 0,
"No geometric mapping for the update");
851 ASSERT (M_quadratureRule != 0,
"No quadrature rule for the update");
853 #ifdef HAVE_LIFEV_DEBUG 855 M_isCellNodeUpdated =
false;
856 M_isDiameterUpdated =
false;
857 M_isMetricUpdated =
false;
858 M_isMeasureUpdated =
false;
859 M_isQuadNodeUpdated =
false;
860 M_isJacobianUpdated =
false;
861 M_isDetJacobianUpdated =
false;
862 M_isInverseJacobianUpdated =
false;
863 M_isWDetUpdated =
false;
864 M_isDphiUpdated =
false;
865 M_isD2phiUpdated =
false;
866 M_isLaplacianUpdated =
false;
870 if ( flag & ET_UPDATE_ONLY_CELL_NODE )
872 updateCellNode (element);
874 if ( flag & ET_UPDATE_ONLY_DIAMETER )
878 if ( flag & ET_UPDATE_ONLY_METRIC )
887 if ( flag & ET_UPDATE_ONLY_QUAD_NODE )
891 if ( flag & ET_UPDATE_ONLY_JACOBIAN )
895 if ( flag & ET_UPDATE_ONLY_DET_JACOBIAN )
899 if ( flag & ET_UPDATE_ONLY_T_INVERSE_JACOBIAN )
903 if ( flag & ET_UPDATE_ONLY_W_DET_JACOBIAN )
907 if ( flag & ET_UPDATE_ONLY_DPHI )
911 if ( flag & ET_UPDATE_ONLY_D2PHI )
915 if ( flag & ET_UPDATE_ONLY_LAPLACIAN )
921 if ( flag & ET_UPDATE_ONLY_MEASURE )
928 template<
UInt spaceDim>
930 ETCurrentFE<spaceDim, 1>::
933 out <<
" Number of FE Dof : " << M_nbFEDof << std::endl;
934 out <<
" Number of Map Dof : " << M_nbMapDof << std::endl;
935 out <<
" Number of QR point : " << M_nbQuadPt << std::endl;
938 out <<
" Cell Nodes : " << std::endl;
949 out <<
" Jacobian : " << std::endl;
963 out <<
" Det jacobian : " << std::endl;
970 out <<
" T inverse Jacobian : " << std::endl;
984 out <<
" DPhi : " << std::endl;
991 out <<
M_dphi[iQuad][iDof][iCoor] <<
" ";
998 out <<
" D2Phi : " << std::endl;
1007 out <<
M_d2phi[iQuad][iDof][iCoor][jCoor] <<
" ";
1016 out <<
" Laplacian : " << std::endl;
1031 template<
UInt spaceDim>
1033 ETCurrentFE<spaceDim, 1>::
1051 template<
UInt spaceDim >
1053 ETCurrentFE<spaceDim, 1>::
1060 M_phi.resize (M_nbQuadPt);
1066 M_phi[q][j] = M_referenceFE->phi (j, M_quadratureRule->quadPointCoor (q) );
1070 #ifdef HAVE_LIFEV_DEBUG 1071 M_isDphiUpdated =
true;
1075 M_phiMap.resize (M_nbQuadPt);
1086 M_dphiReferenceFE.resize (M_nbQuadPt);
1093 for (
UInt j (0); j < spaceDim; ++j)
1095 M_dphiReferenceFE[q][i][j] = M_referenceFE->dPhi (i, j, M_quadratureRule->quadPointCoor (q) );
1101 M_dphiGeometricMap.resize (M_nbQuadPt);
1108 for (
UInt j (0); j < spaceDim; ++j)
1116 M_d2phiReferenceFE.resize (M_nbQuadPt);
1123 for (
UInt j (0); j < spaceDim; ++j)
1126 for (
UInt k (0); k < spaceDim; ++k)
1128 M_d2phiReferenceFE[q][i][j][k] = M_referenceFE->d2Phi (i, j, k, M_quadratureRule->quadPointCoor (q) );
1135 M_d2phiReferenceFE.resize (M_nbQuadPt);
1142 for (
UInt j (0); j < spaceDim; ++j)
1145 for (
UInt k (0); k < spaceDim; ++k)
1147 M_d2phiReferenceFE[q][i][j][k] = M_referenceFE->d2Phi (i, j, k, M_quadratureRule->quadPointCoor (q) );
1158 M_cellNode.resize (M_nbMapDof);
1165 M_quadNode.resize (M_nbQuadPt);
1172 M_jacobian.resize (M_nbQuadPt);
1176 for (
UInt j (0); j < spaceDim; ++j)
1183 M_detJacobian.resize (M_nbQuadPt);
1186 M_wDet.resize (M_nbQuadPt);
1189 M_tInverseJacobian.resize (M_nbQuadPt);
1193 for (
UInt j (0); j < spaceDim; ++j)
1200 M_dphi.resize (M_nbQuadPt);
1207 M_d2phi.resize (M_nbQuadPt);
1215 M_laplacian.resize (M_nbQuadPt);
1225 template <
UInt spaceDim>
1227 ETCurrentFE<spaceDim, 1>::
1231 ASSERT (M_isCellNodeUpdated,
"Cell must be updated to compute the quadrature node position");
1234 #ifdef HAVE_LIFEV_DEBUG 1235 M_isQuadNodeUpdated =
true;
1250 template<
UInt spaceDim>
1252 ETCurrentFE<spaceDim, 1>::
1256 ASSERT (M_isCellNodeUpdated,
"Cell must be updated to compute the jacobian");
1259 #ifdef HAVE_LIFEV_DEBUG 1260 M_isJacobianUpdated =
true;
1263 Real partialSum (0.0);
1274 M_jacobian[iQuadPt][iDim][jDim] = partialSum;
1279 template<
UInt spaceDim>
1281 ETCurrentFE<spaceDim, 1>::
1284 ASSERT (M_isDetJacobianUpdated,
"Determinant of the jacobian must be updated to compute WDet");
1286 #ifdef HAVE_LIFEV_DEBUG 1287 M_isWDetUpdated =
true;
1294 template<
UInt spaceDim>
1296 ETCurrentFE<spaceDim, 1>::
1299 ASSERT (M_isInverseJacobianUpdated,
1300 "Inverse jacobian must be updated to compute the derivative of the basis functions");
1302 #ifdef HAVE_LIFEV_DEBUG 1303 M_isDphiUpdated =
true;
1306 Real partialSum (0.0);
1317 M_dphi[iQuadPt][iDof][iCoor] = partialSum;
1322 template<
UInt spaceDim>
1325 ASSERT ( M_isInverseJacobianUpdated,
1326 "Inverse jacobian must be updated to compute the derivative of the basis functions" );
1328 #ifdef HAVE_LIFEV_DEBUG 1329 M_isD2phiUpdated =
true;
1332 Real partialSum ( 0.0 );
1351 M_d2phi[iQuadPt][iDof][iCoor][jCoor] = partialSum;
1357 template<
UInt spaceDim >
1360 ASSERT ( M_isD2phiUpdated,
1361 "Basis function second derivatives must be updated to compute the laplacian" );
1363 #ifdef HAVE_LIFEV_DEBUG 1364 M_isLaplacianUpdated =
true;
1367 Real partialSum ( 0.0 );
1374 partialSum +=
M_d2phi[iQuadPt][iDof][iCoor][iCoor];
1382 template<
typename ElementType >
1384 ETCurrentFE<spaceDim, 1>::
1388 #ifdef HAVE_LIFEV_DEBUG 1389 M_isCellNodeUpdated =
true;
1399 M_cellNode[i][icoor] = element.point (i).coordinate (icoor);
1404 template<
UInt spaceDim >
1406 ETCurrentFE<spaceDim, 1>::
1409 #ifdef HAVE_LIFEV_DEBUG 1410 M_isCellNodeUpdated =
true;
1413 ASSERT ( ptsCoordinates.size() == M_nbMapDof,
"Number of points does not define the right geometric shape.");
1419 M_cellNode[i][icoor] = ptsCoordinates[i][icoor];
1424 template<
UInt spaceDim>
1426 ETCurrentFE<spaceDim, 1>::
1429 ASSERT (M_isCellNodeUpdated,
"Cell must be updated to compute the diameter");
1431 #ifdef HAVE_LIFEV_DEBUG 1432 M_isDiameterUpdated =
true;
1454 template<
UInt spaceDim>
1456 ETCurrentFE<spaceDim, 1>::
1459 ASSERT (M_isCellNodeUpdated,
"Cell must be updated to compute the metric");
1461 #ifdef HAVE_LIFEV_DEBUG 1462 M_isMetricUpdated =
true;
1484 Real detJ = (x2-x1)*( (y3-y1) * (z4-z1) - (y4-y1) * (z3-z1) ) - (x3-x1) * ( (y2-y1)*(z4-z1) - (z2-z1)*(y4-y1) ) + (x4-x1) * ( (y2-y1)*(z3-z1) - (z2-z1)*(y3-y1) );
1486 Real invJ11 = 1.0/detJ*(J22*J33-J32*J23);
1487 Real invJ12 = 1.0/detJ*(J13*J32-J33*J12);
1488 Real invJ13 = 1.0/detJ*(J12*J23-J22*J13);
1489 Real invJ21 = 1.0/detJ*(J23*J31-J33*J21);
1490 Real invJ22 = 1.0/detJ*(J11*J33-J31*J13);
1491 Real invJ23 = 1.0/detJ*(J13*J21-J23*J11);
1492 Real invJ31 = 1.0/detJ*(J21*J32-J31*J22);
1493 Real invJ32 = 1.0/detJ*(J12*J31-J32*J11);
1494 Real invJ33 = 1.0/detJ*(J11*J22-J21*J12);
1497 for (
int i = 0; i < 3; ++i )
1500 for (
int j = 0; j < 3; ++j )
1502 M_metricTensor(i,j) = 0.0;
1508 M_metricTensor(0,0) = invJ11*invJ11 + invJ21*invJ21 + invJ31*invJ31;
1509 M_metricTensor(0,1) = invJ11*invJ12 + invJ21*invJ22 + invJ31*invJ32;
1510 M_metricTensor(0,2) = invJ11*invJ13 + invJ21*invJ23 + invJ31*invJ33;
1512 M_metricTensor(1,0) = invJ12*invJ11 + invJ22*invJ21 + invJ32*invJ31;
1513 M_metricTensor(1,1) = invJ12*invJ12 + invJ22*invJ22 + invJ32*invJ32;
1514 M_metricTensor(1,2) = invJ12*invJ13 + invJ22*invJ23 + invJ32*invJ33;
1516 M_metricTensor(2,0) = invJ13*invJ11 + invJ23*invJ21 + invJ33*invJ31;
1517 M_metricTensor(2,1) = invJ13*invJ12 + invJ23*invJ22 + invJ33*invJ32;
1518 M_metricTensor(2,2) = invJ13*invJ13 + invJ23*invJ23 + invJ33*invJ33;
1528 template<
UInt spaceDim>
1530 ETCurrentFE<spaceDim, 1>::
1533 ASSERT (M_isWDetUpdated,
"Wdet must be updated to compute the measure");
1535 #ifdef HAVE_LIFEV_DEBUG 1536 M_isMeasureUpdated =
true;
void updateWDet(const UInt &iQuadPt)
Update WeightedJacobian.
void updateCellNode(const ElementType &element)
Update the cell nodes.
VectorSmall< spaceDim > array1D_Return_Type
VectorSmall< spaceDim > const & dphi(const UInt &i, const UInt &q) const
Getter for the derivatives of the basis function in the quadrature nodes (current element) ...
friend class ExpressionAssembly::EvaluationHK
Friend to allow direct access to the raw data.
GeometricMap - Structure for the geometrical mapping.
const Real & weight(const UInt &ig) const
weight(ig) is the ig-th quadrature weight
void updateLaplacian(const UInt &iQuadPt)
Update Laplacian.
array3D_Type M_dphiGeometricMap
friend class ExpressionAssembly::EvaluationDetJacobian
Friend to allow direct access to the raw data.
array3D_Type M_tInverseJacobian
void updateDiameter()
Update the diameter of the cell.
friend class ExpressionAssembly::EvaluationLaplacianJ
Friend to allow direct access to the raw data.
uint32_type flag_Type
bit-flag with up to 32 different flags
void updateDetJacobian(const UInt &iQuadPt)
Update DetJacobian.
VectorSmall< 3 > M_metricVector
Real const & laplacian(const UInt &i, const UInt &q) const
Getter for the derivatives of the basis function in the quadrature nodes (current element) ...
void updateQuadNode(const UInt &iQuadPt)
Update the quadrature nodes.
UInt nbFEDof() const
Getter for the number of degrees of freedom of this element.
std::vector< VectorSmall< spaceDim > > array1D_vector_Type
array3D_Type M_dphiReferenceFE
friend class ExpressionAssembly::EvaluationPhiI
Friend to allow direct access to the raw data.
MatrixSmall< 3, 3 > metricTensor() const
Getter for the metricTensor of the current element.
friend class ExpressionAssembly::EvaluationPosition
Friend to allow direct access to the raw data.
void updateD2phi(const UInt &iQuadPt)
Update D2phi.
Real dPhi(UInt i, UInt icoor, const GeoVector &v) const
return the value of the icoor-th derivative of the i-th basis function on point v ...
QuadratureRule(const QuadratureRule &qr)
Copy constructor.
void updateInverseJacobian(const UInt &iQuadPt)
static const UInt S_spaceDimension
Static value for the space dimension.
std::vector< array2D_Type > array3D_Type
void setupInternalConstants()
Resize all the internal containers w.r. to the stored data and compute the constant values...
ETCurrentFE(const ETCurrentFE< spaceDim, 1 > &otherFE)
Copy constructor.
Real measure() const
Getter for the measure of the current element.
void updateJacobian(const UInt &iQuadPt)
Update Jacobian.
Real phi(const UInt &i, const UInt &q) const
Getter for the values of the basis functions in the quadrature nodes in the current element...
std::vector< array1D_Type > array2D_Type
friend class ExpressionAssembly::EvaluationDphiI
Friend to allow direct access to the raw data.
MatrixSmall< 3, 3 > M_metricTensor
array2D_vector_Type M_dphi
ETCurrentFE()
No default constructor.
std::vector< Real > array1D_Type
void update(const elementType &element, const flag_Type &flag)
Update method.
const GeoVector & quadPointCoor(const UInt &ig) const
quadPointCoor(ig) is the full coordinates of the quadrature point ig
UInt currentId() const
Getter for the identifier of the current element.
Real detJac() const
Getter for the eterminant of the jacobian of the current element.
void operator=(const ETCurrentFE< spaceDim, 1 > &)
No assignement.
void updateMeasure()
Update the measure of the cell.
virtual ~ETCurrentFE()
Destructor.
void updateMetric()
Update the metric of the cell.
void updateInverseJacobian(const UInt &iQuadPt)
Update InverseJacobian.
std::vector< std::vector< MatrixSmall< spaceDim, spaceDim > > > array2D_matrix_Type
Real diameter() const
Getter for the diameter of the current element.
friend class ExpressionAssembly::EvaluationMeas
Friend to allow direct access to the raw data.
const GeometricMap * M_geometricMap
const UInt & nbDof() const
Return the number of degrees of freedom for this reference element.
const ReferenceFE * M_referenceFE
Real dphi(const UInt &i, const UInt &dxi, const UInt &q) const
Getter for the derivatives of the basis function in the quadrature nodes (current element) ...
VectorSmall< 3 > metricVector() const
Getter for the metricTensor of the current element.
double Real
Generic real data.
Real wDet(const UInt &q) const
Getter for the weighted jacobian determinant (current element)
ETCurrentFE(const ReferenceFE &refFE, const GeometricMap &geoMap, const QuadratureRule &qr)
Full constructor.
friend class ExpressionAssembly::EvaluationLaplacianI
Friend to allow direct access to the raw data.
The class for a reference Lagrangian finite element.
void updateCellNode(const std::vector< VectorSmall< spaceDim > > &ptsCoordinates)
Update the cell nodes with a std::vector of points.
friend class ExpressionAssembly::EvaluationDphiJ
Friend to allow direct access to the raw data.
array1D_vector_Type M_quadNode
VectorSmall()
Empty constructor (all components are set to zero)
std::vector< std::vector< VectorSmall< spaceDim > > > array2D_vector_Type
ETCurrentFE(const ReferenceFE &refFE, const GeometricMap &geoMap)
Constructor without quadrature rule.
array2D_matrix_Type M_d2phi
void updateDphi(const UInt &iQuadPt)
Update Dphi.
static const UInt S_fieldDimension
Static value for the dimension of the field (1 here as it is a scalar FE)
const QuadratureRule * M_quadratureRule
friend class ExpressionAssembly::EvaluationMetricVector
Friend to allow direct access to the raw data.
QuadratureRule - The basis class for storing and accessing quadrature rules.
void showMe(std::ostream &out=std::cout) const
ShowMe method.
Real phi(UInt i, const GeoVector &v) const
Return the value of the i-th basis function in the point v.
friend class ExpressionAssembly::EvaluationPhiJ
Friend to allow direct access to the raw data.
array1D_Type M_detJacobian
array4D_Type M_d2phiReferenceFE
void setQuadratureRule(const QuadratureRule &qr)
Setter for the quadrature rule.
const UInt & nbQuadPt() const
Getter for the number of quadrature points.
friend class ExpressionAssembly::EvaluationMetricTensor
Friend to allow direct access to the raw data.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
std::vector< array3D_Type > array4D_Type
Real quadNode(const UInt &q, const UInt &coord) const
Getter for the coordinates of the quadrature nodes in the current element.