Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA
|
||||
|
||||
#ifndef G4DAWNFILE_SCENE_HANDLER_HH
|
||||
#define G4DAWNFILE_SCENE_HANDLER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
#include "G4FRofstream.hh"
|
||||
#include "G4FRConst.hh"
|
||||
|
||||
class G4VisAttributes;
|
||||
class G4DAWNFILE;
|
||||
|
||||
//-----
|
||||
class G4DAWNFILESceneHandler : public G4VSceneHandler
|
||||
{
|
||||
friend class G4DAWNFILEViewer;
|
||||
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILESceneHandler(G4DAWNFILE& system, const G4String& name = "");
|
||||
virtual ~G4DAWNFILESceneHandler();
|
||||
|
||||
//----- overriding base class methods
|
||||
using G4VSceneHandler::AddPrimitive;
|
||||
void AddPrimitive(const G4Polyline& line);
|
||||
void AddPrimitive(const G4Polyhedron& p);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
using G4VSceneHandler::AddSolid;
|
||||
void AddSolid(const G4Box& box);
|
||||
void AddSolid(const G4Cons& cons);
|
||||
void AddSolid(const G4Tubs& tubs);
|
||||
void AddSolid(const G4Trd& trd);
|
||||
void AddSolid(const G4Trap& trap);
|
||||
void AddSolid(const G4Sphere& sphere);
|
||||
void AddSolid(const G4Para& para);
|
||||
void AddSolid(const G4Torus& torus);
|
||||
void AddSolid(const G4VSolid& solid);
|
||||
|
||||
void ClearTransientStore(); // Used for triggering detector re-drawing.
|
||||
|
||||
//----- public methods inherent to this class
|
||||
void FRBeginModeling();
|
||||
void FREndModeling();
|
||||
G4bool FRIsInModeling() { return FRflag_in_modeling; }
|
||||
|
||||
G4bool IsSavingG4Prim(void) { return flag_saving_g4_prim; }
|
||||
void BeginSavingG4Prim(void);
|
||||
void EndSavingG4Prim(void);
|
||||
void SetG4PrimFileName();
|
||||
|
||||
G4DAWNFILE& GetSystem() { return fSystem; }
|
||||
void SendBoundingBox(void);
|
||||
const char* GetG4PrimFileName() { return fG4PrimFileName; }
|
||||
|
||||
private:
|
||||
//----- Utilities etc (common to DAWN and DAWNFILE drivers )
|
||||
G4bool SendVisAttributes(const G4VisAttributes* pAV);
|
||||
G4bool IsVisible(void);
|
||||
void SendTransformedCoordinates(void);
|
||||
void SendPhysVolName(void);
|
||||
void SendNdiv(void);
|
||||
|
||||
//----- public methods common to DAWN and DAWNFILE drivers
|
||||
public:
|
||||
void SendStr(const char* char_string);
|
||||
void SendStrInt(const char* char_string, G4int ival);
|
||||
void SendStrInt3(const char* char_string, G4int ival1, G4int ival2,
|
||||
G4int ival3);
|
||||
void SendStrInt4(const char* char_string, G4int ival1, G4int ival2,
|
||||
G4int ival3, G4int ival4);
|
||||
void SendStrDouble(const char* char_string, G4double dval);
|
||||
void SendStrDouble2(const char* char_string, G4double dval1, G4double dval2);
|
||||
void SendStrDouble3(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3);
|
||||
|
||||
void SendStrDouble4(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4);
|
||||
|
||||
void SendStrDouble5(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5);
|
||||
|
||||
void SendStrDouble6(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6);
|
||||
|
||||
void SendStrDouble7(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6, G4double dval7);
|
||||
|
||||
void SendStrDouble11(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6, G4double dval7, G4double dval8,
|
||||
G4double dval9, G4double dval10, G4double dval11);
|
||||
|
||||
void SendIntDouble3(G4int ival, G4double dval1, G4double dval2,
|
||||
G4double dval3);
|
||||
void SendInt3Str(G4int ival1, G4int ival2, G4int ival3,
|
||||
const char* char_string);
|
||||
void SendInt4Str(G4int ival1, G4int ival2, G4int ival3, G4int ival4,
|
||||
const char* char_string);
|
||||
|
||||
void SendStrDouble3Str(const char* char_string1, G4double dval1,
|
||||
G4double dval2, G4double dval3,
|
||||
const char* char_string2);
|
||||
|
||||
void SendStrDouble6Str(const char* char_string1, G4double dval1,
|
||||
G4double dval2, G4double dval3, G4double dval4,
|
||||
G4double dval5, G4double dval6,
|
||||
const char* char_string2);
|
||||
|
||||
void SendInt(G4int val);
|
||||
void SendDouble(G4double val);
|
||||
|
||||
private:
|
||||
G4DAWNFILE& fSystem; // Graphics system for this scene.
|
||||
static G4int fSceneIdCount;
|
||||
|
||||
G4FRofstream fPrimDest; // defined here
|
||||
G4bool FRflag_in_modeling;
|
||||
// true: FR_BEGIN_MODELING has sent to DAWN, and
|
||||
// FR_END_MODELING has not sent yet.
|
||||
// false: otherwise
|
||||
//
|
||||
// FRflag_in_modeling is set to "true"
|
||||
// in FRBeginModeling(), and to "false"
|
||||
// in FREndModeling().
|
||||
|
||||
G4bool flag_saving_g4_prim;
|
||||
|
||||
const int COMMAND_BUF_SIZE;
|
||||
|
||||
char fG4PrimDestDir[256];
|
||||
char fG4PrimFileName[256];
|
||||
G4int fMaxFileNum;
|
||||
|
||||
G4int fPrec, fPrec2;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA
|
||||
// DAWNFILE viewer - opens window, hard copy, etc.
|
||||
|
||||
#ifndef G4DAWNFILE_VIEWER_HH
|
||||
#define G4DAWNFILE_VIEWER_HH
|
||||
|
||||
#include "G4VViewer.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4DAWNFILESceneHandler;
|
||||
|
||||
class G4DAWNFILEViewer : public G4VViewer
|
||||
{
|
||||
enum FRDEV
|
||||
{
|
||||
FRDEV_PS = 1,
|
||||
FRDEV_XWIN = 2,
|
||||
FRDEV_PS2 = 3,
|
||||
FRDEV_XWIN2 = 4,
|
||||
FRDEV_OPEN_GL = 5,
|
||||
FRDEV_DEVICE_END = 6
|
||||
};
|
||||
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILEViewer(G4DAWNFILESceneHandler& scene, const G4String& name = "");
|
||||
virtual ~G4DAWNFILEViewer();
|
||||
|
||||
//----- overriding base class methods
|
||||
void SetView(); // Do nothing. SendViewParameters will do its job.
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
|
||||
//---- methods inherent to this class
|
||||
void SendViewParameters();
|
||||
const char* GetG4PrimViewer() { return fG4PrimViewer; }
|
||||
const char* GetG4PrimViewerInvocation() { return fG4PrimViewerInvocation; }
|
||||
const char* GetPSViewer() { return fPSViewer; }
|
||||
void SendDrawingStyleToDAWNGUI(std::ostream& out);
|
||||
|
||||
private:
|
||||
G4DAWNFILESceneHandler&
|
||||
fSceneHandler; // Reference to Graphics Scene for this view.
|
||||
|
||||
char fG4PrimViewer[32];
|
||||
char fG4PrimViewerInvocation[64];
|
||||
char fPSViewer[32];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,195 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Tue Jul 2 15:30:49 JST 1996
|
||||
///////////////////////////////////
|
||||
///// G4FRConst.hh /////
|
||||
///////////////////////////////////
|
||||
|
||||
#ifndef G4_FR_COMMAND_LIST_HH
|
||||
#define G4_FR_COMMAND_LIST_HH
|
||||
|
||||
//----- Header comment
|
||||
const char FR_G4_PRIM_HEADER[] = "##G4.PRIM-FORMAT-2.4";
|
||||
// const char FR_PHYSICAL_VOLUME_NAME [] = "#/PhysicalVolumeName" ;
|
||||
const char FR_PHYSICAL_VOLUME_NAME[] = "#/PVName";
|
||||
|
||||
//----- Execution control (beginning with !)
|
||||
const char FR_GUI[] = "!GraphicalUserInterface";
|
||||
const char FR_DEVICE[] = "!Device";
|
||||
const char FR_SET_CAMERA[] = "!SetCamera";
|
||||
const char FR_OPEN_DEVICE[] = "!OpenDevice";
|
||||
const char FR_CLOSE_DEVICE[] = "!CloseDevice";
|
||||
const char FR_DRAW_ALL[] = "!DrawAll";
|
||||
const char FR_CLEAR_DATA[] = "!ClearData";
|
||||
const char FR_QUIT[] = "!Quit";
|
||||
const char FR_DISCONNECT_DAWND[] = "!DisconnectDawnd";
|
||||
const char FR_TERMINATE_DAWND[] = "!TerminateDawnd";
|
||||
const char FR_SAVE[] = "!Save";
|
||||
const char FR_END_SAVE[] = "!EndSave";
|
||||
const char FR_WAIT[] = "!Wait";
|
||||
const char FR_PAUSE[] = "!Pause";
|
||||
|
||||
//----- Drawing Style
|
||||
const char FR_WIREFRAME[] = "/Wireframe";
|
||||
const char FR_SURFACE[] = "/Surface";
|
||||
const char FR_LINES[] = "/Lines";
|
||||
|
||||
//----- Begin and End of Modeling
|
||||
const char FR_BEGIN_MODELING[] = "!BeginModeling";
|
||||
const char FR_END_MODELING[] = "!EndModeling";
|
||||
|
||||
//----- Bounding box
|
||||
const char FR_BOUNDING_BOX[] = "/BoundingBox";
|
||||
const char FR_BOUNDING_BOX_UNIT[] = "/BoundingBox -0.5 -0.5 -0.5 0.5 0.5 0.5";
|
||||
|
||||
//----- Number of divising curved surface
|
||||
const int FR_DEFALUT_NDIV_VALUE = 24;
|
||||
|
||||
const char FR_NDIV[] = "/Ndiv";
|
||||
const char FR_NDIV_DEFAULT[] = "/Ndiv 24";
|
||||
const char FR_NDIV_3[] = "/Ndiv 3";
|
||||
const char FR_NDIV_4[] = "/Ndiv 4";
|
||||
const char FR_NDIV_8[] = "/Ndiv 8";
|
||||
const char FR_NDIV_16[] = "/Ndiv 16";
|
||||
const char FR_NDIV_24[] = "/Ndiv 24";
|
||||
const char FR_NDIV_48[] = "/Ndiv 48";
|
||||
const char FR_NDIV_96[] = "/Ndiv 96";
|
||||
|
||||
//----- Camera information
|
||||
const char FR_CAMERA_POSITION[] = "/CameraPosition";
|
||||
const char FR_CAMERA_POSITION_DEFAULT[] = "/CameraPosition 100000.0 0.0 0.0";
|
||||
// see from far upward position
|
||||
const char FR_TARGET_POINT[] = "/TargetPoint";
|
||||
const char FR_ZOOM_FACTOR[] = "/ZoomFactor";
|
||||
const char FR_SCALE[] = "/Scale";
|
||||
const char FR_FOCAL_DISTANCE[] = "/FocalDistance";
|
||||
|
||||
//----- Body coordinate information
|
||||
const char FR_BASE_VECTOR[] = "/BaseVector";
|
||||
// Give e1 and e2. Then e3 is calculated.
|
||||
const char FR_BASE_VECTOR_DEFAULT[] = "/BaseVector 1.0 0.0 0.0 0.0 1.0 0.0";
|
||||
const char FR_ORIGIN[] = "/Origin";
|
||||
const char FR_ORIGIN_DEFAULT[] = "/Origin 0.0 0.0 0.0";
|
||||
|
||||
//----- Attribute information
|
||||
const char FR_DIFFUSE_RGB[] = "/DiffuseRGB";
|
||||
// old name of /ColorRGB
|
||||
|
||||
const char FR_COLOR_RGB[] = "/ColorRGB";
|
||||
const char FR_COLOR_RGB_DEFAULT[] = "/ColorRGB 1.0 1.0 1.0";
|
||||
const char FR_COLOR_RGB_WHITE[] = "/ColorRGB 1.0 1.0 1.0";
|
||||
|
||||
const char FR_COLOR_RGB_RED[] = "/ColorRGB 1.0 0.0 0.0";
|
||||
const char FR_COLOR_RGB_GREEN[] = "/ColorRGB 0.0 1.0 0.0";
|
||||
const char FR_COLOR_RGB_BLUE[] = "/ColorRGB 0.0 0.0 1.0";
|
||||
|
||||
const char FR_COLOR_RGB_CYAN[] = "/ColorRGB 0.0 1.0 1.0";
|
||||
const char FR_COLOR_RGB_MAGENTA[] = "/ColorRGB 1.0 0.0 1.0";
|
||||
const char FR_COLOR_RGB_YELLOW[] = "/ColorRGB 1.0 1.0 0.0";
|
||||
|
||||
const char FR_SPECULAR_RGB[] = "/SpecularRGB";
|
||||
const char FR_SPECULAR_RGB_DEFAULT[] = "/SpecularRGB 1.0 1.0 1.0";
|
||||
const char FR_SPECULAR_RGB_WHITE[] = "/SpecularRGB 1.0 1.0 1.0";
|
||||
|
||||
const char FR_PHONG_POWER[] = "/PhongPower";
|
||||
const char FR_PHONG_POWER_DEFAULT[] = "/PhongPower 3";
|
||||
|
||||
const char FR_TRANSPARENCY[] = "/Transparency";
|
||||
const char FR_TRANSPARENCY_ON[] = "/Transparency 1 "; // transparent
|
||||
const char FR_TRANSPARENCY_OFF[] = "/Transparency 0 "; // non-transparent
|
||||
|
||||
const char FR_FORCE_WIREFRAME[] = "/ForceWireframe";
|
||||
const char FR_FORCE_WIREFRAME_ON[] = "/ForceWireframe 1";
|
||||
const char FR_FORCE_WIREFRAME_OFF[] = "/ForceWireframe 0";
|
||||
|
||||
const char FR_VISIBILITY[] = "/Visibility";
|
||||
const char FR_VISIBILITY_ON[] = "/Visibility 1"; // visible
|
||||
const char FR_VISIBILITY_OFF[] = "/Visibility 0"; // invisible
|
||||
|
||||
//----- 3D Primitives
|
||||
const char FR_POLYHEDRON[] = "/Polyhedron";
|
||||
const char FR_VERTEX[] = "/Vertex";
|
||||
const char FR_FACET[] = "/Facet";
|
||||
const char FR_END_POLYHEDRON[] = "/EndPolyhedron";
|
||||
|
||||
const char FR_BOX[] = "/Box";
|
||||
const char FR_BOX_UNIT[] = "/Box 0.5 0.5 0.5"; // dx, dy, dz
|
||||
|
||||
const char FR_COLUMN[] = "/Column";
|
||||
const char FR_COLUMN_UNIT[] = "/Column 0.5 0.5"; // R dz
|
||||
|
||||
const char FR_POLYLINE[] = "/Polyline";
|
||||
const char FR_PL_VERTEX[] = "/PLVertex";
|
||||
const char FR_PL_VERTEX_OLD[] = "PLVertex";
|
||||
const char FR_END_POLYLINE[] = "/EndPolyline";
|
||||
|
||||
const char FR_TRD[] = "/Trd";
|
||||
// /Trd dx1 dx2 dy1 dy2 dz ;
|
||||
const char FR_TRAP[] = "/Trap";
|
||||
// /Trap dz theta phi h1 bl1 tl1 alpha1 h2 bl2 tl2 alpha2
|
||||
const char FR_TUBS[] = "/Tubs";
|
||||
// /Tubs rmin rmax dz sphi dphi
|
||||
const char FR_CONS[] = "/Cons";
|
||||
// /Cons rmin1 rmax1 rmin2 rmax2 dz sphi dphi
|
||||
const char FR_SPHERE[] = "/Sphere";
|
||||
// /Sphere R
|
||||
const char FR_SPHERE_SEG[] = "/SphereSeg";
|
||||
// /SphereSeg rmin rmax s_theta d_theta s_phi d_phi
|
||||
const char FR_PARA[] = "/Parallelepiped";
|
||||
// /Parallelepiped dx dy dz tanAlpha tanTheta_cosPhi tanTheta_sinPhi
|
||||
const char FR_PCON[] = "/PolyCone";
|
||||
// /PolyCone sphi dphi nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_PGON[] = "/PolyGon";
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_TORUS[] = "/Torus";
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
|
||||
//----- Marks I (arg: x y z half_size_3d)
|
||||
const char FR_FONT_NAME[] = "/FontName";
|
||||
|
||||
//----- Marks I (arg: x y z half_size_3d)
|
||||
const char FR_MARK_CIRCLE_2D[] = "/MarkCircle2D";
|
||||
const char FR_MARK_SQUARE_2D[] = "/MarkSquare2D";
|
||||
const char FR_MARK_TEXT_2D[] = "/MarkText2D";
|
||||
// /MarkText2D x y z size_world x_offset_world y_offset_world string
|
||||
|
||||
//----- Marks II (arg: x y z half_size_2d)
|
||||
const char FR_MARK_CIRCLE_2DS[] = "/MarkCircle2DS";
|
||||
const char FR_MARK_SQUARE_2DS[] = "/MarkSquare2DS";
|
||||
const char FR_MARK_TEXT_2DS[] = "/MarkText2DS";
|
||||
// /MarkText2DS x y z size_pt x_offset_pt y_offset_pt string
|
||||
|
||||
//----- Text
|
||||
const char FR_TEXT_2DS[] = "/Text2DS";
|
||||
|
||||
//----- For DAWNCUT
|
||||
const char FR_CLIPPING_PLANE[] = "/ClippingPlane";
|
||||
// /ClippingPlaneMarkCross2D a b c d
|
||||
// for plane ax + by + cz + d = 0
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef G4_FR_OFSTREAM_HH
|
||||
#define G4_FR_OFSTREAM_HH
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4FRofstream
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
SEND_BUFMAX = 1024
|
||||
};
|
||||
|
||||
public:
|
||||
// constructors
|
||||
G4FRofstream() { flag_file_open = false; }
|
||||
G4FRofstream(const char* filename);
|
||||
|
||||
// destructor
|
||||
virtual ~G4FRofstream();
|
||||
|
||||
// open and close
|
||||
void Open(const char* filename);
|
||||
void Close();
|
||||
G4bool IsOpen() { return flag_file_open; }
|
||||
|
||||
// utilities
|
||||
void SendLine(const char* string); // save string with new line
|
||||
|
||||
// static functions
|
||||
static G4bool DoesFileExist(const char* filename);
|
||||
|
||||
protected:
|
||||
G4bool flag_file_open;
|
||||
std::ofstream fout;
|
||||
};
|
||||
|
||||
inline void G4FRofstream::Open(const char* filename)
|
||||
{
|
||||
if(!IsOpen())
|
||||
{
|
||||
fout.open(filename);
|
||||
flag_file_open = true;
|
||||
}
|
||||
}
|
||||
|
||||
inline void G4FRofstream::Close()
|
||||
{
|
||||
if(IsOpen())
|
||||
{
|
||||
fout.close();
|
||||
flag_file_open = false;
|
||||
}
|
||||
}
|
||||
|
||||
inline void G4FRofstream::SendLine(const char* message)
|
||||
{
|
||||
if(IsOpen())
|
||||
{
|
||||
fout << message << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
inline G4bool G4FRofstream::DoesFileExist(const char* filename)
|
||||
{
|
||||
G4bool status = false;
|
||||
|
||||
std::ifstream fout_tmp(filename);
|
||||
if(fout_tmp)
|
||||
{
|
||||
status = true;
|
||||
}
|
||||
fout_tmp.close();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline G4FRofstream::G4FRofstream(const char* filename)
|
||||
{
|
||||
flag_file_open = false;
|
||||
Open(filename);
|
||||
}
|
||||
|
||||
inline G4FRofstream::~G4FRofstream() { Close(); }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4VISFEATURESOFDAWNFILE_HH
|
||||
#define G4VISFEATURESOFDAWNFILE_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
G4String G4VisFeaturesOfDAWNFILE();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user