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

GaussQuadratureTet.cpp

Blame
  • GModelIO_IR3.cpp 2.32 KiB
    // Gmsh - Copyright (C) 1997-2016 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    
    #include "GModel.h"
    #include "OS.h"
    #include "MElement.h"
    
    int GModel::writeIR3(const std::string &name, int elementTagType,
                         bool saveAll, double scalingFactor)
    {
      FILE *fp = Fopen(name.c_str(), "w");
      if(!fp){
        Msg::Error("Unable to open file '%s'", name.c_str());
        return 0;
      }
    
      if(noPhysicalGroups()) saveAll = true;
    
      int numVertices = indexMeshVertices(saveAll), num2D = 0, num3D = 0;
      for(fiter it = firstFace(); it != lastFace(); ++it)
        if(saveAll || (*it)->physicals.size())
          num2D += (*it)->getNumMeshElements();
      for(riter it = firstRegion(); it != lastRegion(); ++it)
        if(saveAll || (*it)->physicals.size())
          num3D += (*it)->getNumMeshElements();
    
      fprintf(fp,"33\n");
      if(num2D && num3D)
        fprintf(fp,"%d %d %d\n", numVertices, num2D, num3D);
      else
        fprintf(fp,"%d %d\n", numVertices, num2D ? num2D : num3D);
    
      std::vector<GEntity*> entities;
      getEntities(entities);
    
      for(unsigned int i = 0; i < entities.size(); i++)
        for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++)
          if(entities[i]->mesh_vertices[j]->getIndex() >= 0)
            fprintf(fp,"%d %.16g %.16g %.16g\n", entities[i]->mesh_vertices[j]->getIndex(),
                    entities[i]->mesh_vertices[j]->x() * scalingFactor,
                    entities[i]->mesh_vertices[j]->y() * scalingFactor,
                    entities[i]->mesh_vertices[j]->z() * scalingFactor);
    
      int iElement = 1;
      for(fiter it = firstFace(); it != lastFace(); ++it){
        int numPhys = (*it)->physicals.size();
        if(saveAll || numPhys)
          for(unsigned int i = 0; i < (*it)->getNumMeshElements(); i++)
            (*it)->getMeshElement(i)->writeIR3
              (fp, elementTagType, iElement++, (*it)->tag(),
               numPhys ? (*it)->physicals[0] : 0);
      }
    
      iElement = 1;
      for(riter it = firstRegion(); it != lastRegion(); ++it){
        int numPhys = (*it)->physicals.size();
        if(saveAll || numPhys)
          for(unsigned int i = 0; i < (*it)->getNumMeshElements(); i++)
            (*it)->getMeshElement(i)->writeIR3
              (fp, elementTagType, iElement++, (*it)->tag(),
               numPhys ? (*it)->physicals[0] : 0);
      }
    
      fclose(fp);
      return 1;
    }