32 #include <feel/feelcore/parameter.hpp>
34 #include <feel/feelalg/vector.hpp>
37 #include <feel/feeldiscr/functionspace.hpp>
43 template<
typename T>
class Vector;
48 template<
typename X1,
typename X2>
50 vf::detail::BilinearForm<X1, X2>
51 form( boost::shared_ptr<X1>
const& __X1,
52 boost::shared_ptr<X2>
const& __X2,
53 boost::shared_ptr<MatrixSparse<double> > __M,
57 bool do_threshold =
false,
58 typename X1::value_type threshold = type_traits<double>::epsilon(),
61 return vf::detail::BilinearForm<X1, X2>( __X1, __X2, __M, rowstart, colstart, init, do_threshold, threshold, pattern );
64 template<
typename X1,
typename RepType>
66 vf::detail::LinearForm<X1, RepType, RepType>
67 form( boost::shared_ptr<X1>
const& __X1,
68 boost::shared_ptr<RepType> __M,
71 bool do_threshold =
false,
72 typename X1::value_type threshold = type_traits<typename RepType::value_type>::epsilon() )
74 return vf::detail::LinearForm<X1, RepType, RepType>( __X1, __M, rowstart, init, do_threshold, threshold );
80 template <
class MatrixType>
81 struct is_matrix_ptr : mpl::false_ {};
83 template <
class MatrixType>
84 struct is_matrix_ptr<boost::shared_ptr<MatrixType> >
86 boost::is_base_of<MatrixSparse<typename MatrixType::value_type>,
90 template <
class VectorType>
91 struct is_vector_ptr : mpl::false_ {};
93 template <
class VectorType>
94 struct is_vector_ptr<boost::shared_ptr<VectorType> >
96 boost::is_base_of<Vector<typename VectorType::value_type>,
101 template<
typename FuncSpaceType>
102 struct is_function_space_ptr : mpl::false_ {};
104 template<
typename FuncSpaceType>
105 struct is_function_space_ptr<boost::shared_ptr<FuncSpaceType> > : mpl::true_ {};
110 template<
typename Args>
111 struct compute_form1_return
114 typedef typename boost::remove_reference<typename parameter::binding<Args, tag::test>::type>::type::element_type test_type;
116 typedef typename Backend<double>::vector_type vector_type;
117 typedef vf::detail::LinearForm<test_type,
121 typedef typename parameter::value_type<Args, tag::test>::type test_type;
122 typedef typename parameter::value_type<Args, tag::vector>::type vector_type;
125 typedef vf::detail::LinearForm<test_type,vector_type,vector_type> type;
130 BOOST_PARAMETER_FUNCTION(
131 (
typename compute_form1_return<Args>::type ),
135 ( test, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) ) )
138 ( in_out( vector ), *, backend()->newVector( test ) )
139 ( init, *( boost::is_integral<mpl::_> ),
false )
140 ( do_threshold, *( boost::is_integral<mpl::_> ),
bool(
false ) )
141 ( threshold, *( boost::is_floating_point<mpl::_> ), type_traits<double>::epsilon() )
142 ( rowstart, *( boost::is_integral<mpl::_> ), 0 )
147 Feel::detail::ignore_unused_variable_warning( args );
149 return form( test, vector, rowstart, init, do_threshold, threshold );
152 BOOST_PARAMETER_FUNCTION(
153 (
typename compute_form1_return<Args>::type ),
157 ( test, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) )
158 ( in_out( vector ), *(detail::is_vector_ptr<mpl::_> ) )
161 ( init, *( boost::is_integral<mpl::_> ),
false )
162 ( do_threshold, *( boost::is_integral<mpl::_> ),
bool(
false ) )
163 ( threshold, *( boost::is_floating_point<mpl::_> ), type_traits<double>::epsilon() )
164 ( rowstart, *( boost::is_integral<mpl::_> ), 0 )
169 return form( test, *vector, rowstart, init, do_threshold, threshold );
173 template<
typename Args,
typename T>
174 struct compute_form2_return
177 template<
typename Args>
178 struct compute_form2_return<Args, mpl::false_>
180 typedef typename parameter::value_type<Args, tag::test>::type::element_type::value_type value_type;
181 typedef vf::detail::BilinearForm<typename parameter::value_type<Args, tag::test>::type::element_type,
182 typename parameter::value_type<Args, tag::trial>::type::element_type,
184 VectorUblas<value_type> > type;
186 template<
typename Args>
187 struct compute_form2_return<Args, mpl::true_>
189 typedef typename parameter::value_type<Args, tag::test>::type::element_type::value_type value_type;
190 typedef vf::detail::BilinearForm<typename parameter::value_type<Args, tag::test>::type::element_type,
191 typename parameter::value_type<Args, tag::test>::type::element_type,
193 VectorUblas<value_type> > type;
198 BOOST_PARAMETER_FUNCTION(
199 (
typename compute_form2_return<Args,mpl::bool_<boost::is_same<
typename parameter::value_type<Args, tag::trial>::type, boost::parameter::void_>::value> >::type ),
203 ( test, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) )
204 ( trial, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) )
205 ( in_out( matrix ), *(detail::is_matrix_ptr<mpl::_> ) ) )
207 ( init, *( boost::is_integral<mpl::_> ),
false )
208 ( do_threshold, *( boost::is_integral<mpl::_> ),
bool(
false ) )
209 ( threshold, *( boost::is_floating_point<mpl::_> ), type_traits<double>::epsilon() )
210 ( pattern, *( boost::is_integral<mpl::_> ),
size_type( Pattern::COUPLED ) )
211 ( do_threshold, *( boost::is_integral<mpl::_> ),
bool(
false ) )
212 ( threshold, *( boost::is_floating_point<mpl::_> ), type_traits<double>::epsilon() )
216 Feel::detail::ignore_unused_variable_warning( args );
218 return form( test, trial, *matrix, init, do_threshold, threshold, pattern );
223 BOOST_PARAMETER_FUNCTION( (
typename compute_form2_return<Args,mpl::bool_<boost::is_same<
typename parameter::value_type<Args, tag::trial>::type, boost::parameter::void_>::value> >::type ),
232 ( init, *( boost::is_integral<mpl::_> ),
false )
233 ( pattern, *( boost::is_integral<mpl::_> ),
size_type( Pattern::COUPLED ) )
234 ( in_out( matrix ), *(boost::is_convertible<mpl::_, boost::shared_ptr<MatrixSparse<double>>>), backend()->newMatrix( _test=test, _trial=trial, _pattern=pattern ) )
235 ( rowstart, *( boost::is_integral<mpl::_> ), 0 )
236 ( colstart, *( boost::is_integral<mpl::_> ), 0 )
241 Feel::detail::ignore_unused_variable_warning( args );
244 bool do_threshold =
false;
245 double threshold = 1e-16;
246 return form( test, trial, matrix, rowstart, colstart, init, do_threshold, threshold, pattern );
254 BOOST_PARAMETER_FUNCTION(
255 (
typename compute_form2_return<Args,mpl::bool_<boost::is_same<
typename parameter::value_type<Args, tag::trial>::type, boost::parameter::void_>::value> >::type ),
259 ( test, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) )
260 ( trial, *( boost::is_convertible<mpl::_,boost::shared_ptr<FunctionSpaceBase> > ) )
261 ( in_out( matrix ), *(detail::is_matrix_ptr<mpl::_> ) ) )
263 ( init, *( boost::is_integral<mpl::_> ),
false )
264 ( do_threshold, *( boost::is_integral<mpl::_> ),
bool(
false ) )
265 ( threshold, *( boost::is_floating_point<mpl::_> ), type_traits<double>::epsilon() )
266 ( pattern, *( boost::is_integral<mpl::_> ),
size_type( Pattern::COUPLED ) )
270 return form( test, trial, *matrix, init, do_threshold, threshold, pattern );
size_t size_type
Indices (starting from 0)
Definition: feelcore/feel.hpp:319