6 #ifndef PZCOMPELPOSTPROC_H 7 #define PZCOMPELPOSTPROC_H 34 static LoggerPtr CompElPostProclogger(Logger::getLogger(
"pz.mesh.TPZCompElPostProc"));
45 template <
class TCOMPEL >
64 std::map<int64_t,int64_t> & gl2lcConMap,
65 std::map<int64_t,int64_t> & gl2lcElMap);
68 void InitializeShapeFunctions();
79 virtual TPZCompEl *ClonePatchEl(
TPZCompMesh &mesh,std::map<int64_t,int64_t> & gl2lcConMap,std::map<int64_t,int64_t>&gl2lcElMap)
const override;
85 virtual void Print(std::ostream & out = std::cout)
const override 87 out << __PRETTY_FUNCTION__ <<
" calling print from superclass\n";
156 int ClassId()
const override;
159 void Write(
TPZStream &buf,
int withclassid)
const override;
162 void Read(
TPZStream &buf,
void *context)
override;
166 template<
class TCOMPEL>
171 template<
class TCOMPEL>
176 template<
class TCOMPEL>
182 template<
class TCOMPEL>
188 template<
class TCOMPEL>
191 std::map<int64_t,int64_t> & gl2lcConMap,
192 std::map<int64_t,int64_t> & gl2lcElMap):
198 template <
class TCOMPEL>
203 template <
class TCOMPEL>
208 template <
class TCOMPEL>
217 template <
class TCOMPEL>
220 TCOMPEL::ComputeRequiredData(data, qsi);
228 template <
class TCOMPEL>
237 template <
class TCOMPEL>
240 TCOMPEL::Write(buf,withclassid);
246 template <
class TCOMPEL>
249 TCOMPEL::Read(buf,context);
255 template <
class TCOMPEL>
260 this->InitializeElementMatrix(ef);
273 if (this->NConnects() == 0)
return;
279 this->InitMaterialData(data);
286 data.
p = this->MaxOrder();
287 int dim = this->Reference()->Dimension();
293 TPZIntPoints* pFIntegrationRule = &this->GetIntegrationRule();
294 if (!pFIntegrationRule) {
295 PZError <<
"Error at " << __PRETTY_FUNCTION__ <<
" Integration rule must be used from TPZCompEl. \n";
299 const TPZIntPoints &intrule = this->GetIntegrationRule();
302 int intrulepoints = intrule.
NPoints();
303 int intrulepointsRef = intruleRef.
NPoints();
304 if(intrulepoints != intrulepointsRef)
306 PZError <<
"Error at " << __PRETTY_FUNCTION__ <<
" Referred CompEl with different number of integration points\n";
310 int nshape = this->NShapeF();
319 for(
int int_ind = 0; int_ind < intrulepoints; ++int_ind)
321 intrule. Point(int_ind,intpoint, weight);
322 intruleRef.
Point(int_ind,intpointRef,weightRef);
358 if(CompElPostProclogger->isDebugEnabled())
360 std::stringstream sout;
361 sout <<
"Integration point " << int_ind <<
" x = " << dataRef.
x <<
" GradSol = " << dataRef.
dsol[0] ;
365 int n_var_indexes = varIndex.
NElements();
366 for(
int var_ind = 0; var_ind < n_var_indexes; var_ind++)
368 int variableindex = varIndex[var_ind];
372 if (variableindex < 99) {
373 pMaterialRef->
Solution(dataRef, variableindex, Sol);
376 pCompElRef->
Solution(intpointRef, variableindex, Sol);
380 if(CompElPostProclogger->isDebugEnabled())
382 std::stringstream sout;
385 sout << varname <<
" -value- " << Sol;
389 for(
int i = 0; i <nsolvars; i++) data.
sol[0][index+i] = Sol[i];
393 pPostProcMat->
Contribute(data,weight,ekTemp,efTemp);
400 for(
int i_st = 0; i_st < stackedVarSize; i_st++)
403 efTemp.
GetSub(i_st*nshape, 0, nshape, 1, rhsTemp);
408 ekCopy.
MultAdd(rhsTemp, rhsCopy, result, 1., -1.);
409 REAL invRes =
Norm(result);
411 PZError <<
"Error at " << __PRETTY_FUNCTION__ <<
" Unable to solve the transference linear system\n";
418 PZError <<
"Error at " << __PRETTY_FUNCTION__
419 <<
" Transference linear system solved with residual norm = " 420 << invRes <<
" at " << i_st <<
" export variable\n";
422 for(
int i_sh = 0; i_sh < nshape; i_sh++)
423 ef.
fMat(i_sh * stackedVarSize + i_st, 0) = rhsTemp(i_sh);
428 std::stringstream sout;
429 sout <<
"Element index " << this->fIndex << std::endl;
437 template <class TCOMPEL>
439 PZError <<
"\nTPZCompElPostProc<TCOMPEL>::CalcStiff() Should never be called!!!\n";
443 template <
class TCOMPEL>
446 const REAL SMALLNUMBER = 1.e-8;
455 int64_t nshape = d1.
phi.
Rows();
456 int64_t nshape2 = d2.
phi.
Rows();
457 if(dim != d2.
x.
NElements() || nshape!= nshape2)
463 for(i = 0; i < dim; i++)res +=
pow(d1.
x[i]-d2.
x[i],(REAL)2.0);
464 if(res > SMALLNUMBER)
472 template <
class TCOMPEL>
479 TCOMPEL::ComputeSolution(qsi, phi, dphix, axes, sol, dsol);
482 template <
class TCOMPEL>
487 TCOMPEL::ComputeSolution(qsi, normal, leftsol, dleftsol, leftaxes, rightsol, drightsol, rightaxes);
490 template <
class TCOMPEL>
497 PZError <<
"\nERROR AT " << __PRETTY_FUNCTION__ <<
" - this->Reference() == NULL\n";
500 ref->
Jacobian( intpoint, jacobian, axes, detjac , jacinv);
504 this->
Shape(intpoint,phi,dphi);
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 ComputeRequiredData(TPZVec< REAL > &point, TPZVec< TPZTransform<> > &trvec, TPZVec< TPZMaterialData > &datavec, TPZVec< int64_t > indices)
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
virtual TPZCompEl * Clone(TPZCompMesh &mesh) const override
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
int Solve_LU(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LU method .
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
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
int ClassId() const override
bool dataequal(TPZMaterialData &d1, TPZMaterialData &d2)
Compare some fields of 2 TPZMaterialData and return true if these do match.
virtual TPZCompEl * ClonePatchEl(TPZCompMesh &mesh, std::map< int64_t, int64_t > &gl2lcConMap, std::map< int64_t, int64_t > &gl2lcElMap) const override
Create a copy of the given element. The clone copy have the connect indexes mapped to the local clone...
TPZFNMatrix< 660, REAL > dphi
values of the derivative of the shape functions over the master element
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Templated vector implementation.
void ComputeRequiredData(TPZMaterialData &data, TPZVec< REAL > &qsi) override
Contains declaration of TPZInterpolationSpace class which implements the interface for interpolated c...
void InitializeShapeFunctions()
Initializes the shape function type in order to allow non ill-conditioned L2 Transfer matrix...
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
Contains the declaration of the TPZMultiphysicsElement class. This class is abstract.
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...
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphix, const TPZFMatrix< REAL > &axes, TPZSolVec &sol, TPZGradSolVec &dsol) override
Avoids the calling of the TPZCompElReferred::ComputeSolution wich would attempt to append solution of...
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
TPZFNMatrix< 9, REAL > jacobian
value of the jacobian at the integration point
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
int p
maximum polinomial order of the shape functions
virtual int GetSub(const int64_t sRow, const int64_t sCol, const int64_t rowSize, const int64_t colSize, TPZFMatrix< TVar > &Target) const
Gets submatrix storing it on Target.
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
Abstract class defining integration rules. Numerical Integration.
This abstract class defines the behaviour which each derived class needs to implement.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
virtual ~TPZCompElPostProc()
virtual void ComputeShape(TPZVec< REAL > &intpoint, TPZVec< REAL > &X, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< REAL > &dphidx)
Compute shape functions based on master element in the classical FEM manner.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
void GetPostProcVarName(int64_t index, std::string &varname)
Return the name of the ith postproc variable.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
void Jacobian(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &jac, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Compute a decomposition of the gradient of the mapping function, as a rotation matrix (Jacobian) and ...
virtual void ComputeShape(TPZVec< REAL > &intpoint, TPZVec< REAL > &X, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< REAL > &dphidx) override
Reimplemented in order to ensure the shape functions are computed with local support and thus benefit...
int64_t Rows() const
Returns number of rows.
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
virtual void CalcResidual(TPZElementMatrix &ef) override
The CalcResidual reimplementation is in charge of extracting the data from the referred compEl at the...
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
int intLocPtIndex
Index of the current integration point being evaluated.
int32_t Hash(std::string str)
Contains TPZMatrix<TVar>class, root matrix class.
void GetPostProcessVarIndexList(TPZVec< int > &varIndexList)
Returns a vector with all the variable indexes requested for post processing and an the total number ...
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
This class implements the TPZCompEl structure to enable copying the solution of the referred compEl a...
Implements the interfaces for TPZCompElDisc, TPZInterfaceElement and TPZInterpolatedElement. Computational element.
virtual void Print(std::ostream &out=std::cout) const override
Prints element data.
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
virtual void Print(std::ostream &out=std::cout) const override
Prints element data.
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
void Reset(TPZCompMesh *mesh=NULL, MType type=Unknown)
Reset the data structure.
Template to generate computational elements. Computational Element.
Implements computational mesh. Computational Mesh.
virtual void Solution(TPZVec< REAL > &qsi, int var, TPZVec< STATE > &sol)
Calculates the solution - sol - for the variable var at point qsi, where qsi is expressed in terms of...
Contains the declaration of the shape function discontinuous.
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha=1., const TVar beta=0., const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
int ClassId() const override
write the element data to a stream
virtual void Print(std::ostream &out) const
virtual int MaxOrder()
Returns the max order of interpolation.
virtual int NStateVariables() const override
returns the number of state variables associated with the material
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
virtual const TPZIntPoints & GetIntegrationRule() const
Contains declaration of TPZReferredCompEl class which generates computational elements.
TPZCompEl * ReferredElement()
Returns referred element of this.
virtual void ComputeRequiredData(TPZMaterialData &data, TPZVec< REAL > &qsi)
Compute and fill data with requested attributes.
Defines the interface of a computational element. Computational Element.
TPZSolVec sol
vector of the solutions at the integration point
REAL detjac
determinant of the jacobian
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
virtual void Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
#define PZError
Defines the output device to error messages and the DebugStop() function.