NeoPZ
pzgeoelside.h
Go to the documentation of this file.
1 
6 #ifndef PZGEOELSIDEH
7 #define PZGEOELSIDEH
8 
9 /******* TPZGeoElSide *******/
10 
11 
12 #include "pzvec.h"
13 #include "pzstack.h"
14 #include "pzfmatrix.h"
15 #include "pztrnsform.h"
16 #include "tpzintpoints.h"
17 #include <set>
18 
19 #ifdef _AUTODIFF
20 #include "fadType.h"
21 #endif
22 
23 class TPZCompElSide;
24 
25 class TPZGeoElSide;
26 class TPZGeoMesh;
27 class TPZGeoEl;
28 
34 private:
35  int64_t fGeoElIndex;
36  int fSide;
37 
38 public:
44  TPZGeoElSideIndex(TPZGeoEl *gel,int side);
45 
46  TPZGeoElSideIndex(int64_t gelindex,int side);
47 
48  TPZGeoElSideIndex(const TPZGeoElSide &side);
49 
55 
57  operator bool() const
58  {
59  return fGeoElIndex == -1 || fSide == -1;
60  }
61 
62  int Side() const;
63 
64  void SetSide(int side);
65 
66  TPZGeoEl *Element(const TPZGeoMesh *mesh) const;
67 
68  void SetElement(TPZGeoEl* geoel);
69 
70  int64_t ElementIndex() const;
71 
72  void SetElementIndex(int64_t i);
73  int ClassId() const override;
74  void Read(TPZStream &buf, void *context) override;
75  void Write(TPZStream &buf, int withclassid) const override;
76 };
77 
83 class TPZGeoElSide : public TPZSavable {
84 
86  int fSide;
87 public:
88 
90  int NSubElements();
91 
93  void GetSubElements2(TPZStack<TPZGeoElSide> &subelements);
94 
96  TPZGeoElSide StrictFather();
97 
99  TPZGeoElSide Father2() const;
100 
102  TPZCompElSide LowerLevelCompElementList2(int onlyinterpolated);
103 
105  bool IsRelative(TPZGeoElSide other);
106 
108  bool IsAncestor(TPZGeoElSide other);
109 
111  void X(TPZVec< REAL > &loc, TPZVec< REAL > &result) const;
112 
114  void QsiElement(TPZVec< REAL > &qsi_side, TPZVec< REAL > &qsi_element) const;
115 
117  void GradX(TPZVec<REAL> &loc, TPZFMatrix<REAL> &gradx) const;
118 
119  bool ResetBlendConnectivity(const int64_t &index);
120 
121 #ifdef _AUTODIFF
122 
123  void X(TPZVec< Fad<REAL> > &loc, TPZVec< Fad<REAL> > &result) const;
124 
126  void GradX(TPZVec< Fad<REAL> > &loc, TPZFMatrix< Fad<REAL> > &gradx) const;
127 #endif
128 
130  void Jacobian(TPZVec<REAL> &param,TPZFMatrix<REAL> &jacobian,TPZFMatrix<REAL> &axes,REAL &detjac,TPZFMatrix<REAL> &jacinv) const;
131 
133  REAL Area();
134 
135  int NNeighbours();
136 
138  int NNeighboursButThisElem(TPZGeoEl *thisElem);
139 
140  TPZGeoElSide(){ fGeoEl = 0; fSide = -1;}
141 
142  TPZGeoElSide(TPZGeoEl *gel,int side){ fGeoEl = gel; fSide = side;}
143 
146  TPZGeoElSide(TPZGeoEl *gel, std::set<int64_t> &sideCornerNodes);
147 
148  TPZGeoElSide(const TPZGeoElSideIndex &index, const TPZGeoMesh * mesh){
149  this->fSide = index.Side();
150  this->fGeoEl = index.Element(mesh);
151  if(fGeoEl == 0 && index.ElementIndex() != -1)
152  {
153  DebugStop();
154  }
155  }
156 
157  TPZGeoElSide(int zero) : fGeoEl(0), fSide(-1)
158  {
159 
160  }
161 
162  TPZGeoEl *Element()const{return fGeoEl;}
163 
164  void SetElement(TPZGeoEl* geoel){ fGeoEl = geoel; }
165 
167  void Print(std::ostream &out) const;
168 
169  int Side() const {return fSide;}
170 
171  void SetSide(int side) { fSide = side; }
172 
173  bool IsLinearMapping() const;
174 
175  int Exists() const {return (fGeoEl != 0 && fSide > -1);}
176 
178  void CenterPoint(TPZVec<REAL> &center) const;
179 
181  void CenterX(TPZVec<REAL> &Xcenter) const;
182 
184  void Normal(TPZVec<REAL> &point, TPZGeoEl *left, TPZGeoEl *right, TPZVec<REAL> &normal) const;
185 
187  void Normal(TPZVec<REAL> &point, TPZVec<REAL> &normal) const;
188 
190  int NSides() const;
191 
192  TPZGeoElSide Neighbour() const;//return neighbour of the side fSide
193 
195  void AllNeighbours(TPZStack<TPZGeoElSide> &allneigh);
196 
198  void ComputeNeighbours(TPZStack<TPZGeoElSide> &compneigh);
199 
200  int64_t Id();
201 
203  int Dimension() const;
204 
205  int operator==(const TPZGeoElSide &other) const {
206  return fGeoEl == other.fGeoEl && fSide == other.fSide;
207  }
208  int operator!=(const TPZGeoElSide &other) const {
209  return fGeoEl != other.fGeoEl || fSide != other.fSide;
210  }
211 
212  int operator<(const TPZGeoElSide &other) const {
213  return (fGeoEl < other.fGeoEl || (fGeoEl == other.fGeoEl && fSide < other.fSide));
214  }
215 
216  int operator>(const TPZGeoElSide &other) const {
217  return (fGeoEl > other.fGeoEl || (fGeoEl == other.fGeoEl && fSide > other.fSide));
218  }
219 
221  operator bool() const
222  {
223  return fGeoEl != 0;
224  }
225 
228  void SideTransform3(TPZGeoElSide neighbour,TPZTransform<> &t);
229 
230  void SetConnectivity(const TPZGeoElSide &neighbour) const;
231 
233  void InsertConnectivity(TPZGeoElSide &neighbour);
234 
236  void RemoveConnectivity();
237 
238  static void BuildConnectivities(TPZVec<TPZGeoElSide> &elvec, TPZVec<TPZGeoElSide> &neighvec);
239 
241  void SetNeighbour(const TPZGeoElSide &neighbour) const;
242 
243  TPZTransform<REAL> NeighbourSideTransform(const TPZGeoElSide &neighbour);
244 
249  TPZTransform<REAL> SideToSideTransform(TPZGeoElSide &higherdimensionside);
250 
251  TPZGeoElSide LowestFatherSide();
252 
256  virtual void GetAllSiblings(TPZStack<TPZGeoElSide> &unrefinedSons);
260  virtual void YoungestChildren(TPZStack<TPZGeoElSide> &unrefinedSons);
261 
263  TPZCompElSide Reference() const;
265  int HasSubElement();
266 
267  /* @brief Return the number of nodes for a particular side*/
268  int NSideNodes() const;
269 
271  int64_t SideNodeIndex(int nodenum) const;
272 
274  int64_t SideNodeLocIndex(int nodenum) const;
275 
276 
278  int NeighbourExists(const TPZGeoElSide &neighbour) const;
279 
281  void EqualorHigherCompElementList2(TPZStack<TPZCompElSide> &celside, int onlyinterpolated, int removeduplicates);
282 
286  void HigherDimensionElementList(TPZStack<TPZCompElSide> &elsidevec, int onlyinterpolated);
287 
291  void HigherLevelCompElementList2(TPZStack<TPZCompElSide> &elsidevec, int onlyinterpolated, int removeduplicates);
292 
296  void ConnectedCompElementList(TPZStack<TPZCompElSide> &elsidevec,int onlyinterpolated, int removeduplicates);
297 
302  void EqualLevelCompElementList(TPZStack<TPZCompElSide> &elsidevec, int onlyinterpolated, int removeduplicates);
303 
307  void EqualorHigherCompElementList3(TPZStack<TPZCompElSide> &celside, int onlymultiphysicelement, int removeduplicates);
308 
313  void EqualLevelCompElementList3(TPZStack<TPZCompElSide> &elsidevec, int onlymultiphysicelement, int removeduplicates);
314 
318  void HigherLevelCompElementList3(TPZStack<TPZCompElSide> &elsidevec, int onlymultiphysicelement, int removeduplicates);
319 
320 
321  /* @brief Creates an integration rule for the topology of this side */
322  TPZIntPoints * CreateIntegrationRule(int order);
323 
324  int GelLocIndex(int index) const;
325  int ClassId() const override;
326  void Read(TPZStream &buf, void *context) override;
327  void Write(TPZStream &buf, int withclassid) const override;
328 };
329 
331 std::ostream &operator << (std::ostream & out,const TPZGeoElSide &geoside);
332 
334  TPZGeoElSide neigh = Neighbour();
335 #ifndef NODEBUG
336  if(! Exists() || ! neigh.Exists())
337  {
338  std::cout << "TPZGeoElSide AllNeighbours inconsistent\n";
339  return;
340  }
341 #endif
342  while(neigh != *this)
343  {
344  allneigh.Push(neigh);
345  neigh = neigh.Neighbour();
346  }
347 }
348 
349 
353  //nothing to be done here
354 }
355 
357  this->fSide = -1;
358  this->fGeoElIndex = -1;
359 }
360 
361 inline TPZGeoElSideIndex::TPZGeoElSideIndex(int64_t gelindex,int side){
362  this->fGeoElIndex = gelindex;
363  this->fSide = side;
364 }
365 
367  this->operator =(cp);
368 }
369 
371  return new TPZGeoElSideIndex(*this);
372 }
373 
375  this->fGeoElIndex = A.fGeoElIndex;
376  this->fSide = A.fSide;
377  return *this;
378 }
379 
380 inline int TPZGeoElSideIndex::Side() const{
381  if (this->fSide == -1 || this->fGeoElIndex == -1){
382  return -1;
383  }
384  return this->fSide;
385 }
386 
387 inline void TPZGeoElSideIndex::SetSide(int side){
388  this->fSide = side;
389 }
390 
391 inline int64_t TPZGeoElSideIndex::ElementIndex() const{
392  return this->fGeoElIndex;
393 }
394 
395 inline void TPZGeoElSideIndex::SetElementIndex(int64_t i){
396  this->fGeoElIndex = i;
397 }
398 
399 #endif
TPZGeoEl * Element(const TPZGeoMesh *mesh) const
int operator<(const TPZGeoElSide &other) const
Definition: pzgeoelside.h:212
TPZGeoElSide(TPZGeoEl *gel, int side)
Definition: pzgeoelside.h:142
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
bool IsAncestor(TPZGeoEl *son, TPZGeoEl *father)
void SetElement(TPZGeoEl *geoel)
Definition: pzgeoelside.cpp:46
int ClassId() const override
Define the class id associated with the class.
Definition: pzgeoelside.cpp:51
Templated vector implementation.
TPZGeoElSide(const TPZGeoElSideIndex &index, const TPZGeoMesh *mesh)
Definition: pzgeoelside.h:148
TPZGeoEl * fGeoEl
Definition: pzgeoelside.h:85
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
Definition: fad.h:54
TPZGeoElSide Neighbour() const
Definition: pzgeoel.h:754
void SetElement(TPZGeoEl *geoel)
Definition: pzgeoelside.h:164
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
int64_t ElementIndex() const
Definition: pzgeoelside.h:391
Utility class which represents an element index with its side. Geometry.
Definition: pzgeoelside.h:33
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
std::ostream & operator<<(std::ostream &out, const TPZGeoElSide &geoside)
Overload operator << to print geometric element side data.
void AllNeighbours(TPZStack< TPZGeoElSide > &allneigh)
Returns the set of neighbours which can directly be accessed by the datastructure.
Definition: pzgeoelside.h:333
~TPZGeoElSideIndex()
Destructor.
Definition: pzgeoelside.h:352
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
void SetSide(int side)
Definition: pzgeoelside.h:387
TPZGeoElSide(int zero)
Definition: pzgeoelside.h:157
int operator>(const TPZGeoElSide &other) const
Definition: pzgeoelside.h:216
TPZGeoElSideIndex & operator=(const TPZGeoElSideIndex &A)
Redefines operator = attribuition to TPZGeoElSideIndex object.
Definition: pzgeoelside.h:374
TPZGeoElSideIndex()
Simple constructor.
Definition: pzgeoelside.h:356
void SetElementIndex(int64_t i)
Definition: pzgeoelside.h:395
A simple stack.
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
int operator==(const TPZGeoElSide &other) const
Definition: pzgeoelside.h:205
This class implements a stack object. Utility.
Definition: pzcheckmesh.h:14
int Side() const
Definition: pzgeoelside.h:169
int Exists() const
Definition: pzgeoelside.h:175
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgeoelside.cpp:60
Contains the TPZIntPoints class which defines integration rules.
Contains the TPZTransform<> class which implements an affine transformation between points in paramet...
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
TPZGeoElSideIndex * Clone()
To clone current object.
Definition: pzgeoelside.h:370
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzgeoelside.cpp:55
int Side() const
Definition: pzgeoelside.h:380
int64_t fGeoElIndex
Definition: pzgeoelside.h:35
void SetSide(int side)
Definition: pzgeoelside.h:171
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
int operator!=(const TPZGeoElSide &other) const
Definition: pzgeoelside.h:208