28 for(ord = 2;ord<num;ord++) {
29 phi.
Put(ord,0, 2.0*x*phi(ord-1,0) - phi(ord-2,0));
30 dphi.
Put(0,ord, 2.0*x*dphi(0,ord-1) + 2.0*phi(ord-1,0) - dphi(0,ord-2));
44 for(ord = 2;ord<num;ord++) {
45 phi.
Put(ord,0, x*phi(ord-1,0));
46 dphi.
Put(0,ord, ord*phi(ord-1,0));
65 for (ord = 2; ord < num; ord++)
70 value = ( (2.0 * (ord_real - 1.0) + 1.0) * x * phi(ord - 1, 0) - (ord_real - 1.0) * phi(ord - 2 , 0) ) / (ord_real);
71 phi.
Put(ord, 0, value);
74 value = (2.0 * (ord_real - 1.0) + 1.0) * phi(ord - 1, 0) + dphi(0, ord - 2);
75 dphi.
Put(0, ord, value);
81 cout <<
"Legendre" << endl;
82 for(ord = 0; ord < num; ord++)
84 cout <<
"x = " << x << endl;
85 cout <<
"phi(" << ord <<
", 0) = " << phi(ord, 0) << endl;
86 cout <<
"dphi(0, " << ord <<
" = " << dphi(0, ord) << endl;
102 for (ideriv = 1; ideriv < nderiv; ideriv++)
103 dphi.
Put(ideriv, 0, 0.0);
106 if (num == 1)
return;
111 for (ideriv = 1; ideriv < nderiv; ideriv++)
112 dphi.
Put(ideriv, 1, 0.0);
116 REAL ord_real, value;
117 for (ord = 2; ord < num; ord++)
120 ord_real = (REAL)ord;
122 value = ( (2.0 * (ord_real - 1.0) + 1.0) * x * phi(ord - 1, 0) - (ord_real - 1.0) * phi(ord - 2 , 0) ) / (ord_real);
123 phi.
Put(ord, 0, value);
126 value = (2.0 * (ord_real - 1.0) + 1.0) * phi(ord - 1, 0) + dphi(0, ord - 2);
127 dphi.
Put(0, ord, value);
129 for (ideriv = 1; ideriv < nderiv; ideriv++){
130 value = (2.0 * (ord_real - 1.0) + 1.0) * dphi(ideriv - 1, ord - 1) + dphi(ideriv, ord - 2);
131 dphi.
Put(ideriv, ord, value);
139 cout <<
"Legendre" << endl;
140 for(ord = 0; ord < num; ord++)
142 cout <<
"x = " << x << endl;
143 cout <<
"phi(" << ord <<
", 0) = " << phi(ord, 0) << endl;
144 cout <<
"dphi(0, " << ord <<
" = " << dphi(0, ord) << endl;
155 REAL TPZShapeLinear::JacobiA = 0.5;
156 REAL TPZShapeLinear::JacobiB = 0.5;
160 REAL a = JacobiA, b = JacobiB;
165 phi.
Put(1,0, 0.5 * (a - b + (2.0 + a + b) * x));
166 dphi.
Put(0,1, 0.5*(num + a + b + 1)*phi(num-1,0) );
168 REAL A_ab=0.0, B_ab=0.0, C_ab=0.0;
169 for(
int ord = 2;ord<num;ord++) {
171 A_ab = ((2.0*ord+a+b+1)*(2.0*ord+a+b+2))/(2.0*(ord+1)*(ord+a+b+1));
172 B_ab = ((b*b-a*a)*(2.0*ord+a+b+1))/(2.0*(ord+1)*(ord+a+b+1)*(2.0*ord+a+b));
173 C_ab = ((ord+a)*(ord+b)*(2.0*ord+a+b+2))/((ord+1)*(ord+a+b+1)*(2.0*ord+a+b));
174 phi.
Put(ord,0, (A_ab*x - B_ab)*phi(ord-1,0) - C_ab*phi(ord-2,0));
175 dphi.
Put(0,ord, 0.5*(ord + a + b + 1)*phi(ord-1,0));
188 for(
int ord = 2;ord<num;ord++) {
189 phi.
Put(ord,0, 2.0*x*phi(ord-1,0) - (2.0*(REAL)ord-1.0)*phi(ord-2,0));
190 dphi.
Put(0,ord, (2.0*(REAL)ord-1.0)*phi(ord-2,0));
195 void (*TPZShapeLinear::fOrthogonal)(REAL, int,
TPZFMatrix<REAL> &, TPZFMatrix<REAL> &) = TPZShapeLinear::Chebyshev;
203 void TPZShapeLinear::ShapeGenerating(
TPZVec<REAL> &pt, TPZFMatrix<REAL> &phi, TPZFMatrix<REAL> &dphi)
206 phi(2,0) = phi(0,0)*phi(1,0);
207 dphi(0,2) = dphi(0,0)*phi(1,0)+phi(0,0)*dphi(0,1);
217 if ( order[0] < 0 ) {
218 PZError <<
"Compelbas::shape --> Invalid dimension for arguments: order = " << order[0]
219 <<
" phi.Rows = " << (int) phi.
Rows() <<
" dphi.Cols = " << (int) dphi.
Cols() <<
"\n";
222 if(phi.
Rows() < order[0]+1) {
223 PZError <<
"TPZShapeLinear::shape --> Invalid dimension for argument phi " << endl;
226 if(dphi.
Cols() < order[0]+1) {
227 PZError <<
"TPZShapeLinear::shape --> Invalid dimension for argument dphi " << endl;
238 phi(0,0) = (1-x[0])/2.;
239 phi(1,0) = (1+x[0])/2.;
246 for(is=0; is<NCornerNodes; is++)
248 phiblend(is,0) = phi(is,0);
249 for(d=0; d<Dimension; d++)
251 dphiblend(d,is) = dphi(d,is);
254 ShapeGenerating(x,phiblend,dphiblend);
256 int num2 = order[0]-1;
257 int transformationindex = GetTransformId1d(
id);
261 ShapeInternal(x,order[0],phiint,dphiint,transformationindex);
264 for (ord = 2; ord < order[0]+1; ord++) {
265 dphi(0,ord) = dphiint(0,ord-2)*phiblend(2,0)+dphiblend(0,2)*phiint(ord-2,0);
266 phi(ord,0) = phiint(ord-2,0)*phiblend(2,0);
269 void TPZShapeLinear::ShapeCorner(
TPZVec<REAL> &pt,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi){
279 Shape(pt,
id,order,phi,dphi);
286 int nshape = 2+(order[0]-1);
287 if (shapeorders.
Rows() != nshape) {
290 shapeorders(0,0) = 1;
291 shapeorders(1,0) = 1;
292 for (
int i=2; i<nshape; i++) {
293 shapeorders(i,0) = i;
303 void TPZShapeLinear::ShapeInternal(
TPZVec<REAL> &x,
int ord,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi){
308 fOrthogonal(x[0],num,phi,dphi);
312 void TPZShapeLinear::ShapeInternal(
TPZVec<REAL> &x,
int ord,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi,
int transformation_index){
317 TransformPoint1d(transformation_index, x[0], y);
318 fOrthogonal(y,num,phi,dphi);
319 TransformDerivative1d(transformation_index, num, dphi);
324 void TPZShapeLinear::ShapeInternal(
int side,
TPZVec<REAL> &x,
int order,TPZFMatrix<REAL> &phi, TPZFMatrix<REAL> &dphi){
328 ShapeInternal(x, order, phi, dphi);
331 void TPZShapeLinear::TransformPoint1d(
int transid,REAL in,REAL &out) {
332 if (!transid) out = in;
337 if (!transid) trans.
Mult()(0,0) = 1;
338 else trans.
Mult()(0,0) = -1;
343 void TPZShapeLinear::TransformPoint1d(
int transid,
double &
val) {
345 if (!transid) val = 1.0;
350 void TPZShapeLinear::TransformDerivative1d(
int transid,
int num,TPZFMatrix<REAL> &in) {
352 if(transid == 0)
return;
354 for(i=0;i<num;i++) in(0,i) = -in(0,i);
358 if (
id[1] <
id[0])
return 1;
362 int TPZShapeLinear::NConnectShapeF(
int side,
int order) {
364 if(side<3)
return (order-1);
365 PZError <<
"TPZShapeLinear::NConnectShapeF, bad parameter side " << side << endl;
370 int in,
res=NCornerNodes;
371 for(in=NCornerNodes;in<NSides;in++) res += NConnectShapeF(in,order[in-NCornerNodes]);
376 void TPZShapeLinear::ShapeInternal(FADREAL & x,
int num,
TPZVec<FADREAL> & phi,
int transformation_index){
380 TransformPoint1d(transformation_index,x,y);
381 FADfOrthogonal(y,num,phi);
385 void TPZShapeLinear::TransformPoint1d(
int transid,FADREAL & in,FADREAL &out) {
386 if (!transid) out = in;
390 void TPZShapeLinear::Chebyshev(FADREAL & x,
int num,
TPZVec<FADREAL> &phi){
404 for(ord = 2;ord<num;ord++) {
407 phi[ord] = x * phi[ord-1] * 2.0 - phi[ord-2];
411 void (*TPZShapeLinear::FADfOrthogonal)(FADREAL&,int ,
TPZVec<FADREAL> &) = TPZShapeLinear::Chebyshev;
groups all classes dedicated to the computation of shape functions
REAL val(STATE &number)
Returns value of the variable.
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
int Zero() override
Makes Zero all the elements.
#define DebugStop()
Returns a message to user put a breakpoint in.
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)
virtual int Put(const int64_t row, const int64_t col, const TVar &value)
Put values with bounds checking if DEBUG variable is defined.
Contains TPZShapePoint class which implements the shape function associated with a point...
Implements generic class which holds a matrix of objects. Matrix.
int64_t Cols() const
Returns number of cols.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
#define PZError
Defines the output device to error messages and the DebugStop() function.