LCOV - code coverage report
Current view: top level - src/moab - SpectralMeshTool.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 5 0.0 %
Date: 2020-12-16 07:07:30 Functions: 0 2 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #ifndef SPECTRALMESHTOOL_HPP
       2                 :            : #define SPECTRALMESHTOOL_HPP
       3                 :            : 
       4                 :            : #include "moab/Interface.hpp"  // needs to be here to support inline query_interface
       5                 :            : #include "moab/Error.hpp"      // needs to be here to support inline query_interface
       6                 :            : #include <vector>
       7                 :            : 
       8                 :            : namespace moab
       9                 :            : {
      10                 :            : 
      11                 :            : /** \class SpectralMeshTool
      12                 :            :  * \brief Class with convenience functions for handling spectral mesh
      13                 :            :  * Class with convenience functions for handling spectral meshes.  See description of spectral
      14                 :            :  * mesh handling in doc/metadata_info.doc and in the MOAB user's guide.
      15                 :            :  *
      16                 :            :  * There are two primary representations of spectral meshes:
      17                 :            :  * a) coarse elements: with SPECTRAL_VERTICES lexicographically-ordered array of fine vertices
      18                 :            :  *    on each element, and tags on vertices or on elements (with _LEX suffix)
      19                 :            :  * b) fine elements: as linear elements made from fine vertices, with tags on vertices
      20                 :            :  *
      21                 :            :  */
      22                 :            : class SpectralMeshTool
      23                 :            : {
      24                 :            :   public:
      25                 :            :     /** \brief Constructor
      26                 :            :      * \param impl MOAB Interface instance
      27                 :            :      * \param order Spectral order, defaults to 0
      28                 :            :      */
      29                 :            :     SpectralMeshTool( Interface* impl, int order = 0 );
      30                 :            : 
      31                 :            :     /** \brief Destructor
      32                 :            :      */
      33                 :            :     ~SpectralMeshTool();
      34                 :            : 
      35                 :            :     /** \brief Return tag used to store lexicographically-ordered vertex array
      36                 :            :      * NOTE: If creating this tag with this call, this SpectralMeshTool instance must already have
      37                 :            :      * a non-zero spectral order value set on it; the size of the spectral vertices tag depends on
      38                 :            :      * this order. \param sv_tag Spectral vertices tag \param create_if_missing If true, will create
      39                 :            :      * this tag if it doesn't exist already
      40                 :            :      */
      41                 :            :     Tag spectral_vertices_tag( const bool create_if_missing = false );
      42                 :            : 
      43                 :            :     /** \brief Return tag used to store spectral order
      44                 :            :      * \param so_tag Spectral order tag
      45                 :            :      * \param create_if_missing If true, will create this tag if it doesn't exist already
      46                 :            :      */
      47                 :            :     Tag spectral_order_tag( const bool create_if_missing = false );
      48                 :            : 
      49                 :            :     /** \brief Convert representation from coarse to fine
      50                 :            :      * Each element in set, or in interface if set is not input, is converted to fine elements,
      51                 :            :      * using vertices in SPECTRAL_VERTICES tagged array \param spectral_set Set containing spectral
      52                 :            :      * elements
      53                 :            :      */
      54                 :            :     ErrorCode convert_to_fine( EntityHandle spectral_set );
      55                 :            : 
      56                 :            :     /** \brief Convert representation from fine to coarse
      57                 :            :      * Each element in set, or in interface if set is not input, is converted to coarse elements,
      58                 :            :      * with fine vertices put into SPECTRAL_VERTICES tagged array.  NOTE: This function assumes that
      59                 :            :      * each order^d (fine) elements comprise each coarse element, and are in order of fine elements
      60                 :            :      * in each coarse element.  If order is input as 0, looks for a SPECTRAL_ORDER tag on the mesh.
      61                 :            :      * \param order Order of the spectral mesh
      62                 :            :      * \param spectral_set Set containing spectral elements
      63                 :            :      */
      64                 :            :     ErrorCode convert_to_coarse( int order = 0, EntityHandle spectral_set = 0 );
      65                 :            : 
      66                 :            :     /** \brief Create coarse spectral elements from fine elements pointed to by conn
      67                 :            :      * This function creates the coarse elements by taking conn (assumed to be in FE ordering)
      68                 :            :      * and picking out the corner vertices to make coarse connectivity, and the other vertices
      69                 :            :      * (along with corners) to make SPECTRAL_VERTICES array pointed to by each entity.
      70                 :            :      * \param conn Connectivity of fine (linear) elements, in FE ordering
      71                 :            :      * \param verts_per_e Vertices per entity
      72                 :            :      * \param num_fine_elems Number of fine elements represented by conn
      73                 :            :      * \param spectral_set Set to which coarse elements should be added, if any
      74                 :            :      * \param start_idx Starting index in conn (for parallel support)
      75                 :            :      * \param local_gids If non-null, will insert all fine vertices into this range
      76                 :            :      */
      77                 :            :     template < class T >
      78                 :            :     ErrorCode create_spectral_elems( const T* conn, int num_fine_elems, int dim, Range& output_range, int start_idx = 0,
      79                 :            :                                      Range* local_gids = NULL );
      80                 :            : 
      81                 :            :     /** \brief Set spectral order for this instance
      82                 :            :      * \param order Order set on this instance
      83                 :            :      */
      84                 :            :     void spectral_order( int order )
      85                 :            :     {
      86                 :            :         spectralOrder   = order;
      87                 :            :         spectralOrderp1 = order + 1;
      88                 :            :     }
      89                 :            : 
      90                 :            :     /** \brief Get spectral order for this instance
      91                 :            :      * \return order Order set on this instance
      92                 :            :      */
      93                 :            :     int spectral_order()
      94                 :            :     {
      95                 :            :         return spectralOrder;
      96                 :            :     }
      97                 :            :     /*
      98                 :            :       struct ConnMap
      99                 :            :       {
     100                 :            :         const short a[16];
     101                 :            :       };
     102                 :            :       */
     103                 :            :     static const short int permute_array[];
     104                 :            : 
     105                 :            :     static const short int lin_permute_array[];
     106                 :            : 
     107                 :            :   private:
     108                 :            :     //! the MB instance that this works with
     109                 :            :     Interface* mbImpl;
     110                 :            : 
     111                 :            :     //! error object for this tool
     112                 :            :     Error* mError;
     113                 :            : 
     114                 :            :     //! SPECTRAL_VERTICES tag
     115                 :            :     Tag svTag;
     116                 :            : 
     117                 :            :     //! SPECTRAL_ORDER tag
     118                 :            :     Tag soTag;
     119                 :            : 
     120                 :            :     //! order of the spectral mesh being accessed
     121                 :            :     int spectralOrder;
     122                 :            : 
     123                 :            :     //! order of the spectral mesh being accessed plus one
     124                 :            :     int spectralOrderp1;
     125                 :            : };
     126                 :            : 
     127                 :          0 : inline SpectralMeshTool::SpectralMeshTool( Interface* impl, int order )
     128                 :          0 :     : mbImpl( impl ), svTag( 0 ), soTag( 0 ), spectralOrder( order ), spectralOrderp1( order + 1 )
     129                 :            : {
     130                 :          0 :     impl->query_interface( mError );
     131                 :          0 : }
     132                 :            : 
     133                 :          0 : inline SpectralMeshTool::~SpectralMeshTool() {}
     134                 :            : 
     135                 :            : }  // namespace moab
     136                 :            : 
     137                 :            : #endif

Generated by: LCOV version 1.11