SpECTRE Documentation Coverage Report
Current view: top level - IO - Connectivity.hpp Hit Total Coverage
Commit: c428a3e2e0ca78fe0364ec1b0e0493c627d428d4 Lines: 2 2 100.0 %
Date: 2026-04-26 20:20:36
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Defines functions for computing the connectivity of an element
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <cstddef>
      10             : #include <ostream>
      11             : #include <utility>
      12             : #include <vector>
      13             : 
      14             : template <size_t Dim>
      15             : class Index;
      16             : 
      17             : /// Holds functions needed for visualizing data
      18           1 : namespace vis {
      19             : namespace detail {
      20             : /*!
      21             :  * \brief The set of cell topologies used for visualization
      22             :  *
      23             :  * Tensor-product topologies (Line, Quad, Hexahedron) can be generated by
      24             :  * `compute_cells()`. Non-tensor-product topologies (Triangle, Wedge) are
      25             :  * necessary for filled cylinders, shells, and balls.
      26             :  *
      27             :  * The numerical values correspond to the XDMF topology types.
      28             :  */
      29             : enum class Topology : int {
      30             :   Line = 2,
      31             :   Triangle = 4,
      32             :   Quad = 5,
      33             :   Wedge = 8,
      34             :   Hexahedron = 9
      35             : };
      36             : 
      37             : std::ostream& operator<<(std::ostream& os, const Topology& topology);
      38             : 
      39             : /*!
      40             :  * \brief Represents the number of cells in a particular topology
      41             :  *
      42             :  * Each `CellInTopology` holds an enum of type `Topology` whose
      43             :  * value denotes the type of the topology, e.g. line, quad or hexahedron, and a
      44             :  * vector of bounding indices which are the indices of the grid coordinates in
      45             :  * the contiguous arrays of x, y, and z coordinates that bound the cell.
      46             :  */
      47             : struct CellInTopology {
      48             :   // cppcheck-suppress passedByValue
      49             :   CellInTopology(const Topology& top, std::vector<size_t> bounding_ind)
      50             :       : topology(top), bounding_indices(std::move(bounding_ind)) {}
      51             :   CellInTopology() = default;
      52             :   CellInTopology(const CellInTopology& /*rhs*/) = default;
      53             :   CellInTopology(CellInTopology&& /*rhs*/) = default;
      54             :   CellInTopology& operator=(const CellInTopology& /*rhs*/) = default;
      55             :   CellInTopology& operator=(CellInTopology&& /*rhs*/) = default;
      56             :   ~CellInTopology() = default;
      57             :   Topology topology{Topology::Line};
      58             :   std::vector<size_t> bounding_indices{};
      59             : };
      60             : 
      61             : /// @{
      62             : /*!
      63             :  * \brief Compute the cells in the element.
      64             :  *
      65             :  * Returns a vector of the cells in the topology I1^Dim, i.e. a line if Dim ==
      66             :  * 1, or a hexahedron if Dim == 3. The cells are bounded by lines connecting
      67             :  * grid points along the axes of the element, so if you have (n_x by n_y by n_z)
      68             :  * grid points, you have ((n_x-1) by (n_y-1) by (n_z-1)) cells.
      69             :  *
      70             :  * \note As more topologies are added, e.g. S2, the interface will need slight
      71             :  * modification, however the return type is likely to be able to remain the
      72             :  * same.
      73             :  */
      74             : template <size_t Dim>
      75             : std::vector<CellInTopology> compute_cells(const Index<Dim>& extents);
      76             : 
      77             : std::vector<CellInTopology> compute_cells(const std::vector<size_t>& extents);
      78             : /// @}
      79             : 
      80             : /*!
      81             :  * \brief Return the XDMF 3.0 integer type tag for a given topology.
      82             :  *
      83             :  * The mapping is: Line=2, Triangle=4, Quad=5, Wedge=8, Hexahedron=9.
      84             :  * Used when writing mixed-topology connectivity arrays to HDF5 files.
      85             :  */
      86             : int xdmf_topology_type(Topology topology);
      87             : 
      88             : }  // namespace detail
      89             : }  // namespace vis

Generated by: LCOV version 1.14