| 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 _STVKTETABCD_H_ |
| 30 | #define _STVKTETABCD_H_ |
| 31 | |
| 32 | #include "StVKElementABCD.h" |
| 33 | #include "tetMesh.h" |
| 34 | |
| 35 | /* |
| 36 | This class stores the St.Venant-Kirchhoff A,B,C,D coefficients for a tetrahedral element. |
| 37 | This is the low-memory version (the version that we use most often). |
| 38 | See also StVKInternalForces.h . |
| 39 | */ |
| 40 | |
| 41 | class StVKTetABCD : public StVKElementABCD |
| 42 | { |
| 43 | public: |
| 44 | |
| 45 | // computes the ABCD coefficients |
| 46 | StVKTetABCD(TetMesh * tetMesh); |
| 47 | |
| 48 | virtual Mat3d A(void * elementIterator, int i, int j); |
| 49 | virtual double B(void * elementIterator, int i, int j); |
| 50 | virtual Vec3d C(void * elementIterator, int i, int j, int k); |
| 51 | virtual double D(void * elementIterator, int i, int j, int k, int l); |
| 52 | |
| 53 | typedef struct |
| 54 | { |
| 55 | double volume; |
| 56 | Vec3d Phig[4]; // gradient of a basis function |
| 57 | } elementData; |
| 58 | |
| 59 | typedef struct |
| 60 | { |
| 61 | elementData * elementPointer; |
| 62 | double dots[4][4]; |
| 63 | } ElementCache; |
| 64 | |
| 65 | void AllocateElementIterator(void ** elementIterator); |
| 66 | void ReleaseElementIterator(void * elementIterator); |
| 67 | void PrepareElement(int el, void * elementIterator); // must call each time before accessing an element |
| 68 | |
| 69 | virtual ~StVKTetABCD(); |
| 70 | |
| 71 | protected: |
| 72 | |
| 73 | elementData * elementsData; |
| 74 | |
| 75 | // creates the elementData structure for a tet |
| 76 | void StVKSingleTetABCD(Vec3d vertices[4], elementData * target); |
| 77 | }; |
| 78 | |
| 79 | #endif |
| 80 |