Loading...
Searching...
No Matches
piercedKernelRange.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_PIERCED_KERNEL_RANGE_HPP__
26#define __BITPIT_PIERCED_KERNEL_RANGE_HPP__
27
28namespace bitpit {
29
34template<typename id_t = long>
36{
37
38template<typename PK_id_t>
39friend class PiercedKernel;
40
41private:
45 template<typename PK_id_t>
47
51 typedef Kernel<id_t> kernel_t;
52
53 /*
54 * Iterator type
55 */
57
58public:
61
63 typedef id_t id_type;
64
67
68 // Constructors
70 PiercedKernelRange(const kernel_t *kernel);
71 PiercedKernelRange(const kernel_t *kernel, id_t first, id_t last);
73
74 // General methods
75 void initialize(const kernel_t *kernel);
76 void initialize(const kernel_t *kernel, id_t first, id_t last);
78
79 void swap(PiercedKernelRange &other) noexcept;
80 std::size_t evalSize() const;
81
82 // Methods to get begin and end
83 const_iterator begin() const noexcept;
84 const_iterator end() const noexcept;
85
86 const_iterator cbegin() const noexcept;
87 const_iterator cend() const noexcept;
88
92 template<typename other_id_t = long>
93 bool operator==(const PiercedKernelRange<other_id_t> &rhs) const
94 {
95 if (m_cbegin == rhs.m_cbegin) {
96 return false;
97 }
98
99 if (m_cend == rhs.m_cend) {
100 return false;
101 }
102
103 return true;
104 }
105
109 template<typename other_id_t = long>
111 {
112 if (m_cbegin == rhs.m_cbegin) {
113 return true;
114 }
115
116 if (m_cend != rhs.m_cend) {
117 return true;
118 }
119
120 return false;
121 }
122
123protected:
126
129
130};
131
132}
133
134// Include the implementation
135#include "piercedKernelRange.tpp"
136
137#endif
Iterator for the class PiercedKernel.
The PiercedKernelRange allow to iterate using range-based loops over a PiercedStorage.
const_iterator cend() const noexcept
const_iterator end() const noexcept
void initialize(const kernel_t *kernel)
void swap(PiercedKernelRange &other) noexcept
const_iterator cbegin() const noexcept
const_iterator begin() const noexcept
bool operator!=(const PiercedKernelRange< other_id_t > &rhs) const
Metafunction for generating a pierced kernel.
--- layout: doxygen_footer ---