Closed arturgower closed 6 years ago
Your fix breaks the ability to simulate particles with different shapes/physics because the where is outside the Vector, which enforces that the types are all the same. For example, the following code leads to a type error.
using MultipleScattering
circle = Circle((0.0,0.0),1.0)
rect = Rectangle((2.0,2.0),3.0,2.0)
a = Acoustic(1.0,1.0,2)
particles = [Particle(a,circle), Particle(a,rect)]
source = TwoDimAcousticPlanarSource(a,[1.0,0.0],[0.0,0.0])
sim = FrequencySimulation(a,particles,source)
You were right, it was a mess but I think I've fixed it now. Look at runtests.jl:81 onwards to see if those tests cover your examples. You should be able to use the Particles
type everywhere now.
Yes, all was working with your fix. Note I've now changed the order of the parameters to {T,Dim,FieldDim,PhysicalProperty,Shape}, which will simplify some of these issues. commit 09c29729568468b8d1c477ef2d64bb3616129b67
In
FrequencySimulation
, the field particles is defined as:but I think this leads to unintended behaviour:
This in turn makes it difficult to write functions for
sim.particles
. Instead we should use: