Debian Codegraph @

tools/physicalModeling/mesh2faust/vega/libraries/include/StVKInternalForcesMT.h

raw symbols SCIP
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 #ifndef _STVKINTERNALFORCESMT_H_
30 #define _STVKINTERNALFORCESMT_H_
31
32 #include "StVKInternalForces.h"
33
34 /*
35 This class is a multi-threaded version of the class "StVKInternalForces".
36 It uses POSIX threads ("pthreads") as the threading API.
37 Each thread assembles the internal force with respect to a subset of all the mesh elements.
38 At the end, the individual results are added into a global internal force vector.
39
40 See also StVKInternalForces.h .
41 */
42
43 class StVKInternalForcesMT : public StVKInternalForces
44 {
45 public:
46
47 // same usage as StVKInternalForces, except must specify the number of threads
48 StVKInternalForcesMT(VolumetricMesh * volumetricMesh, StVKElementABCD * precomputedABCDIntegrals, bool addGravity, double g, int numThreads);
49 virtual ~StVKInternalForcesMT();
50
51 virtual void ComputeForces(const double * vertexDisplacements, double * internalForces);
52 virtual double ComputeEnergy(const double * vertexDisplacements);
53
54 // advanced function (tells what range of volumetric mesh elements is assigned to each thread)
55 int GetStartElement(int rank);
56 int GetEndElement(int rank);
57
58 protected:
59 int numThreads;
60 int * startElement, * endElement;
61 double * internalForceBuffer;
62 double * energyBuffer;
63 double * energyAuxBuffer;
64
65 void Compute(int computationTarget, const double * vertexDisplacements, double * internalForces);
66 };
67
68 #endif
69