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

linearSystemCSR.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GaussPoints.cpp 2.46 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 "GaussPoints.h"
    #include "GModel.h"
    #include "MElement.h"
    #include "PView.h"
    
    StringXNumber GaussPointsOptions_Number[] = {
      {GMSH_FULLRC, "Order", NULL, 0},
      {GMSH_FULLRC, "Dimension", NULL, 2},
      {GMSH_FULLRC, "PhysicalGroup", NULL, 0}};
    
    extern "C" {
    GMSH_Plugin *GMSH_RegisterGaussPointsPlugin()
    {
      return new GMSH_GaussPointsPlugin();
    }
    }
    
    int GMSH_GaussPointsPlugin::getNbOptions() const
    {
      return sizeof(GaussPointsOptions_Number) / sizeof(StringXNumber);
    }
    
    StringXNumber *GMSH_GaussPointsPlugin::getOption(int iopt)
    {
      return &GaussPointsOptions_Number[iopt];
    }
    
    std::string GMSH_GaussPointsPlugin::getHelp() const
    {
      return "Given an input mesh, Plugin(GaussPoints) creates a view containing "
             "the Gauss points for a given polynomial `Order'.\n\n"
             "If `PhysicalGroup' is nonzero, the plugin only creates points for "
             "the "
             "elements belonging to the group.";
    }
    
    PView *GMSH_GaussPointsPlugin::execute(PView *v)
    {
      int order = (int)GaussPointsOptions_Number[0].def;
      int dim = (int)GaussPointsOptions_Number[1].def;
      int physical = (int)GaussPointsOptions_Number[2].def;
    
      GModel *m = GModel::current();
      std::vector<GEntity *> entities;
      if(physical) {
        std::map<int, std::vector<GEntity *> > groups[4];
        m->getPhysicalGroups(groups);
        entities = groups[dim][physical];
      }
      else {
        m->getEntities(entities, dim);
      }
    
      if(entities.empty()) {
        Msg::Error("No entities");
        return v;
      }
    
      PView *v2 = new PView();
      PViewDataList *data2 = getDataList(v2);
      for(std::size_t i = 0; i < entities.size(); i++) {
        for(std::size_t j = 0; j < entities[i]->getNumMeshElements(); j++) {
          MElement *e = entities[i]->getMeshElement(j);
          int npts;
          IntPt *gp;
          e->getIntegrationPoints(order, &npts, &gp);
          for(int i = 0; i < npts; i++) {
            double u = gp[i].pt[0];
            double v = gp[i].pt[1];
            double w = gp[i].pt[2];
            // double weight = gp[i].weight;
            SPoint3 p;
            e->pnt(u, v, w, p);
            data2->SP.push_back(p.x());
            data2->SP.push_back(p.y());
            data2->SP.push_back(p.z());
            data2->SP.push_back(e->getNum());
            data2->NbSP++;
          }
        }
      }
    
      data2->setName("GaussPoints");
      data2->setFileName("GaussPoints.pos");
      data2->finalize();
    
      return v;
    }