6 #ifndef TPZGEOELMAPPED_H 7 #define TPZGEOELMAPPED_H 20 static LoggerPtr loggermapped(Logger::getLogger(
"pz.mesh.geoelmapped"));
35 typedef typename TBase::Geo
Geo;
37 TBase(),
fCornerCo(Geo::Dimension,Geo::NNodes,0.)
42 TBase(id,nodeindexes,matind,mesh),
fCornerCo(Geo::Dimension,Geo::NNodes,0.)
47 TBase(nodeindices,matind,mesh),
fCornerCo(Geo::Dimension,Geo::NNodes,0.)
52 TBase(nodeindices,matind,mesh,index),
fCornerCo(Geo::Dimension,Geo::NNodes,0.)
59 std::map<int64_t,int64_t> &gl2lcElIdx);
74 std::map<int64_t,int64_t> &gl2lcNdIdx,
75 std::map<int64_t,int64_t> &gl2lcElIdx)
const override;
81 TBase::Write(buf,withclassid);
88 TBase::Read(buf,context);
115 int64_t& index)
override;
120 TBase::SetFatherIndex(fatherindex);
124 if(father) nextfather = father->
Father();
128 nextfather = father->
Father();
130 int in, nnodes = Geo::NNodes;
135 if(Tol < 1.e-10) Tol = 1.e-10;
141 for(in=0; in<nnodes; in++)
143 for(
int id = 0;
id < 3;
id++){
144 nodeX[id] = this->NodePtr(in)->Coord(
id);
150 while(nextfatherside.
Element())
152 fatherside = nextfatherside;
153 nextfatherside = nextfatherside.
Father2();
166 project.
Apply(aux,ptancestor);
171 for(
int i = 0; i < ptancestor.NElements(); i++){
172 ksidiff += (aux[i]-ptancestor[i])*(aux[i]-ptancestor[i]);
174 ksidiff =
sqrt(ksidiff);
181 std::cout.precision(12);
182 std::cout <<
"\nError at " << __PRETTY_FUNCTION__ << __LINE__ <<
"\n";
183 std::cout <<
"aux:\n";
184 for(
int i = 0; i < aux.
NElements(); i++) std::cout << aux[i] <<
"\t";
185 std::cout <<
"\nptancestor:\n";
186 for(
int i = 0; i < ptancestor.NElements(); i++) std::cout << ptancestor[i] <<
"\t";
192 father->
X(ptancestor,fatherX);
195 for(
int i = 0; i < 3; i++){
196 diff = fatherX[i]-nodeX[i];
201 std::cout <<
"\nError at " << __PRETTY_FUNCTION__ << __LINE__ <<
"\n";
202 std::cout <<
"this->Index = " << this->Index() <<
"\n";
203 std::cout <<
"aux:\n";
204 for(
int i = 0; i < aux.
NElements(); i++) std::cout << aux[i] <<
"\t";
205 std::cout <<
"\nptancestor:\n";
206 for(
int i = 0; i < ptancestor.NElements(); i++) std::cout << ptancestor[i] <<
"\t";
208 std::cout <<
"nodeX:\n";
209 for(
int i = 0; i < nodeX.
NElements(); i++) std::cout << nodeX[i] <<
"\t";
210 std::cout <<
"\nfatherX:\n";
211 for(
int i = 0; i < fatherX.
NElements(); i++) std::cout << fatherX[i] <<
"\t";
217 father->
X(aux,fatherXaux);
219 for(
int i = 0; i < 3; i++){
220 diff = fatherX[i]-fatherXaux[i];
226 std::stringstream sout;
229 sout <<
"\nError at " << __PRETTY_FUNCTION__ << __LINE__ <<
"\n";
230 sout <<
"this->Index = " << this->Index() <<
"\n";
231 sout <<
"Node number " << in << std::endl;
232 sout <<
"Node index " << this->NodeIndex(in) << std::endl;
233 sout <<
"Father side " << this->FatherSide(in,0) << std::endl;
235 for(
int i = 0; i < aux.
NElements(); i++) sout << aux[i] <<
"\t";
236 sout <<
"\nptancestor:\n";
237 for(
int i = 0; i < ptancestor.NElements(); i++) sout << ptancestor[i] <<
"\t";
240 for(
int i = 0; i < nodeX.
NElements(); i++) sout << nodeX[i] <<
"\t";
241 sout <<
"\nfatherX:\n";
242 for(
int i = 0; i < fatherX.
NElements(); i++) sout << fatherX[i] <<
"\t";
243 sout <<
"\nfatherXaux:\n";
244 for(
int i = 0; i < fatherXaux.
NElements(); i++) sout << fatherXaux[i] <<
"\t";
245 std::cout << sout.str();
255 for(
int id=0;
id<Geo::Dimension;
id++)
306 return TGradX(qsi, gradx);
310 return TGradX(qsi, gradx);
366 return TX(ksi,result);
370 return TX(ksi,result);
374 virtual void Print(std::ostream & out = std::cout)
override 383 {std::cout <<
"\n***USING THE JACOBIAN FOR 3D ELEMENTS METHOD***\n";
388 QsiEtaIni[0] = QsiEta[0];
389 QsiEtaIni[1] = QsiEta[1];
390 QsiEtaIni[2] = QsiEta[2];
391 const double deltaQsi = 0.1;
392 const double deltaEta = 0.1;
393 const double deltaZeta = 0.1;
396 std::cout <<
"\ninitial Qsi = " << QsiEtaIni[0] <<
" | initial Eta = " << QsiEtaIni[1] <<
" | initial Zeta = " << QsiEtaIni[2] <<
"\n";
397 std::cout <<
"deltaQsi = const = " << deltaQsi <<
" | deltaEta = const = " << deltaEta <<
" | deltaZeta = const = " << deltaZeta <<
"\n\n";
403 for(
int i = 0; i <= 10; i++)
409 dX = alpha*( jacobian.
GetVal(0,0)*deltaQsi + jacobian.
GetVal(0,1)*deltaEta + jacobian.
GetVal(0,2)*deltaZeta)*Axes(0,0) + alpha*( jacobian.
GetVal(1,0)*deltaQsi + jacobian.
GetVal(1,1)*deltaEta + jacobian.
GetVal(1,2)*deltaZeta)*Axes(1,0) + alpha*( jacobian.
GetVal(2,0)*deltaQsi + jacobian.
GetVal(2,1)*deltaEta + jacobian.
GetVal(2,2)*deltaZeta)*Axes(2,0);
410 XYZaprox[0] = XYZ[0] + dX;
412 dY = alpha*( jacobian.
GetVal(0,0)*deltaQsi + jacobian.
GetVal(0,1)*deltaEta + jacobian.
GetVal(0,2)*deltaZeta)*Axes(0,1) + alpha*( jacobian.
GetVal(1,0)*deltaQsi + jacobian.
GetVal(1,1)*deltaEta + jacobian.
GetVal(1,2)*deltaZeta)*Axes(1,1) + alpha*( jacobian.
GetVal(2,0)*deltaQsi + jacobian.
GetVal(2,1)*deltaEta + jacobian.
GetVal(2,2)*deltaZeta)*Axes(2,1);
413 XYZaprox[1] = XYZ[1] + dY;
415 dZ = alpha*( jacobian.
GetVal(0,0)*deltaQsi + jacobian.
GetVal(0,1)*deltaEta + jacobian.
GetVal(0,2)*deltaZeta)*Axes(0,2) + alpha*( jacobian.
GetVal(1,0)*deltaQsi + jacobian.
GetVal(1,1)*deltaEta + jacobian.
GetVal(1,2)*deltaZeta)*Axes(1,2) + alpha*( jacobian.
GetVal(2,0)*deltaQsi + jacobian.
GetVal(2,1)*deltaEta + jacobian.
GetVal(2,2)*deltaZeta)*Axes(2,2);
416 XYZaprox[2] = XYZ[2] + dZ;
418 QsiEta[0] = QsiEtaIni[0] + alpha*deltaQsi;
419 QsiEta[1] = QsiEtaIni[1] + alpha*deltaEta;
420 QsiEta[2] = QsiEtaIni[2] + alpha*deltaZeta;
422 if((QsiEta[1]>1.00001-QsiEta[0]) || QsiEta[2]>1.00001-QsiEta[0]-QsiEta[1])
break;
425 XYZ[0] -= XYZaprox[0];
426 XYZ[1] -= XYZaprox[1];
427 XYZ[2] -= XYZaprox[2];
429 double XDiffNorm =
sqrt(XYZ[0]*XYZ[0] + XYZ[1]*XYZ[1] + XYZ[2]*XYZ[2]);
430 error(
int(i),0) = XDiffNorm;
433 std::cout <<
"ERROR Vector:\n";
434 for(
int j = 2; j < edge; j++)
436 std::cout <<
error(j,0) <<
"\n";
439 std::cout <<
"\nConvergence Order:\n";
440 for(
int j = 2; j < edge; j++)
444 if(edge != 11) std::cout <<
"The direction track has touch the edge of the element.\nThe method has stopped!\n";
458 const int dim = Geo::Dimension;
465 for(in=0; in<Geo::NNodes; in++)
467 for(
id=0;
id<dim;
id++)
469 ksibar[id] += phi(in,0)*fCornerCo.
GetVal(
id,in);
470 for(jd=0; jd<dim; jd++)
472 jac(
id,jd) += dphi(jd,in)*fCornerCo.
GetVal(
id,in);
490 int ns = this->NSideNodes(side);
493 for(in=0; in<ns; in++)
495 nodeindices[in] = this->SideNodeIndex(side,in);
520 TBase::GradX(qsi,gradx);
527 nextfather = father->
Father();
532 Geo::GradX(fCornerCo,qsi,gradxlocal);
533 Geo::X(fCornerCo,qsi,ksibar);
535 father->
GradX(ksibar, gradxfather);
538 gradxfather.
Multiply(gradxlocal, gradx);
540 if(loggermapped->isDebugEnabled())
542 std::stringstream sout;
543 gradxfather.
Print(
"gradx father",sout);
544 gradxlocal.
Print(
"gradx local",sout);
545 gradx.
Print(
"gradx",sout);
558 return TBase::X(ksi,result);
564 if(father) nextfather = father->
Father();
568 nextfather = father->
Father();
573 father->
X(ksibar,result);
581 const int dim = Geo::Dimension;
585 Geo::TShape(ksi,phi,dphi);
588 for(in=0; in<Geo::NNodes; in++)
590 for(
id=0;
id<dim;
id++)
592 ksibar[id] += phi(in,0)*fCornerCo.
GetVal(
id,in);
598 template<
class TBase>
607 return TBase::IsLinearMapping(side);
611 template<
class TBase>
613 return Hash(
"TPZGeoElMapped") ^ TBase::ClassId() << 1;
virtual TPZGeoEl * ClonePatchEl(TPZGeoMesh &DestMesh, std::map< int64_t, int64_t > &gl2lcNdIdx, std::map< int64_t, int64_t > &gl2lcElIdx) const override
void Print(std::ostream &out=std::cout)
Prints the structural information of the vector object to the output stream. This method will not p...
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TPZGeoElMapped(int64_t id, TPZVec< int64_t > &nodeindexes, int matind, TPZGeoMesh &mesh)
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
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.
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual bool IsLinearMapping(int side) const override
TPZGeoElSide Father2() const
returns the father/side pair which contains the set of points associated with this/side ...
TPZTransform< REAL > Projection(int side)
Compute the projection of the point within the interior of the element to the side of the element...
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
static int fatherside[8][21]
virtual void Initialize()
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
virtual int NSides() const =0
Returns the number of connectivities of the element.
This class implements a geometric element which uses its ancestral to compute its jacobian...
virtual TPZGeoEl * CreateGeoBlendElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Creates a geometric element in same fashion of CreateGeoElement but here the elements are blend...
int WhichSide(TPZVec< int64_t > &SideNodeIds)
Returns the side number which is connected to the SideNodes returns -1 if no side is found...
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
bool IsLinearMapping() const
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
virtual TPZGeoEl * CreateBCGeoEl(int side, int bc) override
void TX(TPZVec< T > &ksi, TPZVec< T > &result) const
void Read(TPZStream &buf, void *context) override
read objects from the stream
TPZGeoElMapped(TPZVec< int64_t > &nodeindices, int matind, TPZGeoMesh &mesh, int64_t &index)
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
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.
Free store vector implementation.
TPZFNMatrix< Geo::Dimension *Geo::NNodes > fCornerCo
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index) override
Creates a geometric element according to the type of the father element.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
TPZGeoElMapped(TPZVec< int64_t > &nodeindices, int matind, TPZGeoMesh &mesh)
void TKsiBar(TPZVec< T > &ksi, TPZVec< T > &ksibar) const
Compute the map of the point ksi to the ancestor ksibar.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Full matrix class. Matrix.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
int ClassId() const override
int32_t Hash(std::string str)
void KsiBar(TPZVec< REAL > &ksi, TPZVec< REAL > &ksibar) const
Compute the map of the point ksi to the ancestor ksibar.
virtual TPZGeoEl * Clone(TPZGeoMesh &DestMesh) const override
void KsiBar(TPZVec< REAL > &ksi, TPZVec< REAL > &ksibar, TPZFMatrix< REAL > &jac) const
Compute the map of the point ksi to the ancestor ksibar and the gradient of the ancestor ksibar with ...
TPZGeoEl * Element() const
virtual void GradX(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &gradx) const =0
Return the gradient of the transformation at the given coordinate.
virtual void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
virtual int Dimension() const =0
Returns the dimension of the element.
virtual TPZTransform< REAL > SideToSideTransform(int sidefrom, int sideto)=0
Compute the transformation between the master element space of one side of an element to the master e...
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_ log
bool ComputeXInverse(TPZVec< REAL > &XD, TPZVec< REAL > &ksi, REAL Tol)
Computes the XInverse and returns true if ksi belongs to master element domain.
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...
This class implements a geometric mesh for the pz environment. Geometry.
MElementType
Define the element types.
void X(TPZVec< REAL > &ksi, TPZVec< REAL > &result) const override
Returns the Jacobian matrix at the point (from son to father)
void GradX(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &gradx) const override
Return the Jacobian matrix at the point.
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
void TGradX(TPZVec< T > &qsi, TPZFMatrix< T > &gradx) const
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
virtual void Print(std::ostream &out) const
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
virtual void JacobianConv(TPZVec< REAL > QsiEta, TPZVec< REAL > &XYZ)
Avaliate the Jacobian 3D (3x3 size) by Expected Convergence Order.
virtual void SetFatherIndex(int64_t fatherindex) override
Sets the father element index.
REAL ZeroTolerance()
Returns the tolerance to Zero value. Actually: .
virtual bool IsGeoElMapped() const override
Returns if is a TPZGeoElMapped< T > element.
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
void InsertConnectivity(TPZGeoElSide &neighbour)
This method inserts the element/side and all lowerdimension sides into the connectivity loop...
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
virtual void Print(std::ostream &out=std::cout) override