-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #478 from SofaDefrost/deprecate_elacticitytest_cre…
…ateSunPlanetSystem fix VariationalSymplecticImplicitSolverNonLinearForceDynamic_test
- Loading branch information
Showing
8 changed files
with
243 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
applications/plugins/SofaTest/Elasticity_test_deprecated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "Elasticity_test_deprecated.inl" | ||
namespace sofa { | ||
|
||
using namespace sofa::defaulttype; | ||
|
||
#ifdef SOFA_WITH_DOUBLE | ||
template struct SOFA_TestPlugin_API Elasticity_test_deprecated<sofa::defaulttype::Vec3dTypes>; | ||
#endif | ||
#ifdef SOFA_WITH_FLOAT | ||
template struct SOFA_TestPlugin_API Elasticity_test_deprecated<sofa::defaulttype::Vec3fTypes>; | ||
#endif | ||
} |
55 changes: 55 additions & 0 deletions
55
applications/plugins/SofaTest/Elasticity_test_deprecated.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture, development version * | ||
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify it * | ||
* under the terms of the GNU General Public License as published by the Free * | ||
* Software Foundation; either version 2 of the License, or (at your option) * | ||
* any later version. * | ||
* * | ||
* This program 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 General Public License for * | ||
* more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License along * | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#ifndef SOFA_Elasticity_test_deprecated_H | ||
#define SOFA_Elasticity_test_deprecated_H | ||
|
||
|
||
#include "Elasticity_test.h" | ||
|
||
namespace sofa { | ||
|
||
template< class DataTypes> | ||
struct SOFA_TestPlugin_API Elasticity_test_deprecated: public Elasticity_test<DataTypes> | ||
{ | ||
typedef component::container::MechanicalObject<DataTypes> DOFs; | ||
typedef typename DOFs::Coord Coord; | ||
typedef typename DOFs::Deriv Deriv; | ||
|
||
/// Create sun-planet system | ||
simulation::Node::SPtr createSunPlanetSystem( | ||
simulation::Node::SPtr root, | ||
double mSun, | ||
double mPlanet, | ||
double g, | ||
Coord xSun, | ||
Deriv vSun, | ||
Coord xPlanet, | ||
Deriv vPlanet); | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
} // namespace sofa | ||
|
||
#endif |
120 changes: 120 additions & 0 deletions
120
applications/plugins/SofaTest/Elasticity_test_deprecated.inl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture, development version * | ||
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify it * | ||
* under the terms of the GNU General Public License as published by the Free * | ||
* Software Foundation; either version 2 of the License, or (at your option) * | ||
* any later version. * | ||
* * | ||
* This program 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 General Public License for * | ||
* more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License along * | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#ifndef SOFA_Elasticity_test_deprecated_INL | ||
#define SOFA_Elasticity_test_deprecated_INL | ||
|
||
#include "Elasticity_test_deprecated.h" | ||
|
||
// Solvers | ||
#include <SofaImplicitOdeSolver/EulerImplicitSolver.h> | ||
#include <SofaImplicitOdeSolver/StaticSolver.h> | ||
#include <SofaBaseLinearSolver/CGLinearSolver.h> | ||
|
||
// Box roi | ||
#include <SofaGeneralEngine/PairBoxRoi.h> | ||
#include <SofaEngine/BoxROI.h> | ||
#include <SofaGeneralEngine/GenerateCylinder.h> | ||
|
||
// Constraint | ||
#include <SofaBoundaryCondition/ProjectToLineConstraint.h> | ||
#include <SofaBoundaryCondition/FixedConstraint.h> | ||
#include <SofaBoundaryCondition/AffineMovementConstraint.h> | ||
#include <SofaBoundaryCondition/FixedPlaneConstraint.h> | ||
|
||
// ForceField | ||
#include <SofaBoundaryCondition/TrianglePressureForceField.h> | ||
#include <SofaMiscForceField/LennardJonesForceField.h> | ||
|
||
#include <SofaBaseMechanics/MechanicalObject.h> | ||
#include <SofaBaseMechanics/UniformMass.h> | ||
#include <SofaBaseTopology/RegularGridTopology.h> | ||
#include <SofaBaseTopology/TetrahedronSetGeometryAlgorithms.h> | ||
#include <SofaBaseVisual/VisualStyle.h> | ||
#include <SofaGeneralDeformable/RegularGridSpringForceField.h> | ||
#include <SofaDeformable/StiffSpringForceField.h> | ||
#include <SofaMiscForceField/MeshMatrixMass.h> | ||
#include <SofaMiscMapping/SubsetMultiMapping.h> | ||
#include <SofaRigid/RigidMapping.h> | ||
|
||
namespace sofa | ||
{ | ||
|
||
typedef component::container::MechanicalObject<defaulttype::Vec3Types> MechanicalObject3; | ||
typedef component::projectiveconstraintset::FixedConstraint<defaulttype::Vec3Types> FixedConstraint3; | ||
typedef component::mass::UniformMass<defaulttype::Vec3Types, SReal> UniformMass3; | ||
|
||
template<class DataTypes> | ||
simulation::Node::SPtr Elasticity_test_deprecated<DataTypes>::createSunPlanetSystem( | ||
simulation::Node::SPtr root, | ||
double mSun, | ||
double mPlanet, | ||
double g, | ||
Coord xSun, | ||
Deriv vSun, | ||
Coord xPlanet, | ||
Deriv vPlanet) | ||
{ | ||
|
||
// Mechanical object with 2 dofs: first sun, second planet | ||
MechanicalObject3::SPtr sunPlanet_dof = modeling::addNew<MechanicalObject3>(root,"sunPlanet_MO"); | ||
|
||
// Set position and velocity | ||
sunPlanet_dof->resize(2); | ||
// Position | ||
MechanicalObject3::VecCoord positions(2); | ||
positions[0] = xSun; | ||
positions[1]= xPlanet; | ||
MechanicalObject3::WriteVecCoord xdof = sunPlanet_dof->writePositions(); | ||
copyToData( xdof, positions ); | ||
// Velocity | ||
MechanicalObject3::VecDeriv velocities(2); | ||
velocities[0] = vSun; | ||
velocities[1]= vPlanet; | ||
MechanicalObject3::WriteVecDeriv vdof = sunPlanet_dof->writeVelocities(); | ||
copyToData( vdof, velocities ); | ||
|
||
// Fix sun | ||
FixedConstraint3::SPtr fixed = modeling::addNew<FixedConstraint3>(root,"FixedSun"); | ||
fixed->addConstraint(0); | ||
|
||
// Uniform Mass | ||
UniformMass3::SPtr massPtr = modeling::addNew<UniformMass3>(root,"mass"); | ||
massPtr->d_totalMass.setValue(mPlanet + mSun); | ||
|
||
// Lennard Jones Force Field | ||
//TODO: Find another FF to add in this test. If Sympletic solver are not deprecated. Erik STC #4 | ||
typename component::forcefield::LennardJonesForceField<DataTypes>::SPtr ff = | ||
modeling::addNew<typename component::forcefield::LennardJonesForceField<DataTypes> >(root); | ||
// Set froce field parameters | ||
ff->setAlpha(1); | ||
ff->setBeta(-1); | ||
ff->setAInit(mPlanet*mSun*g); | ||
|
||
return root; | ||
|
||
} | ||
|
||
|
||
}// sofa | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters