| 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 | #include "StVKElementABCDLoader.h" |
| 30 | #include "StVKCubeABCD.h" |
| 31 | #include "StVKTetABCD.h" |
| 32 | #include "StVKTetHighMemoryABCD.h" |
| 33 | #include "cubicMesh.h" |
| 34 | #include "tetMesh.h" |
| 35 | |
| 36 | StVKElementABCD * StVKElementABCDLoader::load(VolumetricMesh * volumetricMesh, unsigned int loadingFlag) |
| 37 | { |
| 38 | if (volumetricMesh == NULL) |
| 39 | { |
| 40 | printf("Error: volumetric mesh is NULL.\n"); |
| 41 | return NULL; |
| 42 | } |
| 43 | |
| 44 | VolumetricMesh::elementType elementType_ = volumetricMesh->getElementType(); |
| 45 | StVKElementABCD * stVKElementABCD = NULL; |
| 46 | /* |
| 47 | if (elementType_ == CubicMesh::elementType()) |
| 48 | { |
| 49 | //printf("Loading cubic mesh integrals...\n"); |
| 50 | CubicMesh * cubeMesh = (CubicMesh*) volumetricMesh; |
| 51 | stVKElementABCD = new StVKCubeABCD(cubeMesh->getCubeSize()); |
| 52 | } |
| 53 | */ |
| 54 | if (elementType_ == TetMesh::elementType()) |
| 55 | { |
| 56 | //printf("Loading tet mesh integrals...\n"); |
| 57 | TetMesh * tetMesh = (TetMesh*) volumetricMesh; |
| 58 | if ((loadingFlag & 1) == 0) |
| 59 | { |
| 60 | //printf("Using the low-memory coefficient version.\n"); |
| 61 | stVKElementABCD = new StVKTetABCD(tetMesh); |
| 62 | } |
| 63 | else |
| 64 | { |
| 65 | //printf("Using the high-memory coefficient version.\n"); |
| 66 | stVKElementABCD = new StVKTetHighMemoryABCD(tetMesh); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (stVKElementABCD == NULL) |
| 71 | { |
| 72 | printf("Error in StVKElementABCDLoader: invalid mesh type.\n"); |
| 73 | exit(1); |
| 74 | } |
| 75 | |
| 76 | return stVKElementABCD; |
| 77 | } |
| 78 |