Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx  0.1.0
DOLFINx C++ interface
utils.h
1 // Copyright (C) 2012-2020 Chris Richardson
2 //
3 // This file is part of DOLFINx (https://www.fenicsproject.org)
4 //
5 // SPDX-License-Identifier: LGPL-3.0-or-later
6 
7 #pragma once
8 
9 #include <cstdint>
10 #include <dolfinx/common/MPI.h>
11 #include <map>
12 #include <memory>
13 #include <set>
14 #include <vector>
15 
16 namespace dolfinx
17 {
18 
19 namespace mesh
20 {
21 class Mesh;
22 enum class GhostMode;
23 } // namespace mesh
24 
25 namespace common
26 {
27 class IndexMap;
28 }
29 
30 namespace refinement
31 {
32 
39 std::pair<MPI_Comm, std::map<std::int32_t, std::vector<int>>>
40 compute_edge_sharing(const mesh::Mesh& mesh);
41 
49  const MPI_Comm& neighbor_comm,
50  const std::vector<std::vector<std::int32_t>>& marked_for_update,
51  std::vector<bool>& marked_edges, const common::IndexMap& map_e);
52 
61 std::pair<std::map<std::int32_t, std::int64_t>, xt::xtensor<double, 2>>
63  const MPI_Comm& neighbor_comm,
64  const std::map<std::int32_t, std::vector<std::int32_t>>& shared_edges,
65  const mesh::Mesh& mesh, const std::vector<bool>& marked_edges);
66 
75 mesh::Mesh partition(const mesh::Mesh& old_mesh,
76  const graph::AdjacencyList<std::int64_t>& cell_topology,
77  const xt::xtensor<double, 2>& new_vertex_coordinates,
78  bool redistribute, mesh::GhostMode ghost_mode);
79 
88 std::vector<std::int64_t>
89 adjust_indices(const std::shared_ptr<const common::IndexMap>& index_map,
90  std::int32_t n);
91 
92 } // namespace refinement
93 } // namespace dolfinx
dolfinx::refinement::partition
mesh::Mesh partition(const mesh::Mesh &old_mesh, const graph::AdjacencyList< std::int64_t > &cell_topology, const xt::xtensor< double, 2 > &new_vertex_coordinates, bool redistribute, mesh::GhostMode ghost_mode)
Use vertex and topology data to partition new mesh across processes.
Definition: utils.cpp:309
dolfinx::refinement::update_logical_edgefunction
void update_logical_edgefunction(const MPI_Comm &neighbor_comm, const std::vector< std::vector< std::int32_t >> &marked_for_update, std::vector< bool > &marked_edges, const common::IndexMap &map_e)
Transfer marked edges between processes.
Definition: utils.cpp:158
dolfinx::refinement::compute_edge_sharing
std::pair< MPI_Comm, std::map< std::int32_t, std::vector< int > > > compute_edge_sharing(const mesh::Mesh &mesh)
Compute the sharing of edges between processes. The resulting MPI_Comm is over the neighborhood of sh...
Definition: utils.cpp:112
dolfinx::mesh::GhostMode
GhostMode
Enum for different partitioning ghost modes.
Definition: Mesh.h:46
dolfinx::refinement::adjust_indices
std::vector< std::int64_t > adjust_indices(const std::shared_ptr< const common::IndexMap > &index_map, std::int32_t n)
Adjust indices to account for extra n values on each process This is a utility to help add new topolo...
Definition: utils.cpp:280
dolfinx::refinement::create_new_vertices
std::pair< std::map< std::int32_t, std::int64_t >, xt::xtensor< double, 2 > > create_new_vertices(const MPI_Comm &neighbor_comm, const std::map< std::int32_t, std::vector< std::int32_t >> &shared_edges, const mesh::Mesh &mesh, const std::vector< bool > &marked_edges)
Add new vertex for each marked edge, and create new_vertex_coordinates and global_edge->new_vertex ma...
Definition: utils.cpp:193