-
Notifications
You must be signed in to change notification settings - Fork 34
Fix Issues #196 and #197 #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thelfer
merged 2 commits into
master
from
196-mgisfunction-add-function-view-with-strided-coalesent-memory-access
Jan 19, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| title: MFrontGenericInterfaceSupport Version 3.1.1 | ||
| author: Thomas Helfer | ||
| date: 2026 | ||
| lang: en-EN | ||
| numbersections: true | ||
| documentclass: article | ||
| from: markdown+tex_math_single_backslash | ||
| geometry: | ||
| - margin=2cm | ||
| papersize: a4 | ||
| link-citations: true | ||
| colorlinks: true | ||
| figPrefixTemplate: "$$i$$" | ||
| tabPrefixTemplate: "$$i$$" | ||
| secPrefixTemplate: "$$i$$" | ||
| eqnPrefixTemplate: "($$i$$)" | ||
| bibliography: bibliography.bib | ||
| --- | ||
|
|
||
| The page describes the new functionalities of Version 3.1.1 of the | ||
| `MFrontGenericInterfaceSupport` project. | ||
|
|
||
| # Issues fixed | ||
|
|
||
| ## Issue 197: [MGIS/Function] Fix `CoalescedMemoryAccessCompositeTensorsView` for scalar values | ||
|
|
||
| For more details, see <https://github.com/thelfer/MFrontGenericInterfaceSupport/issues/197> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| --- | ||
| title: MFrontGenericInterfaceSupport Version 3.2 | ||
| author: Thomas Helfer | ||
| date: 2026 | ||
| lang: en-EN | ||
| numbersections: true | ||
| documentclass: article | ||
| from: markdown+tex_math_single_backslash | ||
| geometry: | ||
| - margin=2cm | ||
| papersize: a4 | ||
| link-citations: true | ||
| colorlinks: true | ||
| figPrefixTemplate: "$$i$$" | ||
| tabPrefixTemplate: "$$i$$" | ||
| secPrefixTemplate: "$$i$$" | ||
| eqnPrefixTemplate: "($$i$$)" | ||
| bibliography: bibliography.bib | ||
| --- | ||
|
|
||
| This version is meant to be used with `TFEL` Version 5.2. | ||
|
|
||
| # New features of the `MGIS/Function` library | ||
|
|
||
| ## Functions using a strided memory access | ||
|
|
||
| The following classes have been introduced: | ||
|
|
||
| - `StridedCoalescedMemoryAccessTensorView` | ||
| - `StridedCoalescedMemoryAccessCompositeTensorsView` | ||
|
|
||
| ### `StridedCoalescedMemoryAccessTensorView` | ||
|
|
||
| `StridedCoalescedMemoryAccessTensorView` is a tensorial function view | ||
| which stores its components in non interleaved manner using the | ||
| following scheme: | ||
|
|
||
| ~~~~ | ||
| | <------- Component 1 ---------> |....| <----- Component Nc ---------> | | ||
| +-------++-------++------++-------+----+-------++------++------++-------+ | ||
| | Elt 1 || Elt 2 || .... || Elt N |....| Elt 1 ||Elt 2 || .... || Elt N | | ||
| +-------++-------++------++-------+----+-------++------++------++-------+ | ||
| ~~~~ | ||
|
|
||
| #### Example of usage | ||
|
|
||
| ~~~~{.cxx} | ||
| constexpr auto ne = size_type{2}; | ||
| auto space = BasicLinearSpace{ne}; | ||
| std::array<const real, 4 * ne> values = {1, 10, 2, 20, 3, 30, 4, 40}; | ||
| const auto f = StridedCoalescedMemoryAccessTensorView< | ||
| BasicLinearSpace, tfel::math::stensor<2, real>, false>{space, values}; | ||
| const auto e1 = f(0); | ||
| // e1 = {1, 2, 3, 4} | ||
| const auto e2 = f(1); | ||
| // e2 = {10, 20, 30, 40} | ||
| ~~~~ | ||
|
|
||
| ## `StridedCoalescedMemoryAccessCompositeTensorsView` | ||
|
|
||
| `StridedCoalescedMemoryAccessCompositeTensorsView` allows retrieving | ||
| scalar or tensorial objects which are stored in a non interleaved | ||
| manner. | ||
|
|
||
| #### Example of usage | ||
|
|
||
| ~~~~{.cxx} | ||
| using CompositeFunctionView = | ||
| StridedCoalescedMemoryAccessCompositeTensorsView<BasicLinearSpace, 4, | ||
| false>; | ||
| constexpr auto ne = size_type{2}; | ||
| auto space = BasicLinearSpace{ne}; | ||
| std::array<const real, 4 * ne> values = {1, 10, 2, 20, 3, 30, 4, 40}; | ||
| const auto f = CompositeFunctionView{space, values}; | ||
| const auto e1 = f.get<0, tfel::math::stensor<2, real>>(0); | ||
| // e1 = {1, 2, 3, 4} | ||
| const auto e2 = f.get<0, tfel::math::stensor<2, real>>(1); | ||
| // e2 = {10, 20, 30, 40} | ||
| ~~~~ | ||
|
|
||
| # Acknowledgements | ||
|
|
||
| The authors are grateful to the many contributors to the `TFEL/MFront` | ||
| project. This research was conducted in the framework of the PLEIADES | ||
| project, which was supported financially by the CEA (Commissariat à | ||
| l’Énergie Atomique et aux Énergies Alternatives), EDF (Électricité de | ||
| France) and Framatome. Work on `MGIS/Function` was performed as part of | ||
| the EURATOM OperaHPC Project co-funded by the European Union. | ||
|
|
||
| # Issues fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
include/MGIS/Function/StridedCoalescedMemoryAccessFunctionViewBase.hxx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| /*! | ||
| * \file MGIS/Function/StridedCoalescedMemoryAccessFunctionViewBase.hxx | ||
| * \brief | ||
| * \author Thomas Helfer | ||
| * \date 17/01/2026 | ||
| * \copyright (C) Copyright Thomas Helfer 2018. | ||
| * Use, modification and distribution are subject | ||
| * to one of the following licences: | ||
| * - GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying | ||
| * file LGPL-3.0.txt) | ||
| * - CECILL-C, Version 1.0 (See accompanying files | ||
| * CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt). | ||
| */ | ||
|
|
||
| #ifndef LIB_MGIS_FUNCTION_STRIDEDCOALESCEDMEMORYACCESSFUNCTIONVIEWBASE_HXX | ||
| #define LIB_MGIS_FUNCTION_STRIDEDCOALESCEDMEMORYACCESSFUNCTIONVIEWBASE_HXX | ||
|
|
||
| #include <span> | ||
| #include <array> | ||
| #include "MGIS/Config.hxx" | ||
| #include "MGIS/Contract.hxx" | ||
| #include "MGIS/Function/SpaceConcept.hxx" | ||
| #include "MGIS/Function/FunctionConcept.hxx" | ||
| #include "MGIS/Function/Function.hxx" | ||
| #include "MGIS/Function/Evaluator.hxx" | ||
|
|
||
| namespace mgis::function { | ||
|
|
||
| /*! | ||
| * \brief a class meant to describe a function, each component of which is | ||
| * stored contiguously in non interleaved manner using the following scheme: | ||
| * | ||
| * ~~~~ | ||
| * | <------- Component 1 ---------> |....| <----- Component Nc ---------> | | ||
| * +-------++-------++------++-------+----+-------++------++------++-------+ | ||
| * | Elt 1 || Elt 2 || .... || Elt N |....| Elt 1 ||Elt 2 || .... || Elt N | | ||
| * +-------++-------++------++-------+----+-------++------++------++-------+ | ||
| * ~~~~ | ||
| */ | ||
| template <FunctionalSpaceConcept Space, size_type N, bool is_mutable = true> | ||
| requires(N > 0) struct StridedCoalescedMemoryAccessFunctionViewBase | ||
| : private PreconditionsChecker< | ||
| StridedCoalescedMemoryAccessFunctionViewBase<Space, | ||
| N, | ||
| is_mutable>> { | ||
| /*! | ||
| * \brief check that the preconditions to build the view are met | ||
| * \param[in] eh: error handler. | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| [[nodiscard]] static constexpr bool checkPreconditions( | ||
| AbstractErrorHandler&, | ||
| const Space& space, | ||
| std::span<const real>) requires(!is_mutable); | ||
| /*! | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| constexpr StridedCoalescedMemoryAccessFunctionViewBase( | ||
| const Space&, std::span<const real>) requires(!is_mutable); | ||
| /*! | ||
| * \brief check that the preconditions to build the view are met | ||
| * \param[in] eh: error handler. | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| [[nodiscard]] static constexpr bool checkPreconditions( | ||
| AbstractErrorHandler&, const Space&, std::span<real>); | ||
| /*! | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| constexpr StridedCoalescedMemoryAccessFunctionViewBase(const Space&, | ||
| std::span<real>); | ||
| /*! | ||
| * \return the data associated with an integration point | ||
| * \param[in] o: offset associated with the integration point | ||
| */ | ||
| [[nodiscard]] constexpr std::array<real, N> getValues(const size_type) const | ||
| requires(LinearElementSpaceConcept<Space>); | ||
| /*! | ||
| * \return the data associated with an integration point | ||
| * \param[in] e: element index | ||
| * \param[in] i: quadrature point index | ||
| */ | ||
| [[nodiscard]] constexpr std::array<real, N> getValues(const size_type, | ||
| const size_type) const | ||
| requires(LinearQuadratureSpaceConcept<Space>); | ||
| //! \return the underlying quadrature space | ||
| [[nodiscard]] constexpr const Space& getSpace() const noexcept; | ||
|
|
||
| protected: | ||
| /*! | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| template <bool doPreconditionsCheck> | ||
| constexpr StridedCoalescedMemoryAccessFunctionViewBase( | ||
| const PreconditionsCheck<doPreconditionsCheck>&, | ||
| const Space&, | ||
| std::span<const real>) requires(!is_mutable); | ||
| /*! | ||
| * \param[in] space: space | ||
| * \param[in] values: values | ||
| */ | ||
| template <bool doPreconditionsCheck> | ||
| constexpr StridedCoalescedMemoryAccessFunctionViewBase( | ||
| const PreconditionsCheck<doPreconditionsCheck>&, | ||
| const Space&, | ||
| std::span<real>); | ||
| //! \brief underlying discretization space | ||
| const Space space; | ||
| //! \brief pointer to the first component | ||
| const std::conditional_t<is_mutable, real*, const real*> data_pointer; | ||
| }; | ||
|
|
||
| } // namespace mgis::function | ||
|
|
||
| #include "MGIS/Function/StridedCoalescedMemoryAccessFunctionViewBase.ixx" | ||
|
|
||
| #endif /* LIB_MGIS_FUNCTION_STRIDEDCOALESCEDMEMORYACCESSFUNCTIONVIEWBASE_HXX \ | ||
| */ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.