Skip to content
Snippets Groups Projects
Select Git revision
  • 6962920d25256d83e7c8e35c1bad4ee1490e4f1d
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

OnelabParser.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GModelIO_Mesh.cpp 104.48 KiB
    // Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to <gmsh@geuz.org>.
    
    #include <limits>
    #include <stdlib.h>
    #include <string.h>
    #include <map>
    #include <string>
    #include "GModel.h"
    #include "GmshDefines.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 "MElementCut.h"
    #include "SBoundingBox3d.h"
    #include "StringUtils.h"
    #include "GmshMessage.h"
    #include "discreteVertex.h"
    #include "discreteEdge.h"
    #include "discreteFace.h"
    #include "discreteRegion.h"
    #include "MElement.h"
    #include "GEdgeCompound.h"
    #include "GFaceCompound.h"
    
    void GModel::_storePhysicalTagsInEntities(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 = getVertexByTag(it->first); break;
        case 1: ge = getEdgeByTag(it->first); break;
        case 2: ge = getFaceByTag(it->first); break;
        case 3: ge = 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,