$extrastylesheet
eigen_core_support.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 
00021 #ifndef LIBMESH_EIGEN_CORE_SUPPORT_H
00022 #define LIBMESH_EIGEN_CORE_SUPPORT_H
00023 
00024 
00025 
00026 #include "libmesh/libmesh_common.h"
00027 
00028 #ifdef LIBMESH_HAVE_EIGEN
00029 
00030 // Local includes
00031 #include "libmesh/id_types.h"
00032 
00033 // C++ includes
00034 
00035 // // hack to avoid MatType collision...
00036 // #undef libMeshSaveMatType
00037 // #ifdef MatType
00038 // #  define MatType libMeshSaveMatType
00039 // #  undef  MatType
00040 // #endif
00041 
00042 // Eigen includes
00043 #include <Eigen/Dense>
00044 #include <Eigen/Sparse>
00045 
00046 // #ifdef libMeshSaveMatType
00047 // #  define libMeshSaveMatType MatType
00048 // #  undef  libMeshSaveMatType
00049 // #endif
00050 
00051 
00052 namespace libMesh
00053 {
00054 
00055 // must be a signed type!!
00056 #if LIBMESH_DOF_ID_BYTES == 1
00057 // Workaround for Eigen bug
00058 // typedef int8_t eigen_idx_type;
00059 typedef int32_t eigen_idx_type;
00060 #elif LIBMESH_DOF_ID_BYTES == 2
00061 // Workaround for Eigen bug
00062 // typedef int16_t eigen_idx_type;
00063 typedef int32_t eigen_idx_type;
00064 #elif LIBMESH_DOF_ID_BYTES == 8
00065 typedef int64_t eigen_idx_type;
00066 #else // LIBMESH_DOF_ID_BYTES = 4 (default)
00067 typedef int32_t eigen_idx_type;
00068 #endif
00069 
00070 // We have to use RowMajor SparseMatrix storage for our preallocation to work
00071 typedef Eigen::SparseMatrix<Number, Eigen::RowMajor, eigen_idx_type> EigenSM;
00072 typedef Eigen::Matrix<Number, Eigen::Dynamic, 1> EigenSV;
00073 } // namespace libMesh
00074 
00075 
00076 #endif // #ifdef LIBMESH_HAVE_EIGEN
00077 #endif // LIBMESH_EIGEN_CORE_SUPPORT_H