Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
iMSTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ruiliang Gao
iMSTK
Commits
08c8b050
Commit
08c8b050
authored
8 years ago
by
Sreekanth Arikatla
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Make problem state a Vectord typ
Make problem state a Vectord type. This will be templated in future
parent
0cf98b15
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Base/SceneElements/Objects/imstkProblemState.h
+18
-34
18 additions, 34 deletions
Base/SceneElements/Objects/imstkProblemState.h
with
18 additions
and
34 deletions
Base/SceneElements/Objects/imstkProblemState.h
+
18
−
34
View file @
08c8b050
...
...
@@ -22,6 +22,8 @@
#ifndef imstkProblemState_h
#define imstkProblemState_h
#include
"imstkMath.h"
namespace
imstk
{
...
...
@@ -30,7 +32,6 @@ namespace imstk
///
/// \brief This class stores the state of the unknown field variable of the problem
///
template
<
class
T
>
class
ProblemState
{
public:
...
...
@@ -39,17 +40,24 @@ public:
/// \brief Constructor
///
ProblemState
()
=
default
;
ProblemState
(
const
T
&
u
,
const
T
&
v
,
const
T
&
a
=
0
);
ProblemState
(
const
Vectord
&
u
,
const
Vectord
&
v
,
const
Vectord
&
a
);
///
/// \brief Destructor
///
~
ProblemState
(){}
void
initialize
(
const
size_t
numDof
)
{
m_q
.
resize
(
numDof
);
m_qDot
.
resize
(
numDof
);
m_qDotDot
.
resize
(
numDof
);
};
///
/// \brief Set the state to a given one
///
void
setState
(
const
T
&
u
,
const
T
&
v
=
0
,
const
T
&
a
=
0
)
void
setState
(
const
Vectord
&
u
,
const
Vectord
&
v
,
const
Vectord
&
a
)
{
m_q
=
u
;
m_qDot
=
v
;
...
...
@@ -73,51 +81,27 @@ public:
///
/// \brief Get the state
///
T
&
getQ
()
const
{
if
(
!
m_q
)
{
LOG
(
WARNING
)
<<
"State variable is not initialized!"
}
return
m_q
;
}
Vectord
&
getQ
()
{
return
m_q
;
}
///
/// \brief Get the derivative of state w.r.t time
///
T
&
getQDot
()
const
{
if
(
!
m_qDot
)
{
LOG
(
WARNING
)
<<
"Time derivative of state variable is not initialized!"
}
return
m_qDot
;
}
Vectord
&
getQDot
()
{
return
m_qDot
;
}
///
/// \brief Get the double derivative of state w.r.t time
///
T
&
getQDotDot
()
const
{
if
(
!
m_qDotDot
)
{
LOG
(
WARNING
)
<<
"Double time derivative of state variable is not initialized!"
}
return
m_qDotDot
;
}
Vectord
&
getQDotDot
()
{
return
m_qDotDot
;
}
///
/// \brief Get the state
///
T
&
getState
()
{
return
getQ
();
}
Vectord
&
getState
()
{
return
getQ
();
}
protected
:
T
m_q
;
// State
T
m_qDot
;
// Derivative of state w.r.t time
T
m_qDotDot
;
// Double derivative of state w.r.t time
Vectord
m_q
;
// State
Vectord
m_qDot
;
// Derivative of state w.r.t time
Vectord
m_qDotDot
;
// Double derivative of state w.r.t time
};
}
// imstk
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment