NeoPZ
TPZLagrangeMultiplier.h
Go to the documentation of this file.
1 //
2 // TPZLagrangeMultiplier.h
3 // PZ
4 //
5 // Created by Philippe Devloo on 5/2/14.
6 //
7 //
8 
9 #ifndef __PZ__TPZLagrangeMultiplier__
10 #define __PZ__TPZLagrangeMultiplier__
11 
12 #include <iostream>
13 #include "pzdiscgal.h"
14 
17 {
18 
21 
24 
25  STATE fMultiplier;
26 
27  public :
31  {
32 
33  }
36  TPZDiscontinuousGalerkin(nummat), fNStateVariables(nstate), fDimension(dimension), fMultiplier(1.)
37  {
38 
39  }
40 
43  TPZDiscontinuousGalerkin(copy), fNStateVariables(copy.fNStateVariables), fDimension(copy.fDimension), fMultiplier(copy.fMultiplier)
44  {
45 
46  }
47 
49  {
51  fNStateVariables = copy.fNStateVariables;
52  fDimension = copy.fDimension;
53  fMultiplier = copy.fMultiplier;
54  return *this;
55  }
56 
58  {
59  return new TPZLagrangeMultiplier(*this);
60  }
61 
64  {
65 
66  }
67 
69  virtual int Dimension() const override
70  {
71  return fDimension;
72  }
73 
74  virtual void SetMultiplier(STATE mult)
75  {
76  fMultiplier = mult;
77  }
78 
79 
80  virtual std::string Name() override
81  {
82  return "TPZLagrangeMultiplier";
83  }
84 
93  virtual void FillDataRequirementsInterface(TPZMaterialData &data) override
94  {
95  data.SetAllRequirements(false);
96  }
97 
99  virtual void FillDataRequirementsInterface(TPZMaterialData &data, TPZVec<TPZMaterialData > &datavec_left, TPZVec<TPZMaterialData > &datavec_right) override
100  {
101  data.SetAllRequirements(false);
102 // data.fNeedsNormal = true;
103  int nref_left = datavec_left.size();
104  for(int iref = 0; iref<nref_left; iref++){
105  datavec_left[iref].SetAllRequirements(false);
106 // datavec_left[iref].fNeedsSol = true;
107 // datavec_left[iref].fNeedsNormal = true;
108  }
109  int nref_right = datavec_right.size();
110  for(int iref = 0; iref<nref_right; iref++){
111  datavec_right[iref].SetAllRequirements(false);
112 // datavec_right[iref].fNeedsSol = true;
113 // datavec_right[iref].fNeedsNormal = true;
114  }
115 
116  }
117 
124  virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override
125  {
126  DebugStop();
127  }
128 
129  virtual void Contribute(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override;
130 
131  virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef, TPZBndCond &bc) override
132  {
133  DebugStop();
134  }
135  virtual void ContributeBC(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
136  DebugStop();
137  }
138 
139  virtual void Contribute(TPZMaterialData &data,REAL weight,TPZFMatrix<STATE> &ef) override {
140  DebugStop();
141  }
142  virtual void ContributeBC(TPZMaterialData &data,REAL weight,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
143  DebugStop();
144  }
145 
156  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override;
157 
158 
159 // virtual void ContributeInterface(TPZVec<TPZMaterialData> &datavec, TPZVec<TPZMaterialData> &dataleftvec, TPZVec<TPZMaterialData> &datarightvec,
160 // REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef)
161 // {
162 // DebugStop();
163 // }
164 
175  virtual void ContributeInterface(TPZMaterialData &data, TPZVec<TPZMaterialData> &dataleft, TPZVec<TPZMaterialData> &dataright, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override;
176 
177 
187  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ef) override;
188 
189 
199  virtual void ContributeInterface(TPZMaterialData &data, TPZVec<TPZMaterialData> &dataleft, TPZVec<TPZMaterialData> &dataright, REAL weight, TPZFMatrix<STATE> &ef) override
200  {
201  ContributeInterface(data, dataleft[0], dataright[0], weight, ef);
202  }
203 
204 
215  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override
216  {
217  DebugStop();
218  }
219 
231  {
232  DebugStop();
233  }
234 
235 
245  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix<STATE> &ef,TPZBndCond &bc) override
246  {
247  DebugStop();
248  }
249 
251  void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec<STATE> &Solout)
252  {
253  std::cout << __PRETTY_FUNCTION__ << " should never be called\n";
254  DebugStop();
255  }
256 
267  virtual void InterfaceJump(TPZVec<REAL> &x, TPZSolVec &leftu,TPZSolVec &rightu,TPZSolVec &jump) override
268  {
269  DebugStop();
270  }
271 
272 
273 
274  virtual int NStateVariables() const override
275  {
276  return fNStateVariables;
277  }
278 
279 
281  REAL weight,
282  TPZVec<STATE> &nkL,
283  TPZVec<STATE> &nkR,
284  int &errorid) override {
285  PZError << "Method not implemented\n";
286  }
287 
289  REAL weight,
290  TPZVec<STATE> &nk,
291  TPZBndCond &bc,
292  int &errorid) override {
293  PZError << "Method not implemented\n";
294  }
295 
301  public:
302 virtual int ClassId() const override;
303 
304 
306  virtual void Write(TPZStream &buf, int withclassid) const override;
307 
309  virtual void Read(TPZStream &buf, void *context) override;
310 
314 };
315 
316 #endif /* defined(__PZ__TPZLagrangeMultiplier__) */
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
virtual void ContributeInterfaceBCErrors(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZVec< STATE > &nk, TPZBndCond &bc, int &errorid) override
TPZLagrangeMultiplier & operator=(const TPZLagrangeMultiplier &copy)
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...
Material which implements a Lagrange Multiplier.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to stiffness matrix and load vector at one BC integration point...
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void ContributeBC(TPZVec< TPZMaterialData > &datavec, 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 to mul...
TPZMaterial * NewMaterial() override
To create another material of the same type.
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
TPZMaterial & operator=(const TPZMaterial &copy)
operator =
Definition: TPZMaterial.cpp:62
virtual void FillDataRequirementsInterface(TPZMaterialData &data, TPZVec< TPZMaterialData > &datavec_left, TPZVec< TPZMaterialData > &datavec_right) override
This method defines which parameters need to be initialized in order to compute the contribution of i...
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
void SetAllRequirements(bool set)
Set all flags at once.
TPZLagrangeMultiplier(const TPZLagrangeMultiplier &copy)
Copy constructor.
virtual int Dimension() const override
Returns the integrable dimension of the material.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to residual vector at one BC integration point.
TPZLagrangeMultiplier()
Simple constructor.
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
virtual void InterfaceJump(TPZVec< REAL > &x, TPZSolVec &leftu, TPZSolVec &rightu, TPZSolVec &jump) override
Dicontinuous galerkin materials implement contribution of discontinuous elements and interfaces...
virtual void ContributeInterfaceErrors(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZVec< STATE > &nkL, TPZVec< STATE > &nkR, int &errorid) override
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.
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
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 ~TPZLagrangeMultiplier()
Destructor.
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 int ClassId() const override
Unique identifier for serialization purposes.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual std::string Name() override
Returns the name of the material.
virtual void FillDataRequirementsInterface(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the ContributeInterface method...
int fNStateVariables
Number of state variables.
virtual void SetMultiplier(STATE mult)
TPZLagrangeMultiplier(int nummat, int dimension, int nstate)
Constructor with the index of the material object within the vector.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to stiffness matrix and load vector at one BC integration point to multiph...
virtual void ContributeInterface(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, TPZVec< TPZMaterialData > &dataright, REAL weight, TPZFMatrix< STATE > &ef) override
Computes a contribution to residual vector at one integration point.
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
int fDimension
Dimensiona associated with the material.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15