36 #ifndef EVALUATION_INTERPOLATE_LAPLACIAN_HPP 37 #define EVALUATION_INTERPOLATE_LAPLACIAN_HPP 39 #include <lifev/core/LifeV.hpp> 41 #include <lifev/core/array/VectorEpetra.hpp> 42 #include <lifev/core/array/VectorSmall.hpp> 43 #include <lifev/core/array/MatrixSmall.hpp> 45 #include <lifev/eta/fem/ETCurrentFE.hpp> 46 #include <lifev/eta/fem/ETCurrentFlag.hpp> 47 #include <lifev/eta/fem/ETFESpace.hpp> 48 #include <lifev/core/fem/QuadratureRule.hpp> 50 #include <lifev/eta/expression/ExpressionInterpolateLaplacian.hpp> 56 namespace ExpressionAssembly
72 template<
typename MeshType,
typename MapType,
UInt SpaceDim,
UInt FieldDim>
73 class EvaluationInterpolateLaplacian
84 typedef ETFESpace<MeshType, MapType, SpaceDim, FieldDim> fespace_Type;
87 typedef std::shared_ptr<fespace_Type> fespacePtr_Type;
114 EvaluationInterpolateLaplacian (
const EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, FieldDim>& evaluation)
116 M_fespace ( evaluation.M_fespace),
117 M_vector ( evaluation.M_vector, Repeated),
119 M_currentFE (evaluation.M_currentFE),
120 M_interpolatedLaplacians (evaluation.M_interpolatedLaplacians)
122 if (evaluation.M_quadrature != 0)
129 explicit EvaluationInterpolateLaplacian (
const ExpressionInterpolateLaplacian<MeshType, MapType, SpaceDim, FieldDim>& expression)
131 M_fespace ( expression.fespace() ),
132 M_vector ( expression.vector(), Repeated ),
134 M_currentFE (M_fespace->refFE(), M_fespace->geoMap() ),
135 M_interpolatedLaplacians (0)
139 ~EvaluationInterpolateLaplacian()
141 if (M_quadrature != 0)
153 void update (
const UInt& iElement)
157 M_currentFE.update (M_fespace->mesh()->element (iElement), ET_UPDATE_LAPLACIAN);
159 for (UInt i (0); i < M_fespace->refFE().nbDof(); ++i)
161 for (UInt q (0); q < M_quadrature->nbQuadPt(); ++q)
163 for (UInt jDim (0); jDim < FieldDim; ++jDim)
165 UInt globalID (M_fespace->dof().localToGlobalMap (iElement, i)
166 + jDim * M_fespace->dof().numTotalDof() );
168 M_interpolatedLaplacians[q][jDim] +=
169 M_currentFE.laplacian (i + jDim * M_currentFE.nbFEDof(), q)[jDim]
170 * M_vector[globalID];
182 for (
UInt j (0); j < FieldDim; ++j)
184 M_interpolatedLaplacians[q][j] = 0.0;
190 void showValues()
const 192 std::cout <<
" Laplacians : " << std::endl;
196 std::cout << M_interpolatedLaplacians[i] << std::endl;
201 static void display (std::ostream& out = std::cout)
203 out <<
"interpolated[ " << FieldDim <<
" ][ " << SpaceDim <<
" ]";
213 template<
typename CFEType >
214 void setGlobalCFE (
const CFEType* )
218 template<
typename CFEType >
219 void setTestCFE (
const CFEType* )
223 template<
typename CFEType >
224 void setSolutionCFE (
const CFEType* )
230 if (M_quadrature != 0)
235 M_currentFE.setQuadratureRule (qr);
236 M_interpolatedLaplacians.resize (qr.nbQuadPt() );
246 return_Type value_q (
const UInt& q)
const 248 return M_interpolatedLaplacians[q];
252 return_Type value_qi (
const UInt& q,
const UInt& )
const 254 return M_interpolatedLaplacians[q];
258 return_Type value_qij (
const UInt& q,
const UInt& ,
const UInt& )
const 260 return M_interpolatedLaplacians[q];
272 EvaluationInterpolateLaplacian();
277 fespacePtr_Type M_fespace;
278 vector_Type M_vector;
282 ETCurrentFE<SpaceDim, FieldDim> M_currentFE;
285 std::vector<return_Type> M_interpolatedLaplacians;
288 template<
typename MeshType,
typename MapType,
UInt SpaceDim,
UInt FieldDim>
290 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, FieldDim>::
291 S_globalUpdateFlag = ET_UPDATE_NONE;
293 template<
typename MeshType,
typename MapType,
UInt SpaceDim,
UInt FieldDim>
295 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, FieldDim>::
296 S_testUpdateFlag = ET_UPDATE_NONE;
298 template<
typename MeshType,
typename MapType,
UInt SpaceDim,
UInt FieldDim>
300 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, FieldDim>::
301 S_solutionUpdateFlag = ET_UPDATE_NONE;
316 template<
typename MeshType,
typename MapType,
UInt SpaceDim>
317 class EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>
329 typedef ETFESpace<MeshType, MapType, SpaceDim, 1> fespace_Type;
332 typedef std::shared_ptr<fespace_Type> fespacePtr_Type;
359 EvaluationInterpolateLaplacian (
const EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>& evaluation)
361 M_fespace ( evaluation.M_fespace),
362 M_vector ( evaluation.M_vector, Repeated),
363 M_offset ( evaluation.M_offset ),
365 M_currentFE (evaluation.M_currentFE),
366 M_interpolatedLaplacians (evaluation.M_interpolatedLaplacians)
368 if (evaluation.M_quadrature != 0)
375 explicit EvaluationInterpolateLaplacian (
const ExpressionInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>& expression)
377 M_fespace ( expression.fespace() ),
378 M_vector ( expression.vector(), Repeated ),
379 M_offset ( expression.offset() ),
381 M_currentFE (M_fespace->refFE(), M_fespace->geoMap() ),
382 M_interpolatedLaplacians (0)
386 ~EvaluationInterpolateLaplacian()
388 if (M_quadrature != 0)
401 void update (
const UInt& iElement)
405 M_currentFE.update (M_fespace->mesh()->element (iElement), ET_UPDATE_LAPLACIAN);
407 for (UInt i (0); i < M_fespace->refFE().nbDof(); ++i)
409 for (UInt q (0); q < M_quadrature->nbQuadPt(); ++q)
411 UInt globalID (M_fespace->dof().localToGlobalMap (iElement, i) + M_offset);
413 M_interpolatedLaplacians[q] +=
414 M_currentFE.laplacian (i, q)
415 * M_vector[globalID];
425 for (
UInt i (0); i < SpaceDim; ++i)
427 M_interpolatedLaplacians[q] = 0.0;
433 void showValues()
const 435 std::cout <<
" Gradients : " << std::endl;
439 std::cout << M_interpolatedLaplacians[i] << std::endl;
444 static void display (std::ostream& out = std::cout)
446 out <<
"interpolated[ " << SpaceDim <<
" ]";
456 template<
typename CFEType >
457 void setGlobalCFE (
const CFEType* )
461 template<
typename CFEType >
462 void setTestCFE (
const CFEType* )
466 template<
typename CFEType >
467 void setSolutionCFE (
const CFEType* )
473 if (M_quadrature != 0)
478 M_currentFE.setQuadratureRule (qr);
479 M_interpolatedLaplacians.resize (qr.nbQuadPt() );
489 return_Type value_q (
const UInt& q)
const 491 return M_interpolatedLaplacians[q];
495 return_Type value_qi (
const UInt& q,
const UInt& )
const 497 return M_interpolatedLaplacians[q];
501 return_Type value_qij (
const UInt& q,
const UInt& ,
const UInt& )
const 503 return M_interpolatedLaplacians[q];
514 EvaluationInterpolateLaplacian();
519 fespacePtr_Type M_fespace;
520 vector_Type M_vector;
525 ETCurrentFE<SpaceDim, 1> M_currentFE;
528 std::vector<return_Type> M_interpolatedLaplacians;
532 template<
typename MeshType,
typename MapType,
UInt SpaceDim>
534 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>::
535 S_globalUpdateFlag = ET_UPDATE_NONE;
537 template<
typename MeshType,
typename MapType,
UInt SpaceDim>
539 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>::
540 S_testUpdateFlag = ET_UPDATE_NONE;
542 template<
typename MeshType,
typename MapType,
UInt SpaceDim>
544 EvaluationInterpolateLaplacian<MeshType, MapType, SpaceDim, 1>::
545 S_solutionUpdateFlag = ET_UPDATE_NONE;
VectorEpetra - The Epetra Vector format Wrapper.
uint32_type flag_Type
bit-flag with up to 32 different flags
QuadratureRule(const QuadratureRule &qr)
Copy constructor.
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
QuadratureRule - The basis class for storing and accessing quadrature rules.
const UInt & nbQuadPt() const
Getter for the number of quadrature points.
uint32_type UInt
generic unsigned integer (used mainly for addressing)