9 #ifndef __PZ__TPZTriangleSphere__ 10 #define __PZ__TPZTriangleSphere__ 17 template <
class GeomTriang = pzgeom::TPZGeoTriangle>
40 std::map<int64_t,int64_t> & gl2lcNdMap) : GeomTriang(cp,gl2lcNdMap), fXc(cp.fXc), fR(cp.fR)
56 GeomTriang::operator=(cp);
66 if (Xc.
size() != 3 || R == 0.0 ) {
78 static std::string
TypeName() {
return "TPZTriangleSphere";}
96 GeomTriang::X(cornerco,loc,xqsi);
101 for (
int i = 0; i < 3; i++) {
102 XtminusXc[i] = xqsi[i] - Xc[i];
103 NormValue += XtminusXc[i]*XtminusXc[i];
110 NormValue =
sqrt(NormValue);
113 for(
int i=0; i<3; i++)
115 result[i] = (fR/NormValue)*(XtminusXc[i])+ Xc[i];
136 GeomTriang::X(cornerco,par,XTriangle);
140 for (
int i = 0; i < XTriangle.
size(); i++)
141 { XtminusXc(i,0)= XTriangle[i] - Xc[i]; }
142 T NormValue =
Norm(XtminusXc);
146 GeomTriang::GradX(cornerco,par,GradXt);
148 GradOneoverNorm(0,0) = XtminusXc(0,0)*GradXt(0,0)+XtminusXc(1,0)*GradXt(1,0)+XtminusXc(2,0)*GradXt(2,0);
149 GradOneoverNorm(1,0) = XtminusXc(0,0)*GradXt(0,1)+XtminusXc(1,0)*GradXt(1,1)+XtminusXc(2,0)*GradXt(2,1);
150 T a = (NormValue*NormValue*NormValue);
152 GradOneoverNorm = b*GradOneoverNorm;
154 TensorXtGradX(0,0)= XtminusXc(0,0)*GradOneoverNorm(0,0);
155 TensorXtGradX(0,1)= XtminusXc(0,0)*GradOneoverNorm(1,0);
156 TensorXtGradX(1,0)= XtminusXc(1,0)*GradOneoverNorm(0,0);
157 TensorXtGradX(1,1)= XtminusXc(1,0)*GradOneoverNorm(1,0);
158 TensorXtGradX(2,0)= XtminusXc(2,0)*GradOneoverNorm(0,0);
159 TensorXtGradX(2,1)= XtminusXc(2,0)*GradOneoverNorm(1,0);
161 gradx=a*GradXt+TensorXtGradX;
288 template <
class GeomTriang>
290 return Hash(
"TPZTriangleSphere") ^ GeomTriang::ClassId() << 1;
void Read(TPZStream &buf, void *context) override
read objects from the stream
static REAL cornerco[8][3]
void GradX(TPZFMatrix< REAL > &cornerco, TPZVec< T > &par, TPZFMatrix< T > &gradx) const
void X(TPZFMatrix< REAL > &cornerco, TPZVec< T > &loc, TPZVec< T > &result) const
void Write(TPZStream &buf, int withclassid) const override
bool IsGeoBlendEl() const
declare geometry as blended element
TPZTriangleSphere & operator=(const TPZTriangleSphere &cp)
int64_t size() const
Returns the number of elements of the vector.
static bool IsLinearMapping(int side)
virtual void Write(const bool val)
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
TPZTriangleSphere(TPZVec< int64_t > &nodeindexes)
Constructor with list of nodes.
TPZTriangleSphere(const TPZTriangleSphere &cp, std::map< int64_t, int64_t > &gl2lcNdMap)
Constructor with node map.
int ClassId() const override
int32_t Hash(std::string str)
TPZTriangleSphere(const TPZTriangleSphere &cp)
Copy constructor.
This class implements a geometric mesh for the pz environment. Geometry.
TPZTriangleSphere(const TPZTriangleSphere &cp, TPZGeoMesh &)
Copy constructor.
void Read(TPZStream &buf, void *context) override
Creates a geometric element according to the type of the father element.
Defines the interface for saving and reading data. Persistency.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Groups all classes which model the geometry.
static std::string TypeName()
Returns the type name of the element.
void SetData(const REAL R, TPZVec< REAL > &Xc)
static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec< REAL > &lowercorner, TPZVec< REAL > &size)
virtual void Read(bool &val)
TPZTriangleSphere()
Empty constructor.