net.sourceforge.cilib.problem.boundaryconstraint
Class BouncingBoundaryConstraint

java.lang.Object
  extended by net.sourceforge.cilib.problem.boundaryconstraint.BouncingBoundaryConstraint
All Implemented Interfaces:
Serializable, BoundaryConstraint, Cloneable

public class BouncingBoundaryConstraint
extends Object
implements BoundaryConstraint

Instead of making use of reactive boundary constraints that reinitialise an entire Particle (or components thereof), this class is a proactive approach to prevent the Particle from moving outside of the domain. The component of the Particle that will be outside of the domain is placed on the boundary of the domain and the corresponding velocity component is recalculated (inverting the direction), effectively making the Particle bounce off the sides of the domain. The effect achieved is a skewed type of reflection with built-in velocity damping.

See Also:
Serialized Form

Constructor Summary
BouncingBoundaryConstraint()
           
 
Method Summary
 void enforce(Entity entity)
          Enforce the defined boundary constraint on the provided Entity.
 BoundaryConstraint getClone()
          Create a cloned copy of the current object and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BouncingBoundaryConstraint

public BouncingBoundaryConstraint()
Method Detail

getClone

public BoundaryConstraint getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface BoundaryConstraint
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

enforce

public void enforce(Entity entity)
Enforce the defined boundary constraint on the provided Entity.

Specified by:
enforce in interface BoundaryConstraint
Parameters:
entity - The Entity with which the boundary is to be enforced.


Copyright © 2009 CIRG. All Rights Reserved.