Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
+16 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.73 2008/11/21 10:57:25 kmura Exp $
$Id: History,v 1.77 2009/11/06 09:00:02 kmura Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,21 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
6 November, 2009 K. Murakami (intercoms-V09-02-02)
- add GetPreviousSession() in G4UIbatch
6 November, 2009 K. Murakami (intercoms-V09-02-01)
- fix incorrect directory deletion of G4UIcommandTree::RemoveCommand()
14 May 2009 K.Murakami (intercoms-V09-02-00)
- tagged for release 9.3 beta
7th May 2009, Laurent Garnier
- G4UIcommandTree : Add a new function to complete a command path with
maximum characters guess.
- G4UIcommandTree : FindCommandTree will now return current tree when
command path is "/"
21 November, 2008 K.Murakami (intercoms-V09-01-01)
- fix improper comment treatment for line continue characters
in G4UIbatch. [Problem-1034]
+12 -2
View File
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UIbatch.hh,v 1.10 2007/07/16 10:15:12 kmura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4UIbatch.hh,v 1.11 2009/11/06 08:58:53 kmura Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// ====================================================================
// G4UIbatch.hh
@@ -69,9 +69,19 @@ public:
~G4UIbatch();
G4UIsession* GetPreviousSession() const;
virtual G4UIsession* SessionStart();
virtual void PauseSessionStart(G4String Prompt);
};
// ============================================================================
// inlines
inline G4UIsession* G4UIbatch::GetPreviousSession() const
{
return previousSession;
}
#endif
+7 -2
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4UIcommandTree.hh,v 1.16 2008/01/30 11:20:03 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4UIcommandTree.hh,v 1.17 2009/05/07 09:33:51 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
#ifndef G4UIcommandTree_h
@@ -56,6 +56,10 @@ class G4UIcommandTree
void RemoveCommand(G4UIcommand * aCommand);
G4UIcommand * FindPath(const char* commandPath);
G4UIcommandTree * FindCommandTree(const char* commandPath);
G4String CompleteCommandPath(const G4String commandPath);
// Complete most available caracters in common into command path in the command line
// given
void List();
void ListCurrent();
void ListCurrentWithNum();
@@ -64,6 +68,7 @@ class G4UIcommandTree
private:
G4String CreateFileName(const char* pName);
G4String ModStr(const char* strS);
G4String GetFirstMatchedString(const G4String&,const G4String&) const;
std::vector<G4UIcommand*> command;
std::vector<G4UIcommandTree*> tree;
+107 -3
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4UIcommandTree.cc,v 1.14 2008/01/30 11:20:03 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4UIcommandTree.cc,v 1.16 2009/11/06 06:16:07 kmura Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
#include "G4UIcommandTree.hh"
@@ -142,7 +142,8 @@ void G4UIcommandTree::RemoveCommand(G4UIcommand *aCommand)
{
tree[i_thTree]->RemoveCommand( aCommand );
G4int n_commandRemain = tree[i_thTree]->GetCommandEntry();
if(n_commandRemain==0)
G4int n_treeRemain = tree[i_thTree]-> GetTreeEntry();
if(n_commandRemain == 0 && n_treeRemain == 0)
{
G4UIcommandTree * emptyTree = tree[i_thTree];
tree.erase(tree.begin()+i_thTree);
@@ -218,10 +219,113 @@ G4UIcommandTree * G4UIcommandTree::FindCommandTree(const char* commandPath)
return tree[i_thTree]->FindCommandTree( commandPath );
}
}
} else {
return this;
}
return NULL;
}
G4String G4UIcommandTree::CompleteCommandPath(const G4String aCommandPath)
{
G4String pathName = aCommandPath;
G4String remainingPath = aCommandPath;
G4String empty = "";
G4String matchingPath = empty;
// find the tree
G4int jpre= pathName.last('/');
if(jpre != G4int(G4String::npos)) pathName.remove(jpre+1);
G4UIcommandTree* aTree = FindCommandTree(pathName);
if (!aTree) {
return empty;
}
if( pathName.index( pathName ) == std::string::npos ) return empty;
std::vector<G4String> paths;
// list matched directories/commands
G4String strtmp;
G4int nMatch= 0;
int Ndir= aTree-> GetTreeEntry();
int Ncmd= aTree-> GetCommandEntry();
// directory ...
for(G4int idir=1; idir<=Ndir; idir++) {
G4String fpdir= aTree-> GetTree(idir)-> GetPathName();
// matching test
if( fpdir.index(remainingPath, 0) == 0) {
if(nMatch==0) {
matchingPath = fpdir;
} else {
matchingPath = GetFirstMatchedString(fpdir,matchingPath);
}
nMatch++;
paths.push_back(fpdir);
}
}
if (paths.size()>=2) {
G4cout << "Matching directories :" << G4endl;
for( unsigned int i_thCommand = 0; i_thCommand < paths.size(); i_thCommand++ ) {
G4cout << paths[i_thCommand] << G4endl;
}
}
// command ...
std::vector<G4String> commands;
for(G4int icmd=1; icmd<=Ncmd; icmd++){
G4String fpcmd= aTree-> GetPathName() +
aTree-> GetCommand(icmd) -> GetCommandName();
// matching test
if( fpcmd.index(remainingPath, 0) ==0) {
if(nMatch==0) {
matchingPath= fpcmd + " ";
} else {
strtmp= fpcmd + " ";
matchingPath= GetFirstMatchedString(matchingPath, strtmp);
}
nMatch++;
commands.push_back(fpcmd+" ");
}
}
if (commands.size()>=2) {
G4cout << "Matching commands :" << G4endl;
for( unsigned int i_thCommand = 0; i_thCommand < commands.size(); i_thCommand++ ) {
G4cout << commands[i_thCommand] << G4endl;
}
}
return matchingPath;
}
////////////////////////////////////////////////////////////////////
G4String G4UIcommandTree::GetFirstMatchedString(const G4String& str1,
const G4String& str2) const
////////////////////////////////////////////////////////////////////
{
int nlen1= str1.length();
int nlen2= str2.length();
int nmin = nlen1<nlen2 ? nlen1 : nlen2;
G4String strMatched;
for(size_t i=0; G4int(i)<nmin; i++){
if(str1[i]==str2[i]) {
strMatched+= str1[i];
} else {
break;
}
}
return strMatched;
}
void G4UIcommandTree::ListCurrent()
{
G4cout << "Command directory path : " << pathName << G4endl;