NeoPZ
tpzintrulelist.cpp
Go to the documentation of this file.
1 
7 #include "tpzintrulelist.h"
8 #include "pzerror.h"
9 #include "tpzgaussrule.h"
10 #include "tpzintrulet.h"
11 #include "tpzintrulet3d.h"
12 #include "tpzintrulep3d.h"
13 
15 
17 
18  static int first = 1;
19 
20  if(first != 1) {
21  PZError << "second initialization of the integration rule list\n"
22  << " something fishy is going on!\n";
23  //DebugStop(); this verification will be improved by singleton approach
24  return; //ok, if you already exist, you can return
25  }
26 
27  // Cleaning integration rules vectors
28  fintlist.Resize(0);
29  fintlistT.Resize(0);
32 
33  // Cleaning integration rules vectors
34  int maxorder = 75;
35  fintlist.Resize(maxorder+1,NULL);
36  fintlistT.Resize(maxorder+1,NULL);
37  fintlistT3D.Resize(maxorder+1,NULL);
38  fintlistP3D.Resize(maxorder+1,NULL);
39 
40  first++;
41 }
42 
44  int i;
46  for(i=0 ; i<fintlist.NElements() ; i++) if (fintlist[i]) delete fintlist[i];
47  fintlist.Resize(0);
49  for(i=0 ; i<fintlistT.NElements() ; i++) if (fintlistT[i]) delete fintlistT[i];
50  fintlistT.Resize(0);
52  for(i=0 ; i<fintlistT3D.NElements() ; i++) if (fintlistT3D[i]) delete fintlistT3D[i];
54 
56  for(i=0 ; i<fintlistP3D.NElements() ; i++) if (fintlistP3D[i]) delete fintlistP3D[i];
58 }
59 
60 TPZGaussRule* TPZIntRuleList::GetRule(int order,int type) {
61  if(order < 0) {
62  order = 1;
63  }
64  if(type == 1) {
67  }
68  else {
71  }
72  // The vectors of integration rules will be created based on order value
73  if(fintlist.NElements()<order+1)
74  fintlist.Resize(order+1,NULL);
75  if(!fintlist[order])
76  fintlist[order] = new TPZGaussRule(order,type);
77  else if(fintlist[order]->Type() != type) {
78  delete fintlist[order];
79  fintlist[order] = new TPZGaussRule(order,type);
80  }
81  return fintlist[order];
82 }
83 
84 //**************************************
86  if(order < 0) order = 1;
89  }
90 
91  if(fintlistT.NElements()<order+1)
92  fintlistT.Resize(order+1,NULL);
93  if(!fintlistT[order])
94  fintlistT[order] = new TPZIntRuleT(order);
95  return fintlistT[order];
96 }
97 
98 //**************************************
100  if(order < 0) order = 1;
103  }
104 
105  if(fintlistT3D.NElements()<order+1)
106  fintlistT3D.Resize(order+1,NULL);
107  if(!fintlistT3D[order])
108  fintlistT3D[order] = new TPZIntRuleT3D(order);
109  return fintlistT3D[order];
110 }
111 
112 //**************************************
114  if(order < 0) order = 1;
115 // if(order > TPZIntRuleP3D::NRULESPYRAMID_ORDER) {
116 // order = TPZIntRuleP3D::NRULESPYRAMID_ORDER;
117 // }
118 
119  if(fintlistP3D.NElements()<order+1)
120  fintlistP3D.Resize(order+1,NULL);
121  if(!fintlistP3D[order])
122  fintlistP3D[order] = new TPZIntRuleP3D(order);
123  return fintlistP3D[order];
124 }
Integration rule (points and weights) for triangles. Numerical Integration.
Definition: tpzintrulet.h:18
TPZIntRuleList()
Method which initializes all integration rule vectors.
TPZIntRuleP3D * GetRuleP3D(int order)
Returns a pointer to an integration rule for a pyramid.
Contains the TPZIntRuleT class which defines integration rule for triangles based on Linbo Zhang&#39;s pa...
Defines PZError.
Integration rule for pyramid. Numerical Integration.
Definition: tpzintrulep3d.h:17
Integration rule for tetrahedra. Numerical Integration.
Definition: tpzintrulet3d.h:17
TPZGaussRule * GetRule(int order, int type=0)
Returns a pointer to an gaussian integration rule with numint points. This method computes the number...
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...
Definition: pzvec.h:373
Creates instances of all integration rules for rapid selection. Numerical Integration.
~TPZIntRuleList()
Destructor of all integration rule vectors.
TPZVec< TPZIntRuleP3D *> fintlistP3D
Pointer to an array of integration rules for pyramid.
Contains the TPZIntRuleP3D class which defines the integration rule for pyramid.
static TPZIntRuleList gIntRuleList
Static variable with list of all integration rules.
TPZVec< TPZGaussRule *> fintlist
Pointer to an array of integration rules (Gauss Legendre) for line, quad and cube elements...
TPZVec< TPZIntRuleT3D *> fintlistT3D
Pointer to an array of integration rules for tetrahedra.
Contains the TPZIntRuleList class which creates instances of all integration rules for rapid selectio...
Contains the TPZIntRuleT3D class which defines integration rule for tetrahedra.
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
Contains the TPZGaussRule class which implements the Gaussian quadrature.
TPZIntRuleT * GetRuleT(int order)
Returns a pointer to an integration rule for a triangle.
Implements the Gaussian quadrature. Numerical Integration Abstract class.
Definition: tpzgaussrule.h:19
TPZIntRuleT3D * GetRuleT3D(int order)
Returns a pointer to an integration rule for a tetrahedra.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
TPZVec< TPZIntRuleT *> fintlistT
Pointer to an array of integration rules for triangle.