SpECTRE Documentation Coverage Report
Current view: top level - IO - Connectivity.hpp Hit Total Coverage
Commit: 990bc653376fc4a4068db06123ec02659d814816 Lines: 2 2 100.0 %
Date: 2021-05-16 17:17:32
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 A list of all topologies for which we can compute the number of cells
      22             :  */
      23             : enum class Topology { Line, Quad, Hexahedron };
      24             : 
      25             : std::ostream& operator<<(std::ostream& os, const Topology& topology) noexcept;
      26             : 
      27             : /*!
      28             :  * \brief Represents the number of cells in a particular topology
      29             :  *
      30             :  * Each `CellInTopology` holds an enum of type `Topology` whose
      31             :  * value denotes the type of the topology, e.g. line, quad or hexahedron, and a
      32             :  * vector of bounding indices which are the indices of the grid coordinates in
      33             :  * the contiguous arrays of x, y, and z coordinates that bound the cell.
      34             :  */
      35             : struct CellInTopology {
      36             :   // cppcheck-suppress passedByValue
      37             :   CellInTopology(const Topology& top, std::vector<size_t> bounding_ind)
      38             :       : topology(top), bounding_indices(std::move(bounding_ind)) {}
      39             :   CellInTopology() = default;
      40             :   CellInTopology(const CellInTopology& /*rhs*/) = default;
      41             :   CellInTopology(CellInTopology&& /*rhs*/) = default;
      42             :   CellInTopology& operator=(const CellInTopology& /*rhs*/) = default;
      43             :   CellInTopology& operator=(CellInTopology&& /*rhs*/) = default;
      44             :   ~CellInTopology() = default;
      45             :   Topology topology{Topology::Line};
      46             :   std::vector<size_t> bounding_indices{};
      47             : };
      48             : 
      49             : // @{
      50             : /*!
      51             :  * \brief Compute the cells in the element.
      52             :  *
      53             :  * Returns a vector of the cells in the topology I1^Dim, i.e. a line if Dim ==
      54             :  * 1, or a hexahedron if Dim == 3. The cells are bounded by lines connecting
      55             :  * grid points along the axes of the element, so if you have (n_x by n_y by n_z)
      56             :  * grid points, you have ((n_x-1) by (n_y-1) by (n_z-1)) cells.
      57             :  *
      58             :  * \note As more topologies are added, e.g. S2, the interface will need slight
      59             :  * modification, however the return type is likely to be able to remain the
      60             :  * same.
      61             :  */
      62             : template <size_t Dim>
      63             : std::vector<CellInTopology> compute_cells(const Index<Dim>& extents) noexcept;
      64             : 
      65             : std::vector<CellInTopology> compute_cells(
      66             :     const std::vector<size_t>& extents) noexcept;
      67             : // @}
      68             : }  // namespace detail
      69             : }  // namespace vis

Generated by: LCOV version 1.14