![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __SPARSITY_H 00005 #define __SPARSITY_H 00006 00007 #include <dolfin/NewArray.h> 00008 00009 namespace dolfin 00010 { 00011 00012 class ODE; 00013 class Vector; 00014 class Matrix; 00015 00016 class Sparsity 00017 { 00018 public: 00019 00020 // Constructor 00021 Sparsity(unsigned int N); 00022 00023 // Destructor 00024 ~Sparsity(); 00025 00027 void clear(); 00028 00030 void clear(unsigned int i); 00031 00033 void setsize(unsigned int i, unsigned int size); 00034 00036 void set(unsigned int i, unsigned int j); 00037 00039 void set(const Matrix& A); 00040 00042 void transp(const Sparsity& sparsity); 00043 00045 void detect(ODE& ode); 00046 00048 inline bool sparse() const { return !pattern.empty(); } 00049 00051 NewArray<unsigned int>& row(unsigned int i); 00052 00054 const NewArray<unsigned int>& row(unsigned int i) const; 00055 00057 void show() const; 00058 00059 private: 00060 00061 // Check given dependency 00062 bool checkdep(ODE& ode, Vector& u, real f0, unsigned int i, unsigned int j); 00063 00064 // Number of components 00065 unsigned int N; 00066 00067 // Increment of automatic detection of sparsity 00068 real increment; 00069 00070 // The sparsity pattern 00071 NewArray< NewArray<unsigned int> > pattern; 00072 00073 }; 00074 00075 } 00076 00077 #endif
![]()
Documentation automatically generated with Doxygen on 10 Sep 2004.