Nektar++
MatrixFreeBase.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: MatrixFreeBase.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: base class definition for matrrix free type
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_LIBRARY_COLLECTIONS_MATRIXFREEBASE_H
36#define NEKTAR_LIBRARY_COLLECTIONS_MATRIXFREEBASE_H
37
39
40namespace Nektar::Collections
41{
42
44{
45public:
46 // Default constructor
47 MatrixFreeBase() = default;
48
49 MatrixFreeBase(const unsigned int nIn, const unsigned int nOut,
50 const unsigned int nCollSize)
51 : m_nIn(nIn * nCollSize), m_nOut(nOut * nCollSize)
52 {
53 // Padding if needed
55 const auto nElmtNoPad = nCollSize;
56 m_nElmtPad = nElmtNoPad;
57
58 if (nElmtNoPad % vec_t::width != 0)
59 {
60 m_isPadded = true;
62 nElmtNoPad + vec_t::width - (nElmtNoPad % vec_t::width);
63 }
64 }
65
66protected:
67 /// flag for padding
68 bool m_isPadded{false};
69 /// size after padding
70 unsigned int m_nElmtPad;
71 /// actural size of input array
72 unsigned int m_nIn;
73 /// actural size of output array
74 unsigned int m_nOut;
75};
76
77} // namespace Nektar::Collections
78#endif // NEKTAR_LIBRARY_COLLECTIONS_MATRIXFREEBASE_H
MatrixFreeBase(const unsigned int nIn, const unsigned int nOut, const unsigned int nCollSize)
unsigned int m_nIn
actural size of input array
unsigned int m_nElmtPad
size after padding
unsigned int m_nOut
actural size of output array
simd< NekDouble > vec_t
typename abi< ScalarType, width >::type simd
Definition: tinysimd.hpp:80