NeoPZ
pzgraphel1d.cpp
Go to the documentation of this file.
1 
6 #include "pzgraphel1d.h"
7 #include "pzgraphmesh.h"
8 #include "pzcompel.h"
9 #include "pzgeoel.h"
10 
11 using namespace std;
12 
14 {
15 }
16 
18 {
19  int in = ConnectNum(n);
20  int res = fGraphMesh->Res();
21  switch(in)
22  {
23  case 0:
24  case 1:
25  return(1);
26  case 2:
27  return((1 << res)-1);
28  };
29  return(0);
30 }
31 
33  int res = fGraphMesh->Res();
34  int imax = (1<<res);
35  return imax;
36 }
37 
39  int orient;
40  int res = fGraphMesh->Res();
41  int imax = (1<<res);
42  //orient = (fConnects[0]->Id() > fConnects[1]->Id()) ? 1 : 0;
43  orient = (fConnects[0]->SequenceNumber() > fConnects[1]->SequenceNumber()) ? 1 : 0;
44  if(co[0]==0) return fConnects[0]->FirstPoint();
45  if(co[0]==imax) return fConnects[1]->FirstPoint();
46 
47  int64_t first = fConnects[2]->FirstPoint();
48  int64_t neq;
49  neq = first + (co[0]-1) + orient*(imax-1-co[0]-co[0]+1);
50  return neq;
51 }
52 
53 void TPZGraphEl1d::FirstIJ(int no,TPZVec<int> &co,int &incr) {
54 
55  int res = fGraphMesh->Res();
56  int imax, i;
57  imax = 1 << res;
58  switch(no)
59  {
60  case 0:
61  {
62  for (i=0;i<3;i++) co[i]=0;
63  incr = 1;
64  }
65  break;
66  case 1:
67  {
68  co[0] = imax;
69  for (i=1;i<3; i++) co[i]=0;
70  incr = 1;
71  }
72  break;
73  case 2:
74  {
75  for (i=1;i<3; i++) co[i]=0;
76  if(fConnects[0]->SequenceNumber() > fConnects[1]->SequenceNumber())
77  {
78  co[0] = imax-1;
79  incr = -1;
80  }
81  else
82  {
83  incr = 1;
84  co[0] = 1;//ifirst
85  }
86  }
87  break;
88  }
89  return;
90 }
91 
92 void TPZGraphEl1d::NextIJ(int no,TPZVec<int> &co, int incr) {
93 
94  switch(no) {
95  case 0:
96  case 1:
97  return;
98  case 2:
99  co[0] += incr;
100  break;
101  }
102 }
103 
104 /*
105  void TPZGraphEl1d::ComputeSequence(TPZGraphNode *n, int *ibound, int *incr)
106  {
107  int res = fGraphMesh->Res();
108  int imax;
109  imax = 1 << res;
110  int in = ConnectNum(n);
111  incr[0] = incr[1] = 1;
112  switch(in)
113  {
114  case 0:
115  {
116  ibound[0] = 0;//ifirst
117  ibound[1] = 0;//ilast
118  ibound[2] = 0;//jfirst
119  ibound[3] = 0;//jlast
120  }
121  break;
122  case 1:
123  {
124  ibound[0] = imax;//ifirst
125  ibound[1] = imax;//ilast
126  ibound[2] = 0;//jfirst
127  ibound[3] = 0;//jlast
128  }
129  break;
130  case 4:
131  {
132  if(fConnects[0]->SequenceNumber() > fConnects[1]->SequenceNumber())
133  {
134  incr[0] = -1;
135  ibound[0] = imax-1;//ifirst
136  ibound[1] = 1;//ilast
137  }
138  else
139  {
140  incr[0] = 1;
141  ibound[0] = 1;//ifirst
142  ibound[1] = imax-1;//ilast
143  }
144  ibound[2] = 0;//jfirst
145  ibound[3] = 0;//jlast
146  }
147  break;
148  }
149  return;
150  }
151  */
152 
154  int res = fGraphMesh->Res();
155  int imax = 1 << res;
156  ostream &out = fGraphMesh->Out();
157  int64_t ip = fId;
158  TPZVec<int> co0(3,0), co1(3,0);
159  if(st == EV3DStyle) ip++;
160  for(int i=0;i<imax;i++) {
161  if(st == EV3DStyle) out << ip << " 1 ";
162  if(st == EMVStyle) out << ip << " 1 1 1 ";
163  ip++;
164  co0[0]=i;
165  co1[0]=i+1;
166  out << EqNum(co0) << " " << EqNum(co1) << endl;
167  }
168 }
169 
170 void TPZGraphEl1d::Print(ostream &out) {
171  out << "TPZGraphEl1d element id = " << fId << endl;
172  out << "Node numbers : ";
173  int i;
174  for(i=0; i<NConnects(); i++) {
175  out << fConnects[i]->SequenceNumber() << " ";
176  }
177  out << endl << "First Equation : ";
178  for(i=0; i<NConnects(); i++) {
179  out << fConnects[i]->FirstPoint() << " ";
180  }
181  out << endl;
182 }
183 
185  switch(st)
186  {
187  case(EVTKStyle):
188  return 1;
189  // break;
190  default:
191  return -1;
192  }
193  // return -1;
194 }
195 
197 {
198  return 2;
199 }
200 
201 
virtual int NNodes()
Number of corner nodes (geometric information)
virtual int64_t EqNum(TPZVec< int > &co)
Number of equations.
Definition: pzgraphel1d.cpp:38
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
std::ostream & Out()
Definition: pzgraphmesh.h:80
Contains declaration of TPZCompEl class which defines the interface of a computational element...
int64_t FirstPoint()
Definition: pzgraphnode.cpp:55
Contains the TPZGraphEl1d class which implements the graphical one dimensional element.
TPZGraphNode * fConnects[3]
Graphical nodes vector (by connect of the computational element)
Definition: pzgraphel1d.h:61
TPZGraphEl1d(TPZCompEl *ce, TPZGraphMesh *gg)
Constructor for graphical element to computational one dimensional element.
Definition: pzgraphel1d.cpp:13
virtual int NElements()
Definition: pzgraphel1d.cpp:32
int64_t fId
Id of the graphical element.
Definition: pzgraphel.h:98
virtual int NPoints(TPZGraphNode *n)
Number of points to graphical resolution.
Definition: pzgraphel1d.cpp:17
virtual int NConnects()
Number of connects for the element.
Definition: pzgraphel1d.h:27
Definition: TPZDrawStyle.h:12
int Res()
Get the resolution of the draw.
Definition: pzgraphmesh.h:64
Definition: TPZDrawStyle.h:12
TPZGraphMesh * fGraphMesh
Graphical mesh associated with graphical element.
Definition: pzgraphel.h:87
int64_t SequenceNumber()
Definition: pzgraphnode.h:38
string res
Definition: test.py:151
Definition: TPZDrawStyle.h:12
Contains the TPZGraphMesh class which represents a graphical mesh used for post processing purposes...
virtual void Connectivity(TPZDrawStyle st=EDXStyle)
Set dx style for connectivity information.
REAL co[8][3]
Coordinates of the eight nodes.
virtual void NextIJ(int no, TPZVec< int > &co, int incr)
Definition: pzgraphel1d.cpp:92
int ConnectNum(TPZGraphNode *n)
Returns the number of the graphical node in the vector of connects.
Definition: pzgraphel.cpp:72
virtual int ExportType(TPZDrawStyle st)
Sets the style to export (format)
virtual void FirstIJ(int no, TPZVec< int > &co, int &incr)
Definition: pzgraphel1d.cpp:53
Abstract class to graphical one-, two- and three-dimensional element. Post processing.
Definition: pzgraphel.h:23
void Print(std::ostream &out)
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