Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 0 additions & 15 deletions Sofa/Component/IO/Mesh/src/sofa/component/io/mesh/MeshExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,6 @@
#include <sofa/helper/OptionsGroup.h>
#include <sofa/simulation/BaseSimulationExporter.h>

///////////////////////////// FORWARD DECLARATION //////////////////////////////////////////////////
namespace sofa::core
{
namespace objectmodel {
class Event ;
}
namespace behavior {
class BaseMechanicalState;
}
namespace topology {
class BaseMeshTopology ;
}
}


////////////////////////////////// DECLARATION /////////////////////////////////////////////////////
namespace sofa::component::_meshexporter_
{
Expand Down
10 changes: 0 additions & 10 deletions Sofa/Component/Visual/src/sofa/component/visual/Visual3DText.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
#include <sofa/core/visual/VisualModel.h>
#include <sofa/type/RGBAColor.h>

namespace sofa::core::topology
{
class BaseMeshTopology;
} // namespace sofa::core::topology

namespace sofa::core::behavior
{
class BaseMechanicalState;
} // namespace sofa::core::behavior

namespace sofa::component::visual
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@
#include <sofa/core/topology/TopologyData.h>
#include <sofa/type/RGBAColor.h>

namespace sofa::core::topology
{
class BaseMeshTopology;
} // namespace sofa::core::topology

namespace sofa::core::behavior
{
class BaseMechanicalState;
} // namespace sofa::core::behavior

namespace sofa::gl::component::rendering3d
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@
#include <sofa/core/topology/TopologyData.h>
#include <sofa/gl/template.h>

namespace sofa::core::topology
{
class BaseMeshTopology;
} // namespace sofa::core::topology

namespace sofa::core::behavior
{
class BaseMechanicalState;
} // namespace sofa::core::behavior

namespace sofa::gl::component::rendering3d
{

Expand Down
5 changes: 3 additions & 2 deletions Sofa/framework/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ set(HEADER_FILES
${SRC_ROOT}/behavior/BaseLocalMassMatrix.h
${SRC_ROOT}/behavior/BaseMass.h
${SRC_ROOT}/behavior/BaseMatrixLinearSystem.h
${SRC_ROOT}/behavior/BaseMechanicalState.h
${SRC_ROOT}/behavior/BaseOrderingMethod.h
${SRC_ROOT}/behavior/BaseProjectiveConstraintSet.h
${SRC_ROOT}/behavior/BaseRotationFinder.h
${SRC_ROOT}/behavior/BaseVectorOperations.h
${SRC_ROOT}/behavior/BaseVectorState.h
${SRC_ROOT}/behavior/BlocMatrixWriter.h
${SRC_ROOT}/behavior/BlockType.h
${SRC_ROOT}/behavior/Constraint.h
Expand Down Expand Up @@ -273,9 +273,9 @@ set(SOURCE_FILES
${SRC_ROOT}/behavior/BaseLinearSolver.cpp
${SRC_ROOT}/behavior/BaseMass.cpp
${SRC_ROOT}/behavior/BaseMatrixLinearSystem.cpp
${SRC_ROOT}/behavior/BaseMechanicalState.cpp
${SRC_ROOT}/behavior/BaseOrderingMethod.cpp
${SRC_ROOT}/behavior/BaseProjectiveConstraintSet.cpp
${SRC_ROOT}/behavior/BaseVectorState.cpp
${SRC_ROOT}/behavior/ConstraintCorrection.cpp
${SRC_ROOT}/behavior/ConstraintResolution.cpp
${SRC_ROOT}/behavior/ConstraintSolver.cpp
Expand Down Expand Up @@ -371,6 +371,7 @@ set(SOURCE_FILES

set(DEPRECATED_DIR "compat/sofa/core")
set(DEPRECATED_HEADER_FILES
${DEPRECATED_DIR}/behavior/BaseMechanicalState.h
${DEPRECATED_DIR}/objectmodel/BaseObject.h
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program 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 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser 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 *
******************************************************************************/
#pragma once
#include <sofa/core/behavior/BaseVectorState.h>

namespace sofa::core::behavior
{

using BaseMechanicalState = BaseVectorState;

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include <sofa/core/behavior/BaseMechanicalState.h>
#include <sofa/core/behavior/BaseVectorState.h>
#include <sofa/core/objectmodel/BaseNode.h>


namespace sofa::core::behavior
{

BaseMechanicalState::BaseMechanicalState()
BaseVectorState::BaseVectorState()
{
}

BaseMechanicalState::~BaseMechanicalState()
BaseVectorState::~BaseVectorState()
{
}

Expand All @@ -39,7 +39,7 @@ BaseMechanicalState::~BaseMechanicalState()
/// This is used to compute in on steps operations such as $v = v + a*dt, x = x + v*dt$.
/// Note that if the result vector appears inside the expression, it must be the first operand.
/// By default this method decompose the computation into multiple vOp calls.
void BaseMechanicalState::vMultiOp(const ExecParams* params, const VMultiOp& ops)
void BaseVectorState::vMultiOp(const ExecParams* params, const VMultiOp& ops)
{
for (const auto& op : ops)
{
Expand Down Expand Up @@ -79,25 +79,25 @@ void BaseMechanicalState::vMultiOp(const ExecParams* params, const VMultiOp& ops
}

/// Handle state Changes from a given Topology
void BaseMechanicalState::handleStateChange(core::topology::Topology* /*t*/)
void BaseVectorState::handleStateChange(core::topology::Topology* /*t*/)
{
// if (t == this->getContext()->getTopology())
// {
handleStateChange();
// }
}

void BaseMechanicalState::writeState( std::ostream& )
void BaseVectorState::writeState( std::ostream& )
{ }

bool BaseMechanicalState::insertInNode( objectmodel::BaseNode* node )
bool BaseVectorState::insertInNode( objectmodel::BaseNode* node )
{
node->addMechanicalState(this);
Inherit1::insertInNode(node);
return true;
}

bool BaseMechanicalState::removeInNode( objectmodel::BaseNode* node )
bool BaseVectorState::removeInNode( objectmodel::BaseNode* node )
{
node->removeMechanicalState(this);
Inherit1::removeInNode(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,20 @@
namespace sofa::core::behavior
{

/**
* \brief Component storing all state vectors of a simulated body (position, velocity, etc).
*
* This class only contains the data of the body and not any of its
* <i>active</i> computations, which are handled by the Mass, ForceField, and
* LagrangianConstraint components.
*
* Two types of vectors are used :
* \li \code VecCoord \endcode : containing positions.
* \li \code VecDeriv \endcode : derivative values, i.e. velocity, forces, displacements.
* In most cases they are the same (i.e. 3D/2D point particles), but they can
* be different (rigid frames for instance).
*
* Several pre-defined vectors are stored :
* \li \code position \endcode
* \li \code velocity \endcode
* \li \code force \endcode
* \li \code dx \endcode (displacement)
*
* Other vectors can be allocated to store other temporary values.
* Vectors can be assigned efficiently by just swapping pointers.
*
* In addition to state vectors, the current constraint system matrix is also
* stored, containing the coefficient of each constraint defined over the DOFs
* in this body.
*
*/
class SOFA_CORE_API BaseMechanicalState : public virtual BaseState
class SOFA_CORE_API BaseVectorState : public virtual BaseState
{
public:
SOFA_ABSTRACT_CLASS(BaseMechanicalState, BaseState);
SOFA_BASE_CAST_IMPLEMENTATION(BaseMechanicalState);
SOFA_ABSTRACT_CLASS(BaseVectorState, BaseState);
SOFA_BASE_CAST_IMPLEMENTATION(BaseVectorState);

using Index = sofa::Index;
protected:
BaseMechanicalState();
BaseVectorState();

~BaseMechanicalState() override;
~BaseVectorState() override;
private:
BaseMechanicalState(const BaseMechanicalState& n) = delete;
BaseMechanicalState& operator=(const BaseMechanicalState& n) = delete;
BaseVectorState(const BaseVectorState& n) = delete;
BaseVectorState& operator=(const BaseVectorState& n) = delete;

public:
/// @name Methods allowing to have access to the geometry without a template class (generic but not efficient)
Expand Down Expand Up @@ -299,7 +272,7 @@ class SOFA_CORE_API BaseMechanicalState : public virtual BaseState
virtual bool pickParticles(const ExecParams* /* params */, double /*rayOx*/, double /*rayOy*/, double /*rayOz*/,
double /*rayDx*/, double /*rayDy*/, double /*rayDz*/,
double /*radius0*/, double /*dRadius*/,
std::multimap< double, std::pair<sofa::core::behavior::BaseMechanicalState*, int> >& /*particles*/)
std::multimap< double, std::pair<sofa::core::behavior::BaseVectorState*, int> >& /*particles*/)
{
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion Sofa/framework/Core/src/sofa/core/behavior/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace sofa::core::behavior
class BaseInteractionForceField;
class BaseInteractionProjectiveConstraintSet;
class BaseMass;
class BaseMechanicalState;
class BaseVectorState;
using BaseMechanicalState = BaseVectorState;
class MultiMatrixAccessor;
}
7 changes: 7 additions & 0 deletions Sofa/framework/Core/src/sofa/core/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,10 @@ SOFA_ATTRIBUTE_DISABLED("v26.12", "v27.06", "Use solveLinearSystem instead of ac
#define SOFA_CORE_DEPRECATED_GETDATAVECFROMMULTIVECID() \
SOFA_ATTRIBUTE_DEPRECATED("v26.12", "v27.12", "")
#endif

#ifdef SOFA_BUILD_SOFA_CORE
#define SOFA_ATTRIBUTE_DEPRECATED__TOBASEMECHANICALSTATE()
#else
#define SOFA_ATTRIBUTE_DEPRECATED__TOBASEMECHANICALSTATE() \
SOFA_ATTRIBUTE_DEPRECATED("v26.12", "v27.06", "Use toBaseVectorState instead.")
#endif
4 changes: 2 additions & 2 deletions Sofa/framework/Core/src/sofa/core/fwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <sofa/core/behavior/BaseMass.h>
#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/behavior/ConstraintSolver.h>
#include <sofa/core/behavior/BaseMechanicalState.h>
#include <sofa/core/behavior/BaseVectorState.h>
#include <sofa/core/behavior/BaseForceField.h>
#include <sofa/core/behavior/LinearSolver.h>
#include <sofa/core/behavior/BaseConstraintSet.h>
Expand Down Expand Up @@ -174,7 +174,7 @@ SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseMass);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseIntegrationScheme);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::ConstraintSolver);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseLinearSolver);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseMechanicalState);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseVectorState);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseForceField);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseInteractionForceField);
SOFA_DEFINE_OPAQUE_FUNCTIONS_BETWEEN_BASE_AND(sofa::core::behavior::BaseProjectiveConstraintSet);
Expand Down
6 changes: 3 additions & 3 deletions Sofa/framework/Core/src/sofa/core/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ namespace sofa::core::behavior
{
class BaseForceField;
class BaseMass;
class BaseMechanicalState;
class BaseVectorState;
using BaseMechanicalState = BaseVectorState;
class BaseAnimationLoop;
class BaseLagrangianConstraint;
class BaseConstraintSet;
Expand All @@ -111,7 +112,6 @@ class BaseInteractionForceField;
class BaseProjectiveConstraintSet;
class BaseInteractionProjectiveConstraintSet;
class BaseInteractionConstraint;
class BaseMechanicalState;
class LinearSolver;
class MultiMatrixAccessor;

Expand Down Expand Up @@ -276,7 +276,7 @@ SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseMass);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseIntegrationScheme);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::ConstraintSolver);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseLinearSolver);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseMechanicalState);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseVectorState);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseForceField);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseInteractionForceField);
SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::behavior::BaseProjectiveConstraintSet);
Expand Down
5 changes: 4 additions & 1 deletion Sofa/framework/Core/src/sofa/core/objectmodel/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class SOFA_CORE_API Base : public IntrusiveObject
SOFA_BASE_CAST_DEFINITION( behavior, LinearSolver )
SOFA_BASE_CAST_DEFINITION( behavior, ConstraintSolver )
SOFA_BASE_CAST_DEFINITION( behavior, BaseMass )
SOFA_BASE_CAST_DEFINITION( behavior, BaseMechanicalState )
SOFA_BASE_CAST_DEFINITION( behavior, BaseVectorState )
SOFA_BASE_CAST_DEFINITION( behavior, BaseInteractionForceField )
SOFA_BASE_CAST_DEFINITION( behavior, BaseInteractionConstraint )
SOFA_BASE_CAST_DEFINITION( behavior, BaseForceField )
Expand Down Expand Up @@ -469,6 +469,9 @@ class SOFA_CORE_API Base : public IntrusiveObject
SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() virtual const objectmodel::BaseComponent* toBaseObject() const { return toBaseComponent(); }
SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() virtual objectmodel::BaseComponent* toBaseObject() { return toBaseComponent(); }

