Commit e9ff7ce9 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

generic operator terms extended

parent 7b511479
......@@ -512,6 +512,17 @@ void addZOT(Operator& op, const Term& term)
op.addZeroOrderTerm(new GenericZeroOrderTerm<Term>(term));
}
inline void addZOT(Operator* op, double term)
{
addZOT(op, constant(term));
}
inline void addZOT(Operator& op, double term)
{
addZOT(op, constant(term));
}
// .............................................................................
// Rosenbrock method
......@@ -547,6 +558,16 @@ addFOT(Operator& op, const Term& term, FirstOrderType type)
op.addFirstOrderTerm(new GenericFirstOrderTerm_1<Term>(term), type);
}
inline void addFOT(Operator* op, double term, FirstOrderType type)
{
addFOT(op, constant(term), type);
}
inline void addFOT(Operator& op, double term, FirstOrderType type)
{
addFOT(op, constant(term), type);
}
// first order term using FirstOrderTerm::lb_one
template <int I, typename Term>
inline typename boost::enable_if< typename boost::is_same<double, typename Term::value_type>::type >::type
......@@ -562,6 +583,18 @@ addFOT(Operator& op, const Term& term, FirstOrderType type)
op.addFirstOrderTerm(new GenericFirstOrderTerm_i<I,Term>(term), type);
}
template <int I>
inline void addFOT(Operator* op, double term, FirstOrderType type)
{
addFOT<I>(op, constant(term), type);
}
template <int I>
inline void addFOT(Operator& op, double term, FirstOrderType type)
{
addFOT<I>(op, constant(term), type);
}
template <typename Term>
inline typename boost::enable_if< typename boost::is_same<double, typename Term::value_type>::type >::type
addFOT(Operator* op, const Term& term, int I, FirstOrderType type)
......@@ -576,6 +609,16 @@ addFOT(Operator& op, const Term& term, int I, FirstOrderType type)
op.addFirstOrderTerm(new GenericFirstOrderTerm_i<-1,Term>(term,I), type);
}
inline void addFOT(Operator* op, double term, int I, FirstOrderType type)
{
addFOT(op, constant(term), I, type);
}
inline void addFOT(Operator& op, double term, int I, FirstOrderType type)
{
addFOT(op, constant(term), I, type);
}
// first order term using FirstOrderTerm::lb
template <typename Term>
inline typename boost::enable_if< typename boost::is_same<WorldVector<double>, typename Term::value_type>::type >::type
......@@ -591,6 +634,16 @@ addFOT(Operator& op, const Term& term, FirstOrderType type)
op.addFirstOrderTerm(new GenericFirstOrderTerm_b<Term>(term), type);
}
inline void addFOT(Operator* op, WorldVector<double> term, FirstOrderType type)
{
addFOT(op, constant(term), type);
}
inline void addFOT(Operator& op, WorldVector<double> term, FirstOrderType type)
{
addFOT(op, constant(term), type);
}
// _____________________________________________________________________________
// second order term using matrix functions
......@@ -607,6 +660,16 @@ addSOT(Operator& op, const Term& term)
op.addSecondOrderTerm(new GenericSecondOrderTerm_A<Term>(term));
}
inline void addSOT(Operator* op, WorldMatrix<double> term)
{
addSOT(op, constant(term));
}
inline void addSOT(Operator& op, WorldMatrix<double> term)
{
addSOT(op, constant(term));
}
template <bool Symmetric, typename Term>
inline typename boost::enable_if< typename boost::is_same<WorldMatrix<double>, typename Term::value_type>::type >::type
addSOT(Operator* op, const Term& term)
......@@ -621,6 +684,18 @@ addSOT(Operator& op, const Term& term)
op.addSecondOrderTerm(new GenericSecondOrderTerm_A<Term, Symmetric>(term));
}
template <bool Symmetric>
inline void addSOT(Operator* op, WorldMatrix<double> term)
{
addSOT<Symmetric>(op, constant(term));
}
template <bool Symmetric>
inline void addSOT(Operator& op, WorldMatrix<double> term)
{
addSOT<Symmetric>(op, constant(term));
}
// second order term using scalar functions with identity matrix
template <typename Term>
inline typename boost::enable_if< typename boost::is_same<double, typename Term::value_type>::type >::type
......@@ -636,6 +711,16 @@ addSOT(Operator& op, const Term& term)
op.addSecondOrderTerm(new GenericSecondOrderTerm_1<Term>(term));
}
inline void addSOT(Operator* op, double term)
{
addSOT(op, constant(term));
}
inline void addSOT(Operator& op, double term)
{
addSOT(op, constant(term));
}
// second order term using matrix=0 with matrix_ij = function value
template <int I, int J, typename Term>
void addSOT(Operator* op, const Term& term)
......@@ -649,6 +734,17 @@ void addSOT(Operator& op, const Term& term)
op.addSecondOrderTerm(new GenericSecondOrderTerm_ij<I,J,Term>(term));
}
template <int I, int J>
inline void addSOT(Operator* op, double term)
{
addSOT<I,J>(op, constant(term));
}
template <int I, int J>
inline void addSOT(Operator& op, double term)
{
addSOT<I,J>(op, constant(term));
}
template <typename Term>
void addSOT(Operator* op, const Term& term, int I, int J)
{
......@@ -661,6 +757,16 @@ void addSOT(Operator& op, const Term& term, int I, int J)
op.addSecondOrderTerm(new GenericSecondOrderTerm_ij<-1,-1,Term>(term,I,J));
}
inline void addSOT(Operator* op, double term, int I, int J)
{
addSOT(op, constant(term), I, J);
}
inline void addSOT(Operator& op, double term, int I, int J)
{
addSOT(op, constant(term), I, J);
}
}
#endif // AMDIS_GENERIC_OPERATOR_TERM_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment