svMultiPhysics
Loading...
Searching...
No Matches
Vector.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef SVMP_COMMON_MATH_VECTOR_H
5#define SVMP_COMMON_MATH_VECTOR_H
6
7/**
8 * @file Vector.h
9 * @brief Fixed-size vector types for FE computations, backed by Eigen.
10 *
11 * The FE library standardizes on Eigen for linear algebra. These aliases give
12 * element-level code a stable vocabulary type without re-exporting all of
13 * Eigen. Note that, unlike the previous in-house implementation, Eigen types
14 * are NOT zero-initialized by default construction; use Vector::Zero() where a
15 * zeroed value is required.
16 *
17 * This is a small, fixed-size (compile-time length) vector for element-level FE
18 * kernels in namespace svmp::math. It is distinct from, and not a replacement
19 * for, the legacy dynamically sized container in solver/Vector.h: the two differ
20 * in namespace, size model (compile-time vs runtime), and memory management, and
21 * coexist deliberately.
22 */
23
24#include <Eigen/Core>
25
26#include <cstddef>
27
28/**
29 * @defgroup SVMP_Math Math
30 * @brief Linear algebra vocabulary types and dense utilities for finite-element computations.
31 *
32 * @details The Math module defines the fixed-size vector and matrix types
33 * used in element-level kernels (as aliases of Eigen types) and dense linear
34 * algebra utilities used by basis construction and local transforms.
35 *
36 * @defgroup SVMP_Math_Vector Vector
37 * @ingroup SVMP_Math
38 * @brief Fixed-size vector type aliases.
39 */
40
41namespace svmp::math {
42
43/**
44 * @brief Fixed-size column vector for element-level computations
45 * @ingroup SVMP_Math_Vector
46 * @tparam T Scalar type (float, double)
47 * @tparam N Vector dimension
48 */
49template<typename T, std::size_t N>
50using Vector = Eigen::Matrix<T, static_cast<int>(N), 1>;
51
52} // namespace svmp::math
53
54#endif // SVMP_COMMON_MATH_VECTOR_H
Eigen::Matrix< T, static_cast< int >(N), 1 > Vector
Fixed-size column vector for element-level computations.
Definition Vector.h:50