NeoPZ
pznoderep.h
Go to the documentation of this file.
1 
7 #ifndef PZNODEREPH
8 #define PZNODEREPH
9 
10 #include "pzvec.h"
11 
12 #include <map>
13 #include <memory.h>
14 
15 #include "pzmanvector.h"
16 #include "pztrnsform.h"
17 
18 class TPZGeoElSide;
19 class TPZGeoEl;
20 
21 #include "pzlog.h"
22 #ifdef LOG4CXX
23 static LoggerPtr lognoderep(Logger::getLogger("pz.geom.tpznoderep"));
24 #endif
25 
26 namespace pzgeom {
27 
32  const double pzgeom_TPZNodeRep_tol = 1.E-12;
33 
39  template<int N, class Topology>
40  class TPZNodeRep : public Topology
41  {
42 
43  public:
44 
45  virtual void SetNeighbourInfo(int side, TPZGeoElSide &neigh, TPZTransform<> &trans) {
46  std::cout << "Element that is NOT TPZGeoBlend trying to Set Neighbour Information on Geometric Mesh!\n";
47  std::cout << "See TPZGeoElRefLess::SetNeighbourInfo() Method!\n";
48  DebugStop();
49  }
50 
51  bool IsLinearMapping() const;
52 
53  bool IsGeoBlendEl() const
54  {
55  return false;
56  }
57 
58  bool ResetBlendConnectivity(const int64_t &side, const int64_t &index){
59  return false;
60  }
61 
62  static const int NNodes=N;
64  int64_t fNodeIndexes[N];
67  {
68  int nn = nodeindexes.NElements() < N ? nodeindexes.NElements() : N;
69 #ifdef PZDEBUG
70  if(nn<N)
71  {
72  DebugStop();
73  }
74 #endif
75  memcpy(fNodeIndexes,&nodeindexes[0],nn*sizeof(int64_t));
76  int i;
77  for(i=nn; i<N; i++) fNodeIndexes[i]=-1;
78  }
79 
82  {
83  int64_t i;
84  for(i=0; i<N; i++) fNodeIndexes[i]=-1;
85  }
86 
88  TPZNodeRep(const TPZNodeRep &cp,
89  std::map<int64_t,int64_t> & gl2lcNdMap);
90 
93  {
94  memcpy(fNodeIndexes,cp.fNodeIndexes,N*sizeof(int64_t));
95  }
96 
97  void Read(TPZStream &buf, void *context) override{
98  Topology::Read(buf, context);
99  buf.Read(fNodeIndexes, NNodes);
100  }
101 
102  void Write(TPZStream &buf, int withclassid) const override{
103  Topology::Write(buf, withclassid);
104  buf.Write(fNodeIndexes, NNodes);
105  }
106 
107  void Initialize(TPZVec<int64_t> &nodeindexes)
108  {
109  int64_t nn = nodeindexes.NElements() < N ? nodeindexes.NElements() : N;
110 #ifndef NODEBUG
111  if(nodeindexes.NElements() != N)
112  {
113  std::stringstream sout;
114  sout << __PRETTY_FUNCTION__ << " Nodeindexes have wrong size " << nodeindexes.NElements() << " but should be " << N;
115 #ifdef LOG4CXX
116  LOGPZ_ERROR(lognoderep,sout.str().c_str());
117 #else
118  std::cout << sout.str().c_str() << std::endl;
119 #endif
120  }
121 #endif
122  memcpy(fNodeIndexes,&nodeindexes[0],nn*sizeof(int64_t));
123  int64_t i;
124  for(i=nn; i<N; i++) fNodeIndexes[i]=-1;
125 
126  }
127 
129  {
130 
131  }
132 
133  void Print(std::ostream &out) const
134  {
135  int nn;
136  out << "Nodeindices: ";
137  for(nn=0; nn<N; nn++)
138  {
139  out << fNodeIndexes[nn] << ' ';
140  }
141  out << std::endl;
142  }
143 
144  public:
145  int ClassId() const override;
146 
147  protected:
148  };
149 
150  template<int N, class Topology>
152  return Hash("TPZNodeRep") ^ Topology::ClassId() << 1 ^ (N << 2);
153  }
154 };
155 
156 #include "pznoderep.h.h"
157 
158 #endif
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
void Read(TPZStream &buf, void *context) override
Definition: pznoderep.h:97
bool IsGeoBlendEl() const
Definition: pznoderep.h:53
void Initialize(TPZVec< int64_t > &nodeindexes)
Definition: pznoderep.h:107
static const int NNodes
Definition: pznoderep.h:62
Templated vector implementation.
TPZNodeRep()
Empty constructor.
Definition: pznoderep.h:81
bool IsLinearMapping() const
Definition: pznoderep.cpp:35
void Initialize(TPZGeoEl *)
Definition: pznoderep.h:128
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
virtual void SetNeighbourInfo(int side, TPZGeoElSide &neigh, TPZTransform<> &trans)
Definition: pznoderep.h:45
bool ResetBlendConnectivity(const int64_t &side, const int64_t &index)
Definition: pznoderep.h:58
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
const double pzgeom_TPZNodeRep_tol
Initializing tolerance to TPZNodeRep.
Definition: pznoderep.h:32
Free store vector implementation.
TPZNodeRep(TPZVec< int64_t > &nodeindexes)
Constructor with list of nodes.
Definition: pznoderep.h:66
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
Implements ... Geometry Topology.
Definition: pznoderep.h:40
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
void Write(TPZStream &buf, int withclassid) const override
Definition: pznoderep.h:102
void Print(std::ostream &out) const
Definition: pznoderep.h:133
Contains the implementation of the TPZNodeRep methods.
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
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
TPZNodeRep(const TPZNodeRep< N, Topology > &cp)
Copy constructor.
Definition: pznoderep.h:92
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
int ClassId() const override
Definition: pznoderep.h:151
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
int64_t fNodeIndexes[N]
Node indexes of the element.
Definition: pznoderep.h:64