Skip to content

Commit

Permalink
Added the changes to PostProcessorSetup for the transmittence databas…
Browse files Browse the repository at this point in the history
…e, Updated the NuGet packages and version numbers for the release.
  • Loading branch information
lmalenfant committed May 25, 2022
1 parent 6f9a397 commit d019b1a
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,33 @@
<AssemblyName>mc</AssemblyName>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<RootNamespace>Vts.MonteCarlo.CommandLineApplication</RootNamespace>
<AssemblyVersion>6.1.0.0</AssemblyVersion>
<FileVersion>6.1.0.0</FileVersion>
<AssemblyVersion>6.2.0.0</AssemblyVersion>
<FileVersion>6.2.0.0</FileVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Company>Virtual Photonics Technology Initiative</Company>
<Product>MCCL</Product>
<Authors>David Cuccia; Carole Hayakawa; Lisa Malenfant; Janaka Ranasinghesagara; Jennifer Nguyen; Adam Gardner; Michele Martinelli</Authors>
<Description>Monte-Carlo command-line application</Description>
<Copyright>Copyright © 2021 Laser Microbeam and Medical Program</Copyright>
<Copyright>Copyright © 2022 Laser Microbeam and Medical Program</Copyright>
<PackageLicenseUrl>https://github.com/VirtualPhotonics/VTS/blob/master/license.md</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/VirtualPhotonics/VTS/wiki</PackageProjectUrl>
<PackageIconUrl>http://virtualphotonics.org/Themes/VP/Content/Images/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/VirtualPhotonics/VTS</RepositoryUrl>
<PackageTags>C# Monte-Carlo</PackageTags>
<RepositoryType>Git</RepositoryType>
<Version>6.1.0</Version>
<Version>6.2.0</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VirtualPhotonics.Vts" Version="6.0.0" />
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="VirtualPhotonics.Vts" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
100 changes: 81 additions & 19 deletions Vts.MonteCarlo.PostProcessor/PostProcessorSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,56 +96,122 @@ public static void RunPostProcessor(PostProcessorInput input, string inputFolder
// check for pMC tallies first because could have ReflectanceTallies mixed in and want to load CollisionInfo

// Why not mirror the "on-the-fly" code, and allow for all kinds of detector inputs simultaneously? (dc 12/21/2011)
// I hear you. First step is to get code to handle two different types (remove elseif) and
// then optimize for multiple types if possible

// put stop watch start here because several ifs below could get processed
var stopwatch = System.Diagnostics.Stopwatch.StartNew();

IList<IDetectorInput> detectorInputs;
if (input.DetectorInputs.Any(di => di.TallyDetails.IspMCReflectanceTally))
{
IList<IDetectorInput> pMCDetectorInputs;
pMCDetectorInputs = input.DetectorInputs;
detectorInputs = input.DetectorInputs.Where(
di => di.TallyDetails.IspMCReflectanceTally).ToList();
var postProcessor = new PhotonDatabasePostProcessor(
VirtualBoundaryType.pMCDiffuseReflectance,
pMCDetectorInputs,
detectorInputs,
PhotonDatabaseFactory.GetpMCDatabase( // database filenames are assumed to be convention
VirtualBoundaryType.pMCDiffuseReflectance,
inputFolder),
databaseGenerationInputFile
);
postProcessedOutput = postProcessor.Run();
if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
}
else if (input.DetectorInputs.Any(di => di.TallyDetails.IsReflectanceTally))
if (input.DetectorInputs.Any(di => di.TallyDetails.IsReflectanceTally))
{

detectorInputs = input.DetectorInputs.Where(
di => di.TallyDetails.IsReflectanceTally).ToList();
var postProcessor = new PhotonDatabasePostProcessor(
VirtualBoundaryType.DiffuseReflectance,
input.DetectorInputs,
detectorInputs,
PhotonDatabaseFactory.GetPhotonDatabase( //database filenames are assumed to be convention
VirtualBoundaryType.DiffuseReflectance,
inputFolder),
databaseGenerationInputFile
);
postProcessedOutput = postProcessor.Run();
if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
}
if (input.DetectorInputs.Any(di => di.TallyDetails.IspMCTransmittanceTally))
{
detectorInputs = input.DetectorInputs.Where(
di => di.TallyDetails.IspMCTransmittanceTally).ToList();
var postProcessor = new PhotonDatabasePostProcessor(
VirtualBoundaryType.pMCDiffuseTransmittance,
detectorInputs,
PhotonDatabaseFactory.GetpMCDatabase( //database filenames are assumed to be convention
VirtualBoundaryType.pMCDiffuseTransmittance,
inputFolder),
databaseGenerationInputFile
);
postProcessedOutput = postProcessor.Run();
if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
}
else if (input.DetectorInputs.Any(di => di.TallyDetails.IsTransmittanceTally))
if (input.DetectorInputs.Any(di => di.TallyDetails.IsTransmittanceTally))
{
detectorInputs = input.DetectorInputs.Where(
di => di.TallyDetails.IsTransmittanceTally).ToList();
var postProcessor = new PhotonDatabasePostProcessor(
VirtualBoundaryType.DiffuseTransmittance,
input.DetectorInputs,
detectorInputs,
PhotonDatabaseFactory.GetPhotonDatabase( //database filenames are assumed to be convention
VirtualBoundaryType.DiffuseTransmittance,
inputFolder),
databaseGenerationInputFile
);
postProcessedOutput = postProcessor.Run();
if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
}
else if (input.DetectorInputs.Any(di => di.TallyDetails.IsSpecularReflectanceTally))
{
if (input.DetectorInputs.Any(di => di.TallyDetails.IsSpecularReflectanceTally))
{
detectorInputs = input.DetectorInputs.Where(
di => di.TallyDetails.IsSpecularReflectanceTally).ToList();
var postProcessor = new PhotonDatabasePostProcessor(
VirtualBoundaryType.SpecularReflectance,
input.DetectorInputs,
detectorInputs,
PhotonDatabaseFactory.GetPhotonDatabase( //database filenames are assumed to be convention
VirtualBoundaryType.SpecularReflectance,
inputFolder),
databaseGenerationInputFile
);
postProcessedOutput = postProcessor.Run();
if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
}

// save input file to output folder with results
Expand All @@ -155,14 +221,10 @@ public static void RunPostProcessor(PostProcessorInput input, string inputFolder
databaseGenerationInputFile.ToFile(Path.Combine(resultsFolder,
input.OutputName + "_database_infile.txt"));

if (postProcessedOutput != null)
{
foreach (var result in postProcessedOutput.ResultsDictionary.Values)
{
// save all detector data to the specified folder
DetectorIO.WriteDetectorToFile(result, resultsFolder);
}
}
stopwatch.Stop();

Console.WriteLine("Monte Carlo Post Processor complete (time ="
+ stopwatch.ElapsedMilliseconds / 1000f + " seconds).\r");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
<RootNamespace>Vts.MonteCarlo.PostProcessor</RootNamespace>
<AssemblyName>mc_post</AssemblyName>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<AssemblyVersion>6.1.0.0</AssemblyVersion>
<FileVersion>6.1.0.0</FileVersion>
<AssemblyVersion>6.2.0.0</AssemblyVersion>
<FileVersion>6.2.0.0</FileVersion>
<Authors>David Cuccia; Carole Hayakawa; Lisa Malenfant; Janaka Ranasinghesagara; Jennifer Nguyen; Adam Gardner; Michele Martinelli</Authors>
<Company>Virtual Photonics Technology Initiative</Company>
<Product>MCPP</Product>
<Description>Monte-Carlo post-processor command-line application</Description>
<Copyright>Copyright © 2021 Laser Microbeam and Medical Program</Copyright>
<Copyright>Copyright © 2022 Laser Microbeam and Medical Program</Copyright>
<PackageProjectUrl>https://github.com/VirtualPhotonics/VTS/wiki</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/VirtualPhotonics/VTS/blob/master/license.md</PackageLicenseUrl>
<PackageIconUrl>http://virtualphotonics.org/Themes/VP/Content/Images/logo.png</PackageIconUrl>
<RepositoryUrl>https://github.com/VirtualPhotonics/VTS</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageTags>C# Monte-Carlo</PackageTags>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>6.1.0</Version>
<Version>6.2.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VirtualPhotonics.Vts" Version="6.0.0" />
<PackageReference Include="VirtualPhotonics.Vts" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit d019b1a

Please sign in to comment.