Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
b2ea57c6
Commit
b2ea57c6
authored
Jan 04, 2016
by
Ricardo Ortiz
Browse files
ENH: Fix several compilation errors in the TimeIntegrators
module.
parent
467ea338
Pipeline
#4826
passed with stage
Changes
33
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
ContactHandling/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -13,6 +13,7 @@ target_link_libraries(ContactHandling
Event
Collision
Simulators
Solvers
)
if
(
BUILD_TESTING
)
...
...
ContactHandling/UnitTests/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -14,6 +14,8 @@ target_link_libraries(${Module}UnitTestRunner
Collision
Simulators
Mesh
ContactHandling
)
ContactHandling
Solvers
)
simple_test
(
${
Module
}
--reporter=spec
)
Core/SceneObject.h
View file @
b2ea57c6
...
...
@@ -68,7 +68,7 @@ public:
/// \brief Abstract object initialization
virtual
void
initialize
()
=
0
;
virtual
bool
configure
(
std
::
string
ConfigFile
)
=
0
;
virtual
bool
configure
(
const
std
::
string
&
ConfigFile
)
=
0
;
/// \brief Load the initial posiitons, velocities etc.,
virtual
void
loadInitialStates
()
=
0
;
...
...
Core/StaticSceneObject.cpp
View file @
b2ea57c6
...
...
@@ -56,7 +56,7 @@ void StaticSceneObject::loadInitialStates()
{
}
bool
StaticSceneObject
::
configure
(
const
std
::
string
/*ConfigFile*/
)
bool
StaticSceneObject
::
configure
(
const
std
::
string
&
/*ConfigFile*/
)
{
return
false
;
}
...
...
Core/StaticSceneObject.h
View file @
b2ea57c6
...
...
@@ -65,7 +65,7 @@ public:
void
loadInitialStates
()
override
;
/// \brief configure the static scene object using external config file (optional)
bool
configure
(
const
std
::
string
ConfigFile
)
override
;
bool
configure
(
const
std
::
string
&
ConfigFile
)
override
;
void
printInfo
()
const
override
;
...
...
Examples/AVMNidus/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -14,6 +14,7 @@ target_link_libraries(${APP}
ContactHandling
Event
IO
Solvers
)
set_target_properties
(
${
APP
}
...
...
Examples/FEMSimulator/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -13,6 +13,7 @@ target_link_libraries(${APP}
IO
Devices
VirtualTools
Solvers
)
set_target_properties
(
${
APP
}
...
...
Examples/LaparoscopicCamera/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -12,6 +12,7 @@ target_link_libraries(${APP}
IO
Devices
VirtualTools
Solvers
)
set_target_properties
(
${
APP
}
...
...
Examples/Shaders/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -11,6 +11,7 @@ target_link_libraries(${APP}
Mesh
Event
IO
Solvers
)
set_target_properties
(
${
APP
}
...
...
Simulators/CMakeLists.txt
View file @
b2ea57c6
...
...
@@ -5,12 +5,14 @@ simmedtk_add_library(Simulators
VegaFemSceneObject.cpp
VegaFemSimulator.cpp
VegaObjectConfig.cpp
VegaFEMDeformableSceneObject.cpp
PUBLIC_HEADERS
DefaultSimulator.h
SceneObjectDeformable.h
VegaFemSceneObject.h
VegaFemSimulator.h
VegaObjectConfig.h
VegaFEMDeformableSceneObject.h
)
target_link_libraries
(
Simulators
...
...
@@ -22,6 +24,8 @@ target_link_libraries(Simulators
IO
Devices
VirtualTools
Solvers
TimeIntegrators
PUBLIC
VegaFEM::configFile
VegaFEM::vega-getopts
...
...
@@ -36,9 +40,14 @@ target_link_libraries(Simulators
VegaFEM::loadList
VegaFEM::objMesh
VegaFEM::volumetricMesh
VegaFEM::forceModel
)
target_include_directories
(
Simulators
PRIVATE
${
CMAKE_SOURCE_DIR
}
/include
)
if
(
BUILD_TESTING
)
add_subdirectory
(
UnitTests
)
endif
()
Simulators/DeformableSceneObject.h
View file @
b2ea57c6
...
...
@@ -75,7 +75,7 @@ public:
///
/// \brief Initialize the ode solver.
///
bool
init
()
void
init
ialize
()
override
{
auto
thisPointer
=
this
->
safeDownCast
<
DeformableSceneObject
>
();
switch
(
integrationScheme
)
...
...
@@ -92,11 +92,14 @@ public:
{
std
::
cerr
<<
"Invalid time integration scheme."
<<
std
::
endl
;
}
return
false
;
}
}
virtual
bool
configure
(
const
std
::
string
&
)
{
return
false
;
}
///
/// \brief Update states
///
...
...
@@ -130,7 +133,7 @@ public:
///
std
::
shared_ptr
<
OdeSystemState
>
getCurrentState
()
{
this
->
currentState
;
return
this
->
currentState
;
}
///
...
...
@@ -138,9 +141,29 @@ public:
///
std
::
shared_ptr
<
OdeSystemState
>
getPreviousState
()
{
this
->
previousState
;
return
this
->
previousState
;
}
///////////////////////////////////////////////////////////////////////////////
//////////// TODO: These are pure virtual methods from superclass. ////////////
//////////// They should be removed in the future. ////////////
///////////////////////////////////////////////////////////////////////////////
///serialize function explicity writes the object to the memory block
///each scene object should know how to write itself to a memory block
void
serialize
(
void
*
){}
///Unserialize function can recover the object from the memory location
void
unSerialize
(
void
*
){};
///this function may not be used
///every Scene Object should know how to clone itself. Since the data structures will be
///in the beginning of the modules(such as simulator, viewer, collision etc.)
std
::
shared_ptr
<
SceneObject
>
clone
(){
return
nullptr
;};
/// \brief print information related the scene object
void
printInfo
()
const
{};
protected:
std
::
shared_ptr
<
TimeIntegrator
>
odeSolver
;
///> Integration scheme
...
...
Simulators/UnitTests/CMakeLists.txt
0 → 100644
View file @
b2ea57c6
set
(
Module Simulators
)
add_executable
(
${
Module
}
UnitTestRunner
${
BANDIT_RUNNER
}
VegaFEMDeformableSceneObjectSpec.cpp
)
target_compile_options
(
${
Module
}
UnitTestRunner PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wno-old-style-cast -Wno-multichar -Wno-type-limits>
)
target_link_libraries
(
${
Module
}
UnitTestRunner Core Mesh IO Solvers TimeIntegrators Simulators
)
simple_test
(
${
Module
}
--reporter=xunit
)
Simulators/UnitTests/VegaFEMDeformableSceneObjectSpec.cpp
0 → 100644
View file @
b2ea57c6
// This file is part of the SimMedTK project.
// Copyright (c) Center for Modeling, Simulation, and Imaging in Medicine,
// Rensselaer Polytechnic Institute
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//---------------------------------------------------------------------------
//
// Authors:
//
// Contact:
//---------------------------------------------------------------------------
#include <bandit/bandit.h>
#include <memory>
#include <iostream>
// SimMedTK includes
#include "Simulators/VegaFEMDeformableSceneObject.h"
using
namespace
bandit
;
using
namespace
core
;
go_bandit
([]()
{
describe
(
"Vega Deformable Scene Object"
,
[
&
]()
{
VegaFEMDeformableSceneObject
sceneObject
(
"box.veg"
,
"box.config"
);
// auto sceneObject = std::make_shared<VegaFEMDeformableSceneObject>("box.veg","box.config");
// it("constructs ", [&]()
// {
// AssertThat(sceneObject != nullptr, IsTrue());
// });
});
});
Simulators/VegaFEMDeformableSceneObject.cpp
View file @
b2ea57c6
This diff is collapsed.
Click to expand it.
Simulators/VegaFEMDeformableSceneObject.h
View file @
b2ea57c6
This diff is collapsed.
Click to expand it.
Simulators/VegaFemSceneObject.cpp
View file @
b2ea57c6
...
...
@@ -73,7 +73,7 @@ std::shared_ptr<SceneObject> VegaFemSceneObject::clone()
return
safeDownCast
<
SceneObject
>
();
}
bool
VegaFemSceneObject
::
configure
(
const
std
::
string
ConfigFile
)
bool
VegaFemSceneObject
::
configure
(
const
std
::
string
&
ConfigFile
)
{
femConfig
=
std
::
make_shared
<
VegaObjectConfig
>
();
...
...
Simulators/VegaFemSceneObject.h
View file @
b2ea57c6
...
...
@@ -87,7 +87,7 @@ public:
void
initialize
()
override
;
/// \brief configure the vega fem scene object using external config file
bool
configure
(
const
std
::
string
ConfigFile
)
override
;
bool
configure
(
const
std
::
string
&
ConfigFile
)
override
;
/// \brief load initial displacements and velocities of the nodes
void
loadInitialStates
()
override
;
...
...
Solvers/InexactNewton.cpp
View file @
b2ea57c6
...
...
@@ -124,6 +124,7 @@ void InexactNewton::updateJacobian(const core::Vectord &x)
}
const
core
::
SparseMatrixd
&
jacobianMatrix
=
this
->
jacobian
(
x
);
const
core
::
Vectord
&
f
=
this
->
nonLinearSystem
->
getFunctionValue
();
if
(
!
(
jacobianMatrix
.
innerSize
()
>
0
))
{
// TODO: Print message and/or log error.
...
...
@@ -131,9 +132,8 @@ void InexactNewton::updateJacobian(const core::Vectord &x)
}
auto
linearSystem
=
std
::
make_shared
<
LinearSolverType
::
LinearSystemType
>
(
jacobianMatrix
,
this
->
f
);
jacobianMatrix
,
f
);
this
->
linearSolver
->
setSystem
(
linearSystem
);
}
//---------------------------------------------------------------------------
...
...
Solvers/InexactNewton.h
View file @
b2ea57c6
...
...
@@ -226,7 +226,7 @@ private:
double
relativeTolerance
;
///> Relative (to the rhs) tolerance (Default: 1.0e-6).
double
gamma
;
///> Internal parameter used to update the forcing term (Default: 0.9).
double
etaMax
;
///> Maximum tolerance for the linear solver (Default: 0.9).
size_t
maxIterations
;
///> Maximum number of nonlinear iterations (Default:
4
0).
size_t
maxIterations
;
///> Maximum number of nonlinear iterations (Default:
5
0).
bool
useArmijo
;
///> True if Armijo liner search is desired (Default: true).
};
...
...
Solvers/NonLinearSolver.h
View file @
b2ea57c6
...
...
@@ -123,7 +123,6 @@ public:
void
setUpdateIterate
(
const
UpdateIterateType
&
newUpdateIterate
);
protected:
core
::
Vectord
f
;
///< Storage for function evaluations
std
::
array
<
double
,
2
>
sigma
;
///< Safeguarding bounds for the line search
double
alpha
;
///< Parameter to measure decrease
size_t
armijoMax
;
///< Maximum number of step length reductions
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment