Go to the documentation of this file.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 template<class Form, class Type>
00029 inline Foam::Matrix<Form, Type>::Matrix()
00030 :
00031 n_(0),
00032 m_(0),
00033 v_(NULL)
00034 {}
00035
00036
00037 template<class Form, class Type>
00038 inline Foam::autoPtr<Foam::Matrix<Form, Type> > Foam::Matrix<Form, Type>::clone() const
00039 {
00040 return autoPtr<Matrix<Form, Type> >(new Matrix<Form, Type>(*this));
00041 }
00042
00043
00044
00045
00046 template<class Form, class Type>
00047 inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
00048 {
00049 return *reinterpret_cast< Matrix<Form, Type>* >(0);
00050 }
00051
00052
00053
00054 template<class Form, class Type>
00055 inline Foam::label Foam::Matrix<Form, Type>::n() const
00056 {
00057 return n_;
00058 }
00059
00060
00061 template<class Form, class Type>
00062 inline Foam::label Foam::Matrix<Form, Type>::m() const
00063 {
00064 return m_;
00065 }
00066
00067
00068 template<class Form, class Type>
00069 inline Foam::label Foam::Matrix<Form, Type>::size() const
00070 {
00071 return n_*m_;
00072 }
00073
00074
00075 template<class Form, class Type>
00076 inline void Foam::Matrix<Form, Type>::checki(const label i) const
00077 {
00078 if (!n_)
00079 {
00080 FatalErrorIn("Matrix<Form, Type>::checki(const label)")
00081 << "attempt to access element from zero sized row"
00082 << abort(FatalError);
00083 }
00084 else if (i<0 || i>=n_)
00085 {
00086 FatalErrorIn("Matrix<Form, Type>::checki(const label)")
00087 << "index " << i << " out of range 0 ... " << n_-1
00088 << abort(FatalError);
00089 }
00090 }
00091
00092
00093 template<class Form, class Type>
00094 inline void Foam::Matrix<Form, Type>::checkj(const label j) const
00095 {
00096 if (!m_)
00097 {
00098 FatalErrorIn("Matrix<Form, Type>::checkj(const label)")
00099 << "attempt to access element from zero sized column"
00100 << abort(FatalError);
00101 }
00102 else if (j<0 || j>=m_)
00103 {
00104 FatalErrorIn("Matrix<Form, Type>::checkj(const label)")
00105 << "index " << j << " out of range 0 ... " << m_-1
00106 << abort(FatalError);
00107 }
00108 }
00109
00110
00111
00112
00113 template<class Form, class Type>
00114 inline Type* Foam::Matrix<Form, Type>::operator[](const label i)
00115 {
00116 # ifdef FULLDEBUG
00117 checki(i);
00118 # endif
00119 return v_[i];
00120 }
00121
00122
00123 template<class Form, class Type>
00124 inline const Type* Foam::Matrix<Form, Type>::operator[](const label i) const
00125 {
00126 # ifdef FULLDEBUG
00127 checki(i);
00128 # endif
00129 return v_[i];
00130 }
00131
00132
00133