| 1 | /************************************************************************* |
| 2 | * * |
| 3 | * Vega FEM Simulation Library Version 3.1 * |
| 4 | * * |
| 5 | * "volumetricMesh" library , Copyright (C) 2007 CMU, 2009 MIT, 2016 USC * |
| 6 | * All rights reserved. * |
| 7 | * * |
| 8 | * Code author: Jernej Barbic * |
| 9 | * http://www.jernejbarbic.com/code * |
| 10 | * * |
| 11 | * Research: Jernej Barbic, Fun Shing Sin, Daniel Schroeder, * |
| 12 | * Doug L. James, Jovan Popovic * |
| 13 | * * |
| 14 | * Funding: National Science Foundation, Link Foundation, * |
| 15 | * Singapore-MIT GAMBIT Game Lab, * |
| 16 | * Zumberge Research and Innovation Fund at USC * |
| 17 | * * |
| 18 | * This library is free software; you can redistribute it and/or * |
| 19 | * modify it under the terms of the BSD-style license that is * |
| 20 | * included with this library in the file LICENSE.txt * |
| 21 | * * |
| 22 | * This library is distributed in the hope that it will be useful, * |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * |
| 25 | * LICENSE.TXT for more details. * |
| 26 | * * |
| 27 | *************************************************************************/ |
| 28 | |
| 29 | /* |
| 30 | Computes the mass matrix for the given volumetric mesh. |
| 31 | See also volumetricMesh.h . |
| 32 | */ |
| 33 | |
| 34 | #ifndef _GENERATEMASSMATRIX_H_ |
| 35 | #define _GENERATEMASSMATRIX_H_ |
| 36 | |
| 37 | #include "volumetricMesh.h" |
| 38 | #include "sparseMatrix.h" |
| 39 | |
| 40 | class GenerateMassMatrix |
| 41 | { |
| 42 | public: |
| 43 | |
| 44 | // If inflate3Dim flag is on, each matrix element z will be augmented |
| 45 | // to a 3x3 z*I matrix (causing mtx dimensions to grow by a factor of 3). |
| 46 | // In order to get the true 3D mass matrix, set inflate3Dim to true (output |
| 47 | // matrix will be 3*numVertices x 3*numVertices). |
| 48 | // In order to save some space, set it to false (output matrix will be |
| 49 | // numVertices x numVertices). |
| 50 | static void computeMassMatrix(VolumetricMesh * volumetricMesh, SparseMatrix ** massMatrix, bool inflate3Dim = false); |
| 51 | // computes the mass belonging to each vertex, by lumping the mass matrix |
| 52 | // masses has size of volumetricMesh->getNumVertices() if (inflat3Dim == false) or 3 * n if (inflate3Dim == true) |
| 53 | static void computeVertexMasses(VolumetricMesh * volumetricMesh, double * masses, bool inflate3Dim = false); |
| 54 | |
| 55 | protected: |
| 56 | }; |
| 57 | |
| 58 | #endif |
| 59 |