Skip to content
Snippets Groups Projects
Select Git revision
  • aa0e8b0a615aaa394e4dba5713b91af8275e687c
  • 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

PluginManager.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    gmshRegion.cpp 1.97 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 <stdlib.h>
    #include "GModel.h"
    #include "gmshRegion.h"
    #include "Geo.h"
    #include "GmshMessage.h"
    
    gmshRegion::gmshRegion(GModel *m, ::Volume *volume) : GRegion(m, volume->Num)
    {
      resetNativePtr(volume);
      resetMeshAttributes();
    }
    
    void gmshRegion::resetNativePtr(::Volume *volume)
    {
      v = volume;
      l_faces.clear();
      l_dirs.clear();
      for(int i = 0; i < List_Nbr(v->Surfaces); i++) {
        Surface *s;
        List_Read(v->Surfaces, i, &s);
        int ori;
        List_Read(v->SurfacesOrientations, i, &ori);
        GFace *f = model()->getFaceByTag(abs(s->Num));
        if(f) {
          l_faces.push_back(f);
          l_dirs.push_back(ori);
          f->addRegion(this);
        }
        else
          Msg::Error("Unknown surface %d", s->Num);
      }
      for(int i = 0; i < List_Nbr(v->SurfacesByTag); i++) {
        int is;
        List_Read(v->SurfacesByTag, i, &is);
        GFace *f = model()->getFaceByTag(abs(is));
        if(f) {
          l_faces.push_back(f);
          l_dirs.push_back(gmsh_sign(is));
          f->addRegion(this);
        }
        else
          Msg::Error("Unknown surface %d", is);
      }
    }
    
    void gmshRegion::resetMeshAttributes()
    {
      meshAttributes.recombine3D = v->Recombine3D;
      meshAttributes.method = v->Method;
      meshAttributes.QuadTri = v->QuadTri;
      meshAttributes.extrude = v->Extrude;
      if(meshAttributes.method == MESH_TRANSFINITE) {
        meshAttributes.corners.clear();
        for(int i = 0; i < List_Nbr(v->TrsfPoints); i++) {
          Vertex *corn;
          List_Read(v->TrsfPoints, i, &corn);
          GVertex *gv = model()->getVertexByTag(corn->Num);
          if(gv)
            meshAttributes.corners.push_back(gv);
          else
            Msg::Error("Unknown vertex %d in transfinite attributes", corn->Num);
        }
      }
    }
    
    GEntity::GeomType gmshRegion::geomType() const
    {
      switch(v->Typ) {
      case MSH_VOLUME_DISCRETE: return DiscreteVolume;
      default: return Volume;
      }
    }