Commit b2ea57c6 authored by Ricardo Ortiz's avatar Ricardo Ortiz
Browse files

ENH: Fix several compilation errors in the TimeIntegrators

module.
parent 467ea338
Pipeline #4826 passed with stage
......@@ -13,6 +13,7 @@ target_link_libraries(ContactHandling
Event
Collision
Simulators
Solvers
)
if(BUILD_TESTING)
......
......@@ -14,6 +14,8 @@ target_link_libraries(${Module}UnitTestRunner
Collision
Simulators
Mesh
ContactHandling)
ContactHandling
Solvers
)
simple_test(${Module} --reporter=spec)
......@@ -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;
......
......@@ -56,7 +56,7 @@ void StaticSceneObject::loadInitialStates()
{
}
bool StaticSceneObject::configure(const std::string /*ConfigFile*/)
bool StaticSceneObject::configure(const std::string &/*ConfigFile*/)
{
return false;
}
......
......@@ -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;
......
......@@ -14,6 +14,7 @@ target_link_libraries(${APP}
ContactHandling
Event
IO
Solvers
)
set_target_properties(${APP}
......
......@@ -13,6 +13,7 @@ target_link_libraries(${APP}
IO
Devices
VirtualTools
Solvers
)
set_target_properties(${APP}
......
......@@ -12,6 +12,7 @@ target_link_libraries(${APP}
IO
Devices
VirtualTools
Solvers
)
set_target_properties(${APP}
......
......@@ -11,6 +11,7 @@ target_link_libraries(${APP}
Mesh
Event
IO
Solvers
)
set_target_properties(${APP}
......
......@@ -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()
......@@ -75,7 +75,7 @@ public:
///
/// \brief Initialize the ode solver.
///
bool init()
void initialize() 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
......
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)
// 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());
// });
});
});
This diff is collapsed.
This diff is collapsed.
......@@ -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>();
......
......@@ -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;
......
......@@ -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);
}
//---------------------------------------------------------------------------
......
......@@ -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: 40).
size_t maxIterations; ///> Maximum number of nonlinear iterations (Default: 50).
bool useArmijo; ///> True if Armijo liner search is desired (Default: true).
};
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment