Commit 57cf1d79 authored by Inge Wallin's avatar Inge Wallin

Move the Force class out of world.h

parent 0d44402f
......@@ -22,7 +22,7 @@ Legend
[=0]
* CGConstraintSolver
[]
* Solver Generic Solver interface
* Solver Generic Solver interface
* GenericEulerSolver Solver of ordinary diff equations
* EulerSolver
* AdaptiveEulerSolver
......@@ -42,7 +42,7 @@ Legend
* World The root object for everything visible
[time, timeScale, bodies, forces, joints, solvers...]
* Body{body.h} Anything that has dynamic variables that
* Body{body.h} Anything that has dynamic variables that
require ODE integration
* Particle(Item, Body)
* ChargedParticle
......@@ -52,7 +52,7 @@ Legend
* BasePolygon
* Box
* Polygon
* Plane(Item, Body) Unmovable rigid plane
* Plane(Item, Body) Unmovable rigid plane
* Force{world.h} Anything that acts upon bodies changing
......
......@@ -2,15 +2,19 @@
set(stepcore_SRCS
object.cc
constants.cc
# Base objects
item.cc
body.cc
objecterrors.cc
force.cc
# Storage objects
world.cc
solver.cc
collisionsolver.cc
constraintsolver.cc
factory.cc
xmlfile.cc
particle.cc
rigidbody.cc
gas.cc
......@@ -22,6 +26,7 @@ set(stepcore_SRCS
joint.cc
eulersolver.cc
tool.cc
xmlfile.cc
)
if(STEPCORE_WITH_GSL)
......
/* This file is part of StepCore library.
Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
Copyright (C) 2014 Inge Wallin <inge@lysator.liu.se>
StepCore library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
StepCore library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with StepCore; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "force.h"
namespace StepCore
{
STEPCORE_META_OBJECT(Force, QT_TRANSLATE_NOOP("ObjectClass", "Force"), QT_TR_NOOP("Force"),
MetaObject::ABSTRACT,,)
} // namespace StepCore
/* This file is part of StepCore library.
Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
Copyright (C) 2014 Inge Wallin <inge@lysator.liu.se>
StepCore library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
StepCore library 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with StepCore; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** \file force.h
* \brief Contains the Force object.
*/
#ifndef STEPCORE_FORCE_H
#define STEPCORE_FORCE_H
#include <vector> // XXX: Replace if Qt is enabled.
#include "types.h"
#include "item.h"
namespace StepCore
{
/** \ingroup forces
* \brief Interface for forces
*
* Force is anything that acts upon bodies changing derivatives of dynamic variables
*/
class Force
{
STEPCORE_OBJECT(Force)
public:
virtual ~Force() {}
/** Calculate force. Bodies can be accessed through
* this->world()->bodies()
*/
virtual void calcForce(bool calcVariances) = 0;
};
/** List of pointers to Force */
typedef std::vector<Force*> ForceList;
} // namespace StepCore
#endif
......@@ -20,6 +20,7 @@
#include "solver.h"
#include "collisionsolver.h"
#include "constraintsolver.h"
#include <algorithm>
#include <cmath>
#include <QtGlobal>
......@@ -27,7 +28,7 @@
namespace StepCore
{
STEPCORE_META_OBJECT(Force, QT_TRANSLATE_NOOP("ObjectClass", "Force"), QT_TR_NOOP("Force"), MetaObject::ABSTRACT,,)
STEPCORE_META_OBJECT(Joint, QT_TRANSLATE_NOOP("ObjectClass", "Joint"), QT_TR_NOOP("Joint"), MetaObject::ABSTRACT,,)
STEPCORE_META_OBJECT(Tool, QT_TRANSLATE_NOOP("ObjectClass", "Tool"), QT_TR_NOOP("Tool"), MetaObject::ABSTRACT,,)
......
......@@ -28,6 +28,7 @@
#include "object.h"
#include "item.h"
#include "body.h"
#include "force.h"
#include "vector.h"
......@@ -46,23 +47,6 @@ class ItemGroup;
class CollisionSolver;
class ConstraintSolver;
/** \ingroup forces
* \brief Interface for forces
*
* Force is anything that acts upon bodies changing derivatives of dynamic variables
*/
class Force
{
STEPCORE_OBJECT(Force)
public:
virtual ~Force() {}
/** Calculate force. Bodies can be accessed through
* this->world()->bodies()
*/
virtual void calcForce(bool calcVariances) = 0;
};
/** \ingroup joints
* Constraints information structure
......@@ -149,8 +133,6 @@ public:
virtual ~Tool() {}
};
/** List of pointers to Force */
typedef std::vector<Force*> ForceList;
/** List of pointers to Joint */
typedef std::vector<Joint*> JointList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment