NeoPZ
TPZNullMaterial.cpp
Go to the documentation of this file.
1 
6 #include "TPZNullMaterial.h"
8 #include "pzmaterialdata.h"
9 #include "pzerror.h"
10 #include "pzvec.h"
11 #include "pzbndcond.h"
12 #include "pzreal.h"
13 #include "pzadmchunk.h"
14 #include "tpzintpoints.h"
15 #include "pzpoisson3d.h"
16 
17 #include "pzlog.h"
18 
19 #ifdef LOG4CXX
20 #ifdef PZDEBUG
21 #define DEBUG2
22 #endif
23 static LoggerPtr logger(Logger::getLogger("pz.material"));
24 #endif
25 
26 
27 
29 TPZMaterial() {
30  fDim=-1;
31  fNState = 1;
32 }
33 
35 {
36 }
37 
38 
39 
40 void TPZNullMaterial::Print(std::ostream & out) {
41  out << __PRETTY_FUNCTION__ << std::endl;
42  TPZMaterial::Print(out);
43 
44 }
45 
46 int TPZNullMaterial::VariableIndex(const std::string &name) {
47  return TPZMaterial::VariableIndex(name );
48 }
49 
51  return TPZMaterial::NSolutionVariables(index);
52 }
53 
55  int numbersol = data.dsol.size();
56  if (numbersol != 1) {
57  DebugStop();
58  }
59  this->Solution(data.sol[0], data.dsol[0], data.axes, var, Solout);
60 }
61 
63  DebugStop();
64 }
65 
67 {
68 }
69 
70 void TPZNullMaterial::Solution(TPZMaterialData &data, TPZVec<TPZMaterialData> &dataleftvec, TPZVec<TPZMaterialData> &datarightvec, int var, TPZVec<STATE> &Solout, TPZCompEl *left, TPZCompEl *right)
71 {
72 
73 }
74 
76  TPZVec<STATE> &Solout){
77  if(var == 0) Solout = Sol;
78 
79  else if (var==1){
80  STATE val = 0.;
81  for(int i=0; i<fDim; i++){
82  val += DSol(i,i);
83  }
84  Solout[0] = val;
85  }
86 
87  else
88  {
89  TPZMaterial::Solution(Sol, DSol,axes,var,Solout);
90  }
91 }
92 
93 
95 }
96 
98 }
99 
101 }
102 
103 
104 
105 
107  return Hash("TPZNullMaterial") ^ TPZMaterial::ClassId() << 1;
108 }
109 
110 void TPZNullMaterial::Write(TPZStream &buf, int withclassid) const
111 {
112  TPZMaterial::Write(buf,withclassid);
113  if (fDim < 1 || fDim >3) {
114  DebugStop();
115  }
116  buf.Write(&fDim);
117  buf.Write(&fNState);
118 }
119 
120 void TPZNullMaterial::Read(TPZStream &buf, void *context)
121 {
122  TPZMaterial::Read(buf,context);
123  buf.Read(&fDim);
124 #ifdef PZDEBUG
125  if (fDim < 1 || fDim >3) {
126  DebugStop();
127  }
128 #endif
129  buf.Read(&fNState);
130 }
131 
133 {
134 
135 }
136 
138 
139  TPZFMatrix<REAL> &phi = data.phi;
140  TPZFMatrix<REAL> &axes = data.axes;
141  int phr = phi.Rows();
142  short in,jn;
143  STATE v2[1];
144  v2[0] = bc.Val2()(0,0);
145 
146  if(bc.HasForcingFunction()) {
148  bc.ForcingFunction()->Execute(data.x,res);
149  v2[0] = res[0];
150  }
151 
152  switch (bc.Type()) {
153  case 0 : // Dirichlet condition
154  for(in = 0 ; in < phr; in++) {
155  ef(in,0) += (STATE)(gBigNumber* phi(in,0) * weight) * v2[0];
156  for (jn = 0 ; jn < phr; jn++) {
157  ek(in,jn) += gBigNumber * phi(in,0) * phi(jn,0) * weight;
158  }
159  }
160  break;
161  case 1 : // Neumann condition
162  std::cout<< "Not implemented yet!"<<std::endl;
163  break;
164  case 2 : // mixed condition
165  std::cout<< "Not implemented yet!"<<std::endl;
166  break;
167 
168  }
169 
170 
171 }
173 
174 }
175 
virtual int ClassId() const override
Unique identifier for serialization purposes.
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
Definition: pzfunction.h:38
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
clarg::argBool bc("-bc", "binary checkpoints", false)
int Type()
Definition: pzbndcond.h:249
Templated vector implementation.
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
Defines PZError.
void ErrorsHdiv(TPZMaterialData &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values) override
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
Declarates the TPZBlock<REAL>class which implements block matrices.
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 Print(std::ostream &out=std::cout) override
Prints out the data associated with the material.
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
Contains the TPZMatPoisson3d class.
TPZFMatrix< STATE > & Val2(int loadcase=0)
Definition: pzbndcond.h:255
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
int fNState
Number of state variables.
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 Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
TPZAutoPointer< TPZFunction< STATE > > & ForcingFunction()
Returns a procedure as source function for the material.
Definition: TPZMaterial.h:397
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
#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
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
string res
Definition: test.py:151
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
Definition: TPZMaterial.h:472
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
Definition: TPZMaterial.h:83
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
int ClassId() const override
Unique identifier for serialization purposes.
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
int fDim
Problem dimension.
Contains the TPZIntPoints class which defines integration rules.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
virtual ~TPZNullMaterial()
Default destructor.
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.
def values
Definition: rdt.py:119
virtual int VariableIndex(const std::string &name) override
Returns the variable index associated with the name.
TPZNullMaterial()
Creates a material object and inserts it in the vector of material pointers of the mesh...
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZSolVec sol
vector of the solutions at the integration point
virtual void Read(bool &val)
Definition: TPZStream.cpp:91