Skip to content

Commit 63df448

Browse files
committed
small fixes. add von_mises_stress as an alias for vmis
1 parent 1aa043c commit 63df448

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

include/MGIS/Function/Function.hxx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace mgis::function {
112112
/*!
113113
* \brief function defined on a space.
114114
*
115-
* The `FunctionView ` defines a function using an external memory region.
115+
* The `FunctionView` defines a function using an external memory region.
116116
*
117117
* This memory region may contain more data than the one associated with the
118118
* function as illustrated by the following figure:
@@ -130,7 +130,7 @@ namespace mgis::function {
130130
*
131131
* The size of the all data (including the one not related to the function)
132132
* associated with one element of the space is called the `data_stride` in
133-
* the `FunctionView ` class.
133+
* the `FunctionView` class.
134134
*
135135
* The size of the data hold by the function per element of the space, i.e. th
136136
* number of components of the function is given by `data_size`.
@@ -228,6 +228,21 @@ namespace mgis::function {
228228
const size_type,
229229
const size_type) requires((layout.data_size == dynamic_extent) &&
230230
(layout.data_stride == dynamic_extent));
231+
/*!
232+
* \brief check that the preconditions to build the view are met
233+
* \param[in] eh: error handler.
234+
* \param[in] s: quadrature space.
235+
* \param[in] v: values
236+
* \param[in] dsize: size of the data per elements
237+
* \param[in] dstride: data stride
238+
*/
239+
[[nodiscard]] static constexpr bool checkPreconditions(
240+
AbstractErrorHandler&,
241+
const Space&,
242+
ExternalData,
243+
const FunctionDataLayout<layout>&) //
244+
requires((layout.data_size == dynamic_extent) &&
245+
(layout.data_stride == dynamic_extent));
231246
/*!
232247
* \brief constructor
233248
* \param[in] s: quadrature space.

include/MGIS/Function/Function.ixx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,22 @@ namespace mgis::function {
287287
return checkPreconditions(eh, s, v, dsize, dsize);
288288
} // end of checkPreconditions
289289

290+
template <FunctionalSpaceConcept Space,
291+
FunctionDataLayoutDescription layout,
292+
bool is_mutable>
293+
requires(LinearElementSpaceConcept<Space> ||
294+
LinearQuadratureSpaceConcept<Space>) //
295+
constexpr bool FunctionView<Space, layout, is_mutable>::
296+
checkPreconditions(AbstractErrorHandler& eh,
297+
const Space& s,
298+
FunctionView::ExternalData v,
299+
const FunctionDataLayout<layout>& l) //
300+
requires((layout.data_size == dynamic_extent) &&
301+
(layout.data_stride == dynamic_extent)) {
302+
return checkPreconditions(eh, s, v, l.getNumberOfComponents(),
303+
l.getDataStride());
304+
} // end of checkPreconditions
305+
290306
template <FunctionalSpaceConcept Space,
291307
FunctionDataLayoutDescription layout,
292308
bool is_mutable>
@@ -362,8 +378,11 @@ namespace mgis::function {
362378
const FunctionDataLayout<layout>& l) //
363379
requires((layout.data_size == dynamic_extent) &&
364380
(layout.data_stride == dynamic_extent))
365-
: FunctionView(preconditions_check, s, v, l.size, l.stride) {
366-
} // end of FunctionView
381+
: FunctionView(preconditions_check,
382+
s,
383+
v,
384+
l.getNumberOfComponents(),
385+
l.getDataStride()) {} // end of FunctionView
367386

368387
template <FunctionalSpaceConcept Space,
369388
FunctionDataLayoutDescription layout,

include/MGIS/Function/Mechanics.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ namespace mgis::function {
3131
return tfel::math::sigmaeq(s);
3232
});
3333

34+
inline constexpr auto von_mises_stress = vmis;
35+
3436
template <tfel::math::stensor_common::EigenSolver esolver =
3537
tfel::math::stensor_common::TFELEIGENSOLVER>
3638
inline constexpr auto principal_stress = eigen_values<esolver>;

0 commit comments

Comments
 (0)