// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2015 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "crouzeix_raviart_massmatrix.h" #include "unique_simplices.h" #include "all_edges.h" #include "is_edge_manifold.h" #include "doublearea.h" #include #include template void igl::crouzeix_raviart_massmatrix( const Eigen::PlainObjectBase & V, const Eigen::PlainObjectBase & F, Eigen::SparseMatrix & M, Eigen::PlainObjectBase & E, Eigen::PlainObjectBase & EMAP) { // All occurances of directed edges Eigen::MatrixXi allE; all_edges(F,allE); Eigen::VectorXi _1; unique_simplices(allE,E,_1,EMAP); return crouzeix_raviart_massmatrix(V,F,E,EMAP,M); } template void igl::crouzeix_raviart_massmatrix( const Eigen::PlainObjectBase & V, const Eigen::PlainObjectBase & F, const Eigen::PlainObjectBase & E, const Eigen::PlainObjectBase & EMAP, Eigen::SparseMatrix & M) { using namespace Eigen; using namespace std; assert(F.cols() == 3); // Mesh should be edge-manifold assert(is_edge_manifold(V,F)); // number of elements (triangles) int m = F.rows(); // Get triangle areas VectorXd TA; doublearea(V,F,TA); vector > MIJV(3*m); for(int f = 0;f(EMAP(f+m*c),EMAP(f+m*c),TA(f)*0.5); } } M.resize(E.rows(),E.rows()); M.setFromTriplets(MIJV.begin(),MIJV.end()); } #ifdef IGL_STATIC_LIBRARY // Explicit instanciation template void igl::crouzeix_raviart_massmatrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::SparseMatrix&); template void igl::crouzeix_raviart_massmatrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::SparseMatrix&); #endif