IFEM  90A354
ElmMats.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
12 //==============================================================================
13 
14 #ifndef _ELM_MATS_H
15 #define _ELM_MATS_H
16 
17 #include "LocalIntegral.h"
18 #include "MatVec.h"
19 
20 
33 class ElmMats : public LocalIntegral
34 {
35 public:
37  explicit ElmMats(bool lhs = true) : rhsOnly(false), withLHS(lhs) {}
39  virtual ~ElmMats() {}
40 
45  void resize(size_t nA, size_t nB, size_t nC = 0);
46 
49  void redim(size_t ndim);
50 
52  virtual bool empty() const { return A.empty() && b.empty(); }
53 
55  virtual void setStepSize(double, int) {}
56 
58  virtual const Matrix& getNewtonMatrix() const;
60  virtual const Vector& getRHSVector() const;
61 
63  void printMat(std::ostream& os, size_t idx = 0,
64  const char* prefix = nullptr) const;
66  void printVec(std::ostream& os, size_t idx = 0,
67  const char* prefix = nullptr) const;
69  void printScl(std::ostream& os, size_t idx = 0,
70  const char* prefix = nullptr) const;
71 
72  std::vector<Matrix> A;
73  std::vector<Vector> b;
74  std::vector<double> c;
75 
76  std::vector<const char*> Aname;
77  std::vector<const char*> Bname;
78  std::vector<const char*> Cname;
79 
80  bool rhsOnly;
81  bool withLHS;
82 };
83 
84 #endif
Abstract interface for classes representing integrated quantities.
Global algebraic operations on index 1-based matrices and vectors.
Class collecting the element matrices associated with a FEM problem.
Definition: ElmMats.h:34
std::vector< const char * > Bname
Vector names (for debug print)
Definition: ElmMats.h:77
std::vector< Vector > b
The element right-hand-side vectors.
Definition: ElmMats.h:73
std::vector< const char * > Aname
Matrix names (for debug print)
Definition: ElmMats.h:76
void resize(size_t nA, size_t nB, size_t nC=0)
Defines the number of element matrices and vectors.
Definition: ElmMats.C:17
void printScl(std::ostream &os, size_t idx=0, const char *prefix=nullptr) const
Prints element scalar idx to output stream os.
Definition: ElmMats.C:104
ElmMats(bool lhs=true)
Default constructor.
Definition: ElmMats.h:37
virtual const Vector & getRHSVector() const
Returns the element-level right-hand-side vector.
Definition: ElmMats.C:50
virtual void setStepSize(double, int)
Updates the time step size.
Definition: ElmMats.h:55
virtual bool empty() const
Checks if the element matrices are empty.
Definition: ElmMats.h:52
std::vector< Matrix > A
The element coefficient matrices.
Definition: ElmMats.h:72
std::vector< double > c
The scalar quantities.
Definition: ElmMats.h:74
void printVec(std::ostream &os, size_t idx=0, const char *prefix=nullptr) const
Prints element vector idx to output stream os.
Definition: ElmMats.C:86
bool withLHS
If true, left-hand-side element matrices are present.
Definition: ElmMats.h:81
virtual ~ElmMats()
Empty destructor.
Definition: ElmMats.h:39
std::vector< const char * > Cname
Scalar names (for debug print)
Definition: ElmMats.h:78
bool rhsOnly
If true, only the right-hand-sides are assembled.
Definition: ElmMats.h:80
void printMat(std::ostream &os, size_t idx=0, const char *prefix=nullptr) const
Prints element matrix idx to output stream os.
Definition: ElmMats.C:68
void redim(size_t ndim)
Sets the dimension of the element matrices and vectors.
Definition: ElmMats.C:25
virtual const Matrix & getNewtonMatrix() const
Returns the element-level Newton matrix.
Definition: ElmMats.C:32
Abstract base class representing an element level integrated quantity.
Definition: LocalIntegral.h:25
A vector class with some added algebraic operations.
Definition: matrix.h:64