LCOV - code coverage report
Current view: top level - core/meshkit - MeshOp.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 5 7 71.4 %
Date: 2020-07-01 15:24:36 Functions: 3 4 75.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef MESHKIT_MESHOP_HPP
       2                 :            : #define MESHKIT_MESHOP_HPP
       3                 :            : 
       4                 :            : #include "meshkit/Types.hpp"
       5                 :            : #include "meshkit/MKCore.hpp"
       6                 :            : #include "meshkit/GraphNode.hpp"
       7                 :            : #include "moab/Types.hpp"
       8                 :            : #include <vector>
       9                 :            : 
      10                 :            : namespace MeshKit {
      11                 :            : 
      12                 :            : class ModelEnt;
      13                 :            : 
      14                 :            : /** \class MeshOp MeshOp.hpp "meshkit/MeshOp.hpp"
      15                 :            :  * \brief An operation that operates on mesh data
      16                 :            :  *
      17                 :            :  * The class encapsulating setup/execute mesh operations on collections of entities.
      18                 :            :  * MeshOp objects derive from GraphNode, which encapsulates all graph-related
      19                 :            :  * operations on a MeshOp.
      20                 :            :  */
      21                 :            : class MeshOp : public GraphNode
      22                 :            : {
      23                 :            : public:
      24                 :            : 
      25                 :            :     //! Copy constructor
      26                 :            :   MeshOp(const MeshOp &mesh_op);
      27                 :            :   
      28                 :            :     //! Bare constructor
      29                 :            :   MeshOp(MKCore *mkcore, const MEntVector &me_vec = MEntVector());
      30                 :            : 
      31                 :            :     //! Destructor
      32                 :            :   virtual ~MeshOp();
      33                 :            :   
      34                 :            :     /** \brief Add a ModelEnt to this operation's MEntSelection
      35                 :            :      * The MEntSelection is a map, and can only have a given entity once.
      36                 :            :      * \param model_ent ModelEnt being added
      37                 :            :      * \return Returns true if model_ent was actually added, false otherwise
      38                 :            :      */
      39                 :            :   virtual bool add_modelent(ModelEnt *model_ent);
      40                 :            : 
      41                 :            :     /** \brief Removes a ModelEnt from this operation's MEntSelection
      42                 :            :      * \param model_ent ModelEnt being removed
      43                 :            :      * \return Returns true if model_ent was in the map and was actually removed, false if model_ent wasn't in the map
      44                 :            :      */
      45                 :            :   virtual bool remove_modelent(ModelEnt *model_ent);
      46                 :            : 
      47                 :            :     //! Return a reference to the MEntSelection list
      48                 :            :   virtual MEntSelection &me_selection();
      49                 :            : 
      50                 :            :     //! Return a const reference to the MEntSelection list
      51                 :            :   virtual const MEntSelection &me_selection() const;
      52                 :            : 
      53                 :            :     //! Get the associated MKCore object; this applies a dynamic_cast to the parent's MKGraph member
      54                 :            :   MKCore *mk_core() const;
      55                 :            :   
      56                 :            :     /** \brief Return the mesh entity types operated on by this scheme
      57                 :            :      * \return array terminated with \c moab::MBMAXTYPE
      58                 :            :      */
      59                 :            :   virtual const moab::EntityType* mesh_types_arr() const = 0;
      60                 :            : 
      61                 :            :     /** \brief Return what types of mesh entities this algorithm generates; pure virtual so every scheme must define them
      62                 :            :      * \param mesh_types Types handled by this meshop
      63                 :            :      */
      64                 :            :   void mesh_types(std::vector<moab::EntityType> &mesh_types);
      65                 :            :   
      66                 :            :     /** \brief Check that bounding entities have an assigned MeshOp, and create them for ones that don't
      67                 :            :      *
      68                 :            :      * Uses default MeshOp for a given dimension from MeshOpFactory.  If there isn't a registered MeshOp for
      69                 :            :      * the dimension requested, this function throws an exception with mode MK_MESHOP_NOT_FOUND.
      70                 :            :      */
      71                 :            :   void setup_boundary();
      72                 :            : 
      73                 :            :     /** \brief Ensure that this MeshOp depends on any MeshOp assigned to a facet of this MeshOp's selected entities
      74                 :            :      *
      75                 :            :      * For each entity selected for this MeshOp, checks that this MeshOp
      76                 :            :      * has a dependence on any MeshOp assigned to a facet of the entity.
      77                 :            :      * If no such dependence can be found, inserts a direct dependency arc
      78                 :            :      * from this MeshOp to the MeshOp on the facet.
      79                 :            :      *
      80                 :            :      * \param recurse_to_facets if true (default value), this method is called on each MeshOp that is assigned to one or more facets of entities that this MeshOp is assigned to
      81                 :            :      */
      82                 :            :   void ensure_facet_dependencies(bool recurse_to_facets = true);
      83                 :            : 
      84                 :            :     /** \brief Helper function for meshop registration, returns true if specified ModelEnt is a vertex
      85                 :            :      * \param model_ent Model entity being evaluated
      86                 :            :      * \return True if model_ent has dimension() == 0
      87                 :            :      */
      88                 :            :   static bool canmesh_vertex(ModelEnt *model_ent);
      89                 :            :   
      90                 :            :     /** \brief Helper function for meshop registration, returns true if specified ModelEnt is an edge
      91                 :            :      * \param model_ent Model entity being evaluated
      92                 :            :      * \return True if model_ent has dimension() == 1
      93                 :            :      */
      94                 :            :   static bool canmesh_edge(ModelEnt *model_ent);
      95                 :            :   
      96                 :            :     /** \brief Helper function for meshop registration, returns true if specified ModelEnt is a face
      97                 :            :      * \param model_ent Model entity being evaluated
      98                 :            :      * \return True if model_ent has dimension() == 2
      99                 :            :      */
     100                 :            :   static bool canmesh_face(ModelEnt *model_ent);
     101                 :            :   
     102                 :            :     /** \brief Helper function for meshop registration, returns true if specified ModelEnt is a region
     103                 :            :      * \param model_ent Model entity being evaluated
     104                 :            :      * \return True if model_ent has dimension() == 3
     105                 :            :      */
     106                 :            :   static bool canmesh_region(ModelEnt *model_ent);
     107                 :            : 
     108                 :            :   /**
     109                 :            :    * brief  mesh-based geometry model ents based on previous ops
     110                 :            :    * it will be used for Camal advancing front meshers
     111                 :            :    */
     112                 :            :   void create_model_ents_from_previous_ops();
     113                 :            : 
     114                 :            :   /**
     115                 :            :    * brief  get debugging level
     116                 :            :    */
     117                 :         18 :   int get_debug_verbosity() { return debugLevel;} ;
     118                 :            :   /**
     119                 :            :    * brief  set debugging level; usually during / before setup phase, so execute will have it
     120                 :            :    */
     121                 :            :   void set_debug_verbosity(int debug) { debugLevel = debug;} ;
     122                 :            : 
     123                 :            : protected:
     124                 :            :     //! MEntSelection that stores what this operation generated or otherwise worked on
     125                 :            :   MEntSelection mentSelection;
     126                 :            :   int debugLevel;
     127                 :            : private:
     128                 :            : 
     129                 :            : };
     130                 :            : 
     131                 :          0 : inline const MEntSelection &MeshOp::me_selection() const
     132                 :            : {
     133                 :          0 :   return mentSelection;
     134                 :            : }
     135                 :            : 
     136                 :          1 : inline MEntSelection &MeshOp::me_selection() 
     137                 :            : {
     138                 :          1 :   return mentSelection;
     139                 :            : }
     140                 :            : 
     141                 :     327670 : inline MKCore *MeshOp::mk_core() const
     142                 :            : {
     143         [ +  - ]:     327670 :   return dynamic_cast<MKCore*>(mkGraph);
     144                 :            : }
     145                 :            : 
     146                 :            : } // namespace MeshKit
     147                 :            : 
     148                 :            : #endif
     149                 :            : 
     150                 :            :   

Generated by: LCOV version 1.11