gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
linearSystemMUMPS.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef LINEAR_SYSTEM_MUMPS_H
7 #define LINEAR_SYSTEM_MUMPS_H
8 
9 // Interface to a linear system with MUMPS
10 
11 #include "GmshConfig.h"
12 #include "GmshMessage.h"
13 #include "linearSystem.h"
14 
15 #if defined(HAVE_MUMPS)
16 #include "dmumps_c.h"
17 #include "zmumps_c.h"
18 
19 template <class scalar> class linearSystemMUMPS : public linearSystem<scalar> {
20 public:
21  linearSystemMUMPS()
22  {
23  Msg::Info("linearSystemMUMPS not implemented for this element type");
24  }
25 
26  virtual bool isAllocated() const { return false; }
27  virtual void allocate(int nbRows) {}
28  virtual void clear() {}
29  virtual void zeroMatrix() {}
30  virtual void zeroRightHandSide() {}
31  virtual void zeroSolution() {}
32  virtual int systemSolve() { return 1; }
33  virtual void insertInSparsityPattern(int row, int col) {}
34  virtual double normInfRightHandSide() const { return 0.; }
35  virtual double normInfSolution() const { return 0.; }
36 
37  virtual void addToMatrix(int row, int col, const double &val) {}
38  virtual void getFromMatrix(int row, int col, double &val) const {}
39  virtual void addToRightHandSide(int row, const scalar &val, int ith = 0) {}
40  virtual void getFromRightHandSide(int row, scalar &val) const {}
41  virtual void getFromSolution(int row, scalar &val) const {}
42  virtual void addToSolution(int row, const scalar &val) {}
43 };
44 
45 template <> class linearSystemMUMPS<double> : public linearSystem<double> {
46 private:
47  int _n;
48  int _nz;
49 
50  std::vector<int> _irn;
51  std::vector<int> _jcn;
52 
53  std::vector<DMUMPS_REAL> _x;
54  std::vector<DMUMPS_REAL> _b;
55  std::vector<DMUMPS_REAL> _a;
56 
57  // _ij[i][j] is the index of _a that is the (i, j) element of
58  // the system matrix
59  std::vector<std::map<int, int> > _ij;
60 
61 public:
62  linearSystemMUMPS();
63 
64  virtual bool isAllocated() const;
65  virtual void allocate(int nbRows);
66  virtual void clear();
67  virtual void zeroMatrix();
68 
69  virtual void zeroRightHandSide();
70  virtual void zeroSolution();
71  virtual int systemSolve();
72  virtual void insertInSparsityPattern(int row, int col);
73  virtual double normInfRightHandSide() const;
74  virtual double normInfSolution() const;
75 
76  virtual void addToMatrix(int row, int col, const double &val);
77  virtual void getFromMatrix(int row, int col, double &val) const;
78  virtual void addToRightHandSide(int row, const double &val, int ith = 0);
79  virtual void getFromRightHandSide(int row, double &val) const;
80  virtual void getFromSolution(int row, double &val) const;
81  virtual void addToSolution(int row, const double &val);
82 };
83 
84 #endif
85 
86 #endif
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
linearSystemBase::clear
virtual void clear()=0
linearSystemBase::systemSolve
virtual int systemSolve()=0
linearSystemBase::zeroRightHandSide
virtual void zeroRightHandSide()=0
GmshMessage.h
linearSystemBase::zeroSolution
virtual void zeroSolution()=0
linearSystemBase::zeroMatrix
virtual void zeroMatrix()=0
linearSystem::getFromRightHandSide
virtual void getFromRightHandSide(int _row, scalar &val) const =0
linearSystem::addToRightHandSide
virtual void addToRightHandSide(int _row, const scalar &val, int ith=0)=0
linearSystem::addToSolution
virtual void addToSolution(int _row, const scalar &val)=0
linearSystemBase::isAllocated
virtual bool isAllocated() const =0
linearSystemBase::normInfRightHandSide
virtual double normInfRightHandSide() const =0
linearSystemBase::allocate
virtual void allocate(int nbRows)=0
linearSystemBase::insertInSparsityPattern
virtual void insertInSparsityPattern(int _row, int _col)
Definition: linearSystem.h:33
linearSystemBase::normInfSolution
virtual double normInfSolution() const
Definition: linearSystem.h:35
linearSystem::getFromMatrix
virtual void getFromMatrix(int _row, int _col, scalar &val) const =0
linearSystem::getFromSolution
virtual void getFromSolution(int _row, scalar &val) const =0
linearSystem::addToMatrix
virtual void addToMatrix(int _row, int _col, const scalar &val)=0
linearSystem
Definition: linearSystem.h:38
linearSystem.h