2626
2727namespace mgis ::function {
2828
29+ template <size_type N, typename Space>
30+ constexpr std::optional<
31+ std::array<FunctionView<Space,
32+ FunctionDataLayoutDescription{.data_size = 1 ,
33+ .data_stride = 1 }>,
34+ N>>
35+ splitArrayIntoScalarFunctionViews (AbstractErrorHandler&,
36+ const Space&,
37+ std::span<real>);
38+
39+ template <size_type N, typename Space>
40+ constexpr std::optional<
41+ std::array<FunctionView<Space,
42+ FunctionDataLayoutDescription{.data_size = 1 ,
43+ .data_stride = 1 },
44+ false >,
45+ N>>
46+ splitArrayIntoScalarFunctionViews (AbstractErrorHandler&,
47+ const Space&,
48+ std::span<const real>);
49+
50+ /* !
51+ *
52+ */
2953 template <FunctionalSpaceConcept Space, size_type N, bool is_mutable = true >
3054 requires (N > 0 ) struct CoalescedMemoryAccessFunctionViewBase
3155 : private PreconditionsChecker<
3256 CoalescedMemoryAccessFunctionViewBase<Space, N, is_mutable>> {
3357 //
34- using MutableValues = std::array<real*, N>;
58+ template <size_type size = N>
59+ using MutableValues = std::array<real*, size>;
3560 //
36- using ConstValues = std::array<const real*, N>;
61+ template <size_type size = N>
62+ using ConstValues = std::array<const real*, size>;
3763
3864 // ! \brief type of the function view associated with a single component
3965 using ScalarComponentFunctionView =
@@ -55,48 +81,178 @@ namespace mgis::function {
5581 constexpr CoalescedMemoryAccessFunctionViewBase (
5682 const std::array<ScalarComponentFunctionView, N>&);
5783 /* !
58- * \param[in] components: components
84+ * \brief check that the preconditions to build the view are met
85+ * \param[in] eh: error handler.
86+ * \param[in] space: space
87+ * \param[in] values: values
88+ */
89+ [[nodiscard]] static constexpr bool checkPreconditions (
90+ AbstractErrorHandler&,
91+ const Space& space,
92+ std::span<const real>) requires(!is_mutable);
93+ /* !
94+ * \param[in] space: space
95+ * \param[in] values: values
5996 */
60- template <bool doPreconditionsCheck>
6197 constexpr CoalescedMemoryAccessFunctionViewBase (
62- const PreconditionsCheck<doPreconditionsCheck>&,
63- const std::array<ScalarComponentFunctionView, N>&);
98+ const Space&, std::span<const real>) requires(!is_mutable);
99+ /* !
100+ * \brief check that the preconditions to build the view are met
101+ * \param[in] eh: error handler.
102+ * \param[in] space: space
103+ * \param[in] values: values
104+ */
105+ [[nodiscard]] static constexpr bool checkPreconditions (
106+ AbstractErrorHandler&, const Space&, std::span<real>);
107+ /* !
108+ * \param[in] space: space
109+ * \param[in] values: values
110+ */
111+ constexpr CoalescedMemoryAccessFunctionViewBase (const Space&,
112+ std::span<real>);
64113 /* !
65114 * \return the data associated with an integration point
66115 * \param[in] o: offset associated with the integration point
67116 */
68- [[nodiscard]] constexpr MutableValues
69- getValuesPointers ( const size_type) requires (
70- is_mutable&& LinearElementSpaceConcept<Space> &&
71- (!hasElementWorkspace<Space>));
117+ [[nodiscard]] constexpr MutableValues<> getValuesPointers (
118+ const size_type) //
119+ requires( is_mutable&& LinearElementSpaceConcept<Space> &&
120+ (!hasElementWorkspace<Space>));
72121 /* !
73122 * \return the data associated with an integration point
74123 * \param[in] e: element index
75124 * \param[in] i: quadrature point index
76125 */
77- [[nodiscard]] constexpr MutableValues
78- getValuesPointers ( const size_type, const size_type) requires (
79- is_mutable&& LinearQuadratureSpaceConcept<Space> &&
80- (!hasCellWorkspace<Space>));
126+ [[nodiscard]] constexpr MutableValues<> getValuesPointers (
127+ const size_type, const size_type) //
128+ requires( is_mutable&& LinearQuadratureSpaceConcept<Space> &&
129+ (!hasCellWorkspace<Space>));
81130 /* !
82131 * \return the data associated with an integration point
83132 * \param[in] o: offset associated with the integration point
84133 */
85- [[nodiscard]] constexpr ConstValues getValuesPointers (const size_type) const
134+ [[nodiscard]] constexpr ConstValues<> getValuesPointers (
135+ const size_type) const //
86136 requires(LinearElementSpaceConcept<Space> &&
87137 (!hasElementWorkspace<Space>));
88138 /* !
89139 * \return the data associated with an integration point
90140 * \param[in] e: element index
91141 * \param[in] i: quadrature point index
92142 */
93- [[nodiscard]] constexpr ConstValues getValuesPointers (const size_type,
94- const size_type) const
143+ [[nodiscard]] constexpr ConstValues<> getValuesPointers (
144+ const size_type, const size_type) const
95145 requires(LinearQuadratureSpaceConcept<Space> &&
96146 (!hasCellWorkspace<Space>));
147+ /* !
148+ * \return the data associated with an integration point
149+ * \param[in] o: offset associated with the integration point
150+ */
151+ template <size_type begin, size_type size>
152+ [[nodiscard]] constexpr MutableValues<size> getValuesPointers (
153+ const size_type) //
154+ requires((begin + size <= N) && is_mutable &&
155+ LinearElementSpaceConcept<Space> &&
156+ (!hasElementWorkspace<Space>));
157+ /* !
158+ * \return the data associated with an integration point
159+ * \param[in] e: element index
160+ * \param[in] i: quadrature point index
161+ */
162+ template <size_type begin, size_type size>
163+ [[nodiscard]] constexpr MutableValues<size> getValuesPointers (
164+ const size_type,
165+ const size_type) //
166+ requires((begin + size <= N) && is_mutable &&
167+ LinearQuadratureSpaceConcept<Space> &&
168+ (!hasCellWorkspace<Space>));
169+ /* !
170+ * \return the data associated with an integration point
171+ * \param[in] o: offset associated with the integration point
172+ */
173+ template <size_type begin, size_type size>
174+ [[nodiscard]] constexpr ConstValues<size> getValuesPointers (
175+ const size_type) const
176+ requires((begin + size <= N) && LinearElementSpaceConcept<Space> &&
177+ (!hasElementWorkspace<Space>));
178+ /* !
179+ * \return the data associated with an integration point
180+ * \param[in] e: element index
181+ * \param[in] i: quadrature point index
182+ */
183+ template <size_type begin, size_type size>
184+ [[nodiscard]] constexpr ConstValues<size> getValuesPointers (
185+ const size_type, const size_type) const
186+ requires((begin + size <= N) && LinearQuadratureSpaceConcept<Space> &&
187+ (!hasCellWorkspace<Space>));
188+ /* !
189+ * \return the data associated with an integration point
190+ * \param[in] o: offset associated with the integration point
191+ */
192+ template <size_type offset>
193+ [[nodiscard]] constexpr real* getValuePointer (const size_type) //
194+ requires((offset < N) && is_mutable &&
195+ LinearElementSpaceConcept<Space> &&
196+ (!hasElementWorkspace<Space>));
197+ /* !
198+ * \return the data associated with an integration point
199+ * \param[in] e: element index
200+ * \param[in] i: quadrature point index
201+ */
202+ template <size_type offset>
203+ [[nodiscard]] constexpr real* getValuePointer (const size_type,
204+ const size_type) //
205+ requires((offset < N) && is_mutable &&
206+ LinearQuadratureSpaceConcept<Space> &&
207+ (!hasCellWorkspace<Space>));
208+ /* !
209+ * \return the data associated with an integration point
210+ * \param[in] o: offset associated with the integration point
211+ */
212+ template <size_type offset>
213+ [[nodiscard]] constexpr const real* getValuePointer (const size_type) const
214+ requires((offset < N) && LinearElementSpaceConcept<Space> &&
215+ (!hasElementWorkspace<Space>));
216+ /* !
217+ * \return the data associated with an integration point
218+ * \param[in] e: element index
219+ * \param[in] i: quadrature point index
220+ */
221+ template <size_type offset>
222+ [[nodiscard]] constexpr const real* getValuePointer (const size_type,
223+ const size_type) const
224+ requires((offset < N) && LinearQuadratureSpaceConcept<Space> &&
225+ (!hasCellWorkspace<Space>));
97226
98- private:
99- // !
227+ protected:
228+ //
229+ static constexpr auto splitValues (const Space&, std::span<real>);
230+ //
231+ static constexpr auto splitValues (const Space&, std::span<const real>);
232+ /* !
233+ * \param[in] components: components
234+ */
235+ template <bool doPreconditionsCheck>
236+ constexpr CoalescedMemoryAccessFunctionViewBase (
237+ const PreconditionsCheck<doPreconditionsCheck>&,
238+ const std::array<ScalarComponentFunctionView, N>&);
239+ /* !
240+ * \param[in] values: values
241+ */
242+ template <bool doPreconditionsCheck>
243+ constexpr CoalescedMemoryAccessFunctionViewBase (
244+ const PreconditionsCheck<doPreconditionsCheck>&,
245+ const Space&,
246+ std::span<const real>) requires(!is_mutable);
247+ /* !
248+ * \param[in] values: values
249+ */
250+ template <bool doPreconditionsCheck>
251+ constexpr CoalescedMemoryAccessFunctionViewBase (
252+ const PreconditionsCheck<doPreconditionsCheck>&,
253+ const Space&,
254+ std::span<real>);
255+ // ! \brief function's view for each component
100256 std::array<ScalarComponentFunctionView, N> function_components;
101257 };
102258
0 commit comments