iMSTK
Interactive Medical Simulation Toolkit
imstkReducedFeDeformableObject.cpp
1 /*=========================================================================
2 
3  Library: iMSTK
4 
5  Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
6  & Imaging in Medicine, Rensselaer Polytechnic Institute.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0.txt
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =========================================================================*/
21 
22 #include "imstkReducedFeDeformableObject.h"
23 #include "imstkReducedStVKBodyModel.h"
24 #include "imstkLogger.h"
25 
26 namespace imstk
27 {
28 Vectord&
30 {
31  CHECK(m_defModel != nullptr) << "deformation model pointer not valid DeformableObject::getContactForce()";
32 
33  return m_defModel->getContactForce();
34 }
35 
36 bool
38 {
39  m_defModel = std::dynamic_pointer_cast<ReducedStVK>(m_dynamicalModel);
40 
41  if (m_defModel)
42  {
44  }
45  else
46  {
47  LOG(FATAL) << "Dynamics pointer cast failure in DeformableObject::initialize()";
48  return false;
49  }
50 }
51 
52 const Vectord&
54 {
55  return m_defModel->getCurrentState()->getQ();
56 }
57 
58 const Vectord&
60 {
61  return m_defModel->getPreviousState()->getQ();
62 }
63 
64 const Vectord&
66 {
67  return m_defModel->getCurrentState()->getQDot();
68 }
69 
70 const Vectord&
72 {
73  return m_defModel->getPreviousState()->getQDot();
74 }
75 
76 const Vectord&
78 {
79  return m_defModel->getCurrentState()->getQDotDot();
80 }
81 
82 const Vectord&
84 {
85  return m_defModel->getPreviousState()->getQDotDot();
86 }
87 } // imstk
Vectord & getContactForce()
Set/Get dynamical model.
Compound Geometry.
const Vectord & getAccelerations() const
Get the vector of current accelerations.
const Vectord & getVelocities() const
Get the vector of current velocities.
const Vectord & getPrevAccelerations() const
Get the vector of accelerations from previous time step.
bool initialize() override
Initialize the scene object.
std::shared_ptr< AbstractDynamicalModel > m_dynamicalModel
Dynamical model.
const Vectord & getPrevVelocities() const
Get the vector of velocities from previous time step.
const Vectord & getPrevDisplacements() const
Get the vector of displacements from previous time step.
bool initialize() override
Initialize the deformable object.
const Vectord & getDisplacements() const
Get the vector of current displacements.