36 #ifndef GRAPH_ELEMENT_HPP 37 #define GRAPH_ELEMENT_HPP 43 #include <lifev/core/LifeV.hpp> 44 #include <lifev/core/util/OpenMPParameters.hpp> 46 #include <lifev/core/fem/QuadratureRule.hpp> 47 #include <lifev/eta/fem/ETCurrentFE.hpp> 48 #include <lifev/eta/fem/MeshGeometricMap.hpp> 50 #include <lifev/eta/expression/ExpressionToEvaluation.hpp> 52 #include <lifev/eta/array/ETMatrixElemental.hpp> 54 #include <boost/shared_ptr.hpp> 72 template <
typename MeshType,
73 typename TestSpaceType,
74 typename SolutionSpaceType,
75 typename ExpressionType >
84 typedef typename ExpressionToEvaluation < ExpressionType,
85 TestSpaceType::field_dim,
86 SolutionSpaceType::field_dim,
98 const std::shared_ptr<TestSpaceType>& testSpace,
99 const std::shared_ptr<SolutionSpaceType>& solutionSpace,
100 const ExpressionType& expression,
101 const OpenMPParameters& ompParams,
102 const UInt offsetUp = 0,
103 const UInt offsetLeft = 0);
109 ExpressionType > & integrator);
121 template <
typename GraphType>
122 inline void operator>> (std::shared_ptr<GraphType> graph)
141 template <
typename GraphType>
142 void addTo (GraphType& graph);
151 template <
typename GraphType>
152 inline void addTo (std::shared_ptr<GraphType> graph)
154 ASSERT (graph != 0,
" Cannot assemble with an empty graph");
197 template <
typename MeshType,
typename TestSpaceType,
typename SolutionSpaceType,
typename ExpressionType>
198 GraphElement<MeshType, TestSpaceType, SolutionSpaceType, ExpressionType>::
201 const std::shared_ptr<TestSpaceType>& testSpace,
202 const std::shared_ptr<SolutionSpaceType>& solutionSpace,
203 const ExpressionType& ,
204 const OpenMPParameters& ompParams,
206 const UInt offsetLeft)
217 template <
typename MeshType,
typename TestSpaceType,
typename SolutionSpaceType,
typename ExpressionType>
218 GraphElement<MeshType, TestSpaceType, SolutionSpaceType, ExpressionType>::
230 template <
typename MeshType,
typename TestSpaceType,
typename SolutionSpaceType,
typename ExpressionType>
231 GraphElement<MeshType, TestSpaceType, SolutionSpaceType, ExpressionType>::
240 template <
typename MeshType,
typename TestSpaceType,
typename SolutionSpaceType,
typename ExpressionType>
242 GraphElement<MeshType, TestSpaceType, SolutionSpaceType, ExpressionType>::
249 template <
typename GraphType>
251 GraphElement<MeshType, TestSpaceType, SolutionSpaceType, ExpressionType>::
254 UInt nbElements (M_mesh->numElements() );
255 UInt nbTestDof (M_testSpace->refFE().nbDof() );
256 UInt nbSolutionDof (M_solutionSpace->refFE().nbDof() );
263 ETMatrixElemental elementalMatrix (TestSpaceType::field_dim * M_testSpace->refFE().nbDof(),
264 SolutionSpaceType::field_dim * M_solutionSpace->refFE().nbDof() );
266 #pragma omp for schedule(runtime) 267 for (
UInt iElement = 0; iElement < nbElements; ++iElement)
270 elementalMatrix.zero();
273 for (
UInt iblock (0); iblock < TestSpaceType::field_dim; ++iblock)
275 for (
UInt jblock (0); jblock < SolutionSpaceType::field_dim; ++jblock)
279 for (
UInt i (0); i < nbTestDof; ++i)
281 elementalMatrix.setRowIndex
282 (i + iblock * nbTestDof,
283 M_testSpace->dof().localToGlobalMap (iElement, i) + iblock * M_testSpace->dof().numTotalDof() + M_offsetUp);
287 for (
UInt j (0); j < nbSolutionDof; ++j)
289 elementalMatrix.setColumnIndex
290 (j + jblock * nbSolutionDof,
291 M_solutionSpace->dof().localToGlobalMap (iElement, j) + jblock * M_solutionSpace->dof().numTotalDof() + M_offsetLeft);
295 const std::vector<Int>& rowIdx = elementalMatrix.rowIndices();
296 const std::vector<Int>& colIdx = elementalMatrix.columnIndices();
299 graph.InsertGlobalIndices (rowIdx.size(), &rowIdx[0],
300 colIdx.size(), &colIdx[0]);
GraphElement(const GraphElement< MeshType, TestSpaceType, SolutionSpaceType, ExpressionType > &integrator)
Copy constructor.
ExpressionToEvaluation< ExpressionType, TestSpaceType::field_dim, SolutionSpaceType::field_dim, 3 >::evaluation_Type evaluation_Type
Type of the Evaluation.
OpenMPParameters M_ompParams
~GraphElement()
Destructor.
void operator>>(std::shared_ptr< GraphType > graph)
Operator wrapping the addTo method (for shared_ptr)
void addTo(std::shared_ptr< GraphType > graph)
Method that performs the assembly.
std::shared_ptr< MeshType > M_mesh
std::shared_ptr< TestSpaceType > M_testSpace
GraphElement()
No empty constructor.
The class to actually perform the loop over the elements to precompute a graph.
QuadratureRule M_quadrature
GraphElement(const std::shared_ptr< MeshType > &mesh, const QuadratureRule &quadrature, const std::shared_ptr< TestSpaceType > &testSpace, const std::shared_ptr< SolutionSpaceType > &solutionSpace, const ExpressionType &expression, const OpenMPParameters &ompParams, const UInt offsetUp=0, const UInt offsetLeft=0)
Full data constructor.
void addTo(GraphType &graph)
Method that builds the graph.
std::shared_ptr< SolutionSpaceType > M_solutionSpace
QuadratureRule - The basis class for storing and accessing quadrature rules.
void check(std::ostream &out=std::cout)
Ouput method.
uint32_type UInt
generic unsigned integer (used mainly for addressing)