NeoPZ
TPZOneShapeRestraint.h
Go to the documentation of this file.
1 //
2 // TPZOneShapeRestraint.h
3 // PZ
4 //
5 // Created by Philippe Devloo on 5/16/15.
6 //
7 //
8 
9 #ifndef __PZ__TPZOneShapeRestraint__
10 #define __PZ__TPZOneShapeRestraint__
11 
12 #include <stdio.h>
13 #include "pzmanvector.h"
14 #include "TPZStream.h"
15 
16 #include <list>
17 
18 
19 
22 {
25 
28 
29  TPZOneShapeRestraint() : fFaces(4), fOrient(4,-1)
30  {
31  for(int i=0; i<4; i++)
32  {
33  fFaces[i] = std::make_pair<int64_t,int>(-1, -1);
34  }
35  }
36  TPZOneShapeRestraint(const TPZOneShapeRestraint &copy) : fFaces(copy.fFaces), fOrient(copy.fOrient)
37  {
38 
39  }
40 
42  {
43  fFaces = copy.fFaces;
44  fOrient = copy.fOrient;
45  return *this;
46  }
47 
48  bool IsInitialized() const
49  {
50  return fFaces[0].first != -1;
51  }
52 
53  void Print(std::ostream &out) const
54  {
55  out << "TPZOneShapeRestraint ConnectIndex/Degree of freedom : ";
56  for(int i=0; i<4; i++) out << fFaces[i].first << "/" << fFaces[i].second << " ";
57  out << std::endl;
58  out << "Orientation of each face ";
59  for(int i=0; i<4; i++) out << fOrient[i] << " ";
60  out << std::endl;
61  }
62  void Write(TPZStream &buf) const
63  {
64  TPZManVector<int64_t,4> seqnums(4);
65  TPZManVector<int,4> faces(4);
66  for (int i=0; i<4; i++)
67  {
68  seqnums[i] = fFaces[i].first;
69  faces[i] = fFaces[i].second;
70  }
71  buf.Write(&seqnums[0],4);
72  buf.Write(&faces[0],4);
73  buf.Write(&fOrient[0],4);
74  }
75  void Read(TPZStream &buf)
76  {
77  TPZManVector<int64_t,4> seqnums(4);
78  TPZManVector<int,4> faces(4);
79  buf.Read(&seqnums[0],4);
80  buf.Read(&faces[0],4);
81  buf.Read(&fOrient[0],4);
82  for (int i=0; i<4; i++)
83  {
84 // fFaces[i] = std::make_pair<int64_t,int>(seqnums[i], faces[i]); // original
85  fFaces[i] = std::make_pair(seqnums[i], faces[i]); // To compile in linux : Douglas
86  }
87  }
88 
89 
90 };
91 
92 
93 #endif /* defined(__PZ__TPZOneShapeRestraint__) */
void Read(TPZStream &buf)
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
Definition of the retraint associated with the top of the pyramid.
TPZManVector< std::pair< int64_t, int >, 4 > fFaces
Faces which are related. First item is the connect index, second item is the degree of freedom...
TPZOneShapeRestraint & operator=(const TPZOneShapeRestraint &copy)
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
Free store vector implementation.
TPZManVector< int, 4 > fOrient
Orientation of each face.
TPZOneShapeRestraint(const TPZOneShapeRestraint &copy)
void Print(std::ostream &out) const
Contains declaration of the abstract TPZStream class. TPZStream defines the interface for saving and ...
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
void Write(TPZStream &buf) const
virtual void Read(bool &val)
Definition: TPZStream.cpp:91