Skip to content
Snippets Groups Projects
Select Git revision
  • a838a6c8bb2dbae6aae55145d22715b94e50b1ae
  • master default protected
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • patches-4.14
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • hierarchical-basis
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • 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

Trackball.h

Blame
  • GModelIO_MAIL.cpp 1.98 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 "MTriangle.h"
    
    int GModel::writeMAIL(const std::string &name, bool saveAll, double scalingFactor)
    {
      // CEA triangulation (.mail format) for Eric Darrigrand. Note that
      // we currently don't save the edges of the triangulation (the last
      // part of the file).
      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), numTriangles = 0;
      for(fiter it = firstFace(); it != lastFace(); ++it)
        if(saveAll || (*it)->physicals.size())
          numTriangles += (*it)->triangles.size();
    
      fprintf(fp, " %d %d\n", numVertices, numTriangles);
    
      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++){
          MVertex *v = entities[i]->mesh_vertices[j];
          fprintf(fp, " %19.10E %19.10E %19.10E\n", v->x() * scalingFactor,
                  v->y() * scalingFactor, v->z() * scalingFactor);
        }
      }
    
      for(fiter it = firstFace(); it != lastFace(); ++it){
        if(saveAll || (*it)->physicals.size()){
          for(unsigned int i = 0; i < (*it)->triangles.size(); i++){
            MTriangle *t = (*it)->triangles[i];
            fprintf(fp, " %d %d %d\n", t->getVertex(0)->getIndex(),
                    t->getVertex(1)->getIndex(), t->getVertex(2)->getIndex());
          }
        }
      }
    
      // TODO write edges (with signs)
      for(fiter it = firstFace(); it != lastFace(); ++it){
        if(saveAll || (*it)->physicals.size()){
          for(unsigned int i = 0; i < (*it)->triangles.size(); i++){
            //MTriangle *t = (*it)->triangles[i];
            fprintf(fp, " %d %d %d\n", 0, 0, 0);
          }
        }
      }
    
      fclose(fp);
      return 1;
    }