00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RYTHMOS_RK_BUTCHER_TABLEAU_BASE_HPP
00031 #define RYTHMOS_RK_BUTCHER_TABLEAU_BASE_HPP
00032
00033 #include "Rythmos_Types.hpp"
00034 #include "Teuchos_Describable.hpp"
00035 #include "Teuchos_ParameterListAcceptor.hpp"
00036 #include "Teuchos_VerboseObject.hpp"
00037 #include "Teuchos_SerialDenseMatrix.hpp"
00038 #include "Teuchos_SerialDenseVector.hpp"
00039
00040 namespace Rythmos {
00041
00042
00043 template<class Scalar>
00044 class RKButcherTableauBase :
00045 virtual public Teuchos::Describable,
00046 virtual public Teuchos::ParameterListAcceptor,
00047 virtual public Teuchos::VerboseObject<RKButcherTableauBase<Scalar> >
00048 {
00049 public:
00051 virtual int numStages() const = 0;
00053 virtual const Teuchos::SerialDenseMatrix<int,Scalar>& A() const = 0;
00055 virtual const Teuchos::SerialDenseVector<int,Scalar>& b() const = 0;
00057 virtual const Teuchos::SerialDenseVector<int,Scalar>& c() const = 0;
00059 virtual int order() const = 0;
00061 virtual bool operator== (const RKButcherTableauBase<Scalar>& rkbt) const;
00063 virtual void setDescription(std::string longDescription) = 0;
00064 };
00065
00066
00067
00068 template<class Scalar>
00069 bool RKButcherTableauBase<Scalar>::operator== (const RKButcherTableauBase<Scalar>& rkbt) const
00070 {
00071 if (this->numStages() != rkbt.numStages()) {
00072 return false;
00073 }
00074 if (this->order() != rkbt.order()) {
00075 return false;
00076 }
00077 int N = rkbt.numStages();
00078
00079 const Teuchos::SerialDenseVector<int,Scalar> b = this->b();
00080 const Teuchos::SerialDenseVector<int,Scalar> c = this->c();
00081 const Teuchos::SerialDenseVector<int,Scalar> other_b = rkbt.b();
00082 const Teuchos::SerialDenseVector<int,Scalar> other_c = rkbt.c();
00083 for (int i=0 ; i<N ; ++i) {
00084 if (b(i) != other_b(i)) {
00085 return false;
00086 }
00087 if (c(i) != other_c(i)) {
00088 return false;
00089 }
00090 }
00091
00092 const Teuchos::SerialDenseMatrix<int,Scalar>& A = this->A();
00093 const Teuchos::SerialDenseMatrix<int,Scalar>& other_A = rkbt.A();
00094 for (int i=0 ; i<N ; ++i) {
00095 for (int j=0 ; j<N ; ++j) {
00096 if (A(i,j) != other_A(i,j)) {
00097 return false;
00098 }
00099 }
00100 }
00101 return true;
00102 }
00103
00104 }
00105
00106
00107 #endif // RYTHMOS_RK_BUTCHER_TABLEAU_BASE_HPP