Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add egs_view egsinp editor with autocompletion for all egs++ apps #1164

Draft
wants to merge 40 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5cf74da
Add a text editor to egs_view
rtownson Aug 3, 2019
439a0dc
Non-working temporary commit
rtownson Dec 13, 2019
1caf68c
Add a text editor to egs_view
rtownson Aug 3, 2019
0d03724
Non-working temporary commit
rtownson Dec 13, 2019
5642956
Add editor autocomplete and input checking
rtownson Feb 4, 2020
19922d9
Improve egs_view editor input checking
rtownson Feb 22, 2020
212a9f2
Add egs_view editor input dependency checking
rtownson Mar 13, 2020
b7da362
Start adding egs_view editor definition blocks
rtownson Mar 13, 2020
618c6f0
Add egs_view editor source and shape support
rtownson Mar 31, 2020
406f174
Add egs_editor input example menu bar
rtownson Apr 3, 2020
31d2374
Temp
rtownson May 13, 2020
d6fca07
Add egs_editor support for transformations
rtownson Jul 7, 2020
916f1f0
Start adding egs_editor run control support
rtownson Jul 20, 2020
e320166
Finish adding run control inputs to egs_editor
rtownson Jul 23, 2020
85326e6
Improve egs_editor undo history
rtownson Jul 30, 2020
4d2895c
Add Geometry Input Validation
Feb 2, 2021
1d65c15
Add sources, ausgab, other egs_view editor support
hcgallop Feb 10, 2021
0f59cd3
Add support for shapes in egs_view editor
hcgallop Feb 15, 2021
790ed98
Add keystroke seletion to egs_editor
hcgallop Feb 26, 2021
dbcec3a
Add support for applications in egs_view editor
hcgallop Apr 26, 2021
ea05f21
Add support for red line comments
hcgallop Apr 30, 2021
ecd69e2
Fix the recent egs_view ui changes
May 19, 2021
81a28e4
Fix the egs_view dso link to be a relative path
rtownson May 20, 2021
99b8ef4
Add iaea_phsp_source editor inputs
rtownson Apr 6, 2022
2a2e604
Remove old egs_view debug messages
rtownson Apr 7, 2022
70be98a
Improve egs_editor support for shapes
rtownson May 2, 2022
c8c35a9
Run astyle to fix formatting
rtownson May 10, 2022
c78965f
Fix a few typos in the egs_editor additions
rtownson Jun 28, 2022
868f84c
Update egs_input_struct documentation
rtownson Jul 4, 2022
85a78cf
Tidy up egs_view debug output
rtownson Jul 5, 2022
9549983
Fix egs_view image scaling when reloading or saving
rtownson Nov 9, 2023
be3fe92
Add the library auto complete for ausgab objects
rtownson Nov 9, 2023
d251483
Add more egs_editor completion and examples
Xuan-Zheng05 Jul 26, 2024
a45213c
Fixed hardcoded path to density correction files with system dependen…
Xuan-Zheng05 Aug 10, 2024
56e1cce
Fix pegless material autocompletion to work with any name
Xuan-Zheng05 Aug 14, 2024
d2b97b9
Fix incorrect example for media definition
Xuan-Zheng05 Aug 22, 2024
a509ab2
Fix autocomplete error from pegless material addition
Xuan-Zheng05 Aug 30, 2024
efcfc4d
Fix egs_editor medium autocomplete
rtownson Aug 8, 2024
59ea112
Fix make clean of application library objects
rtownson Aug 8, 2024
99e2cbb
Tidy up merge with branch from Xuan
rtownson Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add sources, ausgab, other egs_view editor support
  • Loading branch information
hcgallop authored and rtownson committed Sep 17, 2024
commit 1d65c15357a1ea840613a383d58a00cc1628ad6d
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# Blake Walters
# Max Orok
# Martin Martinov
# Hannah Gallop
#
###############################################################################
#
Expand Down Expand Up @@ -98,6 +99,8 @@
#include "egs_input.h"
#include "egs_functions.h"

static bool EGS_DOSE_SCORING_LOCAL inputSet = false;

