LCOV - code coverage report
Current view: top level - src/partitioning - subdomain_partitioner.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 0 21 0.0 %
Date: 2025-08-19 19:27:09 Functions: 0 4 0.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             : // Local Includes
      21             : #include "libmesh/subdomain_partitioner.h"
      22             : #include "libmesh/elem.h"
      23             : #include "libmesh/enum_partitioner_type.h"
      24             : #include "libmesh/int_range.h"
      25             : #include "libmesh/libmesh_logging.h"
      26             : #include "libmesh/metis_partitioner.h"
      27             : 
      28             : namespace libMesh
      29             : {
      30             : 
      31           0 : SubdomainPartitioner::SubdomainPartitioner () :
      32           0 :   _internal_partitioner(std::make_unique<MetisPartitioner>())
      33           0 : {}
      34             : 
      35             : 
      36           0 : SubdomainPartitioner::SubdomainPartitioner (const SubdomainPartitioner & other)
      37             :   : Partitioner(other),
      38           0 :     chunks(other.chunks),
      39           0 :     _internal_partitioner(other._internal_partitioner->clone())
      40           0 : {}
      41             : 
      42             : 
      43           0 : PartitionerType SubdomainPartitioner::type() const
      44             : {
      45           0 :   return SUBDOMAIN_PARTITIONER;
      46             : }
      47             : 
      48             : 
      49           0 : void SubdomainPartitioner::_do_partition (MeshBase & mesh,
      50             :                                           const unsigned int n)
      51             : {
      52           0 :   libmesh_assert_greater (n, 0);
      53             : 
      54             :   // Check for an easy return.  If the user has not specified any
      55             :   // entries in the chunks vector, we just do a single partitioning.
      56           0 :   if ((n == 1) || chunks.empty())
      57             :     {
      58           0 :       this->single_partition (mesh);
      59           0 :       return;
      60             :     }
      61             : 
      62             :   // Now actually do the partitioning.
      63           0 :   LOG_SCOPE ("_do_partition()", "SubdomainPartitioner");
      64             : 
      65             :   // For each chunk, construct an iterator range for the set of
      66             :   // subdomains in question, and pass it to the internal Partitioner.
      67           0 :   for (const auto & id_set : chunks)
      68           0 :     _internal_partitioner->
      69           0 :       partition_range(mesh,
      70           0 :                       mesh.active_subdomain_set_elements_begin(id_set),
      71           0 :                       mesh.active_subdomain_set_elements_end(id_set),
      72           0 :                       n);
      73             : }
      74             : 
      75             : } // namespace libMesh

Generated by: LCOV version 1.14