xc
LinearSOEData.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //LinearSOEData.h
29 
30 
31 #ifndef LinearSOEData_h
32 #define LinearSOEData_h
33 
34 #include <solution/system_of_eqn/linearSOE/LinearSOE.h>
35 #include "utility/matrix/Vector.h"
36 
37 namespace XC {
38 
40 //
42 class LinearSOEData: public LinearSOE
43  {
44  protected:
45  int size;
46  Vector B, X;
47 
48  void inic(const size_t &);
49  inline const double &getB(const size_t &i) const
50  { return B[i]; }
51  inline double &getB(const size_t &i)
52  { return B(i); }
53  inline const double &getX(const size_t &i) const
54  { return X(i); }
55  inline double &getX(const size_t &i)
56  { return X(i); }
57  inline double *getPtrB(void)
58  { return B.getDataPtr(); }
59  inline const double *getPtrB(void) const
60  { return B.getDataPtr(); }
61  inline double *getPtrX(void)
62  { return X.getDataPtr(); }
63  inline const double *getPtrX(void) const
64  { return X.getDataPtr(); }
65 
66  LinearSOEData(SolutionStrategy *,int classTag,int N= 0);
67  public:
68  virtual int getNumEqn(void) const;
69  virtual void zeroB(void);
70  virtual void zeroX(void);
71  virtual void zero(void);
72 
73  virtual int addB(const Vector &, const double &fact= 1.0);
74  virtual int addB(const Vector &, const ID &,const double &fact= 1.0);
75  virtual int setB(const XC::Vector &v,const double &fact= 1.0);
76  virtual void setX(int loc, double value);
77  virtual void setX(const Vector &x);
78  virtual const Vector &getX(void) const;
79  virtual Vector &getX(void);
80  virtual const Vector &getB(void) const;
81  virtual Vector &getB(void);
82  virtual double normRHS(void) const;
83 
84  void receiveB(const Communicator &);
85  void receiveX(const Communicator &);
86  void receiveBX(const Communicator &);
87  void sendB(Communicator &) const;
88  void sendBX(Communicator &) const;
89  };
90 } // end of XC namespace
91 
92 
93 #endif
94 
Float vector abstraction.
Definition: Vector.h:94
Communication parameters between processes.
Definition: Communicator.h:66
Linear system of equations.
Definition: LinearSOE.h:92
virtual const Vector & getB(void) const
Returns the Vector object created for .
Definition: LinearSOEData.cc:242
virtual void setX(int loc, double value)
If loc is within the range of , sets .
Definition: LinearSOEData.cc:79
Vector of integers.
Definition: ID.h:95
virtual void zeroB(void)
Zeros the entries in the 1d array for .
Definition: LinearSOEData.cc:64
virtual void zero(void)
Zeros the entries in the 1d array for and .
Definition: LinearSOEData.cc:72
virtual double normRHS(void) const
Returns the 2-norm of the vector .
Definition: LinearSOEData.cc:250
Vector B
order of A
Definition: LinearSOEData.h:46
Data (size, arrays,...) for linear system of equations.
Definition: LinearSOEData.h:42
virtual void zeroX(void)
Zeros the entries in the 1d array for .
Definition: LinearSOEData.cc:68
LinearSOEData(SolutionStrategy *, int classTag, int N=0)
Constructor.
Definition: LinearSOEData.cc:39
virtual int getNumEqn(void) const
Return the current size of the system.
Definition: LinearSOEData.cc:60
virtual int setB(const XC::Vector &v, const double &fact=1.0)
Sets B= v*fact.
Definition: LinearSOEData.cc:99
Solution strategy for the finite element problem.
Definition: SolutionStrategy.h:94
void inic(const size_t &)
1d arrays containing coefficients of B and X
Definition: LinearSOEData.cc:44
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
const double * getDataPtr(void) const
Return a pointer to the float date.
Definition: Vector.h:243
virtual int addB(const Vector &, const double &fact=1.0)
add v multiplied by factor to vector B.
Definition: LinearSOEData.cc:139
virtual const Vector & getX(void) const
Returns the Vector object created for .
Definition: LinearSOEData.cc:234