diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 966a838c3..fd29fc42c 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -44,6 +44,7 @@ list (APPEND MAIN_SOURCE_FILES src/opm/common/utility/shmatch.cpp src/opm/common/utility/TimeService.cpp src/opm/material/common/Spline.cpp + src/opm/material/common/TridiagonalMatrix.cpp src/opm/material/components/CO2.cpp src/opm/material/densead/Evaluation.cpp src/opm/material/fluidmatrixinteractions/EclEpsScalingPoints.cpp diff --git a/opm/material/common/TridiagonalMatrix.hpp b/opm/material/common/TridiagonalMatrix.hpp index 26910d480..0b60e8408 100644 --- a/opm/material/common/TridiagonalMatrix.hpp +++ b/opm/material/common/TridiagonalMatrix.hpp @@ -27,12 +27,11 @@ #ifndef OPM_TRIDIAGONAL_MATRIX_HH #define OPM_TRIDIAGONAL_MATRIX_HH -#include -#include #include +#include #include - -#include +#include +#include namespace Opm { @@ -722,42 +721,7 @@ public: /*! * \brief Print the matrix to a given output stream. */ - void print(std::ostream& os = std::cout) const - { - size_t n = size(); - - // row 0 - os << at(0, 0) << "\t" - << at(0, 1) << "\t"; - - if (n > 3) - os << "\t"; - if (n > 2) - os << at(0, n-1); - os << "\n"; - - // row 1 .. n - 2 - for (unsigned rowIdx = 1; rowIdx < n-1; ++rowIdx) { - if (rowIdx > 1) - os << "\t"; - if (rowIdx == n - 2) - os << "\t"; - - os << at(rowIdx, rowIdx - 1) << "\t" - << at(rowIdx, rowIdx) << "\t" - << at(rowIdx, rowIdx + 1) << "\n"; - } - - // row n - 1 - if (n > 2) - os << at(n-1, 0) << "\t"; - if (n > 3) - os << "\t"; - if (n > 4) - os << "\t"; - os << at(n-1, n-2) << "\t" - << at(n-1, n-1) << "\n"; - } + void print(std::ostream& os) const; private: template diff --git a/src/opm/material/common/TridiagonalMatrix.cpp b/src/opm/material/common/TridiagonalMatrix.cpp new file mode 100644 index 000000000..1159558e1 --- /dev/null +++ b/src/opm/material/common/TridiagonalMatrix.cpp @@ -0,0 +1,72 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM 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 2 of the License, or + (at your option) any later version. + + OPM 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 OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ + +#include +#include + +#include + +namespace Opm { + +template +void TridiagonalMatrix::print(std::ostream& os) const +{ + size_t n = size(); + + // row 0 + os << at(0, 0) << "\t" + << at(0, 1) << "\t"; + + if (n > 3) + os << "\t"; + if (n > 2) + os << at(0, n-1); + os << "\n"; + + // row 1 .. n - 2 + for (unsigned rowIdx = 1; rowIdx < n-1; ++rowIdx) { + if (rowIdx > 1) + os << "\t"; + if (rowIdx == n - 2) + os << "\t"; + + os << at(rowIdx, rowIdx - 1) << "\t" + << at(rowIdx, rowIdx) << "\t" + << at(rowIdx, rowIdx + 1) << "\n"; + } + + // row n - 1 + if (n > 2) + os << at(n-1, 0) << "\t"; + if (n > 3) + os << "\t"; + if (n > 4) + os << "\t"; + os << at(n-1, n-2) << "\t" + << at(n-1, n-1) << "\n"; +} + +template void TridiagonalMatrix::print(std::ostream&) const; +template void TridiagonalMatrix::print(std::ostream&) const; + +} diff --git a/tests/test_spline.cpp b/tests/test_spline.cpp index 167277f37..32272d8a2 100644 --- a/tests/test_spline.cpp +++ b/tests/test_spline.cpp @@ -41,6 +41,7 @@ gnuplot> plot "spline.csv" using 1:2 w l ti "Curve", \ #include #include +#include template void testCommon(const Spline& sp,