Skip to content
Snippets Groups Projects
Select Git revision
  • 9139fe13abda3dce6f59c10c899ed0dc0e2cbb23
  • master default protected
  • patches-4.14
  • 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
  • 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

Generator.h

Blame
    • Christophe Geuzaine's avatar
      9139fe13
      · 9139fe13
      Christophe Geuzaine authored
      - new GmshInitialize(argc, argv) and GmshFinalize() for library version,
        now also used throughout
      
      - GModel::mesh(dimension)
      
      We now have a simple API to do basic stuff. We'll interface more as we go (optimize, adapt, etc.).
      
      #include <stdio.h>
      #include <gmsh/Gmsh.h>
      #include <gmsh/GModel.h>
      #include <gmsh/MElement.h>
      
      int main(int argc, char **argv)
      {
        GmshInitialize(argc, argv);
        GModel *m = new GModel();
        m->readGEO("./tutorial/t5.geo");
        m->mesh(3);
        for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
          printf("volume %d contains %d elements:\n", (*it)->tag(), (*it)->getNumMeshElements());
          for(unsigned int i = 0; i < (*it)->getNumMeshElements(); i++)
            printf(" %d", (*it)->getMeshElement(i)->getNum());
          printf("\n");
        }
        m->writeMSH("test.msh");
        m->writeUNV("test.unv");
        GmshFinalize();
      }
      9139fe13
      History
      Christophe Geuzaine authored
      - new GmshInitialize(argc, argv) and GmshFinalize() for library version,
        now also used throughout
      
      - GModel::mesh(dimension)
      
      We now have a simple API to do basic stuff. We'll interface more as we go (optimize, adapt, etc.).
      
      #include <stdio.h>
      #include <gmsh/Gmsh.h>
      #include <gmsh/GModel.h>
      #include <gmsh/MElement.h>
      
      int main(int argc, char **argv)
      {
        GmshInitialize(argc, argv);
        GModel *m = new GModel();
        m->readGEO("./tutorial/t5.geo");
        m->mesh(3);
        for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
          printf("volume %d contains %d elements:\n", (*it)->tag(), (*it)->getNumMeshElements());
          for(unsigned int i = 0; i < (*it)->getNumMeshElements(); i++)
            printf(" %d", (*it)->getMeshElement(i)->getNum());
          printf("\n");
        }
        m->writeMSH("test.msh");
        m->writeUNV("test.unv");
        GmshFinalize();
      }
    CondNumBasis.h 5.85 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>.
    
    #ifndef _CONDNUMBASIS_H_
    #define _CONDNUMBASIS_H_
    
    #include <map>
    #include <vector>
    #include "fullMatrix.h"
    #include "JacobianBasis.h"
    
    class CondNumBasis {
     private:
      const GradientBasis *_gradBasis;
    
      const int _tag, _dim, _condNumOrder;
    
      fullVector<double> primGradShapeBarycenterX, primGradShapeBarycenterY,
                         primGradShapeBarycenterZ;
    
      int _nCondNumNodes;
      int _nMapNodes, _nPrimMapNodes;
    
     public :
      CondNumBasis(int tag, int cnOrder = -1);
    
      // Get methods
      inline int getCondNumOrder() const { return _condNumOrder; }
      inline int getNumCondNumNodes() const { return _nCondNumNodes; }
      inline int getNumMapNodes() const { return _nMapNodes; }
      inline int getNumPrimMapNodes() const { return _nPrimMapNodes; }
    
      // Order calculation
      static int condNumOrder(int tag);
      static int condNumOrder(int parentType, int order);
    
      // Condition number evaluation methods
      inline void getInvCondNum(const fullMatrix<double> &nodesXYZ,
                                fullVector<double> &invCond) const {
        getInvCondNumGeneral(_nCondNumNodes,
                             _gradBasis->gradShapeIdealMatX,
                             _gradBasis->gradShapeIdealMatY,
                             _gradBasis->gradShapeIdealMatZ,
                             nodesXYZ, invCond);
      }
      inline void getSignedInvCondNum(const fullMatrix<double> &nodesXYZ,
                                      const fullMatrix<double> &normals,
                                      fullVector<double> &invCond) const {
        getSignedInvCondNumGeneral(_nCondNumNodes,
                                   _gradBasis->gradShapeIdealMatX,
                                   _gradBasis->gradShapeIdealMatY,
                                   _gradBasis->gradShapeIdealMatZ,
                                   nodesXYZ, normals, invCond);
      }
      inline void getInvCondNumAndGradients(const fullMatrix<double> &nodesXYZ,
                                            fullMatrix<double> &IDI) const {
        getInvCondNumAndGradientsGeneral(_nCondNumNodes,
                                         _gradBasis->gradShapeIdealMatX,
                                         _gradBasis->gradShapeIdealMatY,
                                         _gradBasis->gradShapeIdealMatZ,
                                         nodesXYZ, IDI);
      }
      inline void getSignedInvCondNumAndGradients(const fullMatrix<double> &nodesXYZ,
                                                  const fullMatrix<double> &normals,
                                                  fullMatrix<double> &IDI) const {
        getSignedInvCondNumAndGradientsGeneral(_nCondNumNodes,
                                               _gradBasis->gradShapeIdealMatX,
                                               _gradBasis->gradShapeIdealMatY,
                                               _gradBasis->gradShapeIdealMatZ,
                                               nodesXYZ, normals, IDI);
      }
    
    
     private :
      template<bool sign>
      void getInvCondNumGeneral(int nCondNumNodes,
                                const fullMatrix<double> &gSMatX,
                                const fullMatrix<double> &gSMatY,
                                const fullMatrix<double> &gSMatZ,
                                const fullMatrix<double> &nodesXYZ,
                                const fullMatrix<double> &normals,
                                fullVector<double> &invCond) const;
      void getInvCondNumGeneral(int nCondNumNodes,
                                const fullMatrix<double> &gSMatX,
                                const fullMatrix<double> &gSMatY,
                                const fullMatrix<double> &gSMatZ,
                                const fullMatrix<double> &nodesXYZ,
                                fullVector<double> &invCond) const;
      void getSignedInvCondNumGeneral(int nCondNumNodes,
                                      const fullMatrix<double> &gSMatX,
                                      const fullMatrix<double> &gSMatY,
                                      const fullMatrix<double> &gSMatZ,
                                      const fullMatrix<double> &nodesXYZ,
                                      const fullMatrix<double> &normals,
                                      fullVector<double> &invCond) const;
    
      template<bool sign>
      void getInvCondNumAndGradientsGeneral(int nCondNumNodes,
                                            const fullMatrix<double> &gSMatX,
                                            const fullMatrix<double> &gSMatY,
                                            const fullMatrix<double> &gSMatZ,
                                            const fullMatrix<double> &nodesXYZ,
                                            const fullMatrix<double> &normals,
                                            fullMatrix<double> &IDI) const;
      void getInvCondNumAndGradientsGeneral(int nCondNumNodes,                          // No normal given -> unsigned measure
                                            const fullMatrix<double> &gSMatX,
                                            const fullMatrix<double> &gSMatY,
                                            const fullMatrix<double> &gSMatZ,
                                            const fullMatrix<double> &nodesXYZ,
                                            fullMatrix<double> &IDI) const;
      void getSignedInvCondNumAndGradientsGeneral(int nCondNumNodes,                    // Normals given -> signed measure
                                                  const fullMatrix<double> &gSMatX,
                                                  const fullMatrix<double> &gSMatY,
                                                  const fullMatrix<double> &gSMatZ,
                                                  const fullMatrix<double> &nodesXYZ,
                                                  const fullMatrix<double> &normals,
                                                  fullMatrix<double> &IDI) const;
    
    
    };
    
    #endif