| 1 | /************************************************************************* |
| 2 | * * |
| 3 | * Vega FEM Simulation Library Version 3.1 * |
| 4 | * * |
| 5 | * "StVK" 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 | This class is a multi-threaded version of the class "StVKStiffnessMatrix". |
| 31 | It uses POSIX threads ("pthreads") as the threading API. |
| 32 | Each thread assembles the stiffness matrix with respect to a subset of all the mesh elements. |
| 33 | At the end, the individual results are added into a global stiffness matrix. |
| 34 | |
| 35 | See also StVKStiffnessMatrix.h . |
| 36 | */ |
| 37 | |
| 38 | #ifndef _STVKSTIFFNESSMATRIXMT_H_ |
| 39 | #define _STVKSTIFFNESSMATRIXMT_H_ |
| 40 | |
| 41 | #include "StVKStiffnessMatrix.h" |
| 42 | |
| 43 | class StVKStiffnessMatrixMT : public StVKStiffnessMatrix |
| 44 | { |
| 45 | public: |
| 46 | // multicore version of StVKStiffnessMatrix |
| 47 | StVKStiffnessMatrixMT(StVKInternalForces * stVKInternalForces, int numThreads); |
| 48 | virtual ~StVKStiffnessMatrixMT(); |
| 49 | |
| 50 | // evaluates the stiffness matrix in the given deformation configuration |
| 51 | virtual void ComputeStiffnessMatrix(const double * vertexDisplacements, SparseMatrix * sparseMatrix); |
| 52 | |
| 53 | int GetStartElement(int rank); |
| 54 | int GetEndElement(int rank); |
| 55 | |
| 56 | protected: |
| 57 | int numThreads; |
| 58 | int * startElement, * endElement; |
| 59 | SparseMatrix ** sparseMatrixBuffer; |
| 60 | }; |
| 61 | |
| 62 | #endif |
| 63 |