Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Vector.h

Go to the documentation of this file.
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 //
00004 // Contributions by: Georgios Foufas (2002)
00005 //                   Johan Jansson (2003)
00006 
00007 #ifndef __VECTOR_H
00008 #define __VECTOR_H
00009 
00010 #include <dolfin/constants.h>
00011 #include <dolfin/dolfin_log.h>
00012 #include <dolfin/Variable.h>
00013 #include <dolfin/Matrix.h>
00014 
00015 namespace dolfin {
00016   
00017   class Vector : public Variable {
00018   public:
00019          
00020     Vector();
00021     Vector(int size);
00022     Vector(unsigned int size);
00023     Vector(const Vector& x);
00024     Vector(real x0);
00025     Vector(real x0, real x1);
00026     Vector(real x0, real x1, real x2);
00027     ~Vector ();
00028     
00029     void init(unsigned int size);
00030     void clear();
00031     unsigned int size() const;
00032     unsigned int bytes() const;
00033 
00034     real  operator()(unsigned int i) const;
00035     real& operator()(unsigned int i);
00036 
00037     void operator=(const Vector& x);
00038     void operator=(real scalar);
00039     void operator=(const Matrix::Row& row);
00040     void operator=(const Matrix::Column& col);
00041 
00042     void operator+=(const Vector& x);
00043     void operator+=(const Matrix::Row& row);
00044     void operator+=(const Matrix::Column& col);
00045     void operator+=(real a);     
00046 
00047     void operator-=(const Vector& x);
00048     void operator-=(const Matrix::Row& row);
00049     void operator-=(const Matrix::Column& col);
00050     void operator-=(real a);
00051 
00052     void operator*=(real a);
00053     
00054     real operator*(const Vector& x) const;
00055     real operator*(const Matrix::Row& row) const;
00056     real operator*(const Matrix::Column& col) const;
00057     
00058     real norm () const;
00059     real norm (unsigned int i) const;
00060     
00061     void add(real a, Vector& x);
00062     void add(real a, const Matrix::Row& row);
00063     void add(real a, const Matrix::Column& col);
00064 
00065     void rand();
00066     
00067     // Output
00068     void show() const;
00069     friend LogStream& operator<< (LogStream& stream, const Vector& vector);
00070     
00071     // Friends
00072     friend class DirectSolver;
00073     friend class Matrix;
00074     friend class SISolver;
00075     
00076   private:
00077     
00078     void alloc(unsigned int size);
00079 
00080     unsigned int n;
00081     real *values;
00082     
00083   };
00084 
00085 }
00086 
00087 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.