File: topologycomputation.h

package info (click to toggle)
fenics-dolfinx 1%3A0.10.0.post4-1exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 6,028 kB
  • sloc: cpp: 36,535; python: 25,391; makefile: 226; sh: 171; xml: 55
file content (65 lines) | stat: -rw-r--r-- 2,573 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (C) 2006-2024 Anders Logg and Garth N. Wells
//
// This file is part of DOLFINx (https://www.fenicsproject.org)
//
// SPDX-License-Identifier:    LGPL-3.0-or-later

#pragma once

#include "cell_types.h"
#include <array>
#include <cstdint>
#include <dolfinx/graph/AdjacencyList.h>
#include <memory>
#include <tuple>
#include <vector>

namespace dolfinx::common
{
class IndexMap;
}

namespace dolfinx::mesh
{
class Topology;

/// @brief Compute mesh entities of given topological dimension by
/// computing cell-to-entity `(tdim, i) -> `(dim, entity_type)` and
/// entity-to-vertex connectivity `(dim, entity_type) -> `(0, 0)`
/// connectivity.
///
/// Computed entities are oriented such that their local (to the
/// process) orientation agrees with their global orientation
///
/// @param[in] topology Mesh topology.
/// @param[in] dim Dimension of the entities to create.
/// @param[in] entity_type Entity type in dimension `dim` to create.
/// Entity type must be in the list returned by Topology::entity_types.
/// @return Tuple of (cell->entity connectivity, entity->vertex
/// connectivity, index map for created entities, list of interprocess
/// entities). Interprocess entities lie on the "true" boundary between
/// owned cells of each process. If entities of type `entity_type`
/// already exists, then {nullptr, nullptr, nullptr, std::vector()} is
/// returned.
std::tuple<std::vector<std::shared_ptr<graph::AdjacencyList<std::int32_t>>>,
           std::shared_ptr<graph::AdjacencyList<std::int32_t>>,
           std::shared_ptr<common::IndexMap>, std::vector<std::int32_t>>
compute_entities(const Topology& topology, int dim, CellType entity_type);

/// @brief Compute connectivity (d0 -> d1) for given pair of entity
/// types, given by topological dimension and index, as found in
/// `Topology::entity_types()`
/// @param[in] topology The topology
/// @param[in] d0 Dimension and index of the entities, `(dim0, i)`.
/// @param[in] d1 Dimension and index of the incident entities, `(dim1,
/// j)`.
/// @returns The connectivities [(d0 -> d1), (d1 -> d0)] if they are
/// computed. If (d0, d1) already exists then a nullptr is returned. If
/// (d0, d1) is computed and the computation of (d1, d0) was required as
/// part of computing (d0, d1), the (d1, d0) is returned as the second
/// entry. The second entry is otherwise nullptr.
std::array<std::shared_ptr<graph::AdjacencyList<std::int32_t>>, 2>
compute_connectivity(const Topology& topology, std::array<int, 2> d0,
                     std::array<int, 2> d1);

} // namespace dolfinx::mesh