Skip to content

Commit

Permalink
Merge pull request #2 from hugtalbot/fix_compatibility_with_NG
Browse files Browse the repository at this point in the history
Update to be compatible with SOFA NG
  • Loading branch information
hugtalbot committed Aug 12, 2022
2 parents 1e7d7bf + b254b1d commit a6336c8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2019]
sofa_branch: [master, v21.12]
sofa_branch: [master, v22.06]

steps:
- name: Setup SOFA and environment
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.12)
project(SofaMJEDFEM VERSION 21.12 LANGUAGES CXX)
project(SofaMJEDFEM VERSION 22.06 LANGUAGES CXX)

find_package(SofaFramework REQUIRED)
find_package(SofaBaseTopology REQUIRED)
find_package(SofaBaseMechanics REQUIRED)
find_package(Sofa.Framework REQUIRED)
find_package(Sofa.Component REQUIRED)
find_package(Sofa.GL REQUIRED)

set(SOFAMJEDFEM_SRC_DIR src/SofaMJEDFEM)
Expand Down Expand Up @@ -40,7 +39,7 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILE


# Link the plugin library to its dependency
target_link_libraries(${PROJECT_NAME} SofaBaseTopology SofaBaseMechanics Sofa.GL)
target_link_libraries(${PROJECT_NAME} Sofa.Core Sofa.Type Sofa.DefaultType Sofa.Component.Topology Sofa.Component.StateContainer Sofa.Component.SolidMechanics.FEM.HyperElastic Sofa.GL)


# Create package Config, Version & Target files
Expand Down
5 changes: 2 additions & 3 deletions SofaMJEDFEMConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
@PACKAGE_GUARD@
@PACKAGE_INIT@

find_package(SofaFramework REQUIRED)
find_package(SofaBaseTopology REQUIRED)
find_package(SofaBaseMechanics REQUIRED)
find_package(Sofa.Framework REQUIRED)
find_package(Sofa.Component REQUIRED)
find_package(Sofa.GL REQUIRED)

if(NOT TARGET @PROJECT_NAME@)
Expand Down
4 changes: 3 additions & 1 deletion src/SofaMJEDFEM/MJEDTetrahedralForceField.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,9 @@ type::Mat<3,3,double> MJEDTetrahedralForceField<DataTypes>::getForce(int Tetrahe
tetInfo=&tetrahedronInf[TetrahedronIndex];
type::Mat<3,3,double> force,inverseDeformationGradient;
force.clear();
inverseDeformationGradient.invert(tetInfo->deformationGradient);
const bool canInvert = inverseDeformationGradient.invert(tetInfo->deformationGradient);
assert(canInvert);
SOFA_UNUSED(canInvert);
for(unsigned int w=0;w<isExponential.size();++w){
if(!isExponential[w]){
force+=(tetInfo->sumfS[w].MatSymMultiply(tetInfo->deformationGradient)+inverseDeformationGradient.transposed()*tetInfo->sumDfg[w]*tetInfo->J)*tetInfo->coeff[w];
Expand Down
2 changes: 1 addition & 1 deletion src/SofaMJEDFEM/fem/material/NeoHookeanIsotropicMJED.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
******************************************************************************/
#pragma once

#include <SofaMiscFem/HyperelasticMaterial.h>
#include <sofa/component/solidmechanics/fem/hyperelastic/material/HyperelasticMaterial.h>
#include <sofa/type/Vec.h>
#include <sofa/type/Mat.h>
#include <string>
Expand Down
6 changes: 0 additions & 6 deletions src/SofaMJEDFEM/fem/material/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
******************************************************************************/
//used only to test compilation and dependencies in SOFA. (TODO: see if it has to be removed, or to be removed as soon as another .cpp include them)

#include <SofaMiscFem/BoyceAndArruda.h>
#include <SofaMiscFem/MooneyRivlin.h>
#include <SofaMiscFem/STVenantKirchhoff.h>
#include <SofaMiscFem/HyperelasticMaterial.h>
#include <SofaMiscFem/VerondaWestman.h>
#include <SofaMiscFem/Costa.h>
#include <SofaMJEDFEM/fem/material/NeoHookean.h>
#include <SofaMJEDFEM/fem/material/NeoHookeanIsotropicMJED.h>
#include <SofaMJEDFEM/fem/material/Ogden.h>
Expand Down

0 comments on commit a6336c8

Please sign in to comment.