SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::component::linearsystem::MappingGraph Class Reference

#include <MappingGraph.h>

Detailed Description

Connexions between objects through mappings

Graph must be built with the build() function.

Classes

struct  SameGroupComponents
 

Public Member Functions

core::objectmodel::BaseContextgetRootNode () const
 Return the node used to start the exploration of the scene graph in order to build the mapping graph. More...
 
const sofa::type::vector< BaseMechanicalState * > & getMainMechanicalStates () const
 Return the list of all mechanical states which are not mapped. More...
 
MappingInputs getTopMostMechanicalStates (BaseMechanicalState *) const
 
MappingInputs getTopMostMechanicalStates (core::behavior::BaseForceField *) const
 
MappingInputs getTopMostMechanicalStates (core::behavior::BaseMass *) const
 
ComponentGroups makeComponentGroups (const sofa::core::ExecParams *params) const
 Create groups of components associated to the same mechanical state. More...
 
bool hasAnyMapping () const
 
bool hasAnyMappingInput (BaseMechanicalState *) const
 Return true if the provided mechanical state is an output of a mapping. More...
 
bool hasAnyMappingInput (core::behavior::BaseForceField *) const
 Return true if the mechanical states associated to the provided force field is an output of a mapping. More...
 
bool hasAnyMappingInput (core::behavior::BaseMass *) const
 Return true if the mechanical states associated to the provided mass is an output of a mapping. More...
 
bool isMechanicalStateInContext (BaseMechanicalState *) const
 Return true if the provided mechanical state has been visited when building the mapping graph. More...
 
bool isMappingInput (BaseMechanicalState *mappingInput, BaseMechanicalState *mappingOutput) const
 
MappingInputs getMappingInputs (BaseMechanicalState *) const
 
sofa::type::vector< core::BaseMapping * > getBottomUpMappingsFrom (BaseMechanicalState *) const
 
sofa::Size getTotalNbMainDofs () const
 Return the sum of the degrees of freedom of all main mechanical states. More...
 
type::Vec2u getPositionInGlobalMatrix (BaseMechanicalState *) const
 Return where in the global matrix the provided mechanical state writes its contribution. More...
 
type::Vec2u getPositionInGlobalMatrix (BaseMechanicalState *a, BaseMechanicalState *b) const
 Return where in the global matrix the provided mechanical states writes its contribution. More...
 
 MappingGraph ()=default
 
bool isBuilt () const
 
void build (const sofa::core::ExecParams *params, core::objectmodel::BaseContext *rootNode)
 Build the graph: mandatory to get valid data from the functions that use the graph. More...
 

Constructor details

◆ MappingGraph()

sofa::component::linearsystem::MappingGraph::MappingGraph ( )
default

Function details

◆ build()

void sofa::component::linearsystem::MappingGraph::build ( const sofa::core::ExecParams params,
core::objectmodel::BaseContext rootNode 
)

Build the graph: mandatory to get valid data from the functions that use the graph.

◆ getBottomUpMappingsFrom()

sofa::type::vector< core::BaseMapping * > sofa::component::linearsystem::MappingGraph::getBottomUpMappingsFrom ( BaseMechanicalState mstate) const

◆ getMainMechanicalStates()

const sofa::type::vector< core::behavior::BaseMechanicalState * > & sofa::component::linearsystem::MappingGraph::getMainMechanicalStates ( ) const

Return the list of all mechanical states which are not mapped.

◆ getMappingInputs()

sofa::type::vector< BaseMechanicalState * > sofa::component::linearsystem::MappingGraph::getMappingInputs ( BaseMechanicalState mstate) const

Returns all mechanical states which are input of a mapping where the mechanical state in parameter is an output

◆ getPositionInGlobalMatrix() [1/2]

type::Vec2u sofa::component::linearsystem::MappingGraph::getPositionInGlobalMatrix ( BaseMechanicalState mstate) const

Return where in the global matrix the provided mechanical state writes its contribution.

◆ getPositionInGlobalMatrix() [2/2]

type::Vec2u sofa::component::linearsystem::MappingGraph::getPositionInGlobalMatrix ( BaseMechanicalState a,
BaseMechanicalState b 
) const

Return where in the global matrix the provided mechanical states writes its contribution.

◆ getRootNode()

core::objectmodel::BaseContext * sofa::component::linearsystem::MappingGraph::getRootNode ( ) const

Return the node used to start the exploration of the scene graph in order to build the mapping graph.

◆ getTopMostMechanicalStates() [1/3]

auto sofa::component::linearsystem::MappingGraph::getTopMostMechanicalStates ( BaseMechanicalState mstate) const

Return the list of mechanical states which are: 1) non-mapped 2) input of a mapping involving the provided mechanical state as an output. The search is recursive (more than one level of mapping) and is done during mapping graph construction.

◆ getTopMostMechanicalStates() [2/3]

auto sofa::component::linearsystem::MappingGraph::getTopMostMechanicalStates ( core::behavior::BaseForceField forceField) const

Return the list of mechanical states which are: 1) non-mapped 2) input of a mapping involving the mechanical states associated to the provided force field as an output. The search is recursive (more than one level of mapping) and is done during mapping graph construction.

◆ getTopMostMechanicalStates() [3/3]

auto sofa::component::linearsystem::MappingGraph::getTopMostMechanicalStates ( core::behavior::BaseMass mass) const

Return the list of mechanical states which are: 1) non-mapped 2) input of a mapping involving the mechanical states associated to the provided mass as an output. The search is recursive (more than one level of mapping) and is done during mapping graph construction.

◆ getTotalNbMainDofs()

sofa::Size sofa::component::linearsystem::MappingGraph::getTotalNbMainDofs ( ) const
inline

Return the sum of the degrees of freedom of all main mechanical states.

◆ hasAnyMapping()

bool sofa::component::linearsystem::MappingGraph::hasAnyMapping ( ) const

◆ hasAnyMappingInput() [1/3]

bool sofa::component::linearsystem::MappingGraph::hasAnyMappingInput ( BaseMechanicalState mstate) const

Return true if the provided mechanical state is an output of a mapping.

◆ hasAnyMappingInput() [2/3]

bool sofa::component::linearsystem::MappingGraph::hasAnyMappingInput ( core::behavior::BaseForceField forceField) const

Return true if the mechanical states associated to the provided force field is an output of a mapping.

◆ hasAnyMappingInput() [3/3]

bool sofa::component::linearsystem::MappingGraph::hasAnyMappingInput ( core::behavior::BaseMass mass) const

Return true if the mechanical states associated to the provided mass is an output of a mapping.

◆ isBuilt()

bool sofa::component::linearsystem::MappingGraph::isBuilt ( ) const

◆ isMappingInput()

bool sofa::component::linearsystem::MappingGraph::isMappingInput ( BaseMechanicalState mappingInput,
BaseMechanicalState mappingOutput 
) const

Return true if @input is a mapping input of @output. Multiple intermediate mappings are supported In term of graph connectivity, return true if the two nodes of the directed graph are connected

◆ isMechanicalStateInContext()

bool sofa::component::linearsystem::MappingGraph::isMechanicalStateInContext ( BaseMechanicalState mstate) const

Return true if the provided mechanical state has been visited when building the mapping graph.

◆ makeComponentGroups()

MappingGraph::ComponentGroups sofa::component::linearsystem::MappingGraph::makeComponentGroups ( const sofa::core::ExecParams params) const

Create groups of components associated to the same mechanical state.