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

GenericRegion.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GModelIO_Mesh.cpp 67.42 KiB
    // Gmsh - Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include <stdlib.h>
    #include <string.h>
    #include <map>
    #include <string>
    #include "GModel.h"
    #include "GmshDefines.h"
    #include "MElement.h"
    #include "SBoundingBox3d.h"
    #include "discreteRegion.h"
    #include "discreteFace.h"
    #include "discreteEdge.h"
    #include "discreteVertex.h"
    #include "StringUtils.h"
    
    #if defined(HAVE_GMSH_EMBEDDED)
    #  include "GmshEmbedded.h"
    #else
    #  include "Message.h"
    #endif
    
    static void storePhysicalTagsInEntities(GModel *m, int dim,
                                            std::map<int, std::map<int, std::string> > &map)
    {
      std::map<int, std::map<int, std::string> >::const_iterator it = map.begin();
      for(; it != map.end(); ++it){
        GEntity *ge = 0;
        switch(dim){
        case 0: ge = m->getVertexByTag(it->first); break;
        case 1: ge = m->getEdgeByTag(it->first); break;
        case 2: ge = m->getFaceByTag(it->first); break;
        case 3: ge = m->getRegionByTag(it->first); break;
        }
        if(ge){
          std::map<int, std::string>::const_iterator it2 = it->second.begin();
          for(; it2 != it->second.end(); ++it2){
            if(std::find(ge->physicals.begin(), ge->physicals.end(), it2->first) == 
               ge->physicals.end())
              ge->physicals.push_back(it2->first);
          }
        }
      }
    }
    
    static bool getVertices(int num, int *indices, std::map<int, MVertex*> &map, 
                            std::vector<MVertex*> &vertices)
    {
      for(int i = 0; i < num; i++){
        if(!map.count(indices[i])){
          Msg::Error("Wrong vertex index %d", indices[i]);
          return false;
        }
        else
          vertices.push_back(map[indices[i]]);
      }
      return true;
    }
    
    static bool getVertices(int num, int *indices, std::vector<MVertex*> &vec,
                            std::vector<MVertex*> &vertices)
    {
      for(int i = 0; i < num; i++){
        if(indices[i] < 0 || indices[i] > (int)(vec.size() - 1)){
          Msg::Error("Wrong vertex index %d", indices[i]);
          return false;
        }