PhysicsManager.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_PHYSICSMANAGER_H
#define SURGSIM_PHYSICS_PHYSICSMANAGER_H
#include <boost/thread/mutex.hpp>
#include <list>
#include <memory>
#include <vector>
#include "SurgSim/Framework/ComponentManager.h"
#include "SurgSim/Framework/LockedContainer.h"
#include "SurgSim/Physics/PhysicsManagerState.h"
namespace SurgSim
{
namespace Collision
{
class CollisionPair;
class Representation;
class ContactFilter;
}
namespace Framework
{
class Component;
}
namespace Particles
{
class Representation;
}
namespace Physics
{
class Computation;
class PhysicsManager : public SurgSim::Framework::ComponentManager
{
public:
PhysicsManager();
virtual ~PhysicsManager();
int getType() const override;
friend class PhysicsManagerTest;
void getFinalState(SurgSim::Physics::PhysicsManagerState* s) const;
void addComputation(std::shared_ptr<SurgSim::Physics::Computation> computation);
void setComputations(std::vector<std::shared_ptr<Physics::Computation>> computations);
protected:
bool executeAdditions(const std::shared_ptr<SurgSim::Framework::Component>& component) override;
bool executeRemovals(const std::shared_ptr<SurgSim::Framework::Component>& component) override;
bool doInitialize() override;
bool doStartUp() override;
bool doUpdate(double dt) override;
void doBeforeStop() override;
std::vector<std::shared_ptr<Representation>> m_representations;
std::vector<std::shared_ptr<Collision::Representation>> m_collisionRepresentations;
std::vector<std::shared_ptr<Collision::ContactFilter>> m_contactFilters;
std::vector<std::shared_ptr<Particles::Representation>> m_particleRepresentations;
std::vector<std::shared_ptr<ConstraintComponent>> m_constraintComponents;
std::vector<std::shared_ptr<SurgSim::Physics::Computation>> m_computations;
SurgSim::Framework::LockedContainer<SurgSim::Physics::PhysicsManagerState> m_finalState;
};
std::vector<std::shared_ptr<Physics::Computation>> createDcdPipeline(bool copyState = false);
std::vector<std::shared_ptr<Physics::Computation>> createCcdPipeline(bool copyState = false);
}; // namespace Physics
}; // namespace SurgSim
#endif
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::PhysicsManager::m_particleRepresentations
std::vector< std::shared_ptr< Particles::Representation > > m_particleRepresentations
Definition: PhysicsManager.h:110
SurgSim::Physics::PhysicsManager
PhyicsManager handles the physics and motion calculation, it uses Computations to separate the algori...
Definition: PhysicsManager.h:59
SurgSim::Framework::ComponentManager
Base Component Manager class.
Definition: ComponentManager.h:49
LockedContainer.h
SurgSim::Particles::Particles
DataStructures::Vertices< ParticleData > Particles
Definition: Particles.h:53
SurgSim::Physics::createDcdPipeline
std::vector< std::shared_ptr< Physics::Computation > > createDcdPipeline(bool copyState)
Creates default DCD pipeline, this currently does basic DCD without regard to CCD.
Definition: PhysicsManager.cpp:174
SurgSim::Physics::PhysicsManager::m_contactFilters
std::vector< std::shared_ptr< Collision::ContactFilter > > m_contactFilters
Definition: PhysicsManager.h:108
SurgSim::Physics::PhysicsManager::m_representations
std::vector< std::shared_ptr< Representation > > m_representations
Definition: PhysicsManager.h:104
ComponentManager.h
SurgSim::Framework::LockedContainer< SurgSim::Physics::PhysicsManagerState >
SurgSim::Physics::PhysicsManagerState
Definition: PhysicsManagerState.h:48
SurgSim::Physics::createCcdPipeline
std::vector< std::shared_ptr< Physics::Computation > > createCcdPipeline(bool copyState)
Create default CCD pipeline, this currently does basic CCD without regard to DCD. ...
Definition: PhysicsManager.cpp:196
SurgSim::Physics::PhysicsManager::m_computations
std::vector< std::shared_ptr< SurgSim::Physics::Computation > > m_computations
A list of computations, to perform the physics update.
Definition: PhysicsManager.h:116
PhysicsManagerState.h
SurgSim::Physics::PhysicsManager::m_finalState
SurgSim::Framework::LockedContainer< SurgSim::Physics::PhysicsManagerState > m_finalState
A thread-safe copy of the last PhysicsManagerState in the previous update.
Definition: PhysicsManager.h:119
SurgSim::Physics::PhysicsManager::m_collisionRepresentations
std::vector< std::shared_ptr< Collision::Representation > > m_collisionRepresentations
Definition: PhysicsManager.h:106
SurgSim::Physics::PhysicsManager::m_constraintComponents
std::vector< std::shared_ptr< ConstraintComponent > > m_constraintComponents
Definition: PhysicsManager.h:112