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