LCOV - code coverage report
Current view: top level - include/partitioning - linear_partitioner.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 5 5 100.0 %
Date: 2025-08-19 19:27:09 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : 
      19             : 
      20             : #ifndef LIBMESH_LINEAR_PARTITIONER_H
      21             : #define LIBMESH_LINEAR_PARTITIONER_H
      22             : 
      23             : // Local Includes
      24             : #include "libmesh/partitioner.h"
      25             : 
      26             : // C++ Includes
      27             : #include <memory>
      28             : 
      29             : namespace libMesh
      30             : {
      31             : 
      32             : /**
      33             :  * The \p LinearPartitioner simply takes the element list and splits
      34             :  * it into equal-sized chunks assigned to each processor.  Warning:
      35             :  * the resulting domain decomposition can be arbitrarily bad in terms
      36             :  * of edge-cut and other communication-based metrics!
      37             :  *
      38             :  * \author Benjamin S. Kirk
      39             :  * \date 2003
      40             :  * \brief Partitions the elements based solely on their ids.
      41             :  */
      42             : class LinearPartitioner : public Partitioner
      43             : {
      44             : public:
      45             : 
      46             :   /**
      47             :    * Ctors, assignment operators, and destructor are
      48             :    * all explicitly defaulted for this class.
      49             :    */
      50         674 :   LinearPartitioner () = default;
      51         568 :   LinearPartitioner (const LinearPartitioner &) = default;
      52             :   LinearPartitioner (LinearPartitioner &&) = default;
      53             :   LinearPartitioner & operator= (const LinearPartitioner &) = default;
      54             :   LinearPartitioner & operator= (LinearPartitioner &&) = default;
      55        1053 :   virtual ~LinearPartitioner() = default;
      56             : 
      57             :   virtual PartitionerType type () const override;
      58             : 
      59             :   /**
      60             :    * \returns A copy of this partitioner wrapped in a smart pointer.
      61             :    */
      62         568 :   virtual std::unique_ptr<Partitioner> clone () const override
      63             :   {
      64         568 :     return std::make_unique<LinearPartitioner>(*this);
      65             :   }
      66             : 
      67             :   /**
      68             :    * Called by the SubdomainPartitioner to partition elements in the range (it, end).
      69             :    */
      70             :   virtual void partition_range(MeshBase & mesh,
      71             :                                MeshBase::element_iterator it,
      72             :                                MeshBase::element_iterator end,
      73             :                                const unsigned int n) override;
      74             : protected:
      75             : 
      76             :   /**
      77             :    * Partition the \p MeshBase into \p n subdomains.
      78             :    */
      79             :   virtual void _do_partition (MeshBase & mesh,
      80             :                               const unsigned int n) override;
      81             : };
      82             : 
      83             : } // namespace libMesh
      84             : 
      85             : #endif  // LIBMESH_LINEAR_PARTITIONER_H

Generated by: LCOV version 1.14