eigen_core_support.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 
21 #ifndef LIBMESH_EIGEN_CORE_SUPPORT_H
22 #define LIBMESH_EIGEN_CORE_SUPPORT_H
23 
24 
25 
26 #include "libmesh/libmesh_common.h"
27 
28 #ifdef LIBMESH_HAVE_EIGEN
29 
30 // Local includes
31 #include "libmesh/id_types.h"
32 
33 // C++ includes
34 
35 // // hack to avoid MatType collision...
36 // #undef libMeshSaveMatType
37 // #ifdef MatType
38 // # define MatType libMeshSaveMatType
39 // # undef MatType
40 // #endif
41 
42 // Eigen includes
43 #include <Eigen/Dense>
44 #include <Eigen/Sparse>
45 
46 // #ifdef libMeshSaveMatType
47 // # define libMeshSaveMatType MatType
48 // # undef libMeshSaveMatType
49 // #endif
50 
51 
52 namespace libMesh
53 {
54 
55  // must be a signed type!!
56 #if LIBMESH_DOF_ID_BYTES == 1
57  // Workaround for Eigen bug
58  // typedef int8_t eigen_idx_type;
59  typedef int32_t eigen_idx_type;
60 #elif LIBMESH_DOF_ID_BYTES == 2
61  // Workaround for Eigen bug
62  // typedef int16_t eigen_idx_type;
63  typedef int32_t eigen_idx_type;
64 #elif LIBMESH_DOF_ID_BYTES == 8
65  typedef int64_t eigen_idx_type;
66 #else // LIBMESH_DOF_ID_BYTES = 4 (default)
67  typedef int32_t eigen_idx_type;
68 #endif
69 
70  // We have to use RowMajor SparseMatrix storage for our preallocation to work
71  typedef Eigen::SparseMatrix<Number, Eigen::RowMajor, eigen_idx_type> EigenSM;
72  typedef Eigen::Matrix<Number, Eigen::Dynamic, 1> EigenSV;
73 } // namespace libMesh
74 
75 
76 #endif // #ifdef LIBMESH_HAVE_EIGEN
77 #endif // LIBMESH_EIGEN_CORE_SUPPORT_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo