previous up next SYLLABUS  Previous: 8.3 Program structure &  Up: 8 THE JBONE USER  Next: 8.5 Interactive evaluation form

8.4 An object-oriented example: Monte Carlo in JBONE

The Monte Carlo solver in JBONE is different from the finite differences and finite elements solvers in the sense that the solution is represented by the set of particles and the function $ f$ is just used for diagnostics. As shown in the class tree, the solvers have been divided into particle methods and fluid methods. The discretization with particles is contained in the class ParticleSolution and the Monte Carlo time stepping and boundary conditions in the class MCPSolution. The class ParticleSolution contains a vector of the particles phase space coordinates. Since f[] is only defined as a projection onto the roof-top base, the advantage of an objected oriented methods becomes clear, as e.g. the method limits() can here be overridden from the definition in Solution. Indeed, check how limits() in FluidSolution is computed directly from the solution f[], whereas in ParticleSolution the method generateDistribution() needs to be called prior to finding min and max of f[]. Everything the class jbone needs to know is that the solver is a sub-class of Solution. How and where things are computed, is none of jbone's business! Also note how the solutions to exercises 5.3-5.5 will be inherited in the class MCPDrawParticlesSolution

SYLLABUS  Previous: 8.3 Program structure &  Up: 8 THE JBONE USER  Next: 8.5 Interactive evaluation form

      
back up next contents bibliography Copyright © Lifelong-learners at 09:50:49, November 19th, 2017