iMSTK
Interactive Medical Simulation Toolkit
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
imstk::GeometryAlgorithm Class Referenceabstract

Abstract base class for geometry algorithms. GeometryAlgorithms take N input geometries and produce N output geometries. Subclasses should implement requestUpdate to do algorithm logic. Subclasses may also setInputPortReq to require an input to be a certain type. More...

#include <imstkGeometryAlgorithm.h>

Inheritance diagram for imstk::GeometryAlgorithm:
Inheritance graph
[legend]

Public Member Functions

std::shared_ptr< GeometrygetInput (size_t port=0) const
 Returns input geometry given port, returns nullptr if doesn't exist.
 
std::shared_ptr< GeometrygetOutput (size_t port=0) const
 Returns output geometry given port, returns nullptr if doesn't exist.
 
void setInput (std::shared_ptr< Geometry > inputGeometry, size_t port=0)
 Set the input at the port.
 
void update ()
 Do the actual algorithm.
 

Protected Types

using GeometryCheck = std::function< bool(Geometry *)>
 
using TypeCheckContainer = std::unordered_map< size_t, GeometryCheck >
 

Protected Member Functions

void setOutput (std::shared_ptr< Geometry > inputGeometry, const size_t port=0)
 Set the output at the port.
 
template<typename T >
void setRequiredInputType (const size_t port)
 Declares the type for the port with the given number, also defines that the give port is required for the filter to run correctly.
 
template<typename T >
void setOptionalInputType (const size_t port)
 Declares the type for the port with the given number, the data for this port is optional and may be omitted.
 
virtual void requestUpdate ()=0
 Users can implement this for the logic to be run.
 
virtual bool areInputsValid ()
 Check inputs are correct. More...
 
void setNumInputPorts (const size_t numPorts)
 Get/Set the amount of input ports.
 
 imstkGetMacro (NumInputPorts, size_t)
 
void setNumOutputPorts (const size_t numPorts)
 Get/Set the amount of output ports.
 
 imstkGetMacro (NumOutputPorts, size_t)
 

Protected Attributes

TypeCheckContainer m_requiredTypeChecks
 
TypeCheckContainer m_optionalTypeChecks
 

Detailed Description

Abstract base class for geometry algorithms. GeometryAlgorithms take N input geometries and produce N output geometries. Subclasses should implement requestUpdate to do algorithm logic. Subclasses may also setInputPortReq to require an input to be a certain type.

Definition at line 39 of file imstkGeometryAlgorithm.h.

Member Function Documentation

◆ areInputsValid()

bool imstk::GeometryAlgorithm::areInputsValid ( )
protectedvirtual

Check inputs are correct.

Returns
true if all inputs match the requirements, false if not

Reimplemented in imstk::CollisionDetectionAlgorithm, and imstk::CompoundCD.

Definition at line 63 of file imstkGeometryAlgorithm.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: