| 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 |
#include "volumetricMeshOrthotropicMaterial.h" |
| 30 |
|
| 31 |
VolumetricMesh::OrthotropicMaterial::OrthotropicMaterial(std::string name, double density, double E1, double E2, double E3, double nu12, double nu23, double nu31, double G12, double G23, double G31, double * R): VolumetricMesh::Material(name, density), E1_(E1), E2_(E2), E3_(E3), nu12_(nu12), nu23_(nu23), nu31_(nu31), G12_(G12), G23_(G23), G31_(G31) |
| 32 |
{ |
| 33 |
memcpy(R_, R, sizeof(double) * 9); |
| 34 |
} |
| 35 |
|
| 36 |
VolumetricMesh::OrthotropicMaterial::OrthotropicMaterial(const OrthotropicMaterial & orthotropicMaterial) : VolumetricMesh::Material(orthotropicMaterial.getName(), orthotropicMaterial.getDensity()), |
| 37 |
E1_(orthotropicMaterial.getE1()), |
| 38 |
E2_(orthotropicMaterial.getE2()), |
| 39 |
E3_(orthotropicMaterial.getE3()), |
| 40 |
nu12_(orthotropicMaterial.getNu12()), |
| 41 |
nu23_(orthotropicMaterial.getNu23()), |
| 42 |
nu31_(orthotropicMaterial.getNu31()), |
| 43 |
G12_(orthotropicMaterial.getG12()), |
| 44 |
G23_(orthotropicMaterial.getG23()), |
| 45 |
G31_(orthotropicMaterial.getG31()) |
| 46 |
{ |
| 47 |
orthotropicMaterial.getR(R_); |
| 48 |
} |
| 49 |
|
| 50 |
VolumetricMesh::Material::materialType VolumetricMesh::OrthotropicMaterial::getType() |
| 51 |
{ |
| 52 |
return VolumetricMesh::Material::ORTHOTROPIC; |
| 53 |
} |
| 54 |
|
| 55 |
VolumetricMesh::Material * VolumetricMesh::OrthotropicMaterial::clone() const |
| 56 |
{ |
| 57 |
return new VolumetricMesh::OrthotropicMaterial(*this); |
| 58 |
} |
| 59 |
|
| 60 |
// performs a check via getType and returns NULL if material is not ORTHOTROPIC |
| 61 |
VolumetricMesh::OrthotropicMaterial * downcastOrthotropicMaterial(VolumetricMesh::Material * material) |
| 62 |
{ |
| 63 |
if (material->getType() != VolumetricMesh::Material::ORTHOTROPIC) |
| 64 |
return NULL; |
| 65 |
|
| 66 |
return (VolumetricMesh::OrthotropicMaterial*) material; |
| 67 |
} |
| 68 |
|
| 69 |
void VolumetricMesh::OrthotropicMaterial::setR(double * R) |
| 70 |
{ |
| 71 |
memcpy(R_, R, sizeof(double) * 9); |
| 72 |
} |
| 73 |
|
| 74 |
void VolumetricMesh::OrthotropicMaterial::getR(double * R) const |
| 75 |
{ |
| 76 |
memcpy(R, R_, sizeof(double) * 9); |
| 77 |
} |
| 78 |
|