Debian Codegraph @

tools/physicalModeling/mesh2faust/vega/libraries/volumetricMesh/volumetricMeshENuMaterial.h

raw symbols SCIP
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 #ifndef _VOLUMETRICMESHENUMATERIAL_H_
30 #define _VOLUMETRICMESHENUMATERIAL_H_
31
32 #include "volumetricMesh.h"
33
34 // stores an isotropic material specified by E (Young's modulus), nu (Poisson's ratio), and density
35 // such a material specification is very common: (corotational) linear FEM, StVK, etc.
36 class VolumetricMesh::ENuMaterial : public VolumetricMesh::Material
37 {
38 public:
39 ENuMaterial(std::string name, double density, double E, double nu);
40 ENuMaterial(const ENuMaterial & eNuMaterial);
41 virtual ~ENuMaterial() {}
42 virtual VolumetricMesh::Material * clone() const;
43 virtual VolumetricMesh::Material::materialType getType();
44
45 inline double getE() const; // Young's modulus
46 inline double getNu() const; // Poisson's ratio
47 inline double getLambda() const; // Lame's lambda coefficient
48 inline double getMu() const; // Lame's mu coefficient
49 inline void setE(double E);
50 inline void setNu(double nu);
51
52 protected:
53 double E_, nu_;
54 };
55
56 inline VolumetricMesh::ENuMaterial::ENuMaterial(std::string name, double density, double E, double nu): VolumetricMesh::Material(name, density), E_(E), nu_(nu) {}
57 inline VolumetricMesh::ENuMaterial::ENuMaterial(const ENuMaterial & eNuMaterial) : VolumetricMesh::Material(eNuMaterial.getName(), eNuMaterial.getDensity()), E_(eNuMaterial.getE()), nu_(eNuMaterial.getNu()) {}
58 inline double VolumetricMesh::ENuMaterial::getE() const { return E_; }
59 inline double VolumetricMesh::ENuMaterial::getNu() const { return nu_; }
60 inline double VolumetricMesh::ENuMaterial::getLambda() const { return (nu_ * E_) / ((1 + nu_) * (1 - 2 * nu_)); }
61 inline double VolumetricMesh::ENuMaterial::getMu() const { return E_ / (2 * (1 + nu_)); }
62 inline void VolumetricMesh::ENuMaterial::setE(double E) { E_ = E; }
63 inline void VolumetricMesh::ENuMaterial::setNu(double nu) { nu_ = nu; }
64
65 // obtain pointer to ENuMaterial (necessary inside classes that assume ENu material)
66 VolumetricMesh::ENuMaterial * downcastENuMaterial(VolumetricMesh::Material * material); // performs a check via getType and returns NULL if material is not ENU
67
68 #endif
69