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) 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
16 {
17 namespace fem
18 {
19 class ElementDofLayout;
20 }
21 
22 namespace mesh
23 {
24 enum class CellType;
25 enum class GhostMode : int;
26 class Mesh;
27 
37 graph::AdjacencyList<std::int64_t>
38 extract_topology(const CellType& cell_type, const fem::ElementDofLayout& layout,
39  const graph::AdjacencyList<std::int64_t>& cells);
40 
42 std::vector<double> h(const Mesh& mesh,
43  const xtl::span<const std::int32_t>& entities, int dim);
44 
46 xt::xtensor<double, 2>
47 cell_normals(const Mesh& mesh, int dim,
48  const xtl::span<const std::int32_t>& entities);
49 
51 xt::xtensor<double, 2> midpoints(const mesh::Mesh& mesh, int dim,
52  const xtl::span<const std::int32_t>& entities);
53 
64 std::vector<std::int32_t> locate_entities(
65  const mesh::Mesh& mesh, int dim,
66  const std::function<xt::xtensor<bool, 1>(const xt::xtensor<double, 2>&)>&
67  marker);
68 
89 std::vector<std::int32_t> locate_entities_boundary(
90  const mesh::Mesh& mesh, int dim,
91  const std::function<xt::xtensor<bool, 1>(const xt::xtensor<double, 2>&)>&
92  marker);
93 
105 xt::xtensor<std::int32_t, 2>
106 entities_to_geometry(const mesh::Mesh& mesh, int dim,
107  const xtl::span<const std::int32_t>& entity_list,
108  bool orient);
109 
115 std::vector<std::int32_t> exterior_facet_indices(const Mesh& mesh);
116 
132 graph::AdjacencyList<std::int32_t>
133 partition_cells_graph(MPI_Comm comm, int n, int tdim,
134  const graph::AdjacencyList<std::int64_t>& cells,
135  mesh::GhostMode ghost_mode);
136 
139 graph::AdjacencyList<std::int32_t>
140 partition_cells_graph(MPI_Comm comm, int n, int tdim,
141  const graph::AdjacencyList<std::int64_t>& cells,
142  mesh::GhostMode ghost_mode,
143  const graph::partition_fn& partfn);
144 
145 } // namespace mesh
146 } // namespace dolfinx
dolfinx::mesh::h
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
dolfinx::mesh::exterior_facet_indices
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:459
dolfinx::mesh::extract_topology
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
dolfinx::mesh::CellType
CellType
Cell type identifier.
Definition: cell_types.h:21
dolfinx::mesh::cell_normals
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:102
dolfinx::mesh::GhostMode
GhostMode
Enum for different partitioning ghost modes.
Definition: Mesh.h:46
dolfinx::mesh::locate_entities_boundary
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:271
dolfinx::mesh::locate_entities
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:206
dolfinx::mesh::midpoints
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:186
dolfinx::mesh::partition_cells_graph
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:497
dolfinx::mesh::entities_to_geometry
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:382