Skip to content
Snippets Groups Projects
Select Git revision
  • 3013af52babced9c914cff711b36bf112fba736e
  • master default protected
  • dof-renumbering
  • gdemesy-master-patch-30528
  • eval-space-time
  • oscillating_multiharm
  • MH_movement
  • axisqu
  • write_vtu_and_ensight_formats
  • movingband
  • CP_1972_add_vtu_file_writing
  • mortar
  • fast_freq_sweep_Resolution
  • applyresolvent_again
  • marteaua-master-patch-54323
  • patch-1
  • binde-master-patch-08072
  • binde-master-patch-52461
  • BCGSL
  • resolvent
  • TreeElementsOf
  • getdp_3_5_0
  • getdp_3_4_0
  • getdp_3_3_0
  • getdp_3_2_0
  • getdp_3_1_0
  • getdp_3_0_4
  • getdp_3_0_3
  • getdp_3_0_2
  • getdp_3_0_1
  • getdp_3_0_0
  • onelab_mobile_2.1.0
  • getdp_2_11_3 protected
  • getdp_2_11_2 protected
  • getdp_2_11_1 protected
  • getdp_2_11_0 protected
  • getdp_2_10_0 protected
  • getdp_2_9_2 protected
  • getdp_2_9_1 protected
  • getdp_2_9_0 protected
  • getdp_2_8_0 protected
41 results

MacroManager.cpp

Blame
  • GModelVertexArrays.cpp 15.41 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 <cmath>
    #include "GmshMessage.h"
    #include "GmshDefines.h"
    #include "GModel.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 "MElementCut.h"
    #include "Context.h"
    #include "VertexArray.h"
    #include "SmoothData.h"
    
    static const double curvedRepTol = 1.e-5;
    
    unsigned int getColorByEntity(GEntity *e)
    {
      if(e->getSelection()) { // selection
        return CTX::instance()->color.geom.selection;
      }
      else if(e->useColor()) { // forced from a script
        return e->getColor();
      }
      else if(CTX::instance()->mesh.colorCarousel == 1) { // by elementary entity
        return CTX::instance()->color.mesh.carousel[abs(e->tag() % 20)];
      }
      else if(CTX::instance()->mesh.colorCarousel == 2) { // by physical entity
        int np = e->physicals.size();
        int p = np ? e->physicals[np - 1] : 0;
        return CTX::instance()->color.mesh.carousel[abs(p % 20)];
      }
      else {
        return CTX::instance()->color.fg;
      }
    }
    
    static unsigned int getColorByElement(MElement *ele)
    {
      if(ele->getVisibility() > 1) { // selection
        return CTX::instance()->color.geom.selection;
      }
      else if(CTX::instance()->mesh.colorCarousel == 0) { // by element type
        switch(ele->getType()) {
        case TYPE_LIN: return CTX::instance()->color.mesh.line;
        case TYPE_TRI: return CTX::instance()->color.mesh.triangle;
        case TYPE_QUA: return CTX::instance()->color.mesh.quadrangle;
        case TYPE_TET: return CTX::instance()->color.mesh.tetrahedron;
        case TYPE_HEX: return CTX::instance()->color.mesh.hexahedron;
        case TYPE_PRI: return CTX::instance()->color.mesh.prism;
        case TYPE_PYR: return CTX::instance()->color.mesh.pyramid;
        case TYPE_TRIH: return CTX::instance()->color.mesh.trihedron;
        default: return CTX::instance()->color.mesh.node;
        }
      }
      else if(CTX::instance()->mesh.colorCarousel == 3) { // by partition
        return CTX::instance()
          ->color.mesh.carousel[std::abs(ele->getPartition() % 20)];
      }
      else {
        // by elementary or physical entity (this is not perfect (since
        // e.g. a triangle can have no vertices categorized on a surface),