73 void fillNaturalCoordinates(
GmMatrix& coord,
bool transposed =
false)
const;
132 return cartesianToNatural(coord, X, _preferGeometricConfig, _gradTolConfig, _maxGradIterConfig,
133 _outsideNatTolConfig, ncoord, inside);
170 int maxGradIter,
double outsideNatTol,
GmVector& ncoord,
bool* inside)
const
172 if(preferGeometric && hasGeometryBasedCartesianToNatural())
173 return geometryBasedCartesianToNatural(coord, X, outsideNatTol, ncoord, inside);
175 return gradientBasedCartesianToNatural(coord, X, gradTol, maxGradIter, outsideNatTol, ncoord, inside);
225 virtual double shapeCartesianPartialsFromCoord (
const GmVector& ncoord,
const GmMatrix& X,
GmMatrix& dN,
bool transposed =
false)
const;
226 virtual double shapeCartesianPartialsFromJacobian(
const GmVector& ncoord,
const GmMatrix& J,
GmMatrix& dN,
bool transposed =
false)
const;
278 jacobianAndPartials(ncoord, X, J, P, transposed);
322 const GmMatrix& X,
bool transposed =
false)
const = 0;
344 const GmMatrix& X,
bool transposed =
false)
const = 0;
366 const GmMatrix& X,
bool transposed =
false)
const = 0;
389 virtual bool pointExtrapolationMatrix(
const GmMatrix& points,
GmMatrix& em)
const;
391 double interpolate(
const GmVector& nodeValues,
const GmVector& ncoord)
const;
393 static bool initShapeFunctions();
396 static const GmShape* linearShapeFromElementType(
GmCellType etype,
int P,
int Q);
407#if defined ENABLE_TESTS
408 friend void shapeMappingTests();
410 virtual bool gradientBasedCartesianToNatural(
const GmVector& coord,
const GmMatrix& X,
double tol,
411 int maxIter,
double natTol,
GmVector& ncoord,
bool* inside)
const = 0;
413 bool gradientBasedCartesianToNaturalQuadHex(
const GmVector& coord,
const GmMatrix& X,
double tol,
414 int maxIter,
double natTol,
GmVector& ncoord,
bool* inside,
double alpha = _newtonAlpha)
const;
415 bool gradientBasedCartesianToNaturalTriTet (
const GmVector& coord,
const GmMatrix& X,
double tol,
416 int maxIter,
double natTol,
GmVector& ncoord,
bool* inside,
double alpha = _newtonAlpha)
const;
417 bool gradientBasedCartesianToNaturalBar (
const GmVector& coord,
const GmMatrix& X,
double tol,
418 int maxIter,
double natTol,
GmVector& ncoord,
bool* inside,
double alpha = _newtonAlpha)
const;
419 bool gradientBasedCartesianToNaturalWedge (
const GmVector& coord,
const GmMatrix& X,
double tol,
420 int maxIter,
double natTol,
GmVector& ncoord,
bool* inside,
double alpha = _newtonAlpha)
const;
434 GmVector& ncoord,
bool* inside)
const
436 Q_UNUSED(coord); Q_UNUSED(X); Q_UNUSED(natTol); Q_UNUSED(ncoord); Q_UNUSED(inside);
440 bool checkAndClampNaturalCoordinate(
double& ncoord,
double min,
double max,
double natTol)
const;
441 bool checkAndClampBarycentricNaturalCoordinates(
GmVector& ncoord,
double natTol)
const;
Integration rule base classe.
Definition gmIntegrationRule.h:89
Shape function handling base classe.
Definition gmShape.h:38
virtual void naturalCoordLimits(int coord, double *min, double *max) const =0
Fills min and max with the domain limits for the given natural coordinate (between 0 and numNaturalCo...
virtual bool cartesianToNatural(const GmVector &coord, const GmMatrix &X, GmVector &ncoord, bool *inside) const
Given a set of cartesian coordinates 'coord' and a matrix with node coordinates 'X',...
Definition gmShape.h:130
static double _newtonAlpha
The default value for alpha used in newton method for cartesianToNatural()
Definition gmShape.h:451
virtual double shapeCartesianPartialsFromPJ(const GmMatrix &P, const GmMatrix &J, GmMatrix &dN, bool transposed=false) const =0
Alternative version of shapeCartesianPartialsXxxx() to calculate shape function partial derivatives w...
static double _gradTolConfig
The convergence tolerance used by gradient based calls to cartesianToNatural.
Definition gmShape.h:448
virtual GmCellType elemType() const =0
Returns the type of this element.
virtual void nodeNaturalCoord(int node, GmVector &coord) const =0
Fills the coord vector with the set of natural coordinates for the reference shape function node....
static QMutex _emCacheMutex
The mutex protecting _emCache.
Definition gmShape.h:454
virtual double edgeScalingFactor(int border, const GmVector &borderCoord, const GmVector &elementCoord, const GmMatrix &X, bool transposed=false) const =0
Returns the scaling factor needed when calculating integrals over element edges. This has the same ef...
virtual void jacobianRotation(const GmMatrix &J, GmMatrix &R) const =0
Computes the rotation matrix from the jacobian axis. Useful for interface elements.
virtual bool cartesianToNatural(const GmVector &coord, const GmMatrix &X, bool preferGeometric, double gradTol, int maxGradIter, double outsideNatTol, GmVector &ncoord, bool *inside) const
Given a set of cartesian coordinates 'coord' and a matrix with node coordinates 'X',...
Definition gmShape.h:169
virtual double scaledJacobianDet(const GmMatrix &J) const =0
Returns the Jacobian determinant multiplied by the scaling factor needed for transforming the differe...
virtual bool geometryBasedCartesianToNatural(const GmVector &coord, const GmMatrix &X, double natTol, GmVector &ncoord, bool *inside) const
Virtual function that should be implemented if a shape can provide a geometric algorithm for converti...
Definition gmShape.h:433
virtual void shapePartials(const GmVector &ncoord, GmMatrix &dN, bool transposed=false) const =0
Function used to calculate shape function partial derivatives with respect to its natural coordinates...
virtual int numFunctions() const =0
Returns the number of shape functions of this element type (equal to the number of nodes)
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...
virtual int numCartesianCoord() const =0
Returns the number of cartesian coordinates expected by this element type.
static QMap< QPair< GmCellType, int >, GmMatrix > _emCache
A global cache, keyed by cell type + cacheKey(), storing extrapolation matrices.
Definition gmShape.h:453
virtual double borderScalingFactor(int border, const GmVector &borderCoord, const GmVector &elementCoord, const GmMatrix &X, bool transposed=false) const =0
Returns the scaling factor needed when calculating integrals over borders (edges or faces)....
static GmSpinLock _hElementsLock
The spin-lock protecting the access/creation of shape pointers for hierarchical elements.
Definition gmShape.h:445
virtual bool translateEdgePoint(int edge, const GmVector &srcEdgeCoord, GmVector &elementCoord) const =0
Given a "bar like" edge coordinate (from -1 to 1), at the given edge, fills elementCoord with the equ...
static double _outsideNatTolConfig
The "snap" tolerance used by cartesianToNatural to consider a point outside the element.
Definition gmShape.h:450
virtual void shapeValues(const GmVector &ncoord, GmVector &N) const =0
Function used to evaluate the set of shape functions over a point defined by its natural coordinates.
virtual bool translateFacePoint(int face, const GmVector &srcFaceCoord, GmVector &elementCoord) const =0
Given a "quad like" or "tri like" face coordinate (-1 to 1 pair for quad faces and 0 to 1 barycentric...
virtual double faceScalingFactor(int border, const GmVector &borderCoord, const GmVector &elementCoord, const GmMatrix &X, bool transposed=false) const =0
Returns the scaling factor needed when calculating integrals over element faces. This has the same ef...
static bool _preferGeometricConfig
Should calls to cartesianToNatural prefer geometric algorithms (if available) over the gradient based...
Definition gmShape.h:447
virtual bool hasGeometryBasedCartesianToNatural() const
A virtual function that should be replaced to return true if the shape implements a geometry based al...
Definition gmShape.h:427
virtual void naturalCenter(GmVector &coord) const =0
Fills the coord vector with the set of natural coordinates for the element center.
virtual void jacobian(const GmVector &ncoord, const GmMatrix &X, GmMatrix &J, bool transposed=false) const
Calculates the jacobian matrix, relating cartesian coordinates to natural coordinates.
Definition gmShape.h:275
static int _maxGradIterConfig
The maximum number of iterations used by gradient based calls to cartesianToNatural.
Definition gmShape.h:449
virtual int numNaturalCoord() const =0
Returns the number of natural coordinates used by this element type.
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
A simple spin lock implementation based on a loop using test and set over an atomic int to change its...
Definition gmSpinLock.h:37
Declaration of the GmCell class.
GmCellType
Mesh Cell types. Don't change type orders or add types without reading comments below.
Definition gmCellType.h:31
@ GM_NUM_CELL_TYPES
NOT a cell type. Stores the number of available types.
Definition gmCellType.h:77
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition gmMatrix.h:38
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34