an efficient C++ finite element environment
|
|
Go to the documentation of this file. 1 #ifndef _RHEOLEF_NEWTON_ADD_MISSING_H
2 #define _RHEOLEF_NEWTON_ADD_MISSING_H
29 #include "rheolef/continuation_option.h"
30 #include "rheolef/damped_newton.h"
31 #include <type_traits>
33 namespace rheolef {
namespace details {
46 #define _RHEOLEF_has_inherited_member_macro(NAME) \
47 template <typename Type> \
48 class has_inherited_member_##NAME { \
49 class yes { char m;}; \
50 class no { yes m[2];}; \
51 struct base_mixin { void NAME(){} }; \
52 struct base : public Type, public base_mixin {}; \
53 template <typename T, T t> class helper{}; \
54 template <typename U> \
55 static no deduce(U*, helper<void (base_mixin::*)(), &U::NAME>* = 0); \
56 static yes deduce(...); \
58 static const bool value = sizeof(yes) == sizeof(deduce((base*)(0))); \
59 typedef std::integral_constant<bool, value> type; \
67 template<class Problem, class Sfinae = typename has_inherited_member_adapt<Problem>::type>
70 template<
class Problem>
71 class add_adapt<Problem,
std::true_type>:
public virtual Problem {
77 add_adapt<Problem>& operator= (add_adapt<Problem>&&
f) {
78 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
82 template<
class Problem>
83 class add_adapt<Problem,
std::false_type>:
public virtual Problem {
92 add_adapt<Problem>& operator= (add_adapt<Problem>&&
f) {
93 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
104 template<class Problem, class Sfinae = typename has_inherited_member_refresh<Problem>::type>
105 struct add_refresh{};
107 template<
class Problem>
108 class add_refresh<Problem,
std::true_type>:
public virtual Problem {
114 add_refresh<Problem>& operator= (add_refresh<Problem>&&
f) {
115 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
119 template<
class Problem>
120 class add_refresh<Problem,
std::false_type>:
public virtual Problem {
127 add_refresh<Problem>& operator= (add_refresh<Problem>&&
f) {
128 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
139 template<class Problem, class Sfinae = typename has_inherited_member_direction<Problem>::type>
140 struct add_direction{};
142 template<
class Problem>
143 class add_direction<Problem,
std::true_type>:
public virtual Problem {
149 add_direction<Problem>& operator= (add_direction<Problem>&&
f) {
150 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
154 template<
class Problem>
155 class add_direction<Problem,
std::false_type>:
public virtual Problem {
162 Problem::update_derivative (uh);
163 return - Problem::derivative_solve (Problem::derivative_versus_parameter(uh));
165 add_direction<Problem>& operator= (add_direction<Problem>&&
f) {
166 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
176 template<class Problem, class Sfinae = typename has_inherited_member_space_norm<Problem>::type>
177 struct add_space_norm{};
179 template<
class Problem>
180 class add_space_norm<Problem,
std::true_type>:
public virtual Problem {
186 add_space_norm<Problem>& operator= (add_space_norm<Problem>&&
f) {
187 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
191 template<
class Problem>
192 class add_space_norm<Problem,
std::false_type>:
public virtual Problem {
199 return sqrt(Problem::space_dot (uh,uh));
201 add_space_norm<Problem>& operator= (add_space_norm<Problem>&&
f) {
202 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
212 template<class Problem, class Sfinae = typename details::has_inherited_member_dual_space_norm<Problem>::type>
213 struct add_dual_space_norm{};
215 template<
class Problem>
216 class add_dual_space_norm<Problem,
std::true_type>:
public virtual Problem {
222 add_dual_space_norm<Problem>& operator= (add_dual_space_norm<Problem>&&
f) {
223 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
227 template<
class Problem>
228 class add_dual_space_norm<Problem,
std::false_type>:
public virtual Problem {
235 return sqrt(Problem::dual_space_dot (uh,uh));
237 add_dual_space_norm<Problem>& operator= (add_dual_space_norm<Problem>&&
f) {
238 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
245 template<
class Problem>
247 public virtual add_space_norm<Problem>
248 ,
public virtual add_dual_space_norm<Problem>
255 ,add_space_norm<Problem>(
f)
256 ,add_dual_space_norm<Problem>(
f)
260 ,add_space_norm<Problem>(
f)
261 ,add_dual_space_norm<Problem>(
f)
264 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
268 template<
class Problem>
270 public virtual add_adapt <Problem>
271 ,
public virtual add_refresh <Problem>
272 ,
public virtual add_direction <Problem>
273 ,
public virtual add_space_norm<Problem>
274 ,
public virtual add_dual_space_norm<Problem>
281 ,add_adapt<Problem>(
f)
282 ,add_refresh<Problem>(
f)
283 ,add_direction<Problem>(
f)
284 ,add_space_norm<Problem>(
f)
285 ,add_dual_space_norm<Problem>(
f)
289 ,add_adapt<Problem>(
f)
290 ,add_refresh<Problem>(
f)
291 ,add_direction<Problem>(
f)
292 ,add_space_norm<Problem>(
f)
293 ,add_dual_space_norm<Problem>(
f)
296 static_cast<Problem&
>(*this) =
static_cast<Problem&&
>(
f);
301 #undef _RHEOLEF_has_inherited_member_macro
304 #endif // _RHEOLEF_NEWTON_ADD_MISSING_H
Problem::value_type value_type
Problem::float_type float_type
Problem::value_type value_type
add_missing_damped_newton(const Problem &f)
geo_basic< T, M > adapt(const field_basic< T, M > &uh, const adapt_option &opts)
adapt(uh,opts): see the adapt page for the full documentation
Problem::value_type value_type
Problem::float_type float_type
Problem::float_type float_type
Problem::value_type value_type
add_missing_continuation< Problem > & operator=(add_missing_continuation< Problem > &&f)
add_dual_space_norm(const add_dual_space_norm &f)
Problem::float_type float_type
add_space_norm(const Problem &f)
adapt_option: see the adapt page for the full documentation
add_direction(const add_direction &f)
add_adapt(const add_adapt &f)
add_adapt(const Problem &f)
Problem::float_type float_type
add_missing_continuation(const Problem &f)
Problem::float_type float_type
value_type reinterpolate(const value_type &uh)
Problem::value_type value_type
add_dual_space_norm(const Problem &f)
float_type dual_space_norm(const value_type &uh) const
Problem::float_type float_type
void refresh(float_type, const value_type &, const value_type &) const
Problem::float_type float_type
add_missing_damped_newton< Problem > & operator=(add_missing_damped_newton< Problem > &&f)
Problem::float_type float_type
Problem::value_type value_type
void adapt(const value_type &, const adapt_option &) const
add_space_norm(const Problem &f)
float_type space_norm(const value_type &uh) const
add_space_norm(const add_space_norm &f)
Problem::float_type float_type
add_direction(const Problem &f)
add_missing_continuation(const add_missing_continuation< Problem > &f)
Problem::value_type value_type
This file is part of Rheolef.
add_refresh(const add_refresh &f)
value_type direction(const value_type &uh) const
add_refresh(const add_refresh &f)
add_refresh(const Problem &f)
Problem::value_type value_type
Problem::float_type float_type
add_adapt(const add_adapt &f)
Problem::value_type value_type
add_missing_damped_newton(const add_missing_damped_newton< Problem > &f)
add_direction(const add_direction &f)
add_direction(const Problem &f)
void reset_geo(const value_type &)
Problem::value_type value_type
add_dual_space_norm(const Problem &f)
add_refresh(const Problem &f)
add_dual_space_norm(const add_dual_space_norm &f)
Problem::float_type float_type
add_space_norm(const add_space_norm &f)
Problem::value_type value_type
_RHEOLEF_has_inherited_member_macro(adapt) template< class Problem
add_adapt(const Problem &f)
Problem::value_type value_type