Skip to content
Snippets Groups Projects
Select Git revision
  • 07070da8458b307f08234cdc4843ef7a0c4aaa74
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

TriNodeBasis.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    • Nicolas Marsic's avatar
      1aec02c9
      ** ReferenceSpace: · 1aec02c9
      Nicolas Marsic authored
          -- Add Point Mapping from ABC space to XYZ space
          -- Handle Elements with no Face
      
      ** LineBasis:
          -- Works again
      
      ** Jacobian and GroupOfJacobian:
          -- Computes Good Jacobian from Basis ReferenceSpace
      
      ** Formulation:
          -- Addapted for good Jacobian
      
      ** TermProjection:
          -- Addapted to compute function to project at good point (see ReferenceSpace ABCtoXYZ mapping)
      
      ** Laplace, Poisson, SteadyWave:
          -- Passed with all basis
      
      ** WARNING:
          -- Tet Basis NOT Retested (but seems to work)
          -- FunctionSpace::getDof doesn't work if wrong element type (because of basis implication)
          -- SystemAbstract::fixCoef doesn't work anymore (see above)
          -- Problem with cureved Element (getTypeForMSH gives HO element for FunctionSpace::getDof)
      1aec02c9
      History
      ** ReferenceSpace:
      Nicolas Marsic authored
          -- Add Point Mapping from ABC space to XYZ space
          -- Handle Elements with no Face
      
      ** LineBasis:
          -- Works again
      
      ** Jacobian and GroupOfJacobian:
          -- Computes Good Jacobian from Basis ReferenceSpace
      
      ** Formulation:
          -- Addapted for good Jacobian
      
      ** TermProjection:
          -- Addapted to compute function to project at good point (see ReferenceSpace ABCtoXYZ mapping)
      
      ** Laplace, Poisson, SteadyWave:
          -- Passed with all basis
      
      ** WARNING:
          -- Tet Basis NOT Retested (but seems to work)
          -- FunctionSpace::getDof doesn't work if wrong element type (because of basis implication)
          -- SystemAbstract::fixCoef doesn't work anymore (see above)
          -- Problem with cureved Element (getTypeForMSH gives HO element for FunctionSpace::getDof)
    polynomialBasis.h 2.39 KiB
    // Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@geuz.org>.
    
    #ifndef _POLYNOMIAL_BASIS_H_
    #define _POLYNOMIAL_BASIS_H_
    
    #include <math.h>
    #include <map>
    #include <vector>
    #include "fullMatrix.h"
    #include "nodalBasis.h"
    #include <iostream>
    
    #define SQU(a)  ((a)*(a))
    
    inline double pow_int(const double &a, const int &n)
    {
      switch (n) {
      case 0 : return 1.0;
      case 1 : return a;
      case 2 : return a*a;
      case 3 : return a*a*a;
      case 4 :
        {
          const double a2 = a*a;
          return a2*a2;
        }
      case 5 :
        {
          const double a2 = a*a;
          return a2*a2*a;
        }
      case 6 :
        {
          const double a3 = a*a*a;
          return a3*a3;
        }
      case 7 :
        {
          const double a3 = a*a*a;
          return a3*a3*a;
        }
      case 8 :
        {
          const double a2 = a*a;
          const double a4 = a2*a2;
          return a4*a4;
        }
      case 9 :
        {
          const double a3 = a*a*a;
          return a3*a3*a3;
        }
      case 10 :
        {
          const double a2 = a*a;
          const double a4 = a2*a2;
          return a4*a4*a2;
        }
      default :
        return pow_int(a,n-1)*a;
      }
    }
    
    class polynomialBasis : public nodalBasis
    {
     public:
      // for now the only implemented polynomial basis are nodal poly
      // basis, we use the type of the corresponding gmsh element as type
      fullMatrix<double> monomials;
      fullMatrix<double> coefficients;
    
      polynomialBasis(int tag);
      ~polynomialBasis();
    
      int compareNewAlgoPointsWithOld() const;
    
      virtual inline int getNumShapeFunctions() const {return coefficients.size1();}
    
      virtual void f(double u, double v, double w, double *sf) const;
      virtual void f(const fullMatrix<double> &coord, fullMatrix<double> &sf) const;
      virtual void df(const fullMatrix<double> &coord, fullMatrix<double> &dfm) const;
      virtual void df(double u, double v, double w, double grads[][3]) const;
      virtual void ddf(double u, double v, double w, double hess[][3][3]) const;
      virtual void dddf(double u, double v, double w, double third[][3][3][3]) const;
    
      inline void evaluateMonomials(double u, double v, double w, double p[]) const {
        for (int j = 0; j < monomials.size1(); j++) {
          p[j] = pow_int(u, (int)monomials(j, 0));
          if (monomials.size2() > 1) p[j] *= pow_int(v, (int)monomials(j, 1));
          if (monomials.size2() > 2) p[j] *= pow_int(w, (int)monomials(j, 2));
        }
      }
    };
    
    #endif