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"
33namespace rheolef {
namespace details {
46#define _RHEOLEF_has_inherited_member_macro(NAME) \
47template <typename Type> \
48class 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; \
67template<class Problem, class Sfinae = typename has_inherited_member_adapt<Problem>::type>
70template<
class Problem>
71class 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);
82template<
class Problem>
83class 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);
104template<class Problem, class Sfinae = typename has_inherited_member_refresh<Problem>::type>
107template<
class Problem>
108class 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);
119template<
class Problem>
120class 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);
139template<class Problem, class Sfinae = typename has_inherited_member_direction<Problem>::type>
140struct add_direction{};
142template<
class Problem>
143class 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);
154template<
class Problem>
155class 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);
176template<class Problem, class Sfinae = typename has_inherited_member_space_norm<Problem>::type>
177struct add_space_norm{};
179template<
class Problem>
180class 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);
191template<
class Problem>
192class 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);
212template<class Problem, class Sfinae = typename details::has_inherited_member_dual_space_norm<Problem>::type>
213struct add_dual_space_norm{};
215template<
class Problem>
216class 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);
227template<
class Problem>
228class 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);
245template<
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);
268template<
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
add_adapt(const Problem &f)
void reset_geo(const value_type &)
Problem::value_type value_type
Problem::float_type float_type
void adapt(const value_type &, const adapt_option &) const
value_type reinterpolate(const value_type &uh)
add_adapt(const add_adapt &f)
add_adapt(const Problem &f)
Problem::value_type value_type
Problem::float_type float_type
add_adapt(const add_adapt &f)
add_direction(const add_direction &f)
Problem::value_type value_type
Problem::float_type float_type
add_direction(const Problem &f)
value_type direction(const value_type &uh) const
add_direction(const add_direction &f)
Problem::value_type value_type
Problem::float_type float_type
add_direction(const Problem &f)
add_dual_space_norm(const Problem &f)
add_dual_space_norm(const add_dual_space_norm &f)
Problem::value_type value_type
Problem::float_type float_type
float_type dual_space_norm(const value_type &uh) const
add_dual_space_norm(const Problem &f)
add_dual_space_norm(const add_dual_space_norm &f)
Problem::value_type value_type
Problem::float_type float_type
add_missing_continuation< Problem > & operator=(add_missing_continuation< Problem > &&f)
add_missing_continuation(const Problem &f)
add_missing_continuation(const add_missing_continuation< Problem > &f)
Problem::value_type value_type
Problem::float_type float_type
Problem::value_type value_type
Problem::float_type float_type
add_missing_damped_newton(const Problem &f)
add_missing_damped_newton< Problem > & operator=(add_missing_damped_newton< Problem > &&f)
add_missing_damped_newton(const add_missing_damped_newton< Problem > &f)
add_refresh(const Problem &f)
add_refresh(const add_refresh &f)
Problem::value_type value_type
Problem::float_type float_type
void refresh(float_type, const value_type &, const value_type &) const
add_refresh(const Problem &f)
add_refresh(const add_refresh &f)
Problem::value_type value_type
Problem::float_type float_type
float_type space_norm(const value_type &uh) const
add_space_norm(const add_space_norm &f)
add_space_norm(const Problem &f)
Problem::value_type value_type
Problem::float_type float_type
add_space_norm(const add_space_norm &f)
add_space_norm(const Problem &f)
Problem::value_type value_type
Problem::float_type float_type
This file is part of Rheolef.
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
#define _RHEOLEF_has_inherited_member_macro(NAME)
adapt_option: see the adapt page for the full documentation