Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.3.0/v0.9.0/cpp
DOLFINx  0.3.0
DOLFINx C++ interface
utils.h
1 // Copyright (C) 2019-2020 Garth N. Wells
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 <dolfinx/common/MPI.h>
10 #include <dolfinx/graph/AdjacencyList.h>
11 #include <dolfinx/graph/partition.h>
12 #include <functional>
13 #include <xtl/xspan.hpp>
14 
15 namespace dolfinx::fem
16 {
17 class ElementDofLayout;
18 }
19 
20 namespace dolfinx::mesh
21 {
22 enum class CellType;
23 enum class GhostMode : int;
24 class Mesh;
25 
35 graph::AdjacencyList<std::int64_t>
36 extract_topology(const CellType& cell_type, const fem::ElementDofLayout& layout,
37  const graph::AdjacencyList<std::int64_t>& cells);
38 
40 std::vector<double> h(const Mesh& mesh,
41  const xtl::span<const std::int32_t>& entities, int dim);
42 
44 xt::xtensor<double, 2>
45 cell_normals(const Mesh& mesh, int dim,
46  const xtl::span<const std::int32_t>& entities);
47 
49 xt::xtensor<double, 2> midpoints(const mesh::Mesh& mesh, int dim,
50  const xtl::span<const std::int32_t>& entities);
51 
62 std::vector<std::int32_t> locate_entities(
63  const mesh::Mesh& mesh, int dim,
64  const std::function<xt::xtensor<bool, 1>(const xt::xtensor<double, 2>&)>&
65  marker);
66 
87 std::vector<std::int32_t> locate_entities_boundary(
88  const mesh::Mesh& mesh, int dim,
89  const std::function<xt::xtensor<bool, 1>(const xt::xtensor<double, 2>&)>&
90  marker);
91 
103 xt::xtensor<std::int32_t, 2>
104 entities_to_geometry(const mesh::Mesh& mesh, int dim,
105  const xtl::span<const std::int32_t>& entity_list,
106  bool orient);
107 
113 std::vector<std::int32_t> exterior_facet_indices(const Mesh& mesh);
114 
130 graph::AdjacencyList<std::int32_t>
131 partition_cells_graph(MPI_Comm comm, int n, int tdim,
132  const graph::AdjacencyList<std::int64_t>& cells,
133  mesh::GhostMode ghost_mode);
134 
137 graph::AdjacencyList<std::int32_t>
138 partition_cells_graph(MPI_Comm comm, int n, int tdim,
139  const graph::AdjacencyList<std::int64_t>& cells,
140  mesh::GhostMode ghost_mode,
141  const graph::partition_fn& partfn);
142 
143 } // namespace dolfinx::mesh
Finite element method functionality.
Definition: assemble_matrix_impl.h:23
Mesh data structures and algorithms on meshes.
Definition: DirichletBC.h:20
std::vector< double > h(const Mesh &mesh, const xtl::span< const std::int32_t > &entities, int dim)
Compute greatest distance between any two vertices.
Definition: utils.cpp:60
graph::AdjacencyList< std::int32_t > partition_cells_graph(MPI_Comm comm, int n, int tdim, const graph::AdjacencyList< std::int64_t > &cells, mesh::GhostMode ghost_mode)
Compute destination rank for mesh cells in this rank by applying the default graph partitioner to the...
Definition: utils.cpp:504
xt::xtensor< double, 2 > midpoints(const mesh::Mesh &mesh, int dim, const xtl::span< const std::int32_t > &entities)
Compute midpoints or mesh entities of a given dimension.
Definition: utils.cpp:190
std::vector< std::int32_t > locate_entities(const mesh::Mesh &mesh, int dim, const std::function< xt::xtensor< bool, 1 >(const xt::xtensor< double, 2 > &)> &marker)
Compute indices of all mesh entities that evaluate to true for the provided geometric marking functio...
Definition: utils.cpp:213
xt::xtensor< double, 2 > cell_normals(const Mesh &mesh, int dim, const xtl::span< const std::int32_t > &entities)
Compute normal to given cell (viewed as embedded in 3D)
Definition: utils.cpp:106
graph::AdjacencyList< std::int64_t > extract_topology(const CellType &cell_type, const fem::ElementDofLayout &layout, const graph::AdjacencyList< std::int64_t > &cells)
Extract topology from cell data, i.e. extract cell vertices.
Definition: utils.cpp:33
CellType
Cell type identifier.
Definition: cell_types.h:22
std::vector< std::int32_t > locate_entities_boundary(const mesh::Mesh &mesh, int dim, const std::function< xt::xtensor< bool, 1 >(const xt::xtensor< double, 2 > &)> &marker)
Compute indices of all mesh entities that are attached to an owned boundary facet and evaluate to tru...
Definition: utils.cpp:278
xt::xtensor< std::int32_t, 2 > entities_to_geometry(const mesh::Mesh &mesh, int dim, const xtl::span< const std::int32_t > &entity_list, bool orient)
Compute the indices the geometry data for the vertices of the given mesh entities.
Definition: utils.cpp:389
GhostMode
Enum for different partitioning ghost modes.
Definition: Mesh.h:44
std::vector< std::int32_t > exterior_facet_indices(const Mesh &mesh)
Compute the indices (local) of all exterior facets. An exterior facet (co-dimension 1) is one that is...
Definition: utils.cpp:466