Commit 2e64dd7f authored by Christoph Pflaum's avatar Christoph Pflaum
Browse files

idoku etwas hinzu

parent 66329d7f
...@@ -50,7 +50,7 @@ class PointForPhase { ...@@ -50,7 +50,7 @@ class PointForPhase {
int jSmall; int jSmall;
}; };
class BlockForPhase { class BlockForPhase {
public: public:
BlockForPhase(int id_, double r_) { id = id_; r = r_; } BlockForPhase(int id_, double r_) { id = id_; r = r_; }
...@@ -61,6 +61,8 @@ class BlockForPhase { ...@@ -61,6 +61,8 @@ class BlockForPhase {
double r; double r;
}; };
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
class CalcContinuousArg { class CalcContinuousArg {
public: public:
CalcContinuousArg(Blockgrid2D& blockgrid_); CalcContinuousArg(Blockgrid2D& blockgrid_);
...@@ -75,7 +77,7 @@ class CalcContinuousArg { ...@@ -75,7 +77,7 @@ class CalcContinuousArg {
}; };
/* @} */
#endif // CALCARG2D_H #endif // CALCARG2D_H
......
...@@ -257,128 +257,7 @@ inline double Y_meshsize::Give_cell_rectangle ( params2D_in_cell ) const { ...@@ -257,128 +257,7 @@ inline double Y_meshsize::Give_cell_rectangle ( params2D_in_cell ) const {
/////////////////////////// ///////////////////////////
// 3. Functions // 3. Functions
/////////////////////////// ///////////////////////////
// RALL : ifdef CPP11 : evtl löschen !
#ifdef CPP11
template<int ...> struct seq {};
template<int N, int ...S> struct gens : gens<N-1, N-1, S...> {};
template<int ...S> struct gens<0, S...>{ typedef seq<S...> type; };
template<class A, typename DTyp, typename DTyp_Result, typename ... Arguments>
class Exp2D_Function1 : public Expr2D<Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...> >
{
const A& a_;
tuple<Arguments...> args_;
DTyp_Result
(*Formula_)(DTyp x, Arguments...);
template<elementTyp TYP_EL, int ...S>
inline DTyp_Result
Give_data_private(params2D_in, seq<S...>) const;
// gens<10> g;
// gens<10>::type s;
public:
inline
Exp2D_Function1(const A& a, DTyp_Result
(*Formula)(DTyp x, Arguments...), Arguments ... args)
: a_(a), Formula_(Formula), args_(args...)
{
}
stencil_typ
Give_stencil_typ() const
{
return no_stencil;
}
Blockgrid2D* Give_blockgrid() const { return a_.Give_blockgrid(); };
typedef DTyp_Result Result;
template<elementTyp TYP_EL>
inline DTyp_Result
Give_data(params2D_in) const;
inline DTyp_Result
Give_cell_rectangle(params2D_in_cell) const;
inline DTyp_Result
Give_matrix_rectangles(params2D_in_loc_matrix) const;
template<elementTyp TYP_EL>
void
Update(int id) const
{
a_.Update<TYP_EL>(id);
}
inline Unstructured2DGrid * Give_Ug() const {
return a_.Give_Ug();
}
};
template<class A, class DTyp, class DTyp_Result, typename ... Arguments>
template<elementTyp TYP_EL>
inline DTyp_Result
Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...>::Give_data(params2D_in) const
{
return Give_data_private<TYP_EL>( params2D_out, typename gens<sizeof...(Arguments)>::type() );
}
template<class A, class DTyp, class DTyp_Result, typename ... Arguments>
template<elementTyp TYP_EL, int ...S>
inline DTyp_Result
Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...>::Give_data_private(params2D_in, seq<S...>) const
{
return Formula_ ( a_.Give_data<TYP_EL> ( params2D_out ) , std::get<S>(args_) ...);
}
template<class A, class DTyp, class DTyp_Result, typename ... Arguments>
inline DTyp_Result
Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...>::Give_cell_rectangle(params2D_in_cell) const
{
if (sizeof...(Arguments) == 0)
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell ) );
else {
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell, 1.0 ) );
}
}
template<class A, class DTyp, class DTyp_Result, typename ... Arguments>
inline DTyp_Result
Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...>::Give_matrix_rectangles(params2D_in_loc_matrix) const
{
if (sizeof...(Arguments) == 0)
return Formula_ ( a_.Give_matrix_rectangles ( params2D_out_loc_matrix) );
else {
return Formula_ ( a_.Give_matrix_rectangles ( params2D_out_loc_matrix, 1.0 ) );
}
}
template <class DTyp_Result, class DTyp, typename... Arguments>
class Function2d1 {
public:
typedef DTyp_Result Result;
Function2d1 ( DTyp_Result ( *formula ) ( DTyp x , Arguments... args)) : Formula ( formula ) {}
template <class A>
inline Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...> operator() ( const Expr2D<A>& a, Arguments... args) const
{ return Exp2D_Function1<A, DTyp, DTyp_Result, Arguments...> ( a, Formula, args...); }
private:
DTyp_Result ( *Formula) ( DTyp x, Arguments... );
};
#else
template<class A, typename DTyp, typename DTyp_Result> template<class A, typename DTyp, typename DTyp_Result>
class Exp2D_Function1 : public Expr2D<Exp2D_Function1<A, DTyp, DTyp_Result > > class Exp2D_Function1 : public Expr2D<Exp2D_Function1<A, DTyp, DTyp_Result > >
{ {
...@@ -464,6 +343,8 @@ template<class A, class DTyp, class DTyp_Result> ...@@ -464,6 +343,8 @@ template<class A, class DTyp, class DTyp_Result>
} }
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
template <class DTyp_Result, class DTyp> template <class DTyp_Result, class DTyp>
class Function2d1 { class Function2d1 {
...@@ -478,6 +359,7 @@ class Function2d1 { ...@@ -478,6 +359,7 @@ class Function2d1 {
private: private:
DTyp_Result ( *Formula) ( DTyp x ); DTyp_Result ( *Formula) ( DTyp x );
}; };
/* @} */
template<class A, class B, typename DTyp, typename DTyp_Result> template<class A, class B, typename DTyp, typename DTyp_Result>
class Exp2D_Function2 : public Expr2D<Exp2D_Function2<A, B, DTyp, DTyp_Result> > { class Exp2D_Function2 : public Expr2D<Exp2D_Function2<A, B, DTyp, DTyp_Result> > {
...@@ -538,6 +420,8 @@ inline DTyp_Result Exp2D_Function2<A, B, DTyp, DTyp_Result>::Give_cell_rectangle ...@@ -538,6 +420,8 @@ inline DTyp_Result Exp2D_Function2<A, B, DTyp, DTyp_Result>::Give_cell_rectangle
b_.Give_cell_rectangle ( params2D_out_cell ) ); b_.Give_cell_rectangle ( params2D_out_cell ) );
} }
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
template <class DTyp_Result, class DTyp> template <class DTyp_Result, class DTyp>
class Function2d2 { class Function2d2 {
...@@ -554,6 +438,7 @@ class Function2d2 { ...@@ -554,6 +438,7 @@ class Function2d2 {
private: private:
DTyp_Result ( *Formula ) ( DTyp x, DTyp y ); DTyp_Result ( *Formula ) ( DTyp x, DTyp y );
}; };
/* @} */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// 3 arguments // 3 arguments
...@@ -609,8 +494,9 @@ inline DTyp Exp2D_Function3<A, B, C, DTyp>::Give_cell_rectangle ( params2D_in_ce ...@@ -609,8 +494,9 @@ inline DTyp Exp2D_Function3<A, B, C, DTyp>::Give_cell_rectangle ( params2D_in_ce
c_.Give_cell_rectangle ( params2D_out_cell ) ); c_.Give_cell_rectangle ( params2D_out_cell ) );
} }
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
template <class DTyp> template <class DTyp>
class Function2d3 { class Function2d3 {
public: public:
...@@ -629,7 +515,7 @@ class Function2d3 { ...@@ -629,7 +515,7 @@ class Function2d3 {
private: private:
DTyp ( *Formula ) ( DTyp x, DTyp y, DTyp z ); DTyp ( *Formula ) ( DTyp x, DTyp y, DTyp z );
}; };
/* @} */
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// 5 arguments // 5 arguments
...@@ -698,6 +584,8 @@ inline DTyp Exp2D_Function5<A, B, C, D, E, DTyp>::Give_cell_rectangle ( params2D ...@@ -698,6 +584,8 @@ inline DTyp Exp2D_Function5<A, B, C, D, E, DTyp>::Give_cell_rectangle ( params2D
); );
} }
/** \addtogroup ExpressionTemplates2D **/
/* @{ */
template <class DTyp> template <class DTyp>
class Function2d5 { class Function2d5 {
...@@ -719,345 +607,8 @@ class Function2d5 { ...@@ -719,345 +607,8 @@ class Function2d5 {
private: private:
DTyp ( *Formula ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5 ); DTyp ( *Formula ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5 );
}; };
////////////////////////////////////////////////////////////////////////// /* @} */
// 6 arguments
//////////////////////////////////////////////////////////////////////////
template <class A, class B, class C, class D, class E, class F, class DTyp>
class Exp2D_Function6 : public Expr2D<Exp2D_Function6<A, B, C, D, E, F, DTyp> > {
const A& a_;
const B& b_;
const C& c_;
const D& d_;
const E& e_;
const F& f_;
DTyp ( *Formula_ ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5, DTyp x6);
public:
inline Exp2D_Function6(const A& a,
const B& b,
const C& c,
const D& d,
const E& e,
const F& f,
DTyp ( *Formula ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5, DTyp x6 )) :
a_(a), b_(b), c_(c), d_(d), e_(e), f_(f), Formula_ ( Formula ) {}
stencil_typ Give_stencil_typ() const { return no_stencil; }
typedef DTyp Result;
template <elementTyp TYP_EL>
inline DTyp Give_data ( params2D_in ) const;
inline DTyp Give_cell_rectangle ( params2D_in_cell ) const;
template <elementTyp TYP_EL>
void Update ( int id ) const {
a_.template Update<TYP_EL> ( id );
b_.template Update<TYP_EL> ( id );
c_.template Update<TYP_EL> ( id );
d_.template Update<TYP_EL> ( id );
e_.template Update<TYP_EL> ( id );
f_.template Update<TYP_EL> ( id );
}
inline Unstructured2DGrid * Give_Ug() const {
return a_.Give_Ug();
}
};
template <class A, class B, class C, class D, class E, class F, class DTyp>
template <elementTyp TYP_EL>
inline DTyp Exp2D_Function6<A, B, C, D, E, F, DTyp>::Give_data ( params2D_in ) const {
return Formula_ ( a_.template Give_data<TYP_EL> ( params2D_out ),
b_.template Give_data<TYP_EL> ( params2D_out ),
c_.template Give_data<TYP_EL> ( params2D_out ),
d_.template Give_data<TYP_EL> ( params2D_out ),
e_.template Give_data<TYP_EL> ( params2D_out ),
f_.template Give_data<TYP_EL> ( params2D_out )
);
}
template <class A, class B, class C, class D, class E, class F, class DTyp>
inline DTyp Exp2D_Function6<A, B, C, D, E, F, DTyp>::Give_cell_rectangle ( params2D_in_cell ) const {
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell ),
b_.Give_cell_rectangle ( params2D_out_cell ),
c_.Give_cell_rectangle ( params2D_out_cell ),
d_.Give_cell_rectangle ( params2D_out_cell ),
e_.Give_cell_rectangle ( params2D_out_cell ),
f_.Give_cell_rectangle ( params2D_out_cell )
);
}
template <class DTyp>
class Function2d6 {
public:
typedef DTyp Result;
Function2d6( DTyp ( *formula ) (DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5, DTyp x6)) : Formula ( formula ) {};
template <class A, class B, class C, class D, class E, class F>
inline Exp2D_Function6<A, B, C, D, E, F, DTyp> operator() ( const Expr2D<A>& a,
const Expr2D<B>& b,
const Expr2D<C>& c,
const Expr2D<D>& d,
const Expr2D<E>& e,
const Expr2D<F>& f) const
{ return Exp2D_Function6<A, B, C, D, E, F, DTyp> ( a, b, c, d, e, f, Formula); }
private:
DTyp ( *Formula ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5, DTyp x6 );
};
#endif
#ifdef CPP11
// 2 arguments
template<class A, class B, typename DTyp, typename DTyp_Result, typename ... Arguments>
class Exp2D_Function2 : public Expr2D<Exp2D_Function2<A, B, DTyp, DTyp_Result, Arguments...> > {
const A& a_;
const B& b_;
tuple<Arguments...> args_;
DTyp_Result
(*Formula_)(DTyp x, DTyp y, Arguments...);
template<elementTyp TYP_EL, int ...S>
inline DTyp_Result
Give_data_private(params2D_in, seq<S...>) const;
public:
typedef DTyp_Result Result;
inline Exp2D_Function2 ( const A& a, const B& b, DTyp_Result ( *Formula ) ( DTyp x, DTyp y, Arguments... ), Arguments ... args) :
a_ ( a ), b_ ( b ), Formula_ ( Formula ), args_(args...) {}
Blockgrid2D* Give_blockgrid() const { return a_.Give_blockgrid(); };
stencil_typ Give_stencil_typ() const { return no_stencil; }
template <elementTyp TYP_EL>
inline DTyp_Result Give_data ( params2D_in ) const;
inline DTyp_Result Give_cell_rectangle ( params2D_in_cell ) const;
template <elementTyp TYP_EL>
void Update ( int id ) const {
a_.template Update<TYP_EL> ( id );
b_.template Update<TYP_EL> ( id );
}
inline Unstructured2DGrid * Give_Ug() const {
return a_.Give_Ug();
}
};
template<class A, class B, class DTyp, class DTyp_Result, typename ... Arguments>
template<elementTyp TYP_EL, int ...S>
inline DTyp_Result
Exp2D_Function2<A,B, DTyp, DTyp_Result, Arguments...>::Give_data_private(params2D_in, seq<S...>) const
{
return Formula_ ( a_.template Give_data<TYP_EL> ( params2D_out ),b_.template Give_data<TYP_EL> ( params2D_out ) , std::get<S>(args_) ...);
}
template<class A, class B, typename DTyp, typename DTyp_Result, typename ... Arguments>
template <elementTyp TYP_EL>
inline DTyp_Result Exp2D_Function2<A, B, DTyp, DTyp_Result, Arguments...>::Give_data ( params2D_in ) const {
return Give_data_private<TYP_EL>( params2D_out, typename gens<sizeof...(Arguments)>::type() );
}
template<class A, class B, typename DTyp, typename DTyp_Result, typename ... Arguments>
inline DTyp_Result Exp2D_Function2<A, B, DTyp, DTyp_Result, Arguments...>::Give_cell_rectangle ( params2D_in_cell ) const {
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell ),
b_.Give_cell_rectangle ( params2D_out_cell ) );
}
template <class DTyp_Result, class DTyp, typename... Arguments>
class Function2d2 {
public:
typedef DTyp_Result Result;
Function2d2 ( DTyp_Result ( *formula ) ( DTyp x, DTyp y, Arguments... args )) : Formula ( formula ) {};
template <class A, class B>
inline Exp2D_Function2<A, B, DTyp, DTyp_Result, Arguments...> operator() ( const Expr2D<A>& a,
const Expr2D<B>& b , Arguments... args) const
{ return Exp2D_Function2<A, B, DTyp, DTyp_Result, Arguments...> ( a, b, Formula, args...); }
private:
DTyp_Result ( *Formula ) ( DTyp x, DTyp y, Arguments... );
};
//////////////////////////////////////////////////////////////////////////
// 3 arguments
//////////////////////////////////////////////////////////////////////////
template <class A, class B, class C, class DTyp>
class Exp2D_Function3 : public Expr2D<Exp2D_Function3<A, B, C, DTyp> > {
const A& a_;
const B& b_;
const C& c_;
DTyp ( *Formula_ ) ( DTyp x, DTyp y, DTyp z );
public:
inline Exp2D_Function3 ( const A& a, const B& b, const C& c, DTyp ( *Formula ) ( DTyp x, DTyp y, DTyp z )) :
a_ ( a ), b_ ( b ), c_ ( c ), Formula_ ( Formula ) {}
stencil_typ Give_stencil_typ() const { return no_stencil; }
Blockgrid2D* Give_blockgrid() const { return a_.Give_blockgrid(); };
typedef DTyp Result;
template <elementTyp TYP_EL>
inline DTyp Give_data ( params2D_in ) const;
inline DTyp Give_cell_rectangle ( params2D_in_cell ) const;
template <elementTyp TYP_EL>
void Update ( int id ) const {
a_.template Update<TYP_EL> ( id );
b_.template Update<TYP_EL> ( id );
c_.template Update<TYP_EL> ( id );
}
inline Unstructured2DGrid * Give_Ug() const {
return a_.Give_Ug();
}
};
template <class A, class B, class C, class DTyp>
template <elementTyp TYP_EL>
inline DTyp Exp2D_Function3<A, B, C, DTyp>::Give_data ( params2D_in ) const {
return Formula_ ( a_.template Give_data<TYP_EL> ( params2D_out ),
b_.template Give_data<TYP_EL> ( params2D_out ),
c_.template Give_data<TYP_EL> ( params2D_out ) );
}
template <class A, class B, class C, class DTyp>
inline DTyp Exp2D_Function3<A, B, C, DTyp>::Give_cell_rectangle ( params2D_in_cell ) const {
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell ),
b_.Give_cell_rectangle ( params2D_out_cell ),
c_.Give_cell_rectangle ( params2D_out_cell ) );
}
template <class DTyp>
class Function2d3 {
public:
typedef DTyp Result;
Function2d3 ( DTyp ( *formula ) ( DTyp x, DTyp y, DTyp z )) : Formula ( formula ) {};
template <class A, class B, class C>
inline Exp2D_Function3<A, B, C, DTyp> operator() ( const Expr2D<A>& a,
const Expr2D<B>& b,
const Expr2D<C>& c ) const
{ return Exp2D_Function3<A, B, C, DTyp> ( a, b, c, Formula); }
private:
DTyp ( *Formula ) ( DTyp x, DTyp y, DTyp z );
};
//////////////////////////////////////////////////////////////////////////
// 3 arguments
//////////////////////////////////////////////////////////////////////////
template <class A, class B, class C, class D, class E, class DTyp>
class Exp2D_Function5 : public Expr2D<Exp2D_Function5<A, B, C, D, E, DTyp> > {
const A& a_;
const B& b_;
const C& c_;
const D& d_;
const E& e_;
DTyp ( *Formula_ ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5);
public:
inline Exp2D_Function5(const A& a,
const B& b,
const C& c,
const D& d,
const E& e,
DTyp ( *Formula ) ( DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5 )) :
a_(a), b_(b), c_(c), d_(d), e_(e), Formula_ ( Formula ) {}
stencil_typ Give_stencil_typ() const { return no_stencil; }
typedef DTyp Result;
template <elementTyp TYP_EL>
inline DTyp Give_data ( params2D_in ) const;
inline DTyp Give_cell_rectangle ( params2D_in_cell ) const;
template <elementTyp TYP_EL>
void Update ( int id ) const {
a_.template Update<TYP_EL> ( id );
b_.template Update<TYP_EL> ( id );
c_.template Update<TYP_EL> ( id );
d_.template Update<TYP_EL> ( id );
e_.template Update<TYP_EL> ( id );
}
inline Unstructured2DGrid * Give_Ug() const {
return a_.Give_Ug();
}
};
template <class A, class B, class C, class D, class E, class DTyp>
template <elementTyp TYP_EL>
inline DTyp Exp2D_Function5<A, B, C, D, E, DTyp>::Give_data ( params2D_in ) const {
return Formula_ ( a_.template Give_data<TYP_EL> ( params2D_out ),
b_.template Give_data<TYP_EL> ( params2D_out ),
c_.template Give_data<TYP_EL> ( params2D_out ),
d_.template Give_data<TYP_EL> ( params2D_out ),
e_.template Give_data<TYP_EL> ( params2D_out )
);
}
template <class A, class B, class C, class D, class E, class DTyp>
inline DTyp Exp2D_Function5<A, B, C, D, E, DTyp>::Give_cell_rectangle ( params2D_in_cell ) const {
return Formula_ ( a_.Give_cell_rectangle ( params2D_out_cell ),
b_.Give_cell_rectangle ( params2D_out_cell ),
c_.Give_cell_rectangle ( params2D_out_cell ),
d_.Give_cell_rectangle ( params2D_out_cell ),
e_.Give_cell_rectangle ( params2D_out_cell )
);
}
template <class DTyp>
class Function2d5 {
public:
typedef DTyp Result;
Function2d5( DTyp ( *formula ) (DTyp x1, DTyp x2, DTyp x3, DTyp x4, DTyp x5)) : Formula ( formula ) {};
template <class A, class B, class C, class D, class E>
inline Exp2D_Function5<A, B, C, D, E, DTyp>