LifeV
BuildGraph.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory UNiversity
7 
8  This file is part of the LifeV library
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, see <http://www.gnu.org/licenses/>
22 
23 
24 *******************************************************************************
25 */
26 //@HEADER
27 
28 /*!
29  * @file
30  @brief This file contains the definition of the buildGraph function.
31 
32  This function is used to precompute the graph of a finite element
33  matrix, allowing the matrix to be build in closed, optimized form,
34  which makes the assembly procedure more efficient
35 
36  @date 03/2013
37  @author Radu Popescu <radu.popescu@epfl.ch>
38  */
39 
40 #ifndef BUILD_GRAPH_HPP
41 #define BUILD_GRAPH_HPP
42 
43 #include <lifev/core/LifeV.hpp>
44 
45 #include <lifev/core/util/OpenMPParameters.hpp>
46 
47 #include <lifev/eta/expression/RequestLoopElement.hpp>
48 
49 #include <lifev/core/fem/QuadratureRule.hpp>
50 
51 #include <lifev/eta/expression/GraphElement.hpp>
52 
53 #include <boost/shared_ptr.hpp>
54 
55 namespace LifeV
56 {
57 
58 /*!
59  \namespace ExpressionAssembly
60 
61  Namespace for the assembly via expressions
62 
63  */
64 namespace ExpressionAssembly
65 {
66 
67 //! Function to precompute the matrix graph
68 /*!
69  @author Radu Popescu <radu.popescu@epfl.ch>
70 
71  This is a helper function to precompute the Crs graph used to build
72  a FECrsMatrix in closed optimized form
73  */
74 template < typename MeshType,
75  typename TestSpaceType,
76  typename SolutionSpaceType,
77  typename ExpressionType >
78 GraphElement < MeshType,
79  TestSpaceType,
80  SolutionSpaceType,
81  ExpressionType >
82  buildGraph ( const RequestLoopElement<MeshType>& request,
83  const QuadratureRule& quadrature,
84  const std::shared_ptr<TestSpaceType>& testSpace,
85  const std::shared_ptr<SolutionSpaceType>& solutionSpace,
86  const ExpressionType& expression,
87  const UInt offsetUp = 0,
88  const UInt offsetLeft = 0);
89 template < typename MeshType,
90  typename TestSpaceType,
91  typename SolutionSpaceType,
92  typename ExpressionType >
93 GraphElement < MeshType,
94  TestSpaceType,
95  SolutionSpaceType,
96  ExpressionType >
97  buildGraph ( const RequestLoopElement<MeshType>& request,
98  const QuadratureRule& quadrature,
99  const std::shared_ptr<TestSpaceType>& testSpace,
100  const std::shared_ptr<SolutionSpaceType>& solutionSpace,
101  const ExpressionType& expression,
102  const UInt offsetUp,
103  const UInt offsetLeft)
104 {
105  return GraphElement < MeshType,
106  TestSpaceType,
107  SolutionSpaceType,
108  ExpressionType >
109  (request.mesh(), quadrature, testSpace, solutionSpace, expression,
110  OpenMPParameters(), offsetUp, offsetLeft );
111 }
112 
113 template < typename MeshType,
114 typename TestSpaceType,
115 typename SolutionSpaceType,
116 typename ExpressionType >
117 GraphElement < MeshType,
118  TestSpaceType,
119  SolutionSpaceType,
120  ExpressionType >
121  buildGraph ( const RequestLoopElement<MeshType>& request,
122  const QuadratureRule& quadrature,
123  const std::shared_ptr<TestSpaceType>& testSpace,
124  const std::shared_ptr<SolutionSpaceType>& solutionSpace,
125  const ExpressionType& expression,
126  const OpenMPParameters& ompParams,
127  const UInt offsetUp = 0,
128  const UInt offsetLeft = 0);
129 template < typename MeshType,
130  typename TestSpaceType,
131  typename SolutionSpaceType,
132  typename ExpressionType >
133 GraphElement < MeshType,
134  TestSpaceType,
135  SolutionSpaceType,
136  ExpressionType >
137  buildGraph ( const RequestLoopElement<MeshType>& request,
138  const QuadratureRule& quadrature,
139  const std::shared_ptr<TestSpaceType>& testSpace,
140  const std::shared_ptr<SolutionSpaceType>& solutionSpace,
141  const ExpressionType& expression,
142  const OpenMPParameters& ompParams,
143  const UInt offsetUp,
144  const UInt offsetLeft)
145 {
146  return GraphElement < MeshType,
147  TestSpaceType,
148  SolutionSpaceType,
149  ExpressionType >
150  (request.mesh(), quadrature, testSpace, solutionSpace, expression,
151  ompParams, offsetUp, offsetLeft);
152 }
153 
154 } // Namespace ExpressionAssembly
155 
156 } // Namespace LifeV
157 
158 #endif // BUILD_GRAPH_HPP
The class to actually perform the loop over the elements to precompute a graph.
GraphElement< MeshType, TestSpaceType, SolutionSpaceType, ExpressionType > buildGraph(const RequestLoopElement< MeshType > &request, 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)
Definition: BuildGraph.hpp:137
GraphElement< MeshType, TestSpaceType, SolutionSpaceType, ExpressionType > buildGraph(const RequestLoopElement< MeshType > &request, const QuadratureRule &quadrature, const std::shared_ptr< TestSpaceType > &testSpace, const std::shared_ptr< SolutionSpaceType > &solutionSpace, const ExpressionType &expression, const UInt offsetUp=0, const UInt offsetLeft=0)
Function to precompute the matrix graph.
Definition: BuildGraph.hpp:97
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191