From f4967c8229cafee985525506fcc3fb7e2de2df32 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Mon, 14 Feb 2011 02:14:42 +0100 Subject: [PATCH] + some binary operations --- src/petsc_cxx/AdditionMatrix.h | 39 +++++++++++++++++++++++++++++++++ src/petsc_cxx/BO.h | 31 ++++++++++++++++++++++++++ src/petsc_cxx/Dot.h | 39 +++++++++++++++++++++++++++++++++ src/petsc_cxx/MultiplyMatVec.h | 40 ++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 src/petsc_cxx/AdditionMatrix.h create mode 100644 src/petsc_cxx/BO.h create mode 100644 src/petsc_cxx/Dot.h create mode 100644 src/petsc_cxx/MultiplyMatVec.h diff --git a/src/petsc_cxx/AdditionMatrix.h b/src/petsc_cxx/AdditionMatrix.h new file mode 100644 index 0000000..2ae29b6 --- /dev/null +++ b/src/petsc_cxx/AdditionMatrix.h @@ -0,0 +1,39 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: + * Caner Candan , http://caner.candan.fr + */ + +#ifndef _petsc_cxx_AdditionMatrix_h +#define _petsc_cxx_AdditionMatrix_h + +#include "BO.h" +#include "Matrix.h" + +namespace petsc_cxx +{ + template < typename Atom > + class AdditionMatrix : public BO< Matrix< Atom >, Matrix< Atom >, Matrix< Atom > > + { + public: + void operator()( const Matrix< Atom >& A, const Matrix< Atom >& B, Matrix< Atom >& C ) + { + // TODO + } + }; +} + +#endif // !_petsc_cxx_AdditionMatrix_h diff --git a/src/petsc_cxx/BO.h b/src/petsc_cxx/BO.h new file mode 100644 index 0000000..86fb0cc --- /dev/null +++ b/src/petsc_cxx/BO.h @@ -0,0 +1,31 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: + * Caner Candan , http://caner.candan.fr + */ + +#ifndef _petsc_cxx_BO_h +#define _petsc_cxx_BO_h + +#include "TF.h" + +namespace petsc_cxx +{ + template < typename A1, typename A2, typename R > + class BO : public TF< const A1&, const A2&, R&, void > {}; +} + +#endif // !_petsc_cxx_BO_h diff --git a/src/petsc_cxx/Dot.h b/src/petsc_cxx/Dot.h new file mode 100644 index 0000000..4d28ad1 --- /dev/null +++ b/src/petsc_cxx/Dot.h @@ -0,0 +1,39 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: + * Caner Candan , http://caner.candan.fr + */ + +#ifndef _petsc_cxx_Dot_h +#define _petsc_cxx_Dot_h + +#include "BO.h" +#include "Vector.h" + +namespace petsc_cxx +{ + template < typename Atom > + class Dot : public BO< Vector< Atom >, Vector< Atom >, Atom > + { + public: + void operator()( const Vector< Atom >& a, const Vector< Atom >& b, Atom& dot ) + { + // TODO + } + }; +} + +#endif // !_petsc_cxx_Dot_h diff --git a/src/petsc_cxx/MultiplyMatVec.h b/src/petsc_cxx/MultiplyMatVec.h new file mode 100644 index 0000000..4fd2119 --- /dev/null +++ b/src/petsc_cxx/MultiplyMatVec.h @@ -0,0 +1,40 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: + * Caner Candan , http://caner.candan.fr + */ + +#ifndef _petsc_cxx_MultiplyMatVec_h +#define _petsc_cxx_MultiplyMatVec_h + +#include "BO.h" +#include "Vector.h" +#include "Matrix.h" + +namespace petsc_cxx +{ + template < typename Atom > + class MultiplyMatVec : public BO< Matrix< Atom >, Vector< Atom >, Vector< Atom > > + { + public: + void operator()( const Matrix< Atom >& A, const Vector< Atom >& x, Vector< Atom >& b ) + { + // TODO + } + }; +} + +#endif // !_petsc_cxx_MultiplyMatVec_h