OOFEM 3.0
Loading...
Searching...
No Matches
numerics.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#ifndef numerics_h
36#define numerics_h
37
38#ifdef _USE_EIGEN
39 #define EIGEN_INITIALIZE_MATRICES_BY_ZERO
40 #include<Eigen/Core>
41 #include <Eigen/Dense>
42#endif
43
44namespace oofem{
45 #ifdef _USE_EIGEN
46 #define OOFEM_EIGEN_DERIVED(MyKlass,EigenBase) \
47 MyKlass(void): EigenBase() {} \
48 /* This constructor allows you to construct MyKlass from Eigen expressions */ \
49 template<typename OtherDerived> MyKlass(const Eigen::MatrixBase<OtherDerived>& other): EigenBase(other) { } \
50 /* This method allows you to assign Eigen expressions to MyKlass */ \
51 template<typename OtherDerived> MyKlass& operator=(const Eigen::MatrixBase<OtherDerived>& other) { this->EigenBase::operator=(other); return *this; }
52
53 typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::ColMajor> MatrixXXd;
54 typedef Eigen::Matrix<double,Eigen::Dynamic,1> VectorXd;
55
56 /* typedef for fixed-size base classes */
57 // columns vectors are required to be col-major, even though it makes not difference for storage
58 template<std::size_t N>
59 using VectorNd = Eigen::Matrix<double,N,1,Eigen::ColMajor>;
60
61 // FloatMatrixF with N==1 (one row) must be RowMajor
62 template<std::size_t R, std::size_t C>
63 using MatrixRCd = Eigen::Matrix<double,R,C,(R==1?Eigen::RowMajor:Eigen::ColMajor)>;
64
65 class FloatArray;
66 class FloatMatrix;
67 template<std::size_t N> class FloatArrayF;
68 template<std::size_t R, std::size_t C> class FloatMatrixF;
69 const double NaN(std::numeric_limits<double>::signaling_NaN());
70 // using Eigen::Index;
71 typedef int Index;
72 #else
73 typedef int Index;
74 #endif
75} // end namespace oofem
76
77
78
79#ifdef __LAPACK_MODULE
80// Some forward declarations for LAPACK. Remember to append the underscore to the function name.
81// consumed in floatmatrix.C and floatarray.C
82extern "C" {
83 extern void dgemv_(const char *trans, const int *m, const int *n, const double *alpha, const double *a, const int *lda, const double *x,
84 const int *incx, const double *beta, double *y, const int *incy, int aColumns, int xSize, int ySize);
85 // Y = Y + alpha * X
86 extern void daxpy_(const int *n, const double *alpha, const double *x, const int *incx, double *y, const int *incy, int xsize, int ysize);
87
89 extern void dgecon_(const char *norm, const int *n, const double *a, const int *lda,
90 const double *anorm, double *rcond, double *work, int *iwork, int *info, int norm_len);
92 extern int dgetrf_(const int *m, const int *n, double *a, const int *lda, int *lpiv, int *info);
94 extern int dgetri_(const int *n, double *a, const int *lda, int *ipiv, double *work, const int *lwork, int *info);
96 extern int dgesv_(const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, const double *b, const int *ldb, int *info);
98 extern double dlange_(const char *norm, const int *m, const int *n, const double *a, const int *lda, double *work, int norm_len);
100 extern int dsyevx_(const char *jobz, const char *range, const char *uplo, const int *n, double *a, const int *lda,
101 const double *vl, const double *vu, const int *il, const int *iu,
102 const double *abstol, int *m, double *w, double *z, const int *ldz,
103 double *work, int *lwork, int *iwork, int *ifail, int *info,
104 int jobz_len, int range_len, int uplo_len);
106 extern void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, const double *b, const int *ldb, int *info);
108 extern void dgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k, const double *alpha,
109 const double *a, const int *lda, const double *b, const int *ldb, const double *beta, double *c, const int *ldc,
110 int a_columns, int b_columns, int c_columns);
112 extern void dger_(const int *m, const int *n, const double *alpha, const double *x, const int *incx,
113 const double *y, const int *incy, double *a, const int *lda,
114 int x_len, int y_len, int a_columns);
116 extern void dsyr_(const char *uplo, const int *n, const double *alpha, const double *x, const int *incx,
117 double *a, const int *lda, int x_len, int a_columns);
119 extern void daxpy_(const int *n, const double *alpha, const double *x, const int *incx, double *y, const int *incy, int xsize, int ysize);
121 extern void dscal_(const int *n, const double *alpha, const double *x, const int *incx, int size);
122}
123#endif
124
125
126#endif // numerics_h
127
int Index
Definition numerics.h:73

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011