00001 00005 class LinEqVector : public HandleId 00006 00007 { 00008 VecSimplest(Handle(Vector(NUMT))) vecvec; 00009 bool single_vec; 00010 void trace (); 00011 00012 public: 00013 LinEqVector () {} 00014 LinEqVector (int nblocks); 00015 LinEqVector (const LinEqVector& u); 00016 LinEqVector (Vector(NUMT)& vec); 00017 ~LinEqVector (); 00018 00019 int size () const { return vecvec.size(); } 00020 00021 int getNoEntries () const; 00022 00023 bool redim (int nblocks = 1); 00024 bool redim (const LinEqVector_prm& vecprm); 00025 bool redim (const LinEqVector& u); 00026 00027 int getWork (const VectorWork work_tp = NORM_WORK) const; 00028 real getStorage() const; 00029 00030 bool ok () const; 00031 bool single () const; 00032 00033 Vector(NUMT)& vec (int i = 1) { return vecvec(i).getRef(); } 00034 const Vector(NUMT)& vec (int i = 1) const { return vecvec(i).getRef(); } 00035 00036 void attach (const Vector(NUMT)& vec, int i = 1); 00037 00038 LinEqVector& operator = (const LinEqVector& v); 00039 LinEqVector& operator = (NUMT a); 00040 00041 void assemble 00042 ( 00043 const Vec(NUMT)& ev, 00044 const VecSimple(int)& idx_trans, 00045 int elm_no, 00046 int i = 1 00047 ); 00048 00049 bool blockCompatible (const LinEqVector& y) const; 00050 00051 void add (const LinEqVector& y, const LinEqVector& z); 00052 void add (const LinEqVector& y, char s, const LinEqVector& z); 00053 void add (const LinEqVector& y, NUMT b, const LinEqVector& z); 00054 void add (NUMT a, const LinEqVector& y, NUMT b, const LinEqVector& z); 00055 00056 void mult (NUMT value); 00057 00058 NUMT inner (const LinEqVector& y) const; 00059 real norm (Norm_type lp = l2); 00060 real normDiff (const LinEqVector& y, Norm_type lp = l2); 00061 00062 void randomize (real low = -1.0, real high = 1.0); 00063 00064 const Vec(NUMT)& getVec (int i = 1) const; 00065 Vec(NUMT)& getVec (int i = 1); 00066 const ArrayGen(NUMT)& getArrayGen (int i = 1) const; 00067 ArrayGen(NUMT)& getArrayGen (int i = 1); 00068 const ArrayGenSel(NUMT)& getArrayGenSel (int i = 1) const; 00069 ArrayGenSel(NUMT)& getArrayGenSel (int i = 1); 00070 00071 void debugPrint (Os os, const char* header) const; 00072 friend Os& operator << (Os& os, const LinEqVector& v); 00073 }; 00074 00075 00076 00077 inline void add (LinEqVector& x, LinEqVector& y, LinEqVector& z) 00078 { x.add (y, z); } 00079 00080 00081 00082 inline void add (LinEqVector& x, LinEqVector& y, char s, LinEqVector& z) 00083 { x.add (y, s, z); } 00084 00085 00086 00087 inline void add (LinEqVector& x, LinEqVector& y, NUMT b, LinEqVector& z) 00088 { x.add (y, b, z); } 00089 00090 00091 00092 inline void add(LinEqVector& x, NUMT a, LinEqVector& y, NUMT b, LinEqVector& z) 00093 { x.add (a, y, b, z); } 00094 00095 00096 inline NUMT inner (const LinEqVector& x, const LinEqVector& y) 00097 { return x.inner (y); } 00098 00099 00100