NeoPZ
pzl2projection.h
Go to the documentation of this file.
1 
6 #ifndef PZL2PROJECTION_H
7 #define PZL2PROJECTION_H
8 
9 #include "TPZMaterial.h"
10 #include "pzdiscgal.h"
11 
18 
19 protected:
20 
22  int fDim;
23 
26 
29 
32 
35 
37  REAL fScale;
38 
39 public:
40 
49  TPZL2Projection(int id, int dim, int nstate, TPZVec<STATE> &sol,
50  int IntegrationOrder = -1);
51 
54 
57 
59  enum ESolutionVars { ENone = 0, ESolution = 1 , EDerivative = 2};
60 
65  virtual int IntegrationRuleOrder(int elPMaxOrder) const override ;
66 
71  void SetScaleFactor(REAL scale)
72  {
73  fScale = scale;
74  }
75 
76  virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override ;
77  virtual void ContributeVecShape(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef);
78 
79  virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ef) override
80  {
82  }
83 
85  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override {
86  //NOTHING TO BE DONE HERE
87  }
88 
90  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
91  //NOTHING TO BE DONE HERE
92  }
93 
95  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ef) override {
96  //NOTHING TO BE DONE HERE
97  }
98 
100  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
101  //NOTHING TO BE DONE HERE
102  }
103 
105  virtual int Dimension() const override { return this->fDim; }
106 
108  virtual void SetDimension(int dim) { this->fDim = dim; }
109 
111  virtual int NStateVariables() const override { return this->fNStateVars; }
112 
122  virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef, TPZBndCond &bc) override ;
123  virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ef, TPZBndCond &bc) override {
124  TPZDiscontinuousGalerkin::ContributeBC(data,weight,ef,bc) ;
125  }
126 
128  void SetIsReferred(bool val);
129 
131  virtual TPZMaterial * NewMaterial() override ;
132 
134  virtual int VariableIndex(const std::string &name) override ;
135 
136  virtual int NSolutionVariables(int var) override ;
137 
138 protected:
140  virtual void Solution(TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol,
141  TPZFMatrix<REAL> &axes, int var, TPZVec<STATE> &Solout) override ;
142 public:
144  virtual void Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout) override
145  {
146  TPZMaterial::Solution(data,var,Solout);
147  }
148 
150  virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec<STATE> &Solout)
151  {
152  TPZDiscontinuousGalerkin::SolutionDisc(data,dataleft,dataright,var,Solout);
153  }
154 
155  virtual void Errors(TPZVec<REAL> &x,TPZVec<STATE> &u,
156  TPZFMatrix<STATE> &dudx, TPZFMatrix<REAL> &axes, TPZVec<STATE> &/*flux*/,
157  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> & values) override ;
158  public:
159 virtual int ClassId() const override ;
160 
161 };
162 
163 #endif
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
int fDim
Problem dimension.
void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzdiscgal.h:176
TPZL2Projection(int id, int dim, int nstate, TPZVec< STATE > &sol, int IntegrationOrder=-1)
Class constructor.
virtual void ContributeVecShape(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
To satisfy base class interface.
virtual int VariableIndex(const std::string &name) override
It returns the variable index associated with the name.
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
virtual void Errors(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &dudx, TPZFMatrix< REAL > &axes, TPZVec< STATE > &, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values) override
Computes the error due to the difference between the interpolated flux and the flux computed based o...
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
To satisfy base class interface.
int fIntegrationOrder
Order for setting the integration rule.
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
It returns the solution associated with the var index based on the finite element approximation...
REAL fScale
Scale factor applied to the stiffness matrix and right hand side.
int fNStateVars
Number of state variables.
virtual TPZMaterial * NewMaterial() override
To create another material of the same type.
void SetIsReferred(bool val)
Define if material is referred or not.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual int ClassId() const override
Unique identifier for serialization purposes.
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
virtual int IntegrationRuleOrder(int elPMaxOrder) const override
Get the order of the integration rule necessary to integrate an element with polinomial order p...
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
void SetScaleFactor(REAL scale)
Set a scale factor for the stiffness matrix and right hand side the default value of the scale factor...
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual int NStateVariables() const override
Returns number of state variables.
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
virtual void SetDimension(int dim)
Sets problem dimension.
TPZVec< STATE > fSol
Constant solution vector.
virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
~TPZL2Projection()
Default destructor.
bool fIsReferred
Argument defining this material is a referred material.
ESolutionVars
Solution indices of post-processing.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ef) override
To satisfy base class interface.
def values
Definition: rdt.py:119
virtual int Dimension() const override
Returns problem dimension.
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
To satisfy base class interface.
Implements an L2 projection to constant solution values.