EGS_DoseScoring::EGS_DoseScoring(const string &Name,
EGS_ObjectFactory *f) :
EGS_AusgabObject(Name,f), dose(0), doseM(0), doseF(0),
Expand Down Expand Up @@ -591,6 +594,39 @@ void EGS_DoseScoring::resetCounter() {
//**********************************************************************
extern "C" {

static void setInputs() {
inputSet = true;

setBaseAusgabObjectInputs();

ausBlockInput->getSingleInput("library")->setValues({"EGS_Dose_Scoring"});

// Format: name, isRequired, description, vector string of allowed values
ausBlockInput->addSingleInput("medium dose", false, "Requests the dose deposited in each medium to be scored, default is no", {"yes", "no"});
ausBlockInput->addSingleInput("region dose", false, "Requests the dose deposited in each region to be scored, default is yes", {"yes", "no"});
ausBlockInput->addSingleInput("volume", false, "Either a unique volume, which will be the same for all regions or a list of individual volumes for each region, default is 1g/cm3");
auto dosePtr = ausBlockInput->addSingleInput("dose regions", false, "A list of individual regions");
auto startPtr = ausBlockInput->addSingleInput("dose start region", false, "A list of starts for regions");
auto stopPtr = ausBlockInput->addSingleInput("dose stop region", false, "A list of stops for regions");

dosePtr->addDependency(startPtr, "", true);
dosePtr->addDependency(stopPtr, "", true);
startPtr->addDependency(dosePtr, "", true);
stopPtr->addDependency(dosePtr, "", true);

// This can only be used if one of the geometries is an EGS_XYZGeometry
auto blockPtr = ausBlockInput->addBlockInput("output dose file");
blockPtr->addSingleInput("geometry name", true, "The name of a predefined EGS_XYZGeometry");
blockPtr->addSingleInput("file type", true, "The type of file", {"3ddose"});
}

EGS_DOSE_SCORING_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
if(!inputSet) {
setInputs();
}
return ausBlockInput;
}

EGS_DOSE_SCORING_EXPORT EGS_AusgabObject *createAusgabObject(EGS_Input *input,
EGS_ObjectFactory *f) {
const static char *func = "createAusgabObject(dose_scoring)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Author: Blake Walters, 2018
#
# Contributors: Reid Townson
# Hannah Gallop
#
###############################################################################
*/
Expand All @@ -44,6 +45,8 @@
#include "egs_functions.h"
#include "iaea_phsp.h"

static bool EGS_PHSP_SCORING_LOCAL inputSet = false;

EGS_PhspScoring::EGS_PhspScoring(const string &Name,
EGS_ObjectFactory *f) :
EGS_AusgabObject(Name,f), phsp_index(0), store_max(1000), phsp_file(),
Expand Down Expand Up @@ -519,6 +522,86 @@ bool EGS_PhspScoring::addState(istream &data) {
//**********************************************************************
extern "C" {

static void setInputs() {
inputSet = true;

setBaseAusgabObjectInputs();

ausBlockInput->getSingleInput("library")->setValues({"EGS_Phsp_Scoring"});

// Format: name, isRequired, description, vector string of allowed values
auto formatPtr = ausBlockInput->addSingleInput("output format", false, "The type of file the data is output to", {"EGSnrc", "IAEA"});

auto xPtr = ausBlockInput->addSingleInput("constant X", false, "X values(cm) at which all particles are scored.");
xPtr->addDependency(formatPtr, "IAEA");
auto yPtr = ausBlockInput->addSingleInput("constant Y", false, "Y values(cm) at which all particles are scored.");
yPtr->addDependency(formatPtr, "IAEA");
auto zPtr = ausBlockInput->addSingleInput("constant Z", false, "Z values(cm) at which all particles are scored.");
zPtr->addDependency(formatPtr, "IAEA");
auto muPtr = ausBlockInput->addSingleInput("score mu", false, "Default is no", {"yes", "no"});
muPtr->addDependency(formatPtr, "IAEA");

auto multiPtr = ausBlockInput->addSingleInput("score multiple crossers", false, "Default is no", {"yes", "no"});
multiPtr->addDependency(formatPtr, "EGSnrc");

ausBlockInput->addSingleInput("particle type", true, "The type of particle", {"all", "photons", "charged"});
ausBlockInput->addSingleInput("output directory", true, "The name of output directory");

// Method 1: Score particles on entry to/exit from a predefined geometry
auto spacePtr = ausBlockInput->addSingleInput("phase space geometry", true, "The name of a previously defined geometry");
auto scorePtr = ausBlockInput->addSingleInput("score particles on", false, "entry, exit, entry and exit", {"entry", "exit", "entry and exit"});

// Method 2: Score particles on exiting one region and entering another
auto fromPtr = ausBlockInput->addSingleInput("from regions", true, "A list of exit region numbers");
auto toPtr = ausBlockInput->addSingleInput("to regions", true, "A list of entry region numbers");

// Can only use one method
spacePtr->addDependency(fromPtr, "", true);
spacePtr->addDependency(toPtr, "", true);
scorePtr->addDependency(fromPtr, "", true);
scorePtr->addDependency(toPtr, "", true);
fromPtr->addDependency(spacePtr, "", true);
fromPtr->addDependency(scorePtr, "", true);
toPtr->addDependency(spacePtr, "", true);
toPtr->addDependency(scorePtr, "", true);
}

EGS_PHSP_SCORING_EXPORT string getExample() {
string example;
example =
{R"(
# Example of egs_phsp_scoring
#:start ausgab object:
library = egs_phsp_scoring
name = test
from regions = 0 2
to regions = 3 5
output format = IAEA
constant Z = 10.0
particle type = all
score mu = no
:stop ausgab object:

#:start ausgab object:
library = egs_phsp_scoring
name = test2
phase space geometry = scoreplane
output format = EGSnrc
particle type = all
score particles on = entry
score multiple crossers = yes
:stop ausgab object:
)"};
return example;
}

EGS_PHSP_SCORING_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
if(!inputSet) {
setInputs();
}
return ausBlockInput;
}

EGS_PHSP_SCORING_EXPORT EGS_AusgabObject *createAusgabObject(EGS_Input *input,
EGS_ObjectFactory *f) {
const static char *func = "createAusgabObject(phsp_scoring)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#
# Author: Ernesto Mainegra-Hing, 2018
#
# Contributors:
# Contributors: Hannah Gallop
#
###############################################################################
#
Expand All @@ -50,6 +50,8 @@
#include "egs_input.h"
#include "egs_functions.h"

static bool EGS_RADIATIVE_SPLITTING_LOCAL inputSet = false;

EGS_RadiativeSplitting::EGS_RadiativeSplitting(const string &Name,
EGS_ObjectFactory *f) :
nsplit(1) {
Expand Down Expand Up @@ -111,6 +113,24 @@ void EGS_RadiativeSplitting::setApplication(EGS_Application *App) {
//**********************************************************************
extern "C" {

static void setInputs() {
inputSet = true;

setBaseAusgabObjectInputs();

ausBlockInput->getSingleInput("library")->setValues({"EGS_Radiative_Splitting"});

// Format: name, isRequired, description, vector string of allowed values
ausBlockInput->addSingleInput("splitting", false, "N-split");
}

EGS_RADIATIVE_SPLITTING_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
if(!inputSet) {
setInputs();
}
return ausBlockInput;
}

EGS_RADIATIVE_SPLITTING_EXPORT EGS_AusgabObject *createAusgabObject(EGS_Input *input,
EGS_ObjectFactory *f) {
const static char *func = "createAusgabObject(radiative_splitting)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Author: Iwan Kawrakow, 2009
#
# Contributors: Georgi Gerganov
# Hannah Gallop
#
###############################################################################
*/
Expand All @@ -38,6 +39,8 @@
#include "egs_input.h"
#include "egs_functions.h"

static bool EGS_TRACK_SCORING_LOCAL inputSet = false;

EGS_TrackScoring::EGS_TrackScoring(const string &Name, EGS_ObjectFactory *f) :
EGS_AusgabObject(Name,f), m_pts(0), m_start(0), m_stop(1024), m_lastCase(-1),
m_nScore(0), m_bufSize(16), m_score(false), m_didScore(false),
Expand Down Expand Up @@ -117,6 +120,48 @@ void EGS_TrackScoring::reportResults() {

extern "C" {

static void setInputs() {
inputSet = true;

setBaseAusgabObjectInputs();

ausBlockInput->getSingleInput("library")->setValues({"EGS_Track_Scoring"});

// Format: name, isRequired, description, vector string of allowed values
ausBlockInput->addSingleInput("score photons", false, "Score photons? Default is yes.", {"yes", "no"});
ausBlockInput->addSingleInput("score electrons", false, "Score the elctrons? Default is yes.", {"yes", "no"});
ausBlockInput->addSingleInput("score positrons", false, "Score positrons? Default is yes.", {"yes", "no"});
ausBlockInput->addSingleInput("start scoring", false, "Event_number, default is 0.");
ausBlockInput->addSingleInput("stop scoring", false, "Event_number, default is 1024.");
ausBlockInput->addSingleInput("buffer size", false, "Size, default is 1024.");
ausBlockInput->addSingleInput("file name addition", false, "A string that constructs the output file name");
}

EGS_TRACK_SCORING_EXPORT string getExample() {
string example;
example =
{R"(
# Example of egs_track_scoring
#:start ausgab object:
library = egs_track_scoring
name = my_score
score photons = yes
score electrons = yes
score positrons = yes
start scoring = 0
stop scoring = 1024
:stop ausgab object:
)"};
return example;
}

EGS_TRACK_SCORING_EXPORT shared_ptr<EGS_BlockInput> getInputs() {
if(!inputSet) {
setInputs();
}
return ausBlockInput;
}

EGS_TRACK_SCORING_EXPORT EGS_AusgabObject *createAusgabObject(EGS_Input *input,
EGS_ObjectFactory *f) {
const static char *func = "createAusgabObject(track_scoring)";
Expand Down
7 changes: 7 additions & 0 deletions HEN_HOUSE/egs++/egs_ausgab_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include "egs_application.h"
#include "egs_object_factory.h"
#include "egs_input_struct.h"

#include <string>
#include <iostream>
Expand All @@ -61,6 +62,12 @@ using namespace std;
class EGS_Input;
class EGS_Application;

static shared_ptr<EGS_BlockInput> ausBlockInput = make_shared<EGS_BlockInput>("ausgab object");
static void setBaseAusgabObjectInputs() {
ausBlockInput->addSingleInput("library", true, "The type of ausgab object, loaded by shared library in egs++/dso.");
ausBlockInput->addSingleInput("name", true, "The user-declared unique name of this ausgab object. This is the name you may refer to elsewhere in the input file.");
}

class EGS_EXPORT EGS_AusgabObject : public EGS_Object {

public:
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/egs_base_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void setBaseSourceInputs(bool isSimpleSource = true, bool includeSpectrum

if(isSimpleSource) {
includeSpectrumBlock = true;
srcBlockInput->addSingleInput("charge", true, "The type of particle to emit from the source, as defined by the charge. Use 0 for photons, -1 for electrons and 1 for positrons.");
srcBlockInput->addSingleInput("charge", true, "The type of particle to emit from the source, as defined by the charge. Use 0 for photons, -1 for electrons and 1 for positrons.", {"0", "1", "-1"});
}
if(includeSpectrumBlock) {
shared_ptr<EGS_BlockInput> specBlock = srcBlockInput->addBlockInput("spectrum");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Rowan Thomson
# Dave Rogers
# Martin Martinov
# Hannah Gallop
#
###############################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/geometry/egs_cylinders/egs_cylinders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_Cylinders"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_EllipticCylinders"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_NDGeometry"});

Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/geometry/egs_prism/egs_prism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_Prism"});

Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/geometry/egs_pyramid/egs_pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_Pyramid"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_RoundRect_Cylinders"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# Contributors: Frederic Tessier
# Ernesto Mainegra-Hing
# Marc Chamberland
# Hannah Gallop
#
###############################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion HEN_HOUSE/egs++/geometry/egs_spheres/egs_spheres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ extern "C" {
static void setInputs() {
inputSet = true;

setBaseGeometryInputs(false);
setBaseGeometryInputs();

geomBlockInput->getSingleInput("library")->setValues({"EGS_Spheres"});

Expand Down
Loading