LCOV - code coverage report
Current view: top level - include/partitioner - PetscExternalPartitioner.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 3 3 100.0 %
Date: 2025-07-17 01:28:37 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseEnum.h"
      14             : #include "MoosePartitioner.h"
      15             : 
      16             : class MooseMesh;
      17             : 
      18             : /**
      19             :  * Partitions a mesh using external petsc partitioners such as parmetis, ptscotch, chaco, party,
      20             :  * etc.
      21             :  */
      22             : class PetscExternalPartitioner : public MoosePartitioner
      23             : {
      24             : public:
      25             :   static InputParameters validParams();
      26             : 
      27             :   PetscExternalPartitioner(const InputParameters & params);
      28             : 
      29             :   virtual std::unique_ptr<Partitioner> clone() const override;
      30             : 
      31             :   virtual dof_id_type computeElementWeight(Elem & elm);
      32             : 
      33             :   virtual dof_id_type computeSideWeight(Elem & elem, unsigned int side);
      34             : 
      35             :   using Partitioner::partition;
      36             : 
      37             :   virtual void partition(MeshBase & mesh, const unsigned int n) override;
      38             : 
      39        5740 :   bool applySideWeight() { return _apply_side_weight; }
      40             : 
      41       33600 :   bool applyElementEeight() { return _apply_element_weight; }
      42             : 
      43             :   static void partitionGraph(const Parallel::Communicator & comm,
      44             :                              const std::vector<std::vector<dof_id_type>> & graph,
      45             :                              const std::vector<dof_id_type> & elem_weights,
      46             :                              const std::vector<dof_id_type> & side_weights,
      47             :                              const dof_id_type num_parts,
      48             :                              const dof_id_type num_parts_per_compute_node,
      49             :                              const std::string & part_package,
      50             :                              std::vector<dof_id_type> & partition);
      51             : 
      52             :   /**
      53             :    * Called immediately before partitioning
      54             :    */
      55         490 :   virtual void initialize(MeshBase & /* mesh */){};
      56             : 
      57             : protected:
      58             :   virtual void _do_partition(MeshBase & mesh, const unsigned int n) override;
      59             : 
      60             : private:
      61             :   /*
      62             :    * Do a partition before we call the partitioner
      63             :    * It should be used if the mesh is unpartitioned or the number of parts
      64             :    * does not equal to the number of processors
      65             :    */
      66             :   void preLinearPartition(MeshBase & mesh);
      67             : 
      68             :   std::string _part_package;
      69             :   bool _apply_element_weight;
      70             :   bool _apply_side_weight;
      71             :   processor_id_type _num_parts_per_compute_node;
      72             : };

Generated by: LCOV version 1.14