NeoPZ
pzgnode.h
Go to the documentation of this file.
1 
6 #ifndef TPZGEONODEH
7 #define TPZGEONODEH
8 
9 #include <iostream>
10 #include "pzreal.h"
11 #include "pzerror.h"
12 #include "TPZSavable.h"
13 #include "TPZStream.h"
14 
15 
16 template<class T>
17 class TPZVec;
18 
19 class TPZGeoMesh;
20 class TPZGeoEl;
21 
31 class TPZGeoNode : public TPZSavable {
32 
34  int fId;
36  REAL fCoord[3];
37 
38 public:
40  TPZGeoNode(int id,TPZVec<REAL> &xp,TPZGeoMesh &mesh);
42  TPZGeoNode();
44  TPZGeoNode(const TPZGeoNode &node);
45 
46  TPZGeoNode & operator=(const TPZGeoNode &node);
47 
49  virtual ~TPZGeoNode() { }
50 
52  public:
53 int ClassId() const override;
54 
56  void Read(TPZStream &buf, void *context) override{
57  buf.Read(&fId,1);
58  buf.Read(fCoord,3);
59  }
60 
62  void Write(TPZStream &buf, int withclassid) const override{
63  buf.Write(&fId,1);
64  buf.Write(fCoord,3);
65  }
66 
68  int Id() const
69  {
70  return fId;
71  }
72 
73  void SetNodeId(int id) { fId = id;}
74 
76  void Initialize(TPZVec<REAL> &coord,TPZGeoMesh &mesh);
79  void Initialize(int id,TPZVec<REAL> &coord,TPZGeoMesh &mesh);
80 
82  void Initialize(const TPZGeoNode &node, TPZGeoMesh &mesh);
84  REAL Coord(int i) const;
85 
87  void SetCoord(const TPZVec<REAL> &x);
88 
89 
91  void SetCoord(int i,REAL coord);
92 
96  void Print(std::ostream & out = std::cout);
97 };
98 
99 inline REAL TPZGeoNode::Coord(int i) const {
100 #ifndef NODEBUG
101  if(i > 2 || i < 0) {
102  PZError << "Not exist (TPZGeoNode) coordinate " << i << std::endl;
103  return 1.e12;
104  }
105 #endif
106  return fCoord[i];
107 }
108 
109 #endif
Contains declaration of the TPZSavable class which defines the interface to save and restore objects ...
void SetCoord(const TPZVec< REAL > &x)
Sets all coordinates into the current node. It gets the dim values from x.
Definition: pzgnode.cpp:60
REAL Coord(int i) const
Returns i-th coordinate of the current node.
Definition: pzgnode.h:99
Defines PZError.
void Read(TPZStream &buf, void *context) override
Reads the object from disk.
Definition: pzgnode.h:56
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
TPZGeoNode & operator=(const TPZGeoNode &node)
Definition: pzgnode.cpp:32
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
TPZGeoNode()
Constructor to new node.
Definition: pzgnode.cpp:23
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
int fId
Identity of node.
Definition: pzgnode.h:34
REAL co[8][3]
Coordinates of the eight nodes.
virtual ~TPZGeoNode()
Destructor.
Definition: pzgnode.h:49
void Print(std::ostream &out=std::cout)
Print the node data into out.
Definition: pzgnode.cpp:88
int ClassId() const override
Returns the id of the class (used for writing reading the object)
Definition: pzgnode.cpp:96
void Write(TPZStream &buf, int withclassid) const override
Writes the object to disk.
Definition: pzgnode.h:62
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
void Initialize(TPZVec< REAL > &coord, TPZGeoMesh &mesh)
Initialize the data structure of the node. Creates a unique id for the node automatically.
Definition: pzgnode.cpp:38
Contains declaration of the abstract TPZStream class. TPZStream defines the interface for saving and ...
int Id() const
Returns the identity of the current node.
Definition: pzgnode.h:68
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
void GetCoordinates(TPZVec< REAL > &co)
Fill the coordinates of the node.
Definition: pzgnode.cpp:83
void SetNodeId(int id)
Definition: pzgnode.h:73
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
REAL fCoord[3]
Node coordinates.
Definition: pzgnode.h:36