Loading...
Searching...
No Matches
SCOTCH.h
// Copyright (C) 2010-2013 Garth N. Wells and Chris Richardson
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2010-02-10
// Last changed: 2014-01-09
#ifndef __SCOTCH_PARTITIONER_H
#define __SCOTCH_PARTITIONER_H
#include <cstddef>
#include <cstdint>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <dolfin/common/MPI.h>
#include <dolfin/common/Set.h>
#include "Graph.h"
#include "CSRGraph.h"
namespace dolfin
{
// Forward declarations
class CellType;
class LocalMeshData;
class SCOTCH
{
public:
static void compute_partition(
const MPI_Comm mpi_comm,
std::vector<int>& cell_partition,
std::map<std::int64_t, std::vector<int>>& ghost_procs,
const boost::multi_array<std::int64_t, 2>& cell_vertices,
const std::vector<std::size_t>& cell_weight,
const std::int64_t num_global_vertices,
const std::int64_t num_global_cells,
const CellType& cell_type);
static std::vector<int> compute_gps(const Graph& graph,
std::size_t num_passes=5);
static std::vector<int>
compute_reordering(const Graph& graph,
std::string scotch_strategy="");
static
void compute_reordering(const Graph& graph,
std::vector<int>& permutation,
std::vector<int>& inverse_permutation,
std::string scotch_strategy="");
private:
// Compute cell partitions from distributed dual graph. Note that
// local_graph is not const since we share the data with SCOTCH,
// and the SCOTCH interface is not const-correct.
template<typename T>
static void partition(
const MPI_Comm mpi_comm,
CSRGraph<T>& local_graph,
const std::vector<std::size_t>& node_weights,
const std::set<std::int64_t>& ghost_vertices,
const std::size_t num_global_vertices,
std::vector<int>& cell_partition,
std::map<std::int64_t, std::vector<int>>& ghost_procs);
};
}
#endif
dolfin::CSRGraph
Compressed Sparse Row graph.
Definition CSRGraph.h:45
dolfin::CellType
Definition CellType.h:47
dolfin::LocalMeshData
This class stores mesh data on a local processor corresponding to a portion of a (larger) global mesh...
Definition LocalMeshData.h:59
dolfin::SCOTCH
This class provides an interface to SCOTCH-PT (parallel version).
Definition SCOTCH.h:46
dolfin::SCOTCH::compute_reordering
static std::vector< int > compute_reordering(const Graph &graph, std::string scotch_strategy="")
Definition SCOTCH.cpp:92
dolfin::SCOTCH::compute_gps
static std::vector< int > compute_gps(const Graph &graph, std::size_t num_passes=5)
Definition SCOTCH.cpp:84
dolfin::SCOTCH::compute_partition
static void compute_partition(const MPI_Comm mpi_comm, std::vector< int > &cell_partition, std::map< std::int64_t, std::vector< int > > &ghost_procs, const boost::multi_array< std::int64_t, 2 > &cell_vertices, const std::vector< std::size_t > &cell_weight, const std::int64_t num_global_vertices, const std::int64_t num_global_cells, const CellType &cell_type)
Definition SCOTCH.cpp:51
dolfin
Definition adapt.h:30
dolfin::Graph
std::vector< graph_set_type > Graph
Vector of unordered Sets.
Definition Graph.h:39