partitioning.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Domain partitioning
27 
28 #ifndef OOMPH_PARTITIONING_HEADER
29 #define OOMPH_PARTITIONING_HEADER
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33 #include <oomph-lib-config.h>
34 #endif
35 #ifdef OOMPH_HAS_MPI
36 #include "mpi.h"
37 #endif
38 
39 // ooomph-lib includes
40 #include "Vector.h"
41 #include "problem.h"
42 
43 
44 namespace oomph
45 {
46  //==================================================================
47  // Interfaces to METIS functions
48  //==================================================================
49  extern "C"
50  {
53  int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*);
54 
55 #ifndef OOMPH_TRANSITION_TO_VERSION_3
56  // function from old API which no longer exists in METIS 5.1,
57  // remove this moving to oomph-lib version 3
58 
62  int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*);
63 
64 #endif
65  }
66 
67 
68  //====================================================================
70  //====================================================================
71  namespace METIS
72  {
76  extern void default_error_to_weight_fct(const double& spatial_error,
77  const double& max_error,
78  const double& min_error,
79  int& weight);
80 
83  typedef void (*ErrorToWeightFctPt)(const double& spatial_error,
84  const double& max_error,
85  const double& min_error,
86  int& weight);
87 
91 
98  extern void uniform_partition_mesh(Problem* problem_pt,
99  const unsigned& ndomain,
100  Vector<unsigned>& element_domain);
101 
102 
111  extern void partition_mesh(Problem* problem_pt,
112  const unsigned& ndomain,
113  const unsigned& objective,
114  Vector<unsigned>& element_domain);
115 
116 
125  extern void partition_mesh(OomphCommunicator* comm_pt,
126  Mesh* mesh_pt,
127  const unsigned& ndomain,
128  const unsigned& objective,
129  Vector<unsigned>& element_domain);
130 
131  // /// Use METIS to assign each element to a domain.
132  // /// On return, element_domain[ielem] contains the number
133  // /// of the domain [0,1,...,ndomain-1] to which
134  // /// element ielem has been assigned.
135  // /// - objective=0: minimise edgecut.
136  // /// - objective=1: minimise total communications volume.
137  // /// .
138  // /// Partioning is based on "Data" graph of mesh.
139  // extern void partition_mesh_data(Problem* problem_pt,
140  // const unsigned& ndomain,
141  // const unsigned& objective,
142  // Vector<unsigned>& element_domain);
143 
144 #ifdef OOMPH_HAS_MPI
145 
146 
169  extern void partition_distributed_mesh(
170  Problem* problem_pt,
171  const unsigned& objective,
172  Vector<unsigned>& element_domain_on_this_proc,
173  const bool& bypass_metis = false);
174 
175 #endif
176 
177  } // namespace METIS
178 
179 
180 } // namespace oomph
181 
182 #endif
Definition: mesh.h:67
Definition: communicator.h:54
Definition: problem.h:151
double min_error
Definition: MortaringCantileverCompareToNonMortaring.cpp:189
double max_error
Definition: MortaringCantileverCompareToNonMortaring.cpp:188
void uniform_partition_mesh(Problem *problem_pt, const unsigned &ndomain, Vector< unsigned > &element_domain)
Definition: partitioning.cc:76
void partition_mesh(Problem *problem_pt, const unsigned &ndomain, const unsigned &objective, Vector< unsigned > &element_domain)
Definition: partitioning.cc:116
void(* ErrorToWeightFctPt)(const double &spatial_error, const double &max_error, const double &min_error, int &weight)
Definition: partitioning.h:83
ErrorToWeightFctPt Error_to_weight_fct_pt
Definition: partitioning.cc:63
void default_error_to_weight_fct(const double &spatial_error, const double &max_error, const double &min_error, int &weight)
Definition: partitioning.cc:53
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
void METIS_PartGraphKway(int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *)
Metis graph partitioning function.
void METIS_PartGraphVKway(int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *)