Skip to content

Commit 18de2df

Browse files
committed
[[nodiscard]] everywhere
1 parent cb5b313 commit 18de2df

File tree

8 files changed

+172
-147
lines changed

8 files changed

+172
-147
lines changed

include/MGIS/Function/BinaryOperationEvaluatorBase.hxx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,44 +65,45 @@ namespace mgis::function {
6565
constexpr BinaryOperationEvaluatorBase(const BinaryOperationEvaluatorBase&);
6666
//! \brief move constructor
6767
constexpr BinaryOperationEvaluatorBase(BinaryOperationEvaluatorBase&&);
68+
//! \brief return the underlying space
69+
[[nodiscard]] constexpr decltype(auto) getSpace() const;
6870
//! \brief perform consistency checks
69-
constexpr bool check(AbstractErrorHandler&) const;
71+
[[nodiscard]] constexpr bool check(AbstractErrorHandler&) const;
7072
//! \brief allocate internal workspace
7173
constexpr void allocateWorkspace();
72-
//! \brief return the underlying space
73-
constexpr decltype(auto) getSpace() const;
7474
/*!
7575
* \brief call operator
7676
* \param[in] i: integration point index
7777
*/
78-
constexpr auto operator()(const element_index<Space>&) const
78+
[[nodiscard]] constexpr auto operator()(const element_index<Space>&) const
7979
requires((internals::EvaluatorResultQuery<FirstEvaluatorType>::b1) &&
8080
(internals::EvaluatorResultQuery<SecondEvaluatorType>::b1));
8181
/*!
8282
* \brief call operator
8383
* \param[in] i: integration point index
8484
*/
85-
constexpr auto operator()(const element_workspace<Space>&,
86-
const element_index<Space>&) const
85+
[[nodiscard]] constexpr auto operator()(const element_workspace<Space>&,
86+
const element_index<Space>&) const
8787
requires((internals::EvaluatorResultQuery<FirstEvaluatorType>::b2) &&
8888
(internals::EvaluatorResultQuery<SecondEvaluatorType>::b2));
8989
/*!
9090
* \brief call operator
9191
* \param[in] e: cell index
9292
* \param[in] i: integration point index
9393
*/
94-
constexpr auto operator()(const cell_index<Space>,
95-
const quadrature_point_index<Space>) const
94+
[[nodiscard]] constexpr auto operator()(
95+
const cell_index<Space>, const quadrature_point_index<Space>) const
9696
requires((internals::EvaluatorResultQuery<FirstEvaluatorType>::b3) &&
9797
(internals::EvaluatorResultQuery<SecondEvaluatorType>::b3));
9898
/*!
9999
* \brief call operator
100100
* \param[in] e: cell index
101101
* \param[in] i: integration point index
102102
*/
103-
constexpr auto operator()(const cell_workspace<Space>&,
104-
const cell_index<Space>,
105-
const quadrature_point_index<Space>) const
103+
[[nodiscard]] constexpr auto operator()(
104+
const cell_workspace<Space>&,
105+
const cell_index<Space>,
106+
const quadrature_point_index<Space>) const
106107
requires((internals::EvaluatorResultQuery<FirstEvaluatorType>::b4) &&
107108
(internals::EvaluatorResultQuery<SecondEvaluatorType>::b4));
108109

@@ -116,15 +117,15 @@ namespace mgis::function {
116117
template <typename Child,
117118
EvaluatorConcept FirstEvaluatorType,
118119
EvaluatorConcept SecondEvaluatorType>
119-
constexpr decltype(auto) getSpace(
120+
[[nodiscard]] constexpr decltype(auto) getSpace(
120121
const BinaryOperationEvaluatorBase<Child,
121122
FirstEvaluatorType,
122123
SecondEvaluatorType>&);
123124
//! \brief perform consistency checks
124125
template <typename Child,
125126
EvaluatorConcept FirstEvaluatorType,
126127
EvaluatorConcept SecondEvaluatorType>
127-
constexpr bool check(
128+
[[nodiscard]] constexpr bool check(
128129
AbstractErrorHandler&,
129130
const BinaryOperationEvaluatorBase<Child,
130131
FirstEvaluatorType,

include/MGIS/Function/EvaluatorModifierBase.hxx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,41 +32,42 @@ namespace mgis::function {
3232
constexpr EvaluatorModifierBase(const EvaluatorModifierBase&);
3333
//! \brief move constructor
3434
constexpr EvaluatorModifierBase(EvaluatorModifierBase&&);
35+
//! \brief return the underlying space
36+
[[nodiscard]] constexpr decltype(auto) getSpace() const;
3537
//! \brief perform consistency checks
36-
constexpr bool check(AbstractErrorHandler&) const;
38+
[[nodiscard]] constexpr bool check(AbstractErrorHandler&) const;
3739
//! \brief allocate internal workspace
3840
constexpr void allocateWorkspace();
39-
//! \brief return the underlying space
40-
constexpr decltype(auto) getSpace() const;
4141
/*!
4242
* \brief call operator
4343
* \param[in] i: integration point index
4444
*/
45-
constexpr auto operator()(const element_index<Space>&) const
45+
[[nodiscard]] constexpr auto operator()(const element_index<Space>&) const
4646
requires(internals::EvaluatorResultQuery<EvaluatorType>::b1);
4747
/*!
4848
* \brief call operator
4949
* \param[in] i: integration point index
5050
*/
51-
constexpr auto operator()(const element_workspace<Space>&,
52-
const element_index<Space>&) const
51+
[[nodiscard]] constexpr auto operator()(const element_workspace<Space>&,
52+
const element_index<Space>&) const
5353
requires(internals::EvaluatorResultQuery<EvaluatorType>::b2);
5454
/*!
5555
* \brief call operator
5656
* \param[in] e: cell index
5757
* \param[in] i: integration point index
5858
*/
59-
constexpr auto operator()(const cell_index<Space>&,
60-
const quadrature_point_index<Space>&) const
59+
[[nodiscard]] constexpr auto operator()(
60+
const cell_index<Space>&, const quadrature_point_index<Space>&) const
6161
requires(internals::EvaluatorResultQuery<EvaluatorType>::b3);
6262
/*!
6363
* \brief call operator
6464
* \param[in] e: cell index
6565
* \param[in] i: integration point index
6666
*/
67-
constexpr auto operator()(const cell_workspace<Space>&,
68-
const cell_index<Space>&,
69-
const quadrature_point_index<Space>&) const
67+
[[nodiscard]] constexpr auto operator()(
68+
const cell_workspace<Space>&,
69+
const cell_index<Space>&,
70+
const quadrature_point_index<Space>&) const
7071
requires(internals::EvaluatorResultQuery<EvaluatorType>::b4);
7172

7273
protected:
@@ -75,12 +76,13 @@ namespace mgis::function {
7576
};
7677

7778
template <typename Child, EvaluatorConcept EvaluatorType>
78-
constexpr decltype(auto) getSpace(
79+
[[nodiscard]] constexpr decltype(auto) getSpace(
7980
const EvaluatorModifierBase<Child, EvaluatorType>&);
8081
//! \brief perform consistency checks
8182
template <typename Child, EvaluatorConcept EvaluatorType>
82-
constexpr bool check(AbstractErrorHandler&,
83-
const EvaluatorModifierBase<Child, EvaluatorType>&);
83+
[[nodiscard]] constexpr bool check(
84+
AbstractErrorHandler&,
85+
const EvaluatorModifierBase<Child, EvaluatorType>&);
8486
//! \brief allocate internal workspace
8587
template <typename Child, EvaluatorConcept EvaluatorType>
8688
constexpr void allocateWorkspace(

include/MGIS/Function/FixedSizeModifier.hxx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,45 +48,46 @@ namespace mgis::function {
4848
constexpr FixedSizeModifier(const PreconditionsCheck<doPreconditionsCheck>&,
4949
const EvaluatorType&);
5050
//! \brief perform consistency checks
51-
constexpr bool check(AbstractErrorHandler&) const;
51+
[[nodiscard]] constexpr bool check(AbstractErrorHandler&) const;
5252
//! \brief allocate internal workspace
5353
constexpr void allocateWorkspace();
5454
//! \brief return the underlying space
55-
decltype(auto) getSpace() const;
55+
[[nodiscard]] decltype(auto) getSpace() const;
5656
//! \return the number of components
57-
constexpr size_type getNumberOfComponents() const;
57+
[[nodiscard]] constexpr size_type getNumberOfComponents() const;
5858
/*!
5959
* \brief call operator
6060
* \param[in] i: integration point index
6161
*/
62-
constexpr auto operator()(const element_index<Space>&) const
62+
[[nodiscard]] constexpr auto operator()(const element_index<Space>&) const
6363
requires((internals::EvaluatorResultQuery<EvaluatorType>::b1) &&
6464
(isEvaluatorResultTypeMappable<EvaluatorType>));
6565
/*!
6666
* \brief call operator
6767
* \param[in] i: integration point index
6868
*/
69-
constexpr auto operator()(const element_workspace<Space>&,
70-
const element_index<Space>&) const
69+
[[nodiscard]] constexpr auto operator()(const element_workspace<Space>&,
70+
const element_index<Space>&) const
7171
requires((internals::EvaluatorResultQuery<EvaluatorType>::b2) &&
7272
(isEvaluatorResultTypeMappable<EvaluatorType>));
7373
/*!
7474
* \brief call operator
7575
* \param[in] e: cell index
7676
* \param[in] i: integration point index
7777
*/
78-
constexpr auto operator()(const cell_index<Space>&,
79-
const quadrature_point_index<Space>&) const
78+
[[nodiscard]] constexpr auto operator()(
79+
const cell_index<Space>&, const quadrature_point_index<Space>&) const
8080
requires((internals::EvaluatorResultQuery<EvaluatorType>::b3) &&
8181
(isEvaluatorResultTypeMappable<EvaluatorType>));
8282
/*!
8383
* \brief call operator
8484
* \param[in] e: cell index
8585
* \param[in] i: integration point index
8686
*/
87-
constexpr auto operator()(const cell_workspace<Space>&,
88-
const cell_index<Space>&,
89-
const quadrature_point_index<Space>&) const
87+
[[nodiscard]] constexpr auto operator()(
88+
const cell_workspace<Space>&,
89+
const cell_index<Space>&,
90+
const quadrature_point_index<Space>&) const
9091
requires((internals::EvaluatorResultQuery<EvaluatorType>::b4) &&
9192
(isEvaluatorResultTypeMappable<EvaluatorType>));
9293

@@ -100,22 +101,23 @@ namespace mgis::function {
100101
* \param[in] f: function
101102
*/
102103
template <size_type N, typename EvaluatorType>
103-
constexpr auto view(const EvaluatorType&) requires(
104+
[[nodiscard]] constexpr auto view(const EvaluatorType&) requires(
104105
(N > 0) && (N != dynamic_extent) && //
105106
(EvaluatorConcept<std::decay_t<EvaluatorType>>));
106107

107108
template <EvaluatorConcept EvaluatorType, size_type N>
108-
decltype(auto) getSpace(const FixedSizeModifier<EvaluatorType, N>&);
109+
[[nodiscard]] decltype(auto) getSpace(
110+
const FixedSizeModifier<EvaluatorType, N>&);
109111
//! \brief perform consistency checks
110112
template <EvaluatorConcept EvaluatorType, size_type N>
111-
constexpr bool check(AbstractErrorHandler&,
112-
const FixedSizeModifier<EvaluatorType, N>&);
113+
[[nodiscard]] constexpr bool check(
114+
AbstractErrorHandler&, const FixedSizeModifier<EvaluatorType, N>&);
113115
//! \brief allocate internal workspace
114116
template <EvaluatorConcept EvaluatorType, size_type N>
115117
constexpr void allocateWorkspace(FixedSizeModifier<EvaluatorType, N>&);
116118
//! \return the number of components
117119
template <EvaluatorConcept EvaluatorType, size_type N>
118-
constexpr size_type getNumberOfComponents(
120+
[[nodiscard]] constexpr size_type getNumberOfComponents(
119121
const FixedSizeModifier<EvaluatorType, N>&);
120122

121123
} // end of namespace mgis::function

include/MGIS/Function/FixedSizeView.hxx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,67 +51,70 @@ namespace mgis::function {
5151
constexpr FixedSizeView(const PreconditionsCheck<doPreconditionsCheck>&,
5252
FunctionType&);
5353
//! \brief perform consistency checks
54-
constexpr bool check(AbstractErrorHandler&) const;
54+
[[nodiscard]] constexpr bool check(AbstractErrorHandler&) const;
5555
//! \brief return the underlying space
56-
constexpr decltype(auto) getSpace() const;
56+
[[nodiscard]] constexpr decltype(auto) getSpace() const;
5757
//! \return the number of components
58-
constexpr size_type getNumberOfComponents() const noexcept;
58+
[[nodiscard]] constexpr size_type getNumberOfComponents() const noexcept;
5959
/*!
6060
* \brief call operator
6161
* \param[in] i: integration point index
6262
*/
63-
constexpr auto operator()(const element_index<Space>&) const
63+
[[nodiscard]] constexpr auto operator()(const element_index<Space>&) const
6464
requires((internals::FunctionResultQuery<FunctionType>::b1) &&
6565
(isFunctionConstResultTypeMappable<FunctionType>));
6666
/*!
6767
* \brief call operator
6868
* \param[in] wk: element workspace
6969
* \param[in] i: integration point index
7070
*/
71-
constexpr auto operator()(const element_workspace<Space>&,
72-
const element_index<Space>&) const
71+
[[nodiscard]] constexpr auto operator()(const element_workspace<Space>&,
72+
const element_index<Space>&) const
7373
requires((internals::FunctionResultQuery<FunctionType>::b2) &&
7474
(isFunctionConstResultTypeMappable<FunctionType>));
7575
/*!
7676
* \brief call operator
7777
* \param[in] e: cell index
7878
* \param[in] i: integration point index
7979
*/
80-
constexpr auto operator()(const cell_index<Space>&,
81-
const quadrature_point_index<Space>&) const
80+
[[nodiscard]] constexpr auto operator()(
81+
const cell_index<Space>&, const quadrature_point_index<Space>&) const
8282
requires((internals::FunctionResultQuery<FunctionType>::b3) &&
8383
(isFunctionConstResultTypeMappable<FunctionType>));
8484
/*!
8585
* \brief call operator
8686
* \param[in] e: cell index
8787
* \param[in] i: integration point index
8888
*/
89-
constexpr auto operator()(const cell_workspace<Space>&,
90-
const cell_index<Space>&,
91-
const quadrature_point_index<Space>&) const
89+
[[nodiscard]] constexpr auto operator()(
90+
const cell_workspace<Space>&,
91+
const cell_index<Space>&,
92+
const quadrature_point_index<Space>&) const
9293
requires((internals::FunctionResultQuery<FunctionType>::b4) &&
9394
(isFunctionConstResultTypeMappable<FunctionType>));
9495
/*!
9596
* \brief call operator
9697
* \param[in] i: integration point index
9798
*/
98-
constexpr mutable_value_type operator()(const element_index<Space>&) //
99+
[[nodiscard]] constexpr mutable_value_type operator()(
100+
const element_index<Space>&) //
99101
requires((internals::FunctionResultQuery<FunctionType>::b1) &&
100102
(isFunctionResultTypeMappable<FunctionType>));
101103
/*!
102104
* \brief call operator
103105
* \param[in] i: integration point index
104106
*/
105-
constexpr mutable_value_type operator()(const element_workspace<Space>&,
106-
const element_index<Space>&) //
107+
[[nodiscard]] constexpr mutable_value_type operator()(
108+
const element_workspace<Space>&,
109+
const element_index<Space>&) //
107110
requires((internals::FunctionResultQuery<FunctionType>::b2) &&
108111
(isFunctionResultTypeMappable<FunctionType>));
109112
/*!
110113
* \brief call operator
111114
* \param[in] e: cell index
112115
* \param[in] i: integration point index
113116
*/
114-
constexpr mutable_value_type operator()(
117+
[[nodiscard]] constexpr mutable_value_type operator()(
115118
const cell_index<Space>&,
116119
const quadrature_point_index<Space>&) //
117120
requires((internals::FunctionResultQuery<FunctionType>::b3) &&
@@ -121,7 +124,7 @@ namespace mgis::function {
121124
* \param[in] e: cell index
122125
* \param[in] i: integration point index
123126
*/
124-
constexpr mutable_value_type operator()(
127+
[[nodiscard]] constexpr mutable_value_type operator()(
125128
const cell_workspace<Space>&,
126129
const cell_index<Space>&,
127130
const quadrature_point_index<Space>&) //
@@ -138,23 +141,24 @@ namespace mgis::function {
138141
* \param[in] f: function
139142
*/
140143
template <size_type N, typename FunctionType>
141-
constexpr auto view(FunctionType&) requires(
144+
[[nodiscard]] constexpr auto view(FunctionType&) requires(
142145
(N > 0) && (N != dynamic_extent) && //
143146
(FunctionConcept<std::decay_t<FunctionType>>)&& //
144147
(!std::is_rvalue_reference_v<FunctionType>));
145148

146149
template <FunctionConcept FunctionType, size_type N>
147-
constexpr decltype(auto) getSpace(const FixedSizeView<FunctionType, N>&);
150+
[[nodiscard]] constexpr decltype(auto) getSpace(
151+
const FixedSizeView<FunctionType, N>&);
148152
//! \brief perform consistency checks
149153
template <FunctionConcept FunctionType, size_type N>
150-
constexpr bool check(AbstractErrorHandler&,
151-
const FixedSizeView<FunctionType, N>&);
154+
[[nodiscard]] constexpr bool check(AbstractErrorHandler&,
155+
const FixedSizeView<FunctionType, N>&);
152156
//! \brief allocate internal workspace
153157
template <FunctionConcept FunctionType, size_type N>
154158
constexpr void allocateWorkspace(FixedSizeView<FunctionType, N>&) noexcept;
155159
//! \return the number of components
156160
template <FunctionConcept FunctionType, size_type N>
157-
constexpr size_type getNumberOfComponents(
161+
[[nodiscard]] constexpr size_type getNumberOfComponents(
158162
const FixedSizeView<FunctionType, N>&) noexcept;
159163

160164
} // end of namespace mgis::function

0 commit comments

Comments
 (0)