Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/Inciter/FaceData.hpp 4 : : \copyright 2012-2015 J. Bakosi, 5 : : 2016-2018 Los Alamos National Security, LLC., 6 : : 2019-2021 Triad National Security, LLC. 7 : : All rights reserved. See the LICENSE file for details. 8 : : \details Face-data used only in discontinuous Galerkin discretization scheme 9 : : */ 10 : : // ***************************************************************************** 11 : : #ifndef FaceData_h 12 : : #define FaceData_h 13 : : 14 : : #include <vector> 15 : : #include <tuple> 16 : : #include <map> 17 : : #include <unordered_map> 18 : : 19 : : #include "Types.hpp" 20 : : #include "PUPUtil.hpp" 21 : : #include "ContainerUtil.hpp" 22 : : 23 : : namespace inciter { 24 : : 25 : : //! Data associated to a tetrahedron cell id used to communicate across faces 26 : : using GhostData = 27 : : std::unordered_map< std::size_t, // tet id 28 : : std::tuple< 29 : : // 3 node ids for potentially multiple faces 30 : : std::vector< std::size_t >, 31 : : // elem geometry, see tk::genGeoElemTet() 32 : : std::vector< tk::real >, 33 : : // coordinates of vertex of tet that is not on face 34 : : std::array< tk::real, 3 >, 35 : : // relative position of above vertex in inpoel 36 : : std::size_t, 37 : : // inpoel of said tet 38 : : std::array< std::size_t, 4 > > >; 39 : : 40 : : //! FaceData class holding face-connectivity data useful for DG discretization 41 : : class FaceData { 42 : : 43 : : public: 44 : : //! Empty constructor for Charm++ 45 : 1666 : explicit FaceData() {} 46 : : 47 : : //! \brief Constructor: compute (element-face) data for internal and 48 : : //! domain-boundary faces 49 : : explicit 50 : : FaceData( const std::vector< std::size_t >& inpoel, 51 : : const std::map< int, std::vector< std::size_t > >& bface, 52 : : const std::vector< std::size_t >& triinpoel ); 53 : : 54 : : //! Generate local face IDs for all faces (2 per face since face has 2 esuf) 55 : : void genLocalFaceId( const std::vector< std::size_t >& inpoel ); 56 : : 57 : : /** @name Accessors 58 : : * */ 59 : : ///@{ 60 : 281493 : const std::map< int, std::vector< std::size_t > >& Bface() const 61 : 281493 : { return m_bface; } 62 : 1337 : const std::vector< std::size_t >& Triinpoel() const { return m_triinpoel; } 63 : 1080115 : std::size_t Nbfac() const { return tk::sumvalsize( m_bface ); } 64 : 2472156 : const std::vector< int >& Esuel() const { return m_esuel; } 65 : 45974216 : std::vector< int >& Esuel() { return m_esuel; } 66 : 2892 : std::size_t Nipfac() const { return m_nipfac; } 67 : 350013 : const std::vector< std::size_t >& Inpofa() const { return m_inpofa; } 68 : 41897 : std::vector< std::size_t >& Inpofa() { return m_inpofa; } 69 : : const std::vector< std::size_t >& Belem() const { return m_belem; } 70 : 363412 : const std::vector< int >& Esuf() const { return m_esuf; } 71 : 899895 : std::vector< int >& Esuf() { return m_esuf; } 72 : 12312 : const std::vector< int >& FaceLocalId() const { return m_faceLocalId; } 73 : : //@} 74 : : 75 : : /** @name Charm++ pack/unpack (serialization) routines 76 : : * */ 77 : : ///@{ 78 : : //! \brief Pack/Unpack serialize member function 79 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference 80 : 5373 : void pup( PUP::er &p ) { 81 : 5373 : p | m_bface; 82 : 5373 : p | m_triinpoel; 83 : 5373 : p | m_esuel; 84 : 5373 : p | m_nipfac; 85 : 5373 : p | m_inpofa; 86 : 5373 : p | m_belem; 87 : 5373 : p | m_esuf; 88 : 5373 : p | m_faceLocalId; 89 : 5373 : } 90 : : //! \brief Pack/Unpack serialize operator| 91 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference 92 : : //! \param[in,out] i FaceData object reference 93 : 5373 : friend void operator|( PUP::er& p, FaceData& i ) { i.pup(p); } 94 : : //@} 95 : : 96 : : private: 97 : : //! Boundary faces side-set information 98 : : std::map< int, std::vector< std::size_t > > m_bface; 99 : : //! Triangle face connecitivity 100 : : std::vector< std::size_t > m_triinpoel; 101 : : //! Elements surrounding elements 102 : : std::vector< int > m_esuel; 103 : : //! Number of internal and physical-boundary faces 104 : : std::size_t m_nipfac; 105 : : //! Face-node connectivity 106 : : std::vector< std::size_t > m_inpofa; 107 : : //! Boundary element vector 108 : : std::vector< std::size_t > m_belem; 109 : : //! Element surrounding faces 110 : : std::vector< int > m_esuf; 111 : : //! Local ID of faces wrt. surrounding elements (useful for flux calcs) 112 : : std::vector< int > m_faceLocalId; 113 : : }; 114 : : 115 : : } // inciter:: 116 : : 117 : : #endif // Discretization_h