SOFA_ATTRIBUTE_DEPRECATED__TOBASEMECHANICALSTATE() virtual const behavior::BaseVectorState* toBaseMechanicalState() const { return toBaseVectorState(); }
SOFA_ATTRIBUTE_DEPRECATED__TOBASEMECHANICALSTATE() virtual behavior::BaseVectorState* toBaseMechanicalState() { return toBaseVectorState(); }

/// @}
};

Expand Down
2 changes: 1 addition & 1 deletion Sofa/framework/Core/src/sofa/core/objectmodel/BaseNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class SOFA_CORE_API BaseNode : public virtual Base
BASENODE_ADD_SPECIAL_COMPONENT( core::topology::BaseMeshTopology, MeshTopology, meshTopology )
BASENODE_ADD_SPECIAL_COMPONENT( core::topology::BaseTopologyObject, TopologyObject, topologyObject )
BASENODE_ADD_SPECIAL_COMPONENT( core::BaseState, State, state )
BASENODE_ADD_SPECIAL_COMPONENT( core::behavior::BaseMechanicalState,MechanicalState, mechanicalState )
BASENODE_ADD_SPECIAL_COMPONENT( core::behavior::BaseVectorState,MechanicalState, mechanicalState )
BASENODE_ADD_SPECIAL_COMPONENT( core::BaseMapping, MechanicalMapping, mechanicalMapping )
BASENODE_ADD_SPECIAL_COMPONENT( core::behavior::BaseMass, Mass, mass )
BASENODE_ADD_SPECIAL_COMPONENT( core::behavior::BaseForceField, ForceField, forceField )
Expand Down
Loading