Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/Inciter/FaceData.cpp 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 : : \see FaceData.h for more info. 10 : : */ 11 : : // ***************************************************************************** 12 : : 13 : : #include "Reorder.hpp" 14 : : #include "DerivedData.hpp" 15 : : #include "FaceData.hpp" 16 : : 17 : : using inciter::FaceData; 18 : : 19 : 964 : FaceData::FaceData( 20 : : const std::vector< std::size_t >& inpoel, 21 : : const std::map< int, std::vector< std::size_t > >& bface, 22 : 964 : const std::vector< std::size_t >& triinpoel ) 23 [ + - ][ + - ]: 964 : : m_bface( bface ), m_triinpoel( triinpoel ) 24 : : // ***************************************************************************** 25 : : // Constructor: compute (element-face) data for internal and domain-boundary 26 : : // faces 27 : : //! \param[in] inpoel Mesh connectivity with local IDs 28 : : //! \param[in] bface Boundary-faces mapped to side set ids 29 : : //! \param[in] triinpoel Boundary-face connectivity with local IDs 30 : : // ***************************************************************************** 31 : : { 32 [ + - ]: 964 : auto esup = tk::genEsup( inpoel, 4 ); 33 [ + - ]: 964 : m_esuel = tk::genEsuelTet( inpoel, esup ); 34 : 964 : auto nbfac = tk::sumvalsize( m_bface ); 35 [ + - ]: 964 : m_nipfac = tk::genNipfac( 4, nbfac, m_esuel ); 36 [ + - ]: 964 : m_inpofa = tk::genInpofaTet( m_nipfac, nbfac, inpoel, m_triinpoel, m_esuel ); 37 [ + - ]: 964 : m_belem = tk::genBelemTet( nbfac, m_inpofa, esup ); 38 [ + - ]: 1928 : m_esuf = tk::genEsuf( 4, m_nipfac, nbfac, m_belem, m_esuel ); 39 : : Assert( m_belem.size() == nbfac, 40 : : "Number of boundary-elements and number of boundary-faces unequal" ); 41 : 964 : } 42 : : 43 : : void 44 : 964 : FaceData::genLocalFaceId( const std::vector< std::size_t >& inpoel ) 45 : : // ***************************************************************************** 46 : : // Generate local face IDs for all faces (2 per face since face has 2 esuf) 47 : : // ***************************************************************************** 48 : : { 49 : 964 : m_faceLocalId.resize(m_esuf.size()); 50 : : 51 [ + + ]: 428241 : for (std::size_t f=0; f<m_esuf.size()/2; ++f) { 52 : : std::array< std::size_t, 3 > inpofa_f{{ 53 : 427277 : m_inpofa[3*f], 54 : 427277 : m_inpofa[3*f+1], 55 : 427277 : m_inpofa[3*f+2] }}; 56 : : 57 : : // left element is always interior 58 : : Assert( m_esuf[2*f] > -1, "Interior element detected as -1" ); 59 : 427277 : std::size_t el = static_cast< std::size_t >(m_esuf[2*f]); 60 : : std::array< std::size_t, 4 > inpoel_l{{ 61 : 427277 : inpoel[4*el], 62 : 427277 : inpoel[4*el+1], 63 : 427277 : inpoel[4*el+2], 64 : 427277 : inpoel[4*el+3] }}; 65 : 427277 : m_faceLocalId[2*f] = tk::opposite_vertex_of_tet(inpoel_l, inpofa_f); 66 : : 67 [ + + ]: 427277 : if (f >= Nbfac()) { 68 : : // internal face 69 : : Assert( m_esuf[2*f+1] > -1, "Interior element detected as -1" ); 70 : 336809 : std::size_t er = static_cast< std::size_t >(m_esuf[2*f+1]); 71 : : std::array< std::size_t, 4 > inpoel_r{{ 72 : 336809 : inpoel[4*er], 73 : 336809 : inpoel[4*er+1], 74 : 336809 : inpoel[4*er+2], 75 : 336809 : inpoel[4*er+3] }}; 76 : 336809 : m_faceLocalId[2*f+1] = tk::opposite_vertex_of_tet(inpoel_r, inpofa_f); 77 : : } 78 : : else { 79 : : // boundary face 80 : : Assert( m_esuf[2*f+1] == -1, "Outside boundary element not -1" ); 81 : 90468 : m_faceLocalId[2*f+1] = -1; // no element to the right-side of boundary 82 : : } 83 : : } 84 : 964 : }