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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
// *****************************************************************************
/*!
  \file      src/Mesh/Reorder.hpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.,
             2022-2025 J. Bakosi
             All rights reserved. See the LICENSE file for details.
  \brief     Mesh reordering routines for unstructured meshes
  \details   Mesh reordering routines for unstructured meshes.
*/
// *****************************************************************************
#ifndef Reorder_h
#define Reorder_h

#include <vector><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <utility><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <tuple><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <unordered_map><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <unordered_set><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <map><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <cstddef><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <array><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "Types.hpp"

namespace tk {

//! Shift node IDs to start with zero in element connectivity
std::size_t
shiftToZero( std::vector< std::size_t >& inpoel );

//! Apply new mapping to vector of indices
void
remap( std::vector< std::size_t >& id, const std::vector< std::size_t >& map );

//! Apply new mapping to vector of real numbers
void
remap( std::vector< tk::real >& r, const std::vector< std::size_t >& map );

//! Create remapped vector of indices using a vector
std::vector< std::size_t >
remap( const std::vector< std::size_t >& id,
       const std::vector< std::size_t >& map );

//! In-place remap vector of indices using a map
void
remap( std::vector< std::size_t >& id,
       const std::unordered_map< std::size_t, std::size_t >& map );

//! Create remapped vector of indices using a map
std::vector< std::size_t >
remap( const std::vector< std::size_t >& id,
       const std::unordered_map< std::size_t, std::size_t >& map );

//! Create remapped map of vector of indices using a map
std::map< int, std::vector< std::size_t > >
remap( const std::map< int, std::vector< std::size_t > >& id,
       const std::unordered_map< std::size_t, std::size_t >& map );

//! Reorder mesh points with the advancing front technique
std::vector< std::size_t >
renumber( const std::pair< std::vector< std::size_t >,
                           std::vector< std::size_t > >& psup );

//! Assign local ids to global ids
std::unordered_map< std::size_t, std::size_t >
assignLid( const std::vector< std::size_t >& gid );

//! \brief Generate element connectivity of local node IDs from connectivity of
//!   global node IDs also returning the mapping between local to global IDs
std::tuple< std::vector< std::size_t >,
            std::vector< std::size_t >,
            std::unordered_map< std::size_t, std::size_t > >
global2local( const std::vector< std::size_t >& ginpoel );

//! Test positivity of the Jacobian for all cells in a mesh
bool
positiveJacobians( const std::vector< std::size_t >& inpoel,
                   const std::array< std::vector< real >, 3 >& coord );

//! Generate nodes of side set faces
std::map< int, std::vector< std::size_t > >
bfacenodes( const std::map< int, std::vector< std::size_t > >& bface,
            const std::vector< std::size_t >& triinpoel );

//! Count the number of contributions to a node
tk::real
count( const std::unordered_map< int, std::unordered_set< std::size_t > >& map,
       std::size_t node );

//! Decide if a node is not counted by a chare
bool
slave( const std::unordered_map< int, std::unordered_set< std::size_t > >& map,
     std::size_t node,
     int chare );

} // ::tk

#endif // Reorder_h