-
Notifications
You must be signed in to change notification settings - Fork 9
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
To create a new forward solver, in Visual Studio right click on the ForwardSolvers folder and select Add → Class…
Name the class and click the Add button.
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.
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
}
To see your new forward solver in the WPF GUI, include the Vts.Gui.Wpf project in the Vts Solution. If you compile and run the GUI, you will see your new forward solver added to the list.
Virtual Photonics Technology Initiative
Project Site | Discussion | Education