NeoPZ
pzhdivpressurebound.cpp
Go to the documentation of this file.
1 //
2 // pzhdivpressurebound.cpp
3 // PZ
4 //
5 // Created by Agnaldo Farias on 25/06/13.
6 //
7 //
8 
9 #include "pzhdivpressurebound.h"
10 #include "pzelchdivbound2.h"
11 #include "pzlog.h"
12 #include "TPZMaterial.h"
13 #include "TPZShapeDisc.h"
14 #include "TPZCompElDisc.h"
15 #include "pzmaterialdata.h"
16 #include "pzhdivpressure.h"
17 
18 #ifdef LOG4CXX
19 static LoggerPtr logger(Logger::getLogger("pz.mesh.TPZCompElHDivPressureBound"));
20 #endif
21 
22 
23 template <class TSHAPE>
26 TPZCompElHDivBound2<TSHAPE>(mesh, gel, index){
27 
28 
29  //Creating connect of the pressure's variable
31  this->fConnectIndexes[this->NConnects()-1] = this->CreateMidSideConnect(2);
32 
33  int nshape = 0;
34  if(gel->Dimension()!= mesh.Dimension()-1) DebugStop();
36 
37  if(gel->Dimension()==2 && TSHAPE::Type()==EQuadrilateral){
39  }
40  if (gel->Dimension()==2 && TSHAPE::Type()==ETriangle){
42  }
43 
44  int nstate = 1;
45 
46  int64_t newnodeindex = mesh.AllocateNewConnect(nshape,nstate,this->fPressureOrder);
47  TPZConnect &newnod = mesh.ConnectVec()[newnodeindex];
48  newnod.SetLagrangeMultiplier(1);
49  this->fConnectIndexes[this->NConnects()-1] = this->CreateMidSideConnect(2);
50  int64_t seqnum = newnod.SequenceNumber();
51  newnod.SetLagrangeMultiplier(1);
52  mesh.Block().Set(seqnum,nshape);
53  mesh.ConnectVec()[this->fConnectIndexes[this->NConnects()-1]].IncrementElConnected();
54 }
55 
56 template<class TSHAPE>
58 TPZCompElHDivBound2<TSHAPE>()
59 {
60  fPressureOrder = 0;
61 
62 }
63 
64 template<class TSHAPE>
67 TPZCompElHDivBound2<TSHAPE>(mesh,copy)
68 {
70 }
71 
72 
73 template<class TSHAPE>
74 TPZCompElHDivPressureBound<TSHAPE>::TPZCompElHDivPressureBound(TPZCompMesh &mesh, const TPZCompElHDivPressureBound<TSHAPE> &copy, std::map<int64_t,int64_t> & gl2lcConMap, std::map<int64_t,int64_t> & gl2lcElMap) :
76 TPZCompElHDivBound2<TSHAPE>(mesh,copy,gl2lcConMap,gl2lcElMap)
77 {
79 }
80 
81 template<class TSHAPE>
83 
84 }
85 
86 template<class TSHAPE>
88 {
89 
91 }
92 
93 template<class TSHAPE>
95 {
96  fPressureOrder = order;
97 }
98 
99 template<class TSHAPE>
101 {
103 
104 }
105 
106 template<class TSHAPE>
107 int TPZCompElHDivPressureBound<TSHAPE>::NConnectShapeF(int connect, int order) const
108 {
109 
110  if(connect<NConnects()-2){
111 
112  return TPZCompElHDivBound2<TSHAPE>::NConnectShapeF(connect, order);
113  }
114  else{
115 
116  int nshape = 0;
118 
121  }
122 
123  if(TPZCompElHDivBound2<TSHAPE>::Dimension()==2 && TSHAPE::Type()==EQuadrilateral){
124  nshape = pzshape::TPZShapeDisc::NShapeF(this->fPressureOrder, this->Dimension(), pzshape::TPZShapeDisc:: ETensorial);
125  }
126 
127  if (TPZCompElHDivBound2<TSHAPE>::Dimension()==2 && TSHAPE::Type()==ETriangle){
128  nshape = pzshape::TPZShapeDisc::NShapeF(this->fPressureOrder, this->Dimension(), pzshape::TPZShapeDisc:: EOrdemTotal);
129  }
130 
131  return (nshape);
132  }
133 }
134 
135 
136 template<class TSHAPE>
138 {
139  if(side == TSHAPE::NSides-1 && node == 1)
140  {
141  return 1;
142  }
143  else{
144  int conectId = TPZCompElHDivBound2<TSHAPE>::SideConnectLocId(node, side);
145  return(conectId);
146  }
147 }
148 
149 
150 template<class TSHAPE>
152 {
153  ord.Resize(NConnects());
154  int i;
155  for(i=0; i<NConnects(); i++) {
156  ord[i] = ConnectOrder(i);
157  }
158 }
159 
161 template<class TSHAPE>
163 {
164  DebugStop();
165  std::cout<<"\nNao implementado";
166  return 0;
167 }
168 
169 template<class TSHAPE>
171 {
172  int connectaux= SideConnectLocId(0,side);
173  if(connectaux<0 || connectaux > this-> NConnects()) {
174  PZError << "TPZCompElHDivPressureBound::SetSideOrder. Bad paramenter side " << side << " order " << order << std::endl;
175 #ifdef LOG4CXX
176  std::stringstream sout;
177  sout << __PRETTY_FUNCTION__ << " Bad side or order " << side << " order " << order;
178  LOGPZ_DEBUG(logger,sout.str())
179 #endif
180  return;
181  }
182  TPZConnect &c = this->Connect(connectaux);
183  c.SetOrder(order,this->fConnectIndexes[connectaux]);
184  int64_t seqnum = c.SequenceNumber();
185  int nvar = 1;
186  TPZMaterial * mat =this-> Material();
187  if(mat) nvar = mat->NStateVariables();
188  int nshape = NConnectShapeF(connectaux,order);
189  c.SetNShape(nshape);
190  c.SetNState(nvar);
191  this-> Mesh()->Block().Set(seqnum,nshape*nvar);
192  if(connectaux == NConnects()-1)
193  {
194  this->SetIntegrationRule(2*order);
195  }
196 }
197 
198 
202 template<class TSHAPE>
204 {
205  if(connect<NConnects()-2)
206  {
207  int connord = TPZCompElHDivBound2<TSHAPE>::ConnectOrder(connect);
208  return (connord);
209  }
210  else{
211 
212  const TPZConnect &c = this-> Connect(connect);
213  return c.Order();
214  }
215 }
216 
217 template<class TSHAPE>
219 {
220 
224 }
225 
226 template<class TSHAPE>
228 {
229 
230  TPZManVector<int64_t> firstshapeindex;
231  FirstShapeIndex(firstshapeindex);
232  int nshape = TPZIntelGen<TSHAPE>::NShapeF();
233  shapeindex.Resize(nshape);
234  int64_t nsides = sides.NElements();
235  int64_t is, count=0;
236  for(is=0 ; is<nsides; is++)
237  {
238  int side = sides[is];
239  int sideorder= this->EffectiveSideOrder(side);
240  int NShapeFace = TSHAPE::NConnectShapeF(side,sideorder);
241  int ishapeface;
242  for(ishapeface=0; ishapeface<NShapeFace; ishapeface++)
243  {
244  shapeindex[count++] = is;
245  }
246  }
247  shapeindex.Resize(count);
248 #ifdef LOG4CXX
249  {
250  std::stringstream sout;
251  sout << "count = " << count << " nshape " << nshape;
252  sout << std::endl<<"sides associated with the normals "<< sides <<
253  "\nnormal associated with each shape function : shape function indexes " << shapeindex;
254  LOGPZ_DEBUG(logger,sout.str())
255  }
256 #endif
257 
258 }
259 
260 template<class TSHAPE>
262 {
263  DebugStop();
264  std::cout << "\nNao implementado";
265 }
266 
267 template<class TSHAPE>
269 {
270  DebugStop();
271  std::cout << "\nNao implementado";
272 }
273 
275 template<class TSHAPE>
277 {
278  DebugStop();
279  std::cout << "\nNao implementado";
280 }
281 
282 
284 template<class TSHAPE>
286 {
288 }
289 
291 template<class TSHAPE>
292 void TPZCompElHDivPressureBound<TSHAPE>::Write(TPZStream &buf, int withclassid) const
293 {
294  TPZCompElHDivBound2<TSHAPE>::Write(buf,withclassid);
295 }
296 
297 template<class TSHAPE>
299 #ifndef STATE_COMPLEX
301 #endif
302 }
303 
304 
305 //---------------------
306 #include "pzshapetriang.h"
307 #include "pzshapepoint.h"
308 #include "pzshapelinear.h"
309 #include "pzshapequad.h"
310 
311 using namespace pzshape;
312 
316 
317 #ifndef BORLAND
319 #endif
320 
322 //template class TPZCompElHDivPressureBound<TPZShapePoint>;
virtual int SideConnectLocId(int node, int side) const override
Returns the local node number of icon along is.
int Set(const int index, const int dim, const int pos=-1)
Modifies existing block dimensions or creates a new block with given index.
Definition: pzblock.cpp:104
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
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.
virtual int NConnectShapeF(int connect, int order) const override
Returns the number of shapefunctions associated with a connect.
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
virtual ~TPZCompElHDivPressureBound()
Default destructor.
virtual int64_t AllocateNewConnect(int nshape, int nstate, int order)
Returns an index to a new connect.
Definition: pzcmesh.h:693
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual void SetConnectIndex(int i, int64_t connectindex) override
Sets the node pointer of node i to nod.
groups all classes dedicated to the computation of shape functions
Definition: pzshapeextend.h:16
virtual void SetIntegrationRule(int ord) override
Definition: pzelctemp.cpp:150
virtual int SideConnectLocId(int node, int side) const override
Returns the local node number of icon along is.
void SetLagrangeMultiplier(unsigned char mult)
Set the connect as a pressure connect or not.
Definition: pzconnect.h:236
virtual int Dimension() const override
Returns the dimension of the element.
virtual int NStateVariables() const =0
Returns the number of state variables associated with the material.
MShapeFunctionType fShapeType
virtual int64_t CreateMidSideConnect(int side)
Verify the neighbours of the element and create a node along this side.
Definition: pzintel.cpp:654
virtual int NConnectShapeF(int connect, int order) const override
Returns the number of shapefunctions associated with a connect.
TPZCompElHDivPressureBound()
Default constructor.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
int NShapeF() const override
Returns the total number of shapefunctions.
Definition: pzintel.cpp:63
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
virtual void InitMaterialData(TPZMaterialData &data) override
Initialize a material data and its attributes based on element dimension, number of state variables a...
Implements a generic computational element to HDiv-Pressure scope. Computational Element.
virtual void SetConnectIndex(int i, int64_t connectindex) override
Sets the node pointer of node i to nod.
void ComputeShapeIndex(TPZVec< int > &sides, TPZVec< int64_t > &shapeindex)
Compute the correspondence between the normal vectors and the shape functions.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
unsigned char Order() const
Access function to return the order associated with the connect.
Definition: pzconnect.h:217
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
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
int fPressureOrder
Defines the interpolation order for pressure variable.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
virtual void GetInterpolationOrder(TPZVec< int > &ord) override
Identifies the interpolation order on the interior of the element.
virtual void SetSideOrder(int side, int order) override
Returns the preferred order of the polynomial along side iside.
virtual void SideShapeFunction(int side, TPZVec< REAL > &point, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi) override
Compute the values of the shape function of the side.
virtual int ConnectOrder(int connect) const override
int numberdualfunctions
number of dual function (e.g. pressure in HDiv approximations)
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
virtual void SetCreateFunctions(TPZCompMesh *mesh) override
Set create function in TPZCompMesh to create elements of this type.
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
Implements a generic computational element to HDiv scope. Computational Element.
Contains TPZShapePoint class which implements the shape function associated with a point...
virtual int EffectiveSideOrder(int side) const override
Returns the actual interpolation order of the polynomial along the side.
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
void FirstShapeIndex(TPZVec< int64_t > &Index)
Returns the vector index of the first index shape associate to element.
Contains declaration of TPZCompElHDivPressure class which implements a generic computational element ...
Contains declaration of TPZCompElHDivPressureBound class which implements a generic computational ele...
TPZManVector< int64_t, TSHAPE::NSides > fConnectIndexes
Indexes of the connects associated with the elements.
Definition: pzelctemp.h:25
virtual int Dimension() const =0
Returns the dimension of the element.
Contains declaration of TPZCompElHDivBound2 class which implements a generic computational element (H...
virtual void InitMaterialData(TPZMaterialData &data) override
Initialize a material data and its attributes based on element dimension, number of state variables a...
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
void SetAllCreateFunctionsHDivPressure()
Definition: pzcmesh.h:531
virtual void SetPressureOrder(int ord)
Identifies the interpolation order for pressure variable.
Contains the declaration of the shape function discontinuous.
virtual int ConnectOrder(int connect) const override
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
virtual int NConnects() const override
Returns the number of connect objects of the element.
static int NShapeF(int degree, int dimension, MShapeType type)
Number of shapefunctions dependent on the dimension and order of interpolation.
Contains TPZShapeQuad class which implements the shape functions of a quadrilateral element...
virtual int NConnects() const override
Returns the number of connect objects of the element.
Contains TPZShapeTriang class which implements the shape functions of a triangular element...
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15