File indexing completed on 2024-10-13 06:32:53
0001 /* 0002 SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 0003 SPDX-FileCopyrightText: 2014 Inge Wallin <inge@lysator.liu.se> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 /** \file force.h 0009 * \brief Contains the Force object. 0010 */ 0011 0012 #ifndef STEPCORE_FORCE_H 0013 #define STEPCORE_FORCE_H 0014 0015 0016 #include <vector> // XXX: Replace if Qt is enabled. 0017 0018 #include "types.h" 0019 #include "item.h" 0020 0021 0022 namespace StepCore 0023 { 0024 0025 0026 /** \ingroup forces 0027 * \brief Interface for forces 0028 * 0029 * Force is anything that acts upon bodies changing derivatives of dynamic variables 0030 */ 0031 class Force : public Item 0032 { 0033 STEPCORE_OBJECT(Force) 0034 0035 public: 0036 explicit Force(const QString& name = QString()) 0037 : Item(name) 0038 {} 0039 virtual ~Force() {} 0040 0041 /** Calculate force. Bodies can be accessed through 0042 * this->world()->bodies() 0043 */ 0044 virtual void calcForce(bool calcVariances) = 0; 0045 }; 0046 0047 0048 /** List of pointers to Force */ 0049 typedef std::vector<Force*> ForceList; 0050 0051 0052 } // namespace StepCore 0053 0054 0055 #endif