www.mooseframework.org
PetscExternalPartitioner.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
23 {
24 public:
26 
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 
40 
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 
55  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;
72 };
MeshBase & mesh
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static void partitionGraph(const Parallel::Communicator &comm, const std::vector< std::vector< dof_id_type >> &graph, const std::vector< dof_id_type > &elem_weights, const std::vector< dof_id_type > &side_weights, const dof_id_type num_parts, const dof_id_type num_parts_per_compute_node, const std::string &part_package, std::vector< dof_id_type > &partition)
const Parallel::Communicator & comm() const
virtual void partition(MeshBase &mesh, const unsigned int n) override
processor_id_type _num_parts_per_compute_node
uint8_t processor_id_type
virtual dof_id_type computeElementWeight(Elem &elm)
virtual dof_id_type computeSideWeight(Elem &elem, unsigned int side)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
void preLinearPartition(MeshBase &mesh)
Base class for MOOSE partitioner.
PetscExternalPartitioner(const InputParameters &params)
virtual void initialize(MeshBase &)
Called immediately before partitioning.
Partitions a mesh using external petsc partitioners such as parmetis, ptscotch, chaco, party, etc.
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
uint8_t dof_id_type
virtual std::unique_ptr< Partitioner > clone() const override