Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

AdaptiveRepulsionData.h

Go to the documentation of this file.
00001 /** 
00002 * Declaration of AdaptiveRepulsionData.
00003 * @file AdaptiveRepulsionData.h
00004 * @author Ed Bachta
00005 */
00006 
00007 #ifndef __ADAPTIVEREPULSIONDATA_H__
00008 #define __ADAPTIVEREPULSIONDATA_H__
00009 
00010 #include "Particles.h"
00011 #include "ParticleAttribute.h"
00012 
00013 /**
00014 * AdaptiveRepulsionData contains the parameters r, dr, and D along with
00015 * constants which are needed to implement the Witkin-Heckbert model of
00016 * adaptive particle repulsion. It is normally used by the ParticleRepulsion
00017 * and ParticleFate behaviors to that effect.
00018 */
00019 class AdaptiveRepulsionData : public ParticleAttribute {
00020 
00021 public:
00022 
00023         MAKE_PARTICLESTUFF_NAME();
00024 
00025         // System attributes
00026         double sigma_hat; ///< Desired repulsion radius.
00027         double sigma_max; ///< Maximum repulsion radius.
00028         double diameter;        ///< Surface diameter.
00029         
00030         double alpha;      ///< Repulsion amplitude.
00031         double Ehat;             ///< Desired energy.
00032 
00033         /** # of std. dev.'s away that we expect repulsion to be zero
00034          * Defaults to 3 standard deviations.
00035          */
00036         double sdmul;
00037 
00038         int qlen();
00039         void getq(double *q);
00040         void setq(double *q);
00041         void qname(char **qn);
00042 
00043         // Per particle attributes
00044 
00045         /// Repulsion radii.
00046         std::vector<double> r;
00047         
00048         /// Change in repulsion radii.
00049         std::vector<double> dr;
00050         
00051         /// Particle energies.
00052         std::vector<double> D;
00053 
00054         int qlenpp();
00055         void getqpp(double *q, int i);
00056         void setqpp(double *q, int i);
00057         void qnamepp(char **qn);
00058 
00059         AdaptiveRepulsionData(Particles* ps=NULL,std::string name = std::string("AdaptiveRepulsionData"));
00060 
00061         virtual void setParticleSystem(Particles *);
00062         
00063         void clear();
00064 
00065         /** 
00066         * Integrate data over one time step.
00067         * @param dt Change in time to apply.
00068         */
00069         void integrate(double dt);
00070 
00071         /// Callback for particle removal.
00072         virtual void particleRemoved(unsigned int i);
00073         
00074         /// Callback for particle addition.
00075         virtual void particleAdded(unsigned int i);
00076 
00077         char *qtip(int i) { switch(i) {
00078                 case 0: /* sigma_hat */ return "Desired distance between particles.";
00079                 case 1: /* sigma_max */ return "Maximum distance between particles.";
00080                 case 2: /* diameter */  return "Estimate of the diameter of the surface.";
00081                 case 3: /* alpha */             return "Amplitude of the repulsion force. Proportional to particle motion response time, "
00082                                                                         "but if too large may cause stiffness";
00083                 case 4: /* Ehat */              return "Desired energy of the system. Too much energy leads to jittery particles. "
00084                                                                         "Too little causes the particle system to appear sluggish.";
00085                 case 5: /* sdmul */             return "Repulsion force is a Gaussian. The sdmul parameter is the number of "
00086                                                                         "standard deviations away from a particle that its repulsion force is "
00087                                                                         "tapered to zero.";
00088                 default: return "";
00089         }}
00090 
00091         char *tip() { return "The AdaptiveRepulsionData particle attribute collects data shared "
00092                                                  "by several behaviors that collectively keep particles spaced "
00093                                                  "evenly.";
00094         }
00095 };
00096 
00097 #endif

Generated on Mon Jun 28 14:58:12 2004 for Advanced Surface Library by doxygen 1.3.4