Skip to content
Snippets Groups Projects
Select Git revision
  • 656278c91c71e240d7ffd4fdc9f4a1f60703d8e6
  • master default protected
  • alphashapes
  • quadMeshingTools
  • cygwin_conv_path
  • macos_arm64
  • add-transfiniteautomatic-to-geo
  • patch_releases_4_10
  • HierarchicalHDiv
  • isuruf-master-patch-63355
  • hyperbolic
  • hexdom
  • hxt_update
  • jf
  • 1618-pythonocc-and-gmsh-api-integration
  • octreeSizeField
  • hexbl
  • alignIrregularVertices
  • getEdges
  • patch_releases_4_8
  • isuruf-master-patch-51992
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
  • gmsh_4_8_4
  • gmsh_4_8_3
  • gmsh_4_8_2
  • gmsh_4_8_1
  • gmsh_4_8_0
  • gmsh_4_7_1
  • gmsh_4_7_0
41 results

BackgroundMesh.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GaussLegendreSimplex.cpp 2.02 KiB
    // Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
    
    #include <math.h>
    #include "GaussIntegration.h"
    #include "GaussLegendre1D.h"
    
    static void brickToTet(double xi, double eta, double zeta, double *r, double *s,
                           double *t, double *J)
    {
      double r1, rs1;
      *r = 0.5e0 * (1.0e0 + xi);
      r1 = 1.0e0 - (*r);
      *s = 0.5e0 * (1.0e0 + eta) * r1;
      rs1 = 1.0e0 - (*r) - (*s);
      *t = 0.5e0 * (1.0e0 + zeta) * rs1;
      *J = 0.125e0 * r1 * rs1;
    }
    
    void quadToTri(double xi, double eta, double *r, double *s, double *J)
    {
      double r1;
      *r = 0.5e0 * (1.0e0 + xi);
      r1 = 1.0e0 - (*r);
      *s = 0.5e0 * (1.0e0 + eta) * r1;
      *J = 0.25e0 * r1;
    }
    
    double quadToTriJac(double, double eta) { return 0.125e0 * (1.0e0 - eta); }
    
    int GaussLegendreTet(int n1, int n2, int n3, IntPt *pts)
    {
      /* get degenerate n1Xn2Xn3 Gauss-Legendre scheme to integrate over a tet */
      int i, j, k, index = 0;
      double *pt1, *pt2, *pt3, *wt1, *wt2, *wt3, dJ;
    
      gmshGaussLegendre1D(n1, &pt1, &wt1);
      gmshGaussLegendre1D(n2, &pt2, &wt2);
      gmshGaussLegendre1D(n3, &pt3, &wt3);
      for(i = 0; i < n1; i++) {
        for(j = 0; j < n2; j++) {
          for(k = 0; k < n3; k++) {
            brickToTet(pt1[i], pt2[j], pt3[k], &(pts[index].pt[0]),
                       &(pts[index].pt[1]), &(pts[index].pt[2]), &dJ);
            pts[index++].weight = dJ * wt1[i] * wt2[j] * wt3[k];
          }
        }
      }
      return index;
    }
    
    int GaussLegendreTri(int n1, int n2, IntPt *pts)
    {
      /* get degenerate n1Xn2 Gauss-Legendre scheme to integrate over a tri */
      int i, j, index = 0;
      double *pt1, *pt2, *wt1, *wt2, dJ;
      // const double two = 2.0000000000000000;
    
      gmshGaussLegendre1D(n1, &pt1, &wt1);
      gmshGaussLegendre1D(n2, &pt2, &wt2);
      for(i = 0; i < n1; i++) {
        for(j = 0; j < n2; j++) {
          quadToTri(pt1[i], pt2[j], &(pts[index].pt[0]), &(pts[index].pt[1]), &dJ);
          pts[index].pt[2] = 0;
          pts[index++].weight = dJ * wt1[i] * wt2[j];
        }
      }
      return index;
    }