29 double CrossX, CrossY, CrossZ;
32 CrossX =
fabs(-(coord(1,1)*coord(2,0)) + coord(1,2)*coord(2,0) + coord(1,0)*coord(2,1) - coord(1,2)*coord(2,1) - coord(1,0)*coord(2,2) + coord(1,1)*coord(2,2));
33 CrossY =
fabs(coord(0,1)*coord(2,0) - coord(0,2)*coord(2,0) - coord(0,0)*coord(2,1) + coord(0,2)*coord(2,1) + coord(0,0)*coord(2,2) - coord(0,1)*coord(2,2));
34 CrossZ =
fabs(-(coord(0,1)*coord(1,0)) + coord(0,2)*coord(1,0) + coord(0,0)*coord(1,1) - coord(0,2)*coord(1,1) - coord(0,0)*coord(1,2) + coord(0,1)*coord(1,2));
37 std::cout <<
"Arc3D element with nodes coordinates non initialized!!!\n";
42 if(CrossX <= 1.E-6 && CrossY <= 1.E-6 && CrossZ <= 1.E-6)
44 cout <<
"The 3 given points that define an TPZArc3D are co-linear!\n";
45 cout <<
"Method aborted!";
53 fIBaseCn.Resize(3,3); fICnBase.Resize(3,3); fCenter3D.Resize(3);
54 for(
int i = 0; i < 3; i++)
56 IBaseCnCP(i,0) = coord(i,0) - coord(i,2);
57 IBaseCnCP(i,1) = coord(i,1) - coord(i,2);
61 IBaseCnCP(0,2) = -coord(1,1)*coord(2,0) + coord(1,2)*coord(2,0) + coord(1,0)*coord(2,1) - coord(1,2)*coord(2,1) - coord(1,0)*coord(2,2) + coord(1,1)*coord(2,2);
62 IBaseCnCP(1,2) = coord(0,1)*coord(2,0) - coord(0,2)*coord(2,0) - coord(0,0)*coord(2,1) + coord(0,2)*coord(2,1) + coord(0,0)*coord(2,2) - coord(0,1)*coord(2,2);
63 IBaseCnCP(2,2) = -coord(0,1)*coord(1,0) + coord(0,2)*coord(1,0) + coord(0,0)*coord(1,1) - coord(0,2)*coord(1,1) - coord(0,0)*coord(1,2) + coord(0,1)*coord(1,2);
69 axest.Transpose(&fICnBase);
74 double Xa, Ya, Xb, Yb;
75 ComputeR2Points(coord,Xa,Ya,Xb,Yb);
79 fYcenter = (-Xa*Xb + Xb*Xb + Yb*Yb) / (2.*Yb);
83 Temp[0] = fXcenter; Temp[1] = fYcenter; Temp[2] = 0.;
double temp = 0.;
84 for(
int i = 0; i < 3; i++)
86 for(
int j = 0; j < 3; j++) temp += fIBaseCn(i,j)*Temp[j];
87 fCenter3D[i] = temp + coord(i,2);
92 fRadius =
sqrt( fXcenter*fXcenter + fYcenter*fYcenter );
95 finitialVector.Resize(2,0.);
96 finitialVector[0] = Xa - fXcenter; finitialVector[1] = Ya - fYcenter;
106 REAL resultlocminus1, resultloc0,resultlocplus1;
110 for (
int i=0; i<3; i++) {
111 result[i] -= nodes(i,0);
113 resultlocminus1 =
Norm(result);
119 for (
int i=0; i<3; i++) {
120 result[i] -= nodes(i,1);
122 resultlocplus1 =
Norm(result);
127 for (
int i=0; i<3; i++) {
128 result[i] -= nodes(i,2);
130 resultloc0 =
Norm(result);
136 if(resultlocminus1 >= 1.E-6 )
138 cout <<
"Method aborted!";
142 if(resultlocplus1 >= 1.E-6)
144 cout <<
"Method aborted!";
148 if(resultloc0 >= 1.E-6)
151 cout <<
"Method aborted!";
161 void TPZArc3D::ComputeR2Points(
TPZFMatrix<REAL> &coord,
double &xa,
double &ya,
double &xb,
double &yb)
166 for(i = 0; i < 3; i++) Axe[i] = coord(i,0) - coord(i,2);
167 for(i = 0; i < 3; i++)
169 for(j = 0; j < 3; j++) Temp[i] += fICnBase(i,j)*Axe[j];
171 xa = Temp[0]; ya = Temp[1];
175 for(i = 0; i < 3; i++) Axe[i] = coord(i,1) - coord(i,2);
176 for(i = 0; i < 3; i++)
178 for(j = 0; j < 3; j++) Temp[i] += fICnBase(i,j)*Axe[j];
180 xb = Temp[0]; yb = Temp[1];
182 fAngle = ArcAngle(coord,xa, ya, xb, yb);
187 double TPZArc3D::ArcAngle(
TPZFMatrix<REAL> &coord,
double xa,
double ya,
double xb,
double yb)
const 189 REAL Xcenter, Ycenter, arcAngle, sinBig, cosBig;
193 Ycenter = (-xa*xb + xb*xb + yb*yb) / (2.*yb);
195 cosBig = (xb-Xcenter)*(xa-Xcenter)+(yb-Ycenter)*(ya-Ycenter);
196 sinBig = (xa-Xcenter)*(yb-Ycenter)-(xb-Xcenter)*(ya-Ycenter);
197 arcAngle = -
atan2(sinBig, cosBig);
199 REAL cosMid = (0.-Xcenter)*(xa-Xcenter)+(0.-Ycenter)*(0.-Ycenter);
200 REAL sinMid = (xa-Xcenter)*(0.-Ycenter)-(0.-Xcenter)*(ya-Ycenter);
201 REAL arcMid = -
atan2(sinMid, cosMid);
203 if (0. <= arcMid && arcMid <= arcAngle) {
206 if (arcMid <= 0. && arcAngle <= arcMid)
224 REAL
cos, Angle1, Angle2, Angle3;
227 cos = (-((xa - Xcenter)*Xcenter) - (ya - Ycenter)*Ycenter) /
228 (
sqrt((xa - Xcenter)*(xa - Xcenter) + (ya - Ycenter)*(ya - Ycenter))*
sqrt(Xcenter*Xcenter + Ycenter*Ycenter));
232 cos = (-((xb - Xcenter)*Xcenter) - (yb - Ycenter)*Ycenter) /
233 (
sqrt((xb - Xcenter)*(xb - Xcenter) + (yb - Ycenter)*(yb - Ycenter))*
sqrt(Xcenter*Xcenter + Ycenter*Ycenter));
237 cos = ((xa - Xcenter)*(xb - Xcenter) + (ya - Ycenter)*(yb - Ycenter)) /
238 (
sqrt((xa - Xcenter)*(xa - Xcenter) + (ya - Ycenter)*(ya - Ycenter))*
sqrt((xb - Xcenter)*(xb - Xcenter) + (yb - Ycenter)*(yb - Ycenter)));
244 if(
fabs(Angle3/(Angle1 + Angle2)) >= 1. )
250 arcAngle = (2.*M_PI - Angle3);
341 REAL coords[3][3] = {
344 {M_SQRT1_2,M_SQRT1_2,0}
350 for (
int i=0; i<3; i++) {
352 for (
int j=0; j<3; j++) {
353 cods[j] = lowercorner[j]+coords[i][j];
356 gmesh.
NodeVec()[indexes[i]].Initialize(cods, gmesh);
393 int TPZArc3D::ClassId()
const{
TPZFlopCounter atan2(const TPZFlopCounter &val1, const TPZFlopCounter &val2)
Returns the arc tangent in radians and increments the counter of the Arc Tangent. ATAN2 returns the ...
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
int AllocateNewElement()
Makes more room for new elements.
Implements a vector class which allows to use external storage provided by the user. Utility.
void GramSchmidt(TPZFMatrix< TVar > &Orthog, TPZFMatrix< TVar > &TransfToOrthog)
This method implements a Gram Schimidt method. this = Orthog.TransfToOrthog.
Contains declaration of TPZGeoNode class which defines a geometrical node.
Templated vector implementation.
groups all classes dedicated to the computation of shape functions
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
Contains declaration of TPZGeoElMapped class which implements a geometric element using its ancestral...
expr_ expr_ expr_ expr_ acos
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
Groups all classes defining the structure of the master element.
Implements a generic geometric element which is refined according to a generic refinement pattern...
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.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Contains the TPZNodeRep class which implements ... Clase intermediaria que guarda.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
int32_t Hash(std::string str)
Contains the TPZArc3D class which implements three dimensional arc.
This class implements a geometric mesh for the pz environment. Geometry.
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.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
Groups all classes which model the geometry.
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
int ClassId() const override
Implements an interface to register a class id and a restore function. Persistence.