36 #ifndef EVALUATENODALEXPRESSION_VECTOR_FACE_ID_HPP 37 #define EVALUATENODALEXPRESSION_VECTOR_FACE_ID_HPP 39 #include <lifev/core/LifeV.hpp> 41 #include <lifev/eta/fem/QuadratureBoundary.hpp> 42 #include <lifev/eta/fem/ETCurrentFE.hpp> 43 #include <lifev/eta/fem/ETCurrentBDFE.hpp> 44 #include <lifev/eta/fem/MeshGeometricMap.hpp> 46 #include <lifev/eta/expression/ExpressionToEvaluation.hpp> 48 #include <lifev/eta/array/ETVectorElemental.hpp> 67 template <
typename MeshType,
typename SolutionTestSpace,
typename ExpressionType>
68 class EvaluateNodalExpressionVectorElementFaceID
76 typedef typename ExpressionToEvaluation < ExpressionType,
77 SolutionTestSpace::field_dim,
79 3 >::evaluation_Type evaluation_Type;
88 EvaluateNodalExpressionVectorElementFaceID (
const std::shared_ptr<MeshType>& mesh,
89 const UInt boundaryID,
90 const QuadratureBoundary& quadratureBD,
91 const std::shared_ptr<SolutionTestSpace>& testSpace,
92 const ExpressionType& expression);
95 EvaluateNodalExpressionVectorElementFaceID (
const EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>& integrator);
98 ~EvaluateNodalExpressionVectorElementFaceID();
107 template <
typename VectorType>
108 inline void operator>> (VectorType& vector)
114 template <
typename VectorType>
115 inline void operator>> (std::shared_ptr<VectorType> vector)
127 void check (std::ostream& out = std::cout);
137 template <
typename VectorType>
138 void addTo (VectorType& vec);
148 EvaluateNodalExpressionVectorElementFaceID();
153 std::shared_ptr<MeshType> M_mesh;
159 QuadratureBoundary M_quadratureBoundary;
162 std::shared_ptr<SolutionTestSpace> M_solutionSpace;
165 evaluation_Type M_evaluation;
167 std::vector<ETCurrentBDFE<3>*> M_globalCFE;
168 std::vector<ETCurrentFE<3, SolutionTestSpace::field_dim>*> M_testCFE;
170 ETVectorElemental M_elementalVector;
182 template <
typename MeshType,
typename SolutionTestSpace,
typename ExpressionType>
183 EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>::
184 EvaluateNodalExpressionVectorElementFaceID (
const std::shared_ptr<MeshType>& mesh,
185 const UInt boundaryID,
186 const QuadratureBoundary& quadratureBD,
187 const std::shared_ptr<SolutionTestSpace>& testSpace,
188 const ExpressionType& expression)
190 M_boundaryId (boundaryID),
191 M_quadratureBoundary (quadratureBD),
192 M_solutionSpace (testSpace),
193 M_evaluation (expression),
198 M_elementalVector (SolutionTestSpace::field_dim * testSpace->refFE().nbDof() )
200 for (
UInt i (0); i < 4; ++i)
202 M_globalCFE[i] =
new ETCurrentBDFE<3> (geometricMapFromMesh<MeshType>()
203 , M_quadratureBoundary.qr (i) );
204 M_testCFE[i] =
new ETCurrentFE<3, SolutionTestSpace::field_dim> (testSpace->refFE()
205 , testSpace->geoMap()
206 , M_quadratureBoundary.qr (i) );
210 std::vector< VectorSmall<3> > t0 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
217 std::vector< VectorSmall<3> > t1 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
224 std::vector< VectorSmall<3> > t2 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
234 std::vector< VectorSmall<3> > t3 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
242 M_globalCFE[0]->setRefTangents (t0);
243 M_globalCFE[1]->setRefTangents (t1);
244 M_globalCFE[2]->setRefTangents (t2);
245 M_globalCFE[3]->setRefTangents (t3);
248 M_evaluation.setQuadrature (M_quadratureBoundary.qr (0) );
249 M_evaluation.setGlobalCFE (M_globalCFE[0]);
250 M_evaluation.setTestCFE (M_testCFE[0]);
254 template <
typename MeshType,
typename SolutionTestSpace,
typename ExpressionType>
255 EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>::
256 EvaluateNodalExpressionVectorElementFaceID (
const EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>& integrator)
257 : M_mesh (integrator.M_mesh),
258 M_boundaryId (integrator.M_boundaryId),
259 M_quadratureBoundary (integrator.M_quadratureBoundary),
260 M_solutionSpace (integrator.M_solutionSpace),
261 M_evaluation (integrator.M_evaluation),
266 M_elementalVector (integrator.M_elementalVector)
268 for (
UInt i (0); i < 4; ++i)
270 M_globalCFE[i] =
new ETCurrentBDFE<3> (geometricMapFromMesh<MeshType>()
271 , M_quadratureBoundary.qr (i) );
272 M_testCFE[i] =
new ETCurrentFE<3, SolutionTestSpace::field_dim> (M_solutionSpace->refFE()
273 , M_solutionSpace->geoMap()
274 , M_quadratureBoundary.qr (i) );
278 std::vector< VectorSmall<3> > t0 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
285 std::vector< VectorSmall<3> > t1 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
292 std::vector< VectorSmall<3> > t2 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
302 std::vector< VectorSmall<3> > t3 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
310 M_globalCFE[0]->setRefTangents (t0);
311 M_globalCFE[1]->setRefTangents (t1);
312 M_globalCFE[2]->setRefTangents (t2);
313 M_globalCFE[3]->setRefTangents (t3);
316 M_evaluation.setQuadrature (M_quadratureBoundary.qr (0) );
317 M_evaluation.setGlobalCFE (M_globalCFE[0]);
318 M_evaluation.setTestCFE (M_testCFE[0]);
322 template <
typename MeshType,
typename SolutionTestSpace,
typename ExpressionType>
323 EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>::
324 ~EvaluateNodalExpressionVectorElementFaceID()
326 for (
UInt i (0); i < 4; ++i)
328 delete M_globalCFE[i];
337 template <
typename MeshType,
typename SolutionTestSpace,
typename ExpressionType>
339 EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>::
340 check (std::ostream& out)
342 out <<
" Checking the integration : " << std::endl;
343 M_evaluation.display (out);
345 out <<
" Elemental vector : " << std::endl;
346 M_elementalVector.showMe (out);
351 template <
typename VectorType>
353 EvaluateNodalExpressionVectorElementFaceID < MeshType, SolutionTestSpace, ExpressionType>::
354 addTo (VectorType& vec)
356 UInt nbBoundaryFaces (M_mesh->numBFaces() );
357 UInt nbTestDof (M_solutionSpace->refFE().nbDof() );
363 for (
UInt iFace (0); iFace < nbBoundaryFaces; ++iFace)
366 if ( M_mesh->face (iFace).markerID() != M_boundaryId )
374 M_elementalVector.zero();
377 UInt faceIDinAdjacentElement (M_mesh->face (iFace).firstAdjacentElementPosition() );
380 UInt adjacentElementID (M_mesh->face (iFace).firstAdjacentElementIdentity() );
383 M_globalCFE[faceIDinAdjacentElement]
384 ->update (M_mesh->element (adjacentElementID) );
385 M_testCFE[faceIDinAdjacentElement]
386 ->update (M_mesh->element (adjacentElementID), evaluation_Type::S_testUpdateFlag);
389 M_evaluation.setQuadrature (M_quadratureBoundary.qr (faceIDinAdjacentElement) );
390 M_evaluation.setGlobalCFE (M_globalCFE[faceIDinAdjacentElement]);
391 M_evaluation.setTestCFE (M_testCFE[faceIDinAdjacentElement]);
393 M_evaluation.update (adjacentElementID);
396 for (
UInt iblock (0); iblock < SolutionTestSpace::field_dim; ++iblock)
399 for (
UInt i (0); i < nbTestDof; ++i)
401 M_elementalVector.setRowIndex
402 (i + iblock * nbTestDof,
403 M_solutionSpace->dof().localToGlobalMap (adjacentElementID, i) + iblock * M_solutionSpace->dof().numTotalDof() );
407 for (UInt iQuadPt (0); iQuadPt < M_quadratureBoundary.qr (faceIDinAdjacentElement).nbQuadPt(); ++iQuadPt)
409 for (UInt i (0); i < nbTestDof; ++i)
411 M_elementalVector.element (i + iblock * nbTestDof) +=
412 M_evaluation.value_qi (iQuadPt, i + iblock * nbTestDof);
418 M_elementalVector.pushToGlobal (vec);
uint32_type UInt
generic unsigned integer (used mainly for addressing)