Skip to content
Snippets Groups Projects
Select Git revision
  • 7f8d900ce60840b4420d3c2a57d98ed6ecc66530
  • master default protected
  • revert-ef4a3a4f
  • patch_releases_4_14
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • 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
  • 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

GenericEdge.h

Blame
  • GenericEdge.h 4.60 KiB
    // Gmsh - Copyright (C) 1997-2018 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>.
    //
    // Contributed by Paul-Emile Bernard
    
    #ifndef _GENERIC_EDGE_H
    #define _GENERIC_EDGE_H
    
    #include "GmshConfig.h"
    #include "GEdge.h"
    #include "GModel.h"
    #include "GenericVertex.h"
    #include "Range.h"
    #include <vector>
    
    class GenericFace;
    
    /* The set of Generic Entities is a generic interface to any other modeler.
       Callbacks (function pointers) are given, sending requests, enquiries, to the
       native modeler. */
    
    class GenericEdge : public GEdge {
    protected:
      double s0, s1;
      int id;
      const bool is_seam;
    
    public:
      // callbacks typedef
      typedef bool (*ptrfunction_int_double_refvector)(int, double,
                                                       std::vector<double> &);
      typedef bool (*ptrfunction_int_refdouble_refdouble)(int, double &, double &);
      typedef bool (*ptrfunction_int_double_refdouble)(int, double, double &);
      typedef bool (*ptrfunction_int_refstring)(int, std::string &);
      typedef bool (*ptrfunction_int_refbool)(int, bool &);
      typedef bool (*ptrfunction_int_refvector_refdouble_refvector_refbool)(
        int, const std::vector<double> &, double &, std::vector<double> &, bool &);
      typedef bool (*ptrfunction_int_int_double_int_refvector)(
        int, int, double, int, std::vector<double> &);
    
      GenericEdge(GModel *model, int num, int _native_id, GVertex *v1, GVertex *v2,
                  bool _isseam = false);
      virtual ~GenericEdge();
    
      virtual Range<double> parBounds(int i) const;
      virtual GeomType geomType() const;
      virtual bool degenerate(int) const;
      virtual GPoint point(double p) const;
      virtual SVector3 firstDer(double par) const;
      virtual double curvature(double par) const;
      virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const;
      virtual GPoint closestPoint(const SPoint3 &queryPoint, double &param) const;
    
      ModelType getNativeType() const { return GenericModel; }
      virtual int getNativeInt() const { return id; };
    
      virtual int minimumDrawSegments() const; // for output
    
      bool is3D() const;
      bool isSeam(const GFace *) const;
    
      // sets the callbacks, to be given by the user
      static void setEdgeEvalXYZFromT(ptrfunction_int_double_refvector fct)
      {
        EdgeEvalXYZFromT = fct;
      };
      static void setEdgeEvalParBounds(ptrfunction_int_refdouble_refdouble fct)
      {
        EdgeEvalParBounds = fct;
      };
      static void setEdgeGeomType(ptrfunction_int_refstring fct)
      {
        EdgeGeomType = fct;
      };
      static void setEdgeDegenerated(ptrfunction_int_refbool fct)
      {
        EdgeDegenerated = fct;
      };
      static void setEdgeEvalFirstDer(ptrfunction_int_double_refvector fct)
      {
        EdgeEvalFirstDer = fct;
      };
      static void setEdgeEvalCurvature(ptrfunction_int_double_refdouble fct)
      {
        EdgeEvalCurvature = fct;
      };
      static void
      setEdgeClosestPoint(ptrfunction_int_refvector_refdouble_refvector_refbool fct)
      {
        EdgeClosestPoint = fct;
      };
      static void setEdgeIs3D(ptrfunction_int_refbool fct) { EdgeIs3D = fct; };
      static void setEdgeReparamOnFace(ptrfunction_int_int_double_int_refvector fct)
      {
        EdgeReparamOnFace = fct;
      };
    
    private:
      // the callbacks:
      // --------------
      static ptrfunction_int_double_refvector EdgeEvalXYZFromT;
      static ptrfunction_int_refdouble_refdouble EdgeEvalParBounds;
      static ptrfunction_int_refstring EdgeGeomType;
      static ptrfunction_int_refbool EdgeDegenerated;
      static ptrfunction_int_double_refvector EdgeEvalFirstDer;
      static ptrfunction_int_double_refdouble EdgeEvalCurvature;
      // the first vector is a query point xyz, fills the second vector with closest
      // point on edge using orthogonal projection.  Fills double param with
      // parametric coordinate of end point projection.
      static ptrfunction_int_refvector_refdouble_refvector_refbool EdgeClosestPoint;
      static ptrfunction_int_refbool EdgeIs3D;
      static ptrfunction_int_int_double_int_refvector EdgeReparamOnFace;
    };
    
    class LinearSeamEdge : public GEdge {
    protected:
      double s0, s1;
      SVector3 first_der;
    
    public:
      LinearSeamEdge(GModel *model, int num, GVertex *v1, GVertex *v2);
      virtual ~LinearSeamEdge();
    
      virtual Range<double> parBounds(int i) const;
      virtual GeomType geomType() const;
      virtual bool degenerate(int) const;
      virtual GPoint point(double p) const;
      virtual SVector3 firstDer(double par) const;
      virtual double curvature(double par) const;
      virtual bool isSeam(const GFace *face) const { return true; }
      bool is3D() const;
      virtual GPoint closestPoint(const SPoint3 &queryPoint, double &param) const;
    
      ModelType getNativeType() const { return GenericModel; }
    };
    
    #endif