IFEM  90A354
SAMpatchPETSc.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
12 //==============================================================================
13 
14 #ifndef _SAM_PATCH_PETSC_H
15 #define _SAM_PATCH_PETSC_H
16 
17 #include "SAMpatch.h"
18 #include "PETScSupport.h"
19 #include <map>
20 
21 class ProcessAdm;
22 
23 
28 class SAMpatchPETSc : public SAMpatch
29 {
30 public:
34  SAMpatchPETSc(const std::map<int,int>& g2ln, const ProcessAdm& padm);
36  virtual ~SAMpatchPETSc();
37 
46  virtual Real dot(const Vector& x, const Vector& y, char dofType = 'D') const;
47 
55  virtual Real normL2(const Vector& x, char dofType = 'D') const;
56 
65  virtual Real normInf(const Vector& x, size_t& comp, char dofType = 'D') const;
66 
78  virtual bool expandSolution(const SystemVector& solVec,
79  Vector& dofVec, Real scaleSD) const;
80 
81 private:
82  // Parameters for parallel computing
83  int nProc;
86 
87  const ProcessAdm& adm;
88 
89 #ifdef HAVE_MPI
90  mutable IS glob2LocEq = nullptr;
91 
93  struct DofIS {
94  IS local;
95  IS global;
96  int nDofs;
97  VecScatter ctx;
98  bool scatterCreated = false;
99  };
100  mutable std::map<char,DofIS> dofIS;
101 
103  DofIS& getIS(char dofType) const;
104 #endif
105 };
106 
107 #endif
std::vector< int > IntVec
General integer vector.
Definition: ASMbase.h:25
#define Real
The floating point type to use.
Definition: ImmersedBoundaries.h:18
IFEM PETSc support.
int IS
To avoid compilation failures.
Definition: PETScSupport.h:51
Assembly of FE matrices into system matrices for multi-patch models.
Class for administration of MPI processes in IFEM library.
Definition: ProcessAdm.h:33
This is a sub-class of SAMpatch with support for parallel processing.
Definition: SAMpatchPETSc.h:29
SAMpatchPETSc(const std::map< int, int > &g2ln, const ProcessAdm &padm)
The constructor initializes the l2gn array.
Definition: SAMpatchPETSc.C:20
int nProc
Number of processes.
Definition: SAMpatchPETSc.h:83
IntVec l2gn
Local-to-global node numbers for this processor.
Definition: SAMpatchPETSc.h:85
virtual Real dot(const Vector &x, const Vector &y, char dofType='D') const
Computes the dot-product of two vectors.
Definition: SAMpatchPETSc.C:45
virtual Real normL2(const Vector &x, char dofType='D') const
Computes the L2-norm of a vector.
Definition: SAMpatchPETSc.C:89
const ProcessAdm & adm
Parallel process administrator.
Definition: SAMpatchPETSc.h:87
virtual Real normInf(const Vector &x, size_t &comp, char dofType='D') const
Computes the inf-norm of a vector.
Definition: SAMpatchPETSc.C:127
virtual ~SAMpatchPETSc()
The destructor destroys the index set arrays.
Definition: SAMpatchPETSc.C:28
IntVec ghostNodes
Indices for the ghost nodes.
Definition: SAMpatchPETSc.h:84
virtual bool expandSolution(const SystemVector &solVec, Vector &dofVec, Real scaleSD) const
Expands a solution vector from equation-ordering to DOF-ordering.
Definition: SAMpatchPETSc.C:179
This is a sub-class of SAM with added functionality for spline models.
Definition: SAMpatch.h:29
Base class for representing a system vector on different formats.
Definition: SystemMatrix.h:32
A vector class with some added algebraic operations.
Definition: matrix.h:64