G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPoissonPde.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <gsPde/gsPde.h>
19 
20 namespace gismo
21 {
22 
33 template<class T>
34 class gsPoissonPde : public gsPde<T>
35 {
36 
37 public:
38 
39  gsPoissonPde( ) { }
40 
41 
44  const gsBoundaryConditions<T> &bc,
45  const gsPiecewiseFunction<T> &rhs,
46  const gsFunction<T> * = NULL)
47  : gsPde<T>(domain,bc), m_rhs(rhs)
48  {
49  m_unknownDim.setOnes(1);
50  }
51 
52  int m_compat_dim;
53  GISMO_DEPRECATED
54  gsPoissonPde(const gsFunction<T> &rhs,
55  int domdim,
56  const gsFunction<T> &)
57  : m_compat_dim(domdim), m_rhs(rhs)
58  {
59  m_unknownDim.setOnes(1);
60 
61  }
62  GISMO_DEPRECATED
63  gsPoissonPde(const gsFunction<T> &rhs,
64  int domdim)
65  : m_compat_dim(domdim), m_rhs(rhs)
66 
67  {
68  m_unknownDim.setOnes(1);
69  }
70 
71 
72  GISMO_DEPRECATED
73  gsPoissonPde(void * unused)
74  {
75  m_rhs=new gsConstantFunction<T>(0);
76  m_unknownDim.setOnes(1);
77  }
78 
79 
80 
84  virtual int numRhs() const
85  {
86  return m_rhs.piece(0).targetDim();
87  }
88 
89  const gsFunction<T> * rhs() const { return &m_rhs.piece(0); }
90 
91  virtual int numUnknowns() const {return 1;}
92 
93  virtual bool isSymmetric () const { gsWarn<<"Function is gsPde::isSymmetric should not be used!!"; return true;}
94 
96  virtual std::ostream &print(std::ostream &os) const
97  {
98  os<<"Poisson's equation -\u0394u = f , with:\n";
99  os<<"Source function f= "<< m_rhs <<".\n";
100  return os;
101  }
102 
103  virtual gsPde<T>* restrictToPatch(unsigned np) const
104  {
106  m_boundary_conditions.getConditionsForPatch(np,bc);
107  return new gsPoissonPde<T>(m_domain.patch(np),bc,m_rhs);
108  }
109 
110 protected:
112  using gsPde<T>::m_domain;
114 
116 }; // class gsPoissonPde
117 
118 } // namespace gismo
gsMultiPatch< T > & domain()
Returns a reference to the Pde domain.
Definition: gsPde.h:66
gsPoissonPde(const gsMultiPatch< T > &domain, const gsBoundaryConditions< T > &bc, const gsPiecewiseFunction< T > &rhs, const gsFunction< T > *=NULL)
Constructor.
Definition: gsPoissonPde.h:43
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsPoissonPde.h:96
virtual int numRhs() const
gives the number of rhs functions of the PDEs
Definition: gsPoissonPde.h:84
Abstract class representing a PDE (partial differential equation).
Definition: gsPde.h:43
gsBoundaryConditions< T > m_boundary_conditions
Boundary conditions.
Definition: gsPde.h:167
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
Base class of descriptions of a PDE problem.
#define gsWarn
Definition: gsDebug.h:50
virtual gsPde< T > * restrictToPatch(unsigned np) const
restrictToPatch creats a new PDE object for a single patch np.
Definition: gsPoissonPde.h:103
A Poisson PDE.
Definition: gsPoissonPde.h:34
Provides declaration of a gsPiecewiseFunction class.
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition: gsMultiPatch.h:33
Class containing a set of boundary conditions.
Definition: gsBoundaryConditions.h:341
gsMultiPatch< T > m_domain
Computational domain.
Definition: gsPde.h:165
A function depending on an index i, typically referring to a patch/sub-domain. On each patch a differ...
Definition: gsPiecewiseFunction.h:28
gsVector< unsigned > m_unknownDim
Description of the unknown fields: for each one the target dimension.
Definition: gsPde.h:162