DOLFINx
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
16namespace dolfinx::mesh
17{
18template <typename T>
19class MeshTags;
20class Mesh;
21enum class GhostMode;
22} // namespace dolfinx::mesh
23
24namespace dolfinx::common
25{
26class IndexMap;
27}
28
29namespace dolfinx::refinement
30{
31
40std::pair<MPI_Comm, std::map<std::int32_t, std::vector<int>>>
41compute_edge_sharing(const mesh::Mesh& mesh);
42
50 MPI_Comm neighbor_comm,
51 const std::vector<std::vector<std::int32_t>>& marked_for_update,
52 std::vector<std::int8_t>& marked_edges, const common::IndexMap& map_e);
53
62std::pair<std::map<std::int32_t, std::int64_t>, xt::xtensor<double, 2>>
64 MPI_Comm neighbor_comm,
65 const std::map<std::int32_t, std::vector<std::int32_t>>& shared_edges,
66 const mesh::Mesh& mesh, const std::vector<std::int8_t>& marked_edges);
67
76mesh::Mesh partition(const mesh::Mesh& old_mesh,
77 const graph::AdjacencyList<std::int64_t>& cell_topology,
78 const xt::xtensor<double, 2>& new_vertex_coordinates,
79 bool redistribute, mesh::GhostMode ghost_mode);
80
91std::vector<std::int64_t> adjust_indices(const common::IndexMap& index_map,
92 std::int32_t n);
93
102mesh::MeshTags<std::int32_t>
103transfer_facet_meshtag(const mesh::MeshTags<std::int32_t>& parent_meshtag,
104 const mesh::Mesh& refined_mesh,
105 const std::vector<std::int32_t>& parent_cell,
106 const std::vector<std::int8_t>& parent_facet);
107
115mesh::MeshTags<std::int32_t>
116transfer_cell_meshtag(const mesh::MeshTags<std::int32_t>& parent_meshtag,
117 const mesh::Mesh& refined_mesh,
118 const std::vector<std::int32_t>& parent_cell);
119} // namespace dolfinx::refinement
Miscellaneous classes, functions and types.
Mesh data structures and algorithms on meshes.
Definition: DofMap.h:30
GhostMode
Enum for different partitioning ghost modes.
Definition: utils.h:27
Mesh refinement algorithms.
mesh::MeshTags< std::int32_t > transfer_cell_meshtag(const mesh::MeshTags< std::int32_t > &parent_meshtag, const mesh::Mesh &refined_mesh, const std::vector< std::int32_t > &parent_cell)
Transfer cell MeshTags from coarse mesh to refined mesh.
Definition: utils.cpp:539
std::vector< std::int64_t > adjust_indices(const common::IndexMap &index_map, std::int32_t n)
brief description indices to account for extra n values on each process.
Definition: utils.cpp:372
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.
Definition: utils.cpp:126
mesh::MeshTags< std::int32_t > transfer_facet_meshtag(const mesh::MeshTags< std::int32_t > &parent_meshtag, const mesh::Mesh &refined_mesh, const std::vector< std::int32_t > &parent_cell, const std::vector< std::int8_t > &parent_facet)
Transfer facet MeshTags from coarse mesh to refined mesh.
Definition: utils.cpp:413
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:296
std::pair< std::map< std::int32_t, std::int64_t >, xt::xtensor< double, 2 > > create_new_vertices(MPI_Comm neighbor_comm, const std::map< std::int32_t, std::vector< std::int32_t > > &shared_edges, const mesh::Mesh &mesh, const std::vector< std::int8_t > &marked_edges)
Add new vertex for each marked edge, and create new_vertex_coordinates and global_edge->new_vertex ma...
Definition: utils.cpp:207
void update_logical_edgefunction(MPI_Comm neighbor_comm, const std::vector< std::vector< std::int32_t > > &marked_for_update, std::vector< std::int8_t > &marked_edges, const common::IndexMap &map_e)
Transfer marked edges between processes.
Definition: utils.cpp:172