Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -105,7 +105,7 @@ class G4QTabWidget : public QTabWidget
class G4UIOutputString
{
public:
G4UIOutputString(QString text, G4String thread = "", G4String outputstream = "info");
G4UIOutputString(const QString& text, const G4String& thread = "", const G4String& outputstream = "info");
inline QString GetOutputList() { return " all info warning error "; };
QString fText;
G4String fThread;
@@ -115,7 +115,7 @@ class G4UIOutputString
class G4UIDockWidget : public QDockWidget
{
public:
G4UIDockWidget(QString txt);
G4UIDockWidget(const QString& txt);
void closeEvent(QCloseEvent*) override;
};
@@ -244,7 +244,7 @@ class G4UIQt : public QObject, public G4VBasicShell, public G4VInteractiveSessio
public:
~G4UIQt() override;
void Prompt(G4String);
void Prompt(const G4String&);
void SessionTerminate();
void PauseSessionStart(const G4String&) override;
G4int ReceiveG4debug(const G4String&) override;
@@ -253,7 +253,7 @@ public:
// G4String GetCommand(Widget);
private:
void SecondaryLoop(G4String); // a VIRER
void SecondaryLoop(const G4String&); // a VIRER
void CreateHelpWidget();
void InitHelpTreeAndVisParametersWidget();
void FillHelpTree();
@@ -307,7 +307,7 @@ public:
G4UIDockWidget* CreateUITabWidget();
void CreateViewerWidget();
void OpenHelpTreeOnCommand(const QString&);
QString GetShortCommandPath(QString);
QString GetShortCommandPath(QString&);
QString GetLongCommandPath(QTreeWidgetItem*);
G4bool IsGUICommand(const G4UIcommand*);
G4bool CreateVisCommandGroupAndToolBox(G4UIcommand*, QWidget*, G4int, G4bool isDialog);
@@ -321,7 +321,7 @@ public:
QString FilterOutput(const G4UIOutputString&, const QString&, const QString&);
G4String GetThreadPrefix();
G4bool CheckG4EnvironmentVariable(char* txt, char* version);
QStandardItemModel* CreateCompleterModel(G4String aCmd);
QStandardItemModel* CreateCompleterModel(const G4String& aCmd);
void CreateEmptyViewerPropertiesWidget();
void CreateEmptyPickInfosWidget();
@@ -138,7 +138,7 @@ class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession
static G4String GetToolTips(G4int);
G4String GetHelpTreeToolTips(HTREEITEM);
static G4String ConvertNewLines(G4String);
static G4String ConvertNewLines(const G4String&);
void HelpTreeDoubleClick(HTREEITEM);
@@ -151,7 +151,7 @@ class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession
G4bool InitHelpTreeItems();
HTREEITEM AddItemToHelpTree(LPTSTR, HTREEITEM = TVI_ROOT);
static G4String GetShortCommandPath(G4String);
static G4String GetShortCommandPath(const G4String&);
LPSTR GetItemPath(HTREEITEM);
void CreateHelpTree(HTREEITEM, G4UIcommandTree*);
@@ -80,7 +80,7 @@ class G4UIXm : public G4VBasicShell, public G4VInteractiveSession
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
void AddButton(const char*, const char*, const char*);
void Prompt(G4String);
void Prompt(const G4String&);
void SessionTerminate();
virtual void PauseSessionStart(const G4String&);
virtual G4int ReceiveG4debug(const G4String&);
@@ -89,7 +89,7 @@ class G4UIXm : public G4VBasicShell, public G4VInteractiveSession
G4String GetCommand(Widget);
private:
void SecondaryLoop(G4String);
void SecondaryLoop(const G4String&);
G4bool GetHelpChoice(G4int&);
void ExitHelp() const;
static void CommandEnteredCallback(Widget, XtPointer, XtPointer);
@@ -97,9 +97,9 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
// 3rd priority : refer $HOME/.g4session
if (selected == kNone) {
G4String appinput = argv[0];
const G4String& appinput = argv[0];
G4String appname = "";
size_t islash = appinput.find_last_of("/\\");
std::size_t islash = appinput.find_last_of("/\\");
if (islash == G4String::npos)
appname = appinput;
else
@@ -224,7 +224,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
while (fsession.good()) {
if (fsession.eof()) break;
fsession.getline(linebuf, BUFSIZE);
G4String aline = G4StrUtil::strip_copy(linebuf);
const G4String& aline = G4StrUtil::strip_copy(linebuf);
if (aline[0] == '#') continue;
if (aline.empty()) continue;
if (iline == 1)
@@ -235,7 +235,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
G4String aname = aline.substr(0, idx);
idx = aline.find_first_not_of(' ', idx);
if (idx == G4String::npos) break;
G4String sname = aline.substr(idx, aline.size() - idx);
const G4String& sname = aline.substr(idx, aline.size() - idx);
sessionMap[aname] = sname;
}
iline++;
@@ -247,7 +247,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
if (it != sessionMap.end())
stype = sessionMap[appname];
else
stype = default_session;
stype = std::move(default_session);
G4StrUtil::to_lower(stype);
// select session...
+20 -9
View File
@@ -1687,7 +1687,8 @@ void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
if (sceneTreeItem->GetType() != G4SceneTreeItem::touchable) return;
auto oldQColor = ConvertG4ColourToQColor(sceneTreeItem->GetVisAttributes().GetColour());
auto newQColor = QColorDialog::getColor(oldQColor, fNewSceneTreeItemTreeWidget, "", QColorDialog::ShowAlphaChannel);
auto newQColor = QColorDialog::getColor
(oldQColor, fNewSceneTreeItemTreeWidget, "", QColorDialog::ShowAlphaChannel);
if (!newQColor.isValid()) return;
if (newQColor == oldQColor) return;
@@ -1698,6 +1699,16 @@ void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
auto uiMan = G4UImanager::GetUIpointer();
uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
uiMan->ApplyCommand("/vis/touchable/set/colour " + oss.str());
// Normally the sceneTreeItem will be updated when the scene is processed after the above
// commands, but if the user sets the opacity to zero, G4PhysicalVolumeModel does not
// transmit it (this is because some users set the opacity to zero to make a volume
// invisible - perhaps they should use the visibility flag, but hey-ho).
// By design, the sceneTreeItem remains, so it can still be interacted with, but
// the colour will not be updated, so we do it here.
if (newColour.GetAlpha() == 0.) {
sceneTreeItem->AccessVisAttributes().SetColour(newColour);
}
}
void G4UIQt::SceneTreeItemExpanded(QTreeWidgetItem* item)
@@ -1901,7 +1912,7 @@ void G4UIQt::NewSceneTreeItemTreeWidget::ActWithAnInteger
{
G4bool ok = true;
auto newValue = QInputDialog::getInt(this, action.c_str(), action.c_str(),
0, 0, 999, 1, &ok);
0, 0, 9999999, 1, &ok);
if (ok) {
auto uiMan = G4UImanager::GetUIpointer();
uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
@@ -2420,7 +2431,7 @@ G4UIsession* G4UIQt::SessionStart()
/** Display the prompt in the prompt area
@param aPrompt : string to display as the promt label
*/
void G4UIQt::Prompt(G4String aPrompt)
void G4UIQt::Prompt(const G4String& aPrompt)
{
if (aPrompt == nullptr) return;
@@ -2460,7 +2471,7 @@ void G4UIQt::PauseSessionStart(const G4String& aState)
Begin the secondary loop
@param a_prompt : label to display as the prompt label
*/
void G4UIQt::SecondaryLoop(G4String aPrompt)
void G4UIQt::SecondaryLoop(const G4String& aPrompt)
{
if (aPrompt == nullptr) return;
@@ -4078,7 +4089,7 @@ void G4UIQt::UpdateCommandCompleter()
fCompleter->popup()->installEventFilter(this);
}
QStandardItemModel* G4UIQt::CreateCompleterModel(G4String aCmd)
QStandardItemModel* G4UIQt::CreateCompleterModel(const G4String& aCmd)
{
QList<QStandardItem*> dirModelList;
QList<QStandardItem*> commandModelList;
@@ -4529,7 +4540,7 @@ QString G4UIQt::FilterOutput(
const G4UIOutputString& output, const QString& currentThread, const QString& filter)
{
#ifdef G4MULTITHREADED
if ((currentThread == "All") || (currentThread == output.fThread)) {
if ((currentThread == "All") || (currentThread == output.fThread.data())) {
#else
if (currentThread == "") {
#endif
@@ -4795,7 +4806,7 @@ QMultiMap<G4int, QString> G4UIQt::LookForHelpStringInChildTree(
}
#endif
QString G4UIQt::GetShortCommandPath(QString commandPath)
QString G4UIQt::GetShortCommandPath(QString& commandPath)
{
if (commandPath.indexOf("/") == 0) {
commandPath = commandPath.right(commandPath.size() - 1);
@@ -5449,7 +5460,7 @@ G4QTabWidget::G4QTabWidget()
{}
#endif
G4UIOutputString::G4UIOutputString(QString text, G4String origine, G4String outputStream)
G4UIOutputString::G4UIOutputString(const QString& text, const G4String& origine, const G4String& outputStream)
: fText(text), fThread(origine)
{
if (! GetOutputList().contains(QString(" ") + outputStream + " ")) {
@@ -5549,7 +5560,7 @@ void G4QTabWidget::paintEvent(QPaintEvent*)
}
#endif
G4UIDockWidget::G4UIDockWidget(QString txt) : QDockWidget(txt) {}
G4UIDockWidget::G4UIDockWidget(const QString& txt) : QDockWidget(txt) {}
void G4UIDockWidget::closeEvent(QCloseEvent* aEvent)
{
@@ -1034,14 +1034,14 @@ G4String G4UIWin32::GetHelpTreeToolTips(HTREEITEM item)
/****************************************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
G4String G4UIWin32::ConvertNewLines(G4String a_string)
G4String G4UIWin32::ConvertNewLines(const G4String& a_string)
{
// Geant4 uses UNIX's style for new lines (\n)
// we must convert them to Windows' style (\r\n)
G4String str = std::move(a_string);
size_t index = str.find("\n", 0);
G4String str = a_string;
std::size_t index = str.find("\n", 0);
while (index < str.length()) {
str.replace(index, 2, "\r\n");
str.replace(index, 1, "\r\n");
// Advance index forward so the next iteration doesn't pick it up as well.
index = str.find("\n", index + 2);
}
@@ -1306,9 +1306,9 @@ HTREEITEM G4UIWin32::AddItemToHelpTree(LPTSTR lpszItem, HTREEITEM aParent)
/****************************************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
G4String G4UIWin32::GetShortCommandPath(G4String commandPath)
G4String G4UIWin32::GetShortCommandPath(const G4String& commandPath)
{
G4String str = std::move(commandPath);
G4String str = commandPath;
if (str.find_last_of("/") == (str.size() - 1)) str = str.erase(str.size() - 1, 1);
@@ -172,7 +172,7 @@ G4UIsession* G4UIXm::SessionStart()
return this;
}
/***************************************************************************/
void G4UIXm::Prompt(G4String aPrompt)
void G4UIXm::Prompt(const G4String& aPrompt)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
@@ -204,7 +204,7 @@ void G4UIXm::PauseSessionStart(const G4String& a_state)
}
}
/***************************************************************************/
void G4UIXm::SecondaryLoop(G4String a_prompt)
void G4UIXm::SecondaryLoop(const G4String& a_prompt)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{