36 #ifndef INTEGRATE_VECTOR_FACE_ID_HPP 37 #define INTEGRATE_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> 50 #include <boost/shared_ptr.hpp> 57 namespace ExpressionAssembly
69 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
70 class IntegrateVectorFaceID
78 typedef typename ExpressionToEvaluation < ExpressionType,
79 TestSpaceType::field_dim,
81 3 >::evaluation_Type evaluation_Type;
90 IntegrateVectorFaceID (
const std::shared_ptr<MeshType>& mesh,
91 const UInt boundaryID,
92 const QuadratureBoundary& quadratureBD,
93 const std::shared_ptr<TestSpaceType>& testSpace,
94 const ExpressionType& expression);
97 IntegrateVectorFaceID (
const IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>& integrator);
100 ~IntegrateVectorFaceID();
109 template <
typename VectorType>
110 inline void operator>> (VectorType& vector)
116 template <
typename VectorType>
117 inline void operator>> (std::shared_ptr<VectorType> vector)
129 void check (std::ostream& out = std::cout);
139 template <
typename VectorType>
140 void addTo (VectorType& vec);
150 IntegrateVectorFaceID();
155 std::shared_ptr<MeshType> M_mesh;
161 QuadratureBoundary M_quadratureBoundary;
164 std::shared_ptr<TestSpaceType> M_testSpace;
167 evaluation_Type M_evaluation;
169 std::vector<ETCurrentBDFE<3>*> M_globalCFE;
170 std::vector<ETCurrentFE<3, TestSpaceType::field_dim>*> M_testCFE;
172 ETVectorElemental M_elementalVector;
184 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
185 IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>::
186 IntegrateVectorFaceID (
const std::shared_ptr<MeshType>& mesh,
187 const UInt boundaryID,
188 const QuadratureBoundary& quadratureBD,
189 const std::shared_ptr<TestSpaceType>& testSpace,
190 const ExpressionType& expression)
192 M_boundaryId (boundaryID),
193 M_quadratureBoundary (quadratureBD),
194 M_testSpace (testSpace),
195 M_evaluation (expression),
200 M_elementalVector (TestSpaceType::field_dim * testSpace->refFE().nbDof() )
202 for (UInt i (0); i < 4; ++i)
204 M_globalCFE[i] =
new ETCurrentBDFE<3> (geometricMapFromMesh<MeshType>()
205 , M_quadratureBoundary.qr (i) );
206 M_testCFE[i] =
new ETCurrentFE<3, TestSpaceType::field_dim> (testSpace->refFE()
207 , testSpace->geoMap()
208 , M_quadratureBoundary.qr (i) );
212 std::vector< VectorSmall<3> > t0 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
219 std::vector< VectorSmall<3> > t1 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
226 std::vector< VectorSmall<3> > t2 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
236 std::vector< VectorSmall<3> > t3 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
244 M_globalCFE[0]->setRefTangents (t0);
245 M_globalCFE[1]->setRefTangents (t1);
246 M_globalCFE[2]->setRefTangents (t2);
247 M_globalCFE[3]->setRefTangents (t3);
250 M_evaluation.setQuadrature (M_quadratureBoundary.qr (0) );
251 M_evaluation.setGlobalCFE (M_globalCFE[0]);
252 M_evaluation.setTestCFE (M_testCFE[0]);
256 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
257 IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>::
258 IntegrateVectorFaceID (
const IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>& integrator)
259 : M_mesh (integrator.M_mesh),
260 M_boundaryId (integrator.M_boundaryId),
261 M_quadratureBoundary (integrator.M_quadratureBoundary),
262 M_testSpace (integrator.M_testSpace),
263 M_evaluation (integrator.M_evaluation),
268 M_elementalVector (integrator.M_elementalVector)
270 for (UInt i (0); i < 4; ++i)
272 M_globalCFE[i] =
new ETCurrentBDFE<3> (geometricMapFromMesh<MeshType>()
273 , M_quadratureBoundary.qr (i) );
274 M_testCFE[i] =
new ETCurrentFE<3, TestSpaceType::field_dim> (M_testSpace->refFE()
275 , M_testSpace->geoMap()
276 , M_quadratureBoundary.qr (i) );
280 std::vector< VectorSmall<3> > t0 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
287 std::vector< VectorSmall<3> > t1 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
294 std::vector< VectorSmall<3> > t2 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
304 std::vector< VectorSmall<3> > t3 (2, VectorSmall<3> (0.0, 0.0, 0.0) );
312 M_globalCFE[0]->setRefTangents (t0);
313 M_globalCFE[1]->setRefTangents (t1);
314 M_globalCFE[2]->setRefTangents (t2);
315 M_globalCFE[3]->setRefTangents (t3);
318 M_evaluation.setQuadrature (M_quadratureBoundary.qr (0) );
319 M_evaluation.setGlobalCFE (M_globalCFE[0]);
320 M_evaluation.setTestCFE (M_testCFE[0]);
324 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
325 IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>::
326 ~IntegrateVectorFaceID()
328 for (UInt i (0); i < 4; ++i)
330 delete M_globalCFE[i];
339 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
341 IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>::
342 check (std::ostream& out)
344 out <<
" Checking the integration : " << std::endl;
345 M_evaluation.display (out);
347 out <<
" Elemental vector : " << std::endl;
348 M_elementalVector.showMe (out);
352 template <
typename MeshType,
typename TestSpaceType,
typename ExpressionType>
353 template <
typename VectorType>
355 IntegrateVectorFaceID < MeshType, TestSpaceType, ExpressionType>::
356 addTo (VectorType& vec)
358 UInt nbBoundaryFaces (M_mesh->numBFaces() );
359 UInt nbTestDof (M_testSpace->refFE().nbDof() );
365 for (UInt iFace (0); iFace < nbBoundaryFaces; ++iFace)
368 if ( M_mesh->face (iFace).markerID() != M_boundaryId )
376 M_elementalVector.zero();
379 UInt faceIDinAdjacentElement (M_mesh->face (iFace).firstAdjacentElementPosition() );
382 UInt adjacentElementID (M_mesh->face (iFace).firstAdjacentElementIdentity() );
385 M_globalCFE[faceIDinAdjacentElement]
386 ->update (M_mesh->element (adjacentElementID) );
387 M_testCFE[faceIDinAdjacentElement]
388 ->update (M_mesh->element (adjacentElementID), evaluation_Type::S_testUpdateFlag);
391 M_evaluation.setQuadrature (M_quadratureBoundary.qr (faceIDinAdjacentElement) );
392 M_evaluation.setGlobalCFE (M_globalCFE[faceIDinAdjacentElement]);
393 M_evaluation.setTestCFE (M_testCFE[faceIDinAdjacentElement]);
395 M_evaluation.update (adjacentElementID);
398 for (UInt iblock (0); iblock < TestSpaceType::field_dim; ++iblock)
401 for (UInt i (0); i < nbTestDof; ++i)
403 M_elementalVector.setRowIndex
404 (i + iblock * nbTestDof,
405 M_testSpace->dof().localToGlobalMap (adjacentElementID, i) + iblock * M_testSpace->dof().numTotalDof() );
409 for (UInt iQuadPt (0); iQuadPt < M_quadratureBoundary.qr (faceIDinAdjacentElement).nbQuadPt(); ++iQuadPt)
411 for (UInt i (0); i < nbTestDof; ++i)
413 M_elementalVector.element (i + iblock * nbTestDof) +=
414 M_evaluation.value_qi (iQuadPt, i + iblock * nbTestDof)
415 * M_globalCFE[faceIDinAdjacentElement]->M_wMeas[iQuadPt];
421 M_elementalVector.pushToGlobal (vec);