Skip to content
Snippets Groups Projects
Select Git revision
  • e8949e6257949e7ecd036e57e33541cd244cad86
  • master default protected
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • hierarchical-basis
  • alphashapes
  • relaying
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • 3115-issue-fix
  • 3023-Fillet2D-Update
  • convert_fdivs
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • 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
41 results

ACISEdge.h

Blame
  • GModelIO_MSH3.cpp 26.62 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 <sstream>
    #include <iomanip>
    #include <ctime>
    #include "GModel.h"
    #include "OS.h"
    #include "GmshMessage.h"
    #include "MElement.h"
    #include "MPoint.h"
    #include "MLine.h"
    #include "MTriangle.h"
    #include "MQuadrangle.h"
    #include "MTetrahedron.h"
    #include "MHexahedron.h"
    #include "MPrism.h"
    #include "MPyramid.h"
    #include "MTrihedron.h"
    #include "StringUtils.h"
    #include "discreteVertex.h"
    #include "discreteEdge.h"
    #include "discreteFace.h"
    #include "discreteRegion.h"
    
    static int readMSHPhysicals(FILE *fp, GEntity *ge)
    {
      int nump;
      if(fscanf(fp, "%d", &nump) != 1) return 0;
      for(int i = 0; i < nump; i++) {
        int tag;
        if(fscanf(fp, "%d", &tag) != 1) return 0;
        ge->physicals.push_back(tag);
      }
      return 1;
    }
    
    static void readMSHEntities(FILE *fp, GModel *gm)
    {
      int nv, ne, nf, nr;
      int tag;
      if(fscanf(fp, "%d %d %d %d", &nv, &ne, &nf, &nr) != 4) return;
      for(int i = 0; i < nv; i++) {
        if(fscanf(fp, "%d", &tag) != 1) return;
        GVertex *gv = gm->getVertexByTag(tag);
        if(!gv) {
          gv = new discreteVertex(gm, tag);
          gm->add(gv);
        }
        if(!readMSHPhysicals(fp, gv)) return;
      }
      for(int i = 0; i < ne; i++) {
        int n;
        if(fscanf(fp, "%d %d", &tag, &n) != 2) return;
        GEdge *ge = gm->getEdgeByTag(tag);
        if(!ge) {
          GVertex *v1 = 0, *v2 = 0;
          for(int j = 0; j < n; j++) {
            int tagv;
            if(fscanf(fp, "%d", &tagv) != 1){
              delete ge;
              return;
            }
            GVertex *v = gm->getVertexByTag(tagv);
            if(!v) Msg::Error("Unknown GVertex %d", tagv);
            if(j == 0) v1 = v;
            if(j == 1) v2 = v;
          }