Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosserat extension refactoring 2 #111

Merged
merged 26 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bef4478
Rename BaseCosserat into BaseCosseratMapping
damienmarchal Jun 11, 2024
6b170ea
Rename BaseCosserat files into BaseCosseratMapping
damienmarchal Jun 11, 2024
15f6037
Refactor the code so that BaseCosseratMapping is the base class of C…
damienmarchal Jun 11, 2024
6f463c9
Add a Cosserat/fwd.h file to declare new types in Cosserat plugin
damienmarchal Jun 12, 2024
87a30a7
Move SE3, se3, _SE3, _se3 out of the class.
damienmarchal Jun 12, 2024
18d8335
FIXUP
damienmarchal Jun 12, 2024
3e73639
Add a types.h file to factorize all types declaration in cosserat plu…
damienmarchal Jun 12, 2024
dc496d8
Add a comment in BaseCOsseratMapping.
damienmarchal Jun 12, 2024
837c3bf
Replace Matrix3 by Mat3x3 and Matrix4 by Mat4x4.
damienmarchal Jun 12, 2024
f4b88f2
Replace if(d_debug) msg_info("YOLO") by msg_info()
damienmarchal Jun 12, 2024
9aa7ac6
Replace ReadAccessor with sofa::helper::getReadAccessor;
damienmarchal Jun 12, 2024
077e984
remove toModel, fromModel1, fromModel2 to use he inherited attributes…
damienmarchal Jun 12, 2024
2d44aef
Several cleaning BaseCosseratMapping
damienmarchal Jun 12, 2024
e7392fe
Clean Vec6,Mat4x4 usage in BaseCosseratMapping for more readability (…
damienmarchal Jun 12, 2024
ee8b742
Cosmetic cleaning in BaseCosserat & DiscreteCorreseratMapping.h
damienmarchal Jun 13, 2024
293f3d7
Removes un-needed includes in BaseCosseratMapping.h
damienmarchal Jun 13, 2024
6a6f10d
Factorize toModel, fromModel1, fromModel2 in BaseCosseratMapping
damienmarchal Jun 13, 2024
0059942
Refactor the init() between BaseCosseratMapping & its child classes (…
damienmarchal Jun 13, 2024
bda1ff1
Factorize initialization in BaseCosseratMapping.
damienmarchal Jun 13, 2024
334cf6b
FIXUP initialization.
damienmarchal Jun 13, 2024
aa20251
Factorizing in init funciton.
damienmarchal Jun 13, 2024
60446a5
Types declaration in BaseCosseratMapping removed.
damienmarchal Jun 13, 2024
40279f6
Modernize types declaration in DiscreetCosseratMapping
damienmarchal Jun 13, 2024
b63fb6d
Refactor computeAdjoint.
damienmarchal Jun 18, 2024
35dada7
add callback function in case we are doing dynamic discretisation of …
adagolodjo Jun 25, 2024
6eee0d9
mv the initCosserat.h.in file into config.h.in
adagolodjo Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ endif()
set(SRC_ROOT_DIR src/${PROJECT_NAME})

set(HEADER_FILES
${SRC_ROOT_DIR}/initCosserat.h.in
${SRC_ROOT_DIR}/mapping/BaseCosserat.h
${SRC_ROOT_DIR}/mapping/BaseCosserat.inl
${SRC_ROOT_DIR}/config.h.in
${SRC_ROOT_DIR}/fwd.h
${SRC_ROOT_DIR}/types.h
${SRC_ROOT_DIR}/mapping/BaseCosseratMapping.h
${SRC_ROOT_DIR}/mapping/BaseCosseratMapping.inl
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.h
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.inl
${SRC_ROOT_DIR}/mapping/DiscreteDynamicCosseratMapping.h
Expand Down Expand Up @@ -50,7 +52,7 @@ set(HEADER_FILES
)
set(SOURCE_FILES
${SRC_ROOT_DIR}/initCosserat.cpp
${SRC_ROOT_DIR}/mapping/BaseCosserat.cpp
${SRC_ROOT_DIR}/mapping/BaseCosseratMapping.cpp
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.cpp
${SRC_ROOT_DIR}/mapping/DiscreteDynamicCosseratMapping.cpp
${SRC_ROOT_DIR}/engine/ProjectionEngine.cpp
Expand Down
2 changes: 1 addition & 1 deletion Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.12)

set(This Cosserat_test)

Expand Down
8 changes: 5 additions & 3 deletions docs/testScene/tuto_compare_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ def _add_cosserat_frame(p_node, _bending_node, framesF, _section_curv_abs, _fram

cosserat_in_Sofa_frame_node.addObject('UniformMass', totalMass=_beam_mass)

cosserat_in_Sofa_frame_node.addObject('DiscreteCosseratMapping', curv_abs_input=_section_curv_abs,
curv_abs_output=_frame_curv_abs, name='cosseratMapping',
cosserat_in_Sofa_frame_node.addObject('DiscreteCosseratMapping',
curv_abs_input=_section_curv_abs,
curv_abs_output=_frame_curv_abs,
name='cosseratMapping',
input1=_bending_node.cosserat_state.getLinkPath(),
input2=p_node.cosserat_base_mo.getLinkPath(),
output=frames_mo.getLinkPath(), debug=0, radius=_radius)
output=frames_mo.getLinkPath(), printLog=True, radius=_radius)
return cosserat_in_Sofa_frame_node


Expand Down
2 changes: 1 addition & 1 deletion src/Cosserat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(Cosserat.src VERSION 21.06.99)

set(HEADER_FILES
initCosserat.h
config.h

mapping/BaseCosserat.h
mapping/BaseCosserat.inl
Expand Down
21 changes: 6 additions & 15 deletions src/Cosserat/initCosserat.h.in → src/Cosserat/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
* Contact information: https://project.inria.fr/softrobot/contact/ *
* *
******************************************************************************/
#ifndef SOFA_COSSERAT_INIT_H
#define SOFA_COSSERAT_INIT_H
#pragma once

#include <sofa/config.h>

Expand All @@ -45,17 +44,9 @@
This is the plugin for the Discret Cosserat Plugin
*/

namespace Cosserat {

namespace type {
//using Vec3 = sofa::defaulttype::Vec3;
//using cosserat::type::SE3;
namespace Cosserat
{
SOFA_COSSERAT_API void init();
constexpr const char *MODULE_NAME = "@PROJECT_NAME@";
constexpr const char *MODULE_VERSION = "@PROJECT_VERSION@";
}


SOFA_COSSERAT_API void init();
constexpr const char *MODULE_NAME = "@PROJECT_NAME@";
constexpr const char *MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace Cosserat

#endif /* SOFA_COSSERAT_INIT_H */
2 changes: 1 addition & 1 deletion src/Cosserat/engine/ProjectionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef COSSERAT_ProjectionEngine_H
#define COSSERAT_ProjectionEngine_H

#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>
#include <sofa/core/behavior/PairInteractionConstraint.h>
#include <sofa/core/behavior/MechanicalState.h>
#include <sofa/core/DataEngine.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Cosserat/forcefield/BeamHookeLawForceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>

#include <sofa/type/Vec.h>
#include <sofa/type/Mat.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Cosserat/forcefield/BeamHookeLawForceFieldRigid.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>

#include <sofa/type/Vec.h>
#include <sofa/type/Mat.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Cosserat/forcefield/CosseratInternalActuation.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>

#include <sofa/type/Vec.h>
#include <sofa/type/Mat.h>
Expand Down
2 changes: 1 addition & 1 deletion src/Cosserat/forcefield/CosseratInternalActuation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>
#include <Cosserat/forcefield/CosseratInternalActuation.h>

#include <sofa/linearalgebra/FullVector.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
******************************************************************************/
#define SOFA_COMPONENT_FORCEFIELD_UNIFORMVELOCITYDAMPINGFORCEFIELD_CPP

#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>
#include <Cosserat/forcefield/MyUniformVelocityDampingForceField.inl>
#include <sofa/core/ObjectFactory.h>
#include <sofa/defaulttype/VecTypes.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>

#include <sofa/core/behavior/ForceField.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>
#include <Cosserat/forcefield/MyUniformVelocityDampingForceField.h>
#include "MyUniformVelocityDampingForceField.h"
#include <sofa/defaulttype/BaseMatrix.h>
Expand Down
41 changes: 41 additions & 0 deletions src/Cosserat/fwd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006-2018 INRIA, USTL, UJF, CNRS, MGH *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
*******************************************************************************
* Plugin Cosserat v1.0 *
* *
* This plugin is also distributed under the GNU LGPL (Lesser General *
* Public License) license with the same conditions than SOFA. *
* *
* Contributors: Defrost team (INRIA, University of Lille, CNRS, *
* Ecole Centrale de Lille) *
* *
* Contact information: https://project.inria.fr/softrobot/contact/ *
* *
******************************************************************************/
#pragma once

#include <Cosserat/config.h>
#include <sofa/type/fwd.h>
namespace Cosserat
{
namespace type
{
using SE3 = sofa::type::Matrix4;
}
}

2 changes: 1 addition & 1 deletion src/Cosserat/initCosserat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <Cosserat/initCosserat.h>
#include <Cosserat/config.h>

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
Expand Down
166 changes: 0 additions & 166 deletions src/Cosserat/mapping/BaseCosserat.cpp

This file was deleted.

Loading
Loading