OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

simpleMatrix.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::simpleMatrix
00027 
00028 Description
00029     Foam::simpleMatrix
00030 
00031 SourceFiles
00032     simpleMatrix.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef simpleMatrix_H
00037 #define simpleMatrix_H
00038 
00039 #include "scalarMatrices.H"
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 // Forward declaration of friend functions and operators
00047 
00048 template<class Type>
00049 class simpleMatrix;
00050 
00051 template<class Type>
00052 Ostream& operator<<
00053 (
00054     Ostream&,
00055     const simpleMatrix<Type>&
00056 );
00057 
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class simpleMatrix Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class Type>
00064 class simpleMatrix
00065 :
00066     public scalarSquareMatrix
00067 {
00068     // Private data
00069 
00070         Field<Type> source_;
00071 
00072 
00073 public:
00074 
00075     // Constructors
00076 
00077         //- Construct given size
00078         simpleMatrix(const label);
00079 
00080         //- Construct from components
00081         simpleMatrix(const scalarSquareMatrix&, const Field<Type>&);
00082 
00083         //- Construct from Istream
00084         simpleMatrix(Istream&);
00085 
00086         //- Construct as copy
00087         simpleMatrix(const simpleMatrix<Type>&);
00088 
00089 
00090     // Member Functions
00091 
00092         // Access
00093 
00094             Field<Type>& source()
00095             {
00096                 return source_;
00097             }
00098 
00099             const Field<Type>& source() const
00100             {
00101                 return source_;
00102             }
00103 
00104 
00105         //- Solve the matrix using Gaussian elimination with pivoting
00106         //  and return the solution
00107         Field<Type> solve() const;
00108 
00109         //- Solve the matrix using LU decomposition with pivoting
00110         //  and return the solution
00111         Field<Type> LUsolve() const;
00112 
00113 
00114     // Member Operators
00115 
00116         void operator=(const simpleMatrix<Type>&);
00117 
00118 
00119     // Ostream Operator
00120 
00121         friend Ostream& operator<< <Type>
00122         (
00123             Ostream&,
00124             const simpleMatrix<Type>&
00125         );
00126 };
00127 
00128 
00129 // Global operators
00130 
00131 template<class Type>
00132 simpleMatrix<Type> operator+
00133 (
00134     const simpleMatrix<Type>&,
00135     const simpleMatrix<Type>&
00136 );
00137 
00138 template<class Type>
00139 simpleMatrix<Type> operator-
00140 (
00141     const simpleMatrix<Type>&,
00142     const simpleMatrix<Type>&
00143 );
00144 
00145 template<class Type>
00146 simpleMatrix<Type> operator*
00147 (
00148     const scalar,
00149     const simpleMatrix<Type>&
00150 );
00151 
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 } // End namespace Foam
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #ifdef NoRepository
00160 #   include "simpleMatrix.C"
00161 #endif
00162 
00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00164 
00165 #endif
00166 
00167 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd