step/stepcore
coulombforce.h
Go to the documentation of this file.00001 /* This file is part of StepCore library. 00002 Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 00003 00004 StepCore library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 StepCore library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with StepCore; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00023 #ifndef STEPCORE_COULOMBFORCE_H 00024 #define STEPCORE_COULOMBFORCE_H 00025 00026 #include "world.h" 00027 #include "object.h" 00028 #include "constants.h" 00029 00030 namespace StepCore 00031 { 00032 00033 class CoulombForce; 00034 00038 class CoulombForceErrors: public ObjectErrors 00039 { 00040 STEPCORE_OBJECT(CoulombForceErrors) 00041 00042 public: 00044 CoulombForceErrors(Item* owner = NULL) 00045 : ObjectErrors(owner), _coulombConstVariance(0) {} 00046 00048 CoulombForce* coulombForce() const; 00049 00051 double coulombConstVariance() const { return _coulombConstVariance; } 00053 void setCoulombConstVariance(double coulombConstVariance) { 00054 _coulombConstVariance = coulombConstVariance; } 00055 00056 protected: 00057 double _coulombConstVariance; 00058 friend class CoulombForce; 00059 }; 00060 00061 00082 class CoulombForce: public Item, public Force 00083 { 00084 STEPCORE_OBJECT(CoulombForce) 00085 00086 public: 00088 CoulombForce(double coulombConst = Constants::Coulomb); 00089 00090 void calcForce(bool calcVariances); 00091 00093 double coulombConst() const { return _coulombConst; } 00095 void setCoulombConst(double coulombConst) { _coulombConst = coulombConst; } 00096 00098 CoulombForceErrors* coulombForceErrors() { 00099 return static_cast<CoulombForceErrors*>(objectErrors()); } 00100 00101 protected: 00102 ObjectErrors* createObjectErrors() { return new CoulombForceErrors(this); } 00103 00104 double _coulombConst; 00105 }; 00106 00107 } // namespace StepCore 00108 00109 #endif 00110
KDE 4.2 API Reference