-// $Id$
+/*---------------------------- dsmatrix.h ---------------------------*/
+/* <Id:> */
+#ifndef __dsmatrix_H
+#define __dsmatrix_H
+/*---------------------------- dsmatrix.h ---------------------------*/
+
// This file is part of the DEAL Library
// DEAL is Copyright(1995) by
public:
//////////
void reinit(int m, int n, int max_per_row);
- //////////
- dSMatrixStruct(int m, int n, int max_per_row)
- : max_dim(0), max_vec_len(0), rowstart(0), colnums(0)
- {
- reinit(m,n,max_per_row);
- }
- //////////
- dSMatrixStruct(int n, int max_per_row)
- : max_dim(0), max_vec_len(0), rowstart(0), colnums(0)
- {
- reinit(n,n,max_per_row);
- }
- //////////
- ~dSMatrixStruct()
- {
- delete[] rowstart;
- delete[] colnums;
- }
+ //////////
+ dSMatrixStruct(int m, int n, int max_per_row);
+
+ //////////
+ dSMatrixStruct(int n, int max_per_row);
+ //////////
+ ~dSMatrixStruct();
//////////
void compress();
//////////
//////////
void add_matrix(const iVector& rows, const iVector& cols);
- void print_gnuplot (ostream &) const;
- int n_rows () const { return rows; };
- int n_cols () const { return cols; };
- int bandwidth () const;
+ void print_gnuplot (ostream &) const;
+ int n_rows () const;
+ int n_cols () const;
+ int bandwidth () const;
friend class ConstraintMatrix;
friend class DoFHandler<1>;
-
-
/*
CLASS
dSMatrix
dSMatrix ();
//
- dSMatrix(dSMatrixStruct& c)
- : cols(&c), val(0), max_len(0)
- {
- reinit();
- }
+ dSMatrix(dSMatrixStruct& c);
+
//
- ~dSMatrix()
- {
- delete[] val;
- }
-
+ ~dSMatrix();
+
//
void reinit();
void reinit (dSMatrixStruct &);
//
- int m() const { return cols->rows; }
+ int m() const;
//
- int n() const { return cols->cols; }
+ int n() const;
//
- void set(int i,int j,double value) {
- Assert (cols->operator()(i,j) != -1,
- ExcInvalidIndex(i,j));
- val[cols->operator()(i,j)] = value;
- }
+ void set (int i, int j, double value);
//
- void add(int i,int j,double value) {
- Assert (cols->operator()(i,j) != -1,
- ExcInvalidIndex(i,j));
- val[cols->operator()(i,j)]+= value;
- }
-
+ void add (int i, int j, double value);
+
//
void vmult (dVector& dst,const dVector& src) const;
//
friend class ConstraintMatrix;
};
+
+
+
+
+
+/*---------------------- Inline functions -----------------------------------*/
+
+inline
+int dSMatrixStruct::n_rows () const {
+ return rows;
+};
+
+
+
+inline
+int dSMatrixStruct::n_cols () const {
+ return cols;
+};
+
+
+
+
+
+inline
+int dSMatrix::m () const
+{
+ return cols->rows;
+};
+
+
+
+inline
+int dSMatrix::n () const
+{
+ return cols->cols;
+};
+
+
+
+inline
+void dSMatrix::set (int i, int j, double value) {
+ Assert (cols->operator()(i,j) != -1,
+ ExcInvalidIndex(i,j));
+ val[cols->operator()(i,j)] = value;
+};
+
+
+
+inline
+void dSMatrix::add (int i, int j, double value) {
+ Assert (cols->operator()(i,j) != -1,
+ ExcInvalidIndex(i,j));
+ val[cols->operator()(i,j)]+= value;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+/*---------------------------- dsmatrix.h ---------------------------*/
+/* end of #ifndef __dsmatrix_H */
#endif
+/*---------------------------- dsmatrix.h ---------------------------*/
+
+dSMatrixStruct::dSMatrixStruct(int m, int n, int max_per_row)
+ : max_dim(0),
+ max_vec_len(0),
+ rowstart(0),
+ colnums(0)
+{
+ reinit (m,n,max_per_row);
+};
+
+
+
+dSMatrixStruct::dSMatrixStruct(int n, int max_per_row)
+ : max_dim(0),
+ max_vec_len(0),
+ rowstart(0),
+ colnums(0)
+{
+ reinit (n,n,max_per_row);
+};
+
+
+
+dSMatrixStruct::~dSMatrixStruct ()
+{
+ if (rowstart != 0)
+ delete[] rowstart;
+ if (colnums != 0)
+ delete[] colnums;
+}
+
+
+
+
void
dSMatrixStruct::reinit(int m, int n, int max_per_row)
{
compressed = 0;
}
+
void
dSMatrixStruct::compress()
{
delete[] entries;
}
+
int
dSMatrixStruct::operator () (int i, int j)
{
return -1;
}
+
void
dSMatrixStruct::add (int i, int j)
{
Assert (false, ExcNotEnoughSpace(i));
}
+
+
void
dSMatrixStruct::add_matrix(int n, int* rowcols)
{
}
+
void
dSMatrixStruct::add_matrix(int m, int n, int* rows, int* cols)
{
add(rows[i], cols[j]);
}
+
+
void
dSMatrixStruct::add_matrix(const iVector& rowcols)
{
}
+
void
dSMatrixStruct::add_matrix(const iVector& rows, const iVector& cols)
{
}
+
void
dSMatrixStruct::print_gnuplot (ostream &out) const
{
}
+
int
dSMatrixStruct::bandwidth () const
{
max_len(0) {};
+
+dSMatrix::dSMatrix (dSMatrixStruct &c)
+ : cols(&c), val(0), max_len(0)
+{
+ reinit();
+};
+
+
+
+dSMatrix::~dSMatrix ()
+{
+ delete[] val;
+};
+
+
+
void
dSMatrix::reinit()
{
Assert (cols != 0, ExcMatrixNotInitialized());
Assert (cols->compressed, ExcNotCompressed());
- if(max_len<cols->vec_len)
+ if (max_len<cols->vec_len)
{
if (val) delete[] val;
val = new double[cols->vec_len];
}
}
+
void
dSMatrix::Tvmult(dVector& dst,const dVector& src) const
{