How to write UI-supported classes?
This page describes how to write new classes
that can be loaded just by giving their name in the User Interface. It can be a
new type of transport model, environment or particle source.
If you want to write a new piece of code for
SPIS/NUM, you may have several approaches.
You may be thinking in terms of routines, as
e.g. in Fortran 90. You will be forced by Java to write your code as a method
of a class, but you'll be free to write it as you want. You may even declare it
static, declaring this way that it is the same method/routine for any instance
of the class. It would then real be like on old-fashioned routine. This is most
of the time to be avoided (although necessary in some cases as for
mathematical/physical libraries, see e.g. "physical routines" and
data).
In SPIS object oriented (OO) code you will more
likely derive a new class from an existing class. Examples:
-
if you want to write a new
source of particle defined by a surface velocity distribution (e.g. an electric
thruster exhaust), you will follow the right "model" of surface
distribution, so that your model can be used generically as any other source of
particles: you will derive your class from SurfDistrib.
It will then necessary offer the requested capabilities to be a surface
distribution: providing distribution moments or particle samples (abstract methods
of SurfDistrib you'll have to implement)
-
if you want to write a new
model of material interaction, you'll write a new class derived from MaterialModel,
different of BasicMaterialModel
currently under use. It will need to offer all what offers a material model,
basically Interactors for all types of interactions.
-
Or you may just write an new
interactor (e.g. for a more refined mode of photo-emission) deriving from Interactor
class. You'll have to write a constructor for your new class that will pass in
and out fluxes to Interactor
constructor,
The next question is how to "plug"
your new class into the code. How to have it executed properly in place of
another version of source/model/interactor, etc.
page still under construction