Tec batch evaluation - #55
Merged
Merged
Conversation
- Added lightweight MatrixView / ConstMatrixView abstractions for non-owning matrix access and submatrix extraction. - Added row-based std::span accessors for safer contiguous access. - Implemented subView support with stride-aware views. - Added contiguous-memory detection via isContiguous(). - Improved const-correctness and added [[nodiscard]] annotations. - Added utility methods: - empty() - sameShape() - isSquare() - row() - Improved transpose() robustness: - Added alias-safe handling for M.transpose(M) - Added optimized in-place transpose for square matrices - Added safe fallback path for rectangular matrices - Improved resize/assign documentation and API consistency. - Expanded unit tests: - MatrixView and nested subviews - transpose aliasing - reshape preservation - const row access - move semantics - empty/square/shape utilities - contiguous vs non-contiguous views Preparation work for future batched FEM kernels and view-based assembly optimizations.
This major update transitions the CFEM++ integration engine from a single-point scalar evaluation model to a high-performance, SIMD-friendly batch evaluation architecture using Structure-of-Arrays (SoA). Core Architecture & Reference Element: - Redesigned `ReferenceElement` API to fully support batch processing (`evaluateShapesBatch`, `computeMappingBatch`). - Introduced Strict Separation of Concerns for mappings: `MappingInfoBatch` acts as the geometric data owner (Jacobian, DetJ), while `MappingInfoBatchView` acts as a zero-copy view for physical derivatives. - Implemented dimensional masking in `computePhysicalFirstDerivativesBatch` to correctly handle embedded manifolds (e.g., 2D surface in 3D space) based on `refDim` vs `spatialDim`. Memory Management & Optimization: - Integrated `EvalContext` with a thread-local Arena memory allocator to eliminate dynamic OS allocations (`new`/`malloc`) inside the hot loops. - Implemented a `Bookmark/Release` mechanism to safely manage temporary AST evaluation buffers while preserving physical derivatives. - Applied Loop-Invariant Code Motion by precomputing SIMD padded strides (`kernel_utils::computePaddedStride`) inside the Phase 2 cache build. Volume Integration (`integrate`): - Rewrote the integration loop to utilize OpenMP parallelization over cells. - Hoisted Jacobian and determinant computations out of the quadrature loop for affine elements. Boundary Integration (`integrateBoundary`): - Implemented the "Hybrid View" architecture: successfully combines facet geometry (normals, dS) with parent cell inverse Jacobians (for gradients) in a single zero-copy view. - Added automatic projection of boundary quadrature points into the parent reference space (`projectFacetRefCoordToCellRefCoord`). Bug Fixes & Documentation: - Fixed a Segmentation Fault caused by blind 3D array access during physical derivative computation on 2D elements. - Added comprehensive Doxygen documentation covering thread-safety, Arena memory lifecycles, and the Hybrid Geometry architecture.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.