This project has moved and is read-only. For the latest updates, please go here.

Adding a New Forward Solver to the VTS

Bring up the VTS project In Visual Studio

Browse to the location of the existing forward solvers:
Core/Vts/Modeling/ForwardSolvers/

In File System:
…\vts\src\Vts\Modeling\ForwardSolvers\

Here you will see the the list of all the existing forward solvers
ForwardSolvers.png

To create a new forward solver, in Visual Studio right click on the ForwardSolvers folder and select Add → Class…
AddClass.png

Name the class and click the Add button.
AddNewItemDialog.png

Visual Studio will create a class within the Vts.Modeling.ForwardSolvers namespace with the name you gave the file.

namespace Vts.Modeling.ForwardSolvers
{
    public class ReallyAwfulForwardSolver
    {

    }
}

Inherit from the ForwardSolverBase class.
Type a : after the name of the class and a list of options should appear, select ForwardSolverBase.
To automatically implement the class, after typing or selecting ForwardSolverBase click CTRL + . or highlight the smart tag to the bottom left of the name and select "Implement abstract class 'ForwardSolverBase'.

    public class ReallyAwfulForwardSolver : ForwardSolverBase
    {
        public override double RofRho(OpticalProperties op, double rho)
        {
            throw new NotImplementedException();
        }
...

Remove the line of code that throws a not implemented exception and replace it with your Forward Solver code

        public override double RofRho(OpticalProperties op, double rho)
        {
            return 0.01 * (op.Musp * op.Mua * rho);
        }

To allow you to select your new Forward Solver from the GUI interface, you need to add a line of code under ForwardSolverType in the enums file which can be found here:
Core/Vts/Common/Enums.cs

In File System:
…\vts\src\Vts\Common\Enums.cs

    public enum ForwardSolverType
    {
        PointSourceSDA,
        DistributedPointSourceSDA,
        DistributedGaussianSourceSDA,
        DeltaPOne,
        MonteCarlo,
        Nurbs,
        pMC,
        DiscreteOrdinates
        ReallyAwful
    }


If you compile and run the GUI, you will see your new forward solver added to the list.
ReallyAwfulForwardSolver.png

Last edited May 14, 2012 at 8:38 PM by lmalenfant, version 7

Comments

No comments yet.