NeoPZ
pztrigraph.cpp
Go to the documentation of this file.
1 
6 #include "pztrigraph.h"
7 #include "pzgraphmesh.h"
8 
9 using namespace std;
10 
12 }
13 
15  return 7;
16 }
17 
19  int res = fGraphMesh->Res();
20  int imax = (1<<res);
21  return imax*imax;
22 }
23 
25  int res = fGraphMesh->Res();
26  int imax = (1<<res);
27  int in = ConnectNum(n);
28  switch(in) {
29  case 0:
30  case 1:
31  case 2:
32  return 1;
33  case 3:
34  case 4:
35  case 5:
36  return imax-1;
37  case 6:
38  return ((imax-1)*(imax-2))/2;
39  }
40  return 1;
41 }
42 
44  int res = fGraphMesh->Res();
45  int imax = 1 << res;
46  ostream &out = fGraphMesh->Out();
47  int64_t ip = fId;
48  TPZVec<int> co0(3,0), co1(3,0), co2(3,0);
49  if(st == EV3DStyle) ip++;
50  // int64_t ip = (fId+1)*imax*imax;//Cedric 22/03/99
51  for(int j=0;j<imax;j++) {
52  for(int i=0;i<imax-j;i++) {
53  if(st == EV3DStyle) out << ip++ << " 3 ";
54  if(st == EMVStyle) out << ip++ << " 1 1 1 ";
55  co0[0]=i; co0[1]=j;
56  co1[0]=i+1; co1[1]=j;
57  co2[0]=i; co2[1]=j+1;
58  if(i <imax-j-1) {
59  if(st == EV3DStyle) out << ip++ << " 3 ";
60  if(st == EMVStyle) out << ip++ << " 1 1 1 ";
61  co0[0]=i+1; co0[1]=j;
62  co1[0]=i+1; co1[1]=j+1;
63  co2[0]=i; co2[1]=j+1;
64  }
65  out << EqNum(co0) << " " << EqNum(co1) << " " <<
66  EqNum(co2) << endl;
67  }
68  }
69 }
70 
72  int orient[3];
73  int loc;
74  int res = fGraphMesh->Res();
75  int imax = (1<<res);
76  for(int is=0;is<3;is++) {
77  orient[is] = (fConnects[is]->SequenceNumber() > fConnects[(is+1)%3]->SequenceNumber()) ? 1 : 0;
78  }
79  if(co[0]==0 && co[1]==0) return fConnects[0]->FirstPoint();
80  if(co[0]==imax && co[1]==0) return fConnects[1]->FirstPoint();
81  if(co[0]==0 && co[1]==imax) return fConnects[2]->FirstPoint();
82 
83  if(co[1]==0) loc = 0;
84  else if(co[0]+co[1]==imax) loc=1;
85  else if(co[0]==0) loc=2;
86  else loc=3;
87  int64_t first = fConnects[3+loc]->FirstPoint();
88  int64_t neq;
89  switch(loc) {
90  case 0:
91  neq = first + (co[0]-1) + orient[loc]*(imax-1-co[0]-co[0]+1);
92  break;
93  case 1:
94  neq = first + (imax-1-co[0]) + orient[loc]*(co[0]-1-imax+1+co[0]);
95  break;
96  case 2:
97  neq = first + (imax-1-co[1]) + orient[loc]*(co[1]-1-imax+1+co[1]);
98  break;
99  case 3:
100  {
101  neq = first + (co[1]-1);
102  for(int run=1;run<co[0];run++) neq += imax-run-1;
103  break;
104  }
105  default:
106  neq = 0;
107  break;
108  }
109  return neq;
110 }
111 
112 void TPZGraphElT::QsiEta(TPZVec<int> &co, int imax, TPZVec<REAL> &qsieta){
113  int i,ni = co.NElements();
114  for(i=0; i<ni; i++) qsieta[i] = (1.*co[i])/imax;
115 }
116 
117 void TPZGraphElT::FirstIJ(int no,TPZVec<int> &co, int &incr){
118  int res = fGraphMesh->Res();
119  int imax;
120  imax = 1 << res;
121  switch(no) {
122  case 0:
123  {
124  co[0]=0;
125  co[1]=0;
126  incr = 1;
127  }
128  break;
129  case 1:
130  {
131  co[0] = imax;
132  co[1]=0;
133  incr = 1;
134  }
135  break;
136  case 2:
137  {
138  co[0] = 0;
139  co[1] = imax;
140  incr = 1;
141  }
142  break;
143  case 3:
144  {
145  co[1] = 0;
146  if(fConnects[0]->SequenceNumber() > fConnects[1]->SequenceNumber())
147  {
148  co[0] = imax-1;
149  incr = -1;
150  }
151  else
152  {
153  incr = 1;
154  co[0] = 1;//ifirst
155  }
156  }
157  break;
158  case 4:
159  {
160  if(fConnects[1]->SequenceNumber() > fConnects[2]->SequenceNumber())
161  {
162  incr = 1;
163  co[1] = imax-1;//co[1]first
164  co[0] = 1;
165  }
166  else
167  {
168  incr = -1;
169  co[0] = imax-1;
170  co[1] = 1;//co[1]first
171  }
172  }
173  break;
174  case 5:
175  {
176  co[0] = 0;
177  //modified Philippe 25/7/97
178  // wrong comparaison
179  // if(fConnects[0]->Id() > fConnects[3]->Id())
180  if(fConnects[0]->SequenceNumber() > fConnects[2]->SequenceNumber())
181  {
182  incr = -1;
183  co[1] = imax-1;//co[1]first
184  }
185  else
186  {
187  incr = 1;
188  co[1] = 1;//co[1]first
189  }
190  }
191  break;
192  case 6:
193  {
194  incr = 1;
195  co[0] = 1;
196  co[1] = 1;
197  }
198  }
199  return;
200 }
201 
202 void TPZGraphElT::NextIJ(int no, TPZVec<int> &co, int incr){
203  int res = fGraphMesh->Res();
204  int imax;
205  imax = 1 << res;
206  switch(no) {
207  case 0:
208  case 1:
209  case 2:
210  return;
211  case 3:
212  co[0] += incr;
213  break;
214  case 4:
215  co[0] += incr;
216  co[1] -= incr;
217  break;
218  case 5:
219  co[1]+= incr;
220  break;
221  case 6:
222  co[1]++;
223  if(co[0]+co[1]>= imax) {
224  co[1] = 1;
225  co[0]++;
226  }
227  break;
228  }
229 }
230 
232  switch(st)
233  {
234  case(EVTKStyle):
235  return 5;//vtk_triangle
236  default:
237  return -1;
238  }
239 }
240 
242 {
243  return 3;
244 }
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
TPZGraphElT(TPZCompEl *c, TPZGraphMesh *g)
Constructor for graphical element to computational triangular element.
Definition: pztrigraph.cpp:11
std::ostream & Out()
Definition: pzgraphmesh.h:80
virtual void Connectivity(TPZDrawStyle st=EDXStyle)
Set dx style for connectivity information.
Definition: pztrigraph.cpp:43
int64_t FirstPoint()
Definition: pzgraphnode.cpp:55
virtual int NElements()
Definition: pztrigraph.cpp:18
virtual int64_t EqNum(TPZVec< int > &co)
Number of equations.
Definition: pztrigraph.cpp:71
TPZGraphNode * fConnects[7]
Graphical nodes vector (by connect of the computational element)
Definition: pztrigraph.h:62
int64_t fId
Id of the graphical element.
Definition: pzgraphel.h:98
virtual int ExportType(TPZDrawStyle st)
Sets the style to export (format)
Definition: pztrigraph.cpp:231
Definition: TPZDrawStyle.h:12
int Res()
Get the resolution of the draw.
Definition: pzgraphmesh.h:64
Definition: TPZDrawStyle.h:12
virtual int NConnects()
Number of connects for the element.
Definition: pztrigraph.cpp:14
TPZGraphMesh * fGraphMesh
Graphical mesh associated with graphical element.
Definition: pzgraphel.h:87
int64_t SequenceNumber()
Definition: pzgraphnode.h:38
Contains the TPZGraphElT class which implements the graphical triangular element. ...
virtual int NNodes()
Number of corner nodes (geometric information)
Definition: pztrigraph.cpp:241
string res
Definition: test.py:151
Definition: TPZDrawStyle.h:12
Contains the TPZGraphMesh class which represents a graphical mesh used for post processing purposes...
REAL co[8][3]
Coordinates of the eight nodes.
virtual void NextIJ(int no, TPZVec< int > &co, int incr)
Definition: pztrigraph.cpp:202
virtual int NPoints(TPZGraphNode *n)
Number of points to graphical resolution.
Definition: pztrigraph.cpp:24
int ConnectNum(TPZGraphNode *n)
Returns the number of the graphical node in the vector of connects.
Definition: pzgraphel.cpp:72
virtual void QsiEta(TPZVec< int > &i, int imax, TPZVec< REAL > &qsieta)
This method maps the index of a point to parameter space as a function of the number of divisions...
Definition: pztrigraph.cpp:112
virtual void FirstIJ(int no, TPZVec< int > &co, int &incr)
Definition: pztrigraph.cpp:117
Abstract class to graphical one-, two- and three-dimensional element. Post processing.
Definition: pzgraphel.h:23
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
To export a graphical node. Post processing.
Definition: pzgraphnode.h:24
TPZDrawStyle
Definition: TPZDrawStyle.h:12