Skip to content
Snippets Groups Projects
Select Git revision
  • 0ddd963aca1497447001dd54d72851f9408c844d
  • 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.
    BackgroundMesh.cpp 33.41 KiB
    // Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include "GmshMessage.h"
    #include "BackgroundMesh.h"
    #include "Numeric.h"
    #include "Context.h"
    #include "GVertex.h"
    #include "GEdge.h"
    #include "GEdgeCompound.h"
    #include "GFace.h"
    #include "GFaceCompound.h"
    #include "GModel.h"
    #include "Field.h"
    #include "MElement.h"
    #include "MElementOctree.h"
    #include "MLine.h"
    #include "MTriangle.h"
    #include "MQuadrangle.h"
    #include "MVertex.h"
    
    #if defined(HAVE_SOLVER)
    #include "dofManager.h"
    #include "laplaceTerm.h"
    #include "linearSystemGMM.h"
    #include "linearSystemCSR.h"
    #include "linearSystemFull.h"
    #include "linearSystemPETSc.h"
    #endif
    
    // computes the characteristic length of the mesh at a vertex in order
    // to have the geometry captured with accuracy. A parameter called
    // CTX::instance()->mesh.minCircPoints tells the minimum number of points per
    // radius of curvature
    
    #if defined(HAVE_ANN)
    static int _NBANN = 2;
    #endif
    
    SMetric3 buildMetricTangentToCurve(SVector3 &t, double l_t, double l_n)
    {
      if (l_t == 0.0) return SMetric3(1.e-22);
      SVector3 a;
      if (t(0) <= t(1) && t(0) <= t(2)){
        a = SVector3(1,0,0);
      }
      else if (t(1) <= t(0) && t(1) <= t(2)){
        a = SVector3(0,1,0);
      }
      else{
        a = SVector3(0,0,1);
      }
      SVector3 b = crossprod (t,a);
      SVector3 c = crossprod (b,t);
      b.normalize();
      c.normalize();
      t.normalize();
      SMetric3 Metric (1./(l_t*l_t),1./(l_n*l_n),1./(l_n*l_n),t,b,c);
      return Metric;
    }
    
    SMetric3 buildMetricTangentToSurface(SVector3 &t1, SVector3 &t2,
                                         double l_t1, double l_t2, double l_n)
    {
      t1.normalize();
      t2.normalize();
      SVector3 n = crossprod (t1,t2);
      n.normalize();