GemaCoreLib
The GeMA Core library
gmShapeH.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_SHAPEH_H_
25 #define _GEMA_SHAPEH_H_
26 
27 #include "gmShape.h"
28 
31 {
32 public:
33 
35  GmHShape(int P, int Q) : _POrder(P), _QOrder(Q) { assert(P > 0 && Q > 0); }
36 
38  int POrder() const { return _POrder; }
39 
41  int QOrder() const { return _QOrder; }
42 
43  // See comments on the base class
44  virtual int numFunctions() const { return numPFunctions() + numQFunctions(); }
45  virtual int numPFunctions() const { return _nPFunctions; }
46  virtual int numQFunctions() const { return _nQFunctions; }
47 
48  virtual int numPVertexFunctions() const { return _nPVertexFunctions; }
49  virtual int numPEdgeFunctions() const { return _nPEdgeFunctions; }
50  virtual int numPFaceFunctions() const { return _nPFaceFunctions; }
51  virtual int numPBubbleFunctions() const { return _nPBubbleFunctions; }
52 
53  virtual int numQEdgeFunctions() const { return _nQEdgeFunctions; }
54  virtual int numQFaceFunctions() const { return _nQFaceFunctions; }
55  virtual int numQBubbleFunctions() const { return _nQBubbleFunctions; }
56 
57  virtual int numPEdgeFunctionsEdge() const { return _nPEdgeFunctionsEdge;}; //<! Number of Pressure Edge Functions associated for edge
58  virtual int numPFaceFunctionsFace() const { return _nPFaceFunctionsFace;}; //<! Number of Pressure Face Functions associated for face.
59  virtual int numQEdgeFunctionsEdge() const { return _nQEdgeFunctionsEdge;}; //<! Number of Flux Edge Functions associated for edge
60  virtual int numQFaceFunctionsFace() const { return _nQFaceFunctionsFace;}; //<! Number of Flux Face Functions associated for face.
61 
62  virtual void shapeValuesVec(const GmVector& ncoord, GmMatrix &N, bool transposed = false) const = 0;
63  virtual void shapeValuesVecBorder(const int border, const GmVector& ncoord, GmMatrix& N, bool transposed = false) const = 0;
64 
65  virtual void shapePartialsVec(const GmVector& ncoord, GmMatrix& N) const = 0;
66 
67  // See comments on the base class
68  virtual double scaledJacobianDet(const GmMatrix& J) const { return arma::det(J); }
69 
70  virtual void jacobianAndPartials(const GmVector& ncoord, const GmMatrix& X, GmMatrix& J, GmMatrix& P, bool transposed = false) const;
71 
72  void fillNaturalCoordinates(GmMatrix& coord, bool transposed = false) const;
73  virtual void naturalToCartesian(const GmVector& ncoord, const GmMatrix& X, GmVector& coord) const;
74 
75 protected:
76  // See comments on the base class. At the moment we don't have a working version for H elements
77  // What do we need to change from standard quad / hex methods?
78  virtual bool gradientBasedCartesianToNatural(const GmVector& coord, const GmMatrix& X, double tol,
79  int maxIter, double natTol, GmVector& ncoord, bool* inside) const
80  {
81  Q_UNUSED(coord); Q_UNUSED(X); Q_UNUSED(tol); Q_UNUSED(maxIter); Q_UNUSED(natTol); Q_UNUSED(ncoord); Q_UNUSED(inside);
82  return false;
83  }
84 
85  int _POrder;
86  int _QOrder;
87 
89  int _nPEdgeFunctions;
90  int _nPFaceFunctions;
91  int _nPBubbleFunctions;
92  int _nPEdgeFunctionsEdge;
93  int _nPFaceFunctionsFace;
94  int _nPFunctions;
95 
96  int _nQEdgeFunctions;
97  int _nQFaceFunctions;
98  int _nQBubbleFunctions;
99  int _nQEdgeFunctionsEdge;
100  int _nQFaceFunctionsFace;
101  int _nQFunctions;
102 };
103 
104 
105 #endif
106 
int POrder() const
Returns the element P order.
Definition: gmShapeH.h:38
virtual void naturalToCartesian(const GmVector &ncoord, const GmMatrix &X, GmVector &coord) const
Given a set of natural coordinates 'ncoord' and a matrix with node coordinates 'X',...
Definition: gmShape.cpp:106
virtual void jacobianAndPartials(const GmVector &ncoord, const GmMatrix &X, GmMatrix &J, GmMatrix &P, bool transposed=false) const =0
This function does the same calculations as the jacobian() call, but also filling the extra parameter...
int _nPVertexFunctions
Elements Q order.
Definition: gmShapeH.h:88
Shape function handling base classe for hierarchical elements.
Definition: gmShapeH.h:30
int QOrder() const
Returns the element Q order.
Definition: gmShapeH.h:41
Shape function handling base classe.
Definition: gmShape.h:37
GmHShape(int P, int Q)
Constructor. Receives as parameters the elements P & Q orders.
Definition: gmShapeH.h:35
void fillNaturalCoordinates(GmMatrix &coord, bool transposed=false) const
Fills the coord matrix with the set of natural coordinates for the shape nodes.
Definition: gmShape.cpp:61
virtual double scaledJacobianDet(const GmMatrix &J) const
Returns the Jacobian determinant multiplied by the scaling factor needed for transforming the differe...
Definition: gmShapeH.h:68
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
virtual int numFunctions() const
Returns the number of shape functions of this element type (equal to the number of nodes)
Definition: gmShapeH.h:44
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
int _QOrder
Elements P order.
Definition: gmShapeH.h:86
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
Declaration of the GmShape base class.