starting udate geant sloid
This commit is contained in:
@@ -28,11 +28,15 @@
|
||||
|
||||
#include "Core/Object.h"
|
||||
#include "Geant/Matter.h"
|
||||
#include "Math/Transform.h"
|
||||
#include <Geant4/G4LogicalVolume.hh>
|
||||
#include "Math/ContainerBox.h"
|
||||
#include "Math/Dense.h"
|
||||
#include "Math/TriangleMesh.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class G4Material;
|
||||
class G4LogicalVolume;
|
||||
class G4TessellatedSolid;
|
||||
@@ -42,28 +46,17 @@ namespace uLib {
|
||||
namespace Geant {
|
||||
|
||||
class Solid : public Object {
|
||||
public:
|
||||
|
||||
uLibTypeMacro(Solid, Object)
|
||||
ULIB_SERIALIZE_ACCESS
|
||||
ULIB_DECLARE_PROPERTIES(Solid)
|
||||
|
||||
public:
|
||||
|
||||
Solid();
|
||||
Solid(const char *name);
|
||||
virtual ~Solid();
|
||||
|
||||
void SetNistMaterial(const char *name);
|
||||
void SetMaterial(G4Material *material);
|
||||
|
||||
void SetSizeUnit(const char *unit);
|
||||
|
||||
// Implementiamo SetParent qui, per tutti.
|
||||
virtual void SetParent(Solid *parent);
|
||||
|
||||
// Setters per la posizione (necessari per il piazzamento)
|
||||
void SetTransform(Matrix4f transform);
|
||||
|
||||
uLibGetMacro(Material, G4Material *)
|
||||
uLibGetSetMacro(Logical, G4LogicalVolume *)
|
||||
uLibGetSetMacro(Physical, G4VPhysicalVolume *)
|
||||
|
||||
virtual G4VSolid* GetG4Solid() const { return nullptr; }
|
||||
|
||||
inline const char *GetName() const {
|
||||
@@ -72,20 +65,57 @@ public:
|
||||
|
||||
template < typename Ar >
|
||||
void serialize(Ar &ar, const unsigned int version) {
|
||||
ar & boost::serialization::make_nvp("Name", m_Name);
|
||||
ar & HRP("Name", m_Name);
|
||||
ar & HRP("Material", m_Material);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
public slots:
|
||||
virtual void Update();
|
||||
|
||||
protected:
|
||||
std::string m_Name;
|
||||
G4Material *m_Material;
|
||||
G4LogicalVolume *m_Logical;
|
||||
G4VPhysicalVolume *m_Physical; // <-- Memorizza l'oggetto posizionato
|
||||
G4ThreeVector *m_Position; // <-- Offset rispetto al centro del padre
|
||||
G4RotationMatrix* m_Rotation; // <-- Rotazione rispetto al padre
|
||||
};
|
||||
|
||||
|
||||
class LogicalVolume : public Object {
|
||||
|
||||
uLibTypeMacro(LogicalVolume, Object)
|
||||
ULIB_SERIALIZE_ACCESS
|
||||
ULIB_DECLARE_PROPERTIES(LogicalVolume)
|
||||
|
||||
public:
|
||||
|
||||
LogicalVolume();
|
||||
LogicalVolume(const char *name);
|
||||
virtual ~LogicalVolume();
|
||||
|
||||
virtual G4VSolid* GetG4Solid() const { return nullptr; }
|
||||
|
||||
inline const char *GetName() const {
|
||||
return m_Logical ? m_Logical->GetName().c_str() : m_Name.c_str();
|
||||
}
|
||||
|
||||
template < typename Ar >
|
||||
void serialize(Ar &ar, const unsigned int version) {
|
||||
ar & HRP("Name", m_Name);
|
||||
ar & HRP("Material", m_Material);
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void Update();
|
||||
|
||||
protected:
|
||||
std::string m_Name;
|
||||
Material *m_Material;
|
||||
|
||||
G4LogicalVolume *m_Logical;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,8 +125,10 @@ public:
|
||||
|
||||
TessellatedSolid();
|
||||
TessellatedSolid(const char *name);
|
||||
|
||||
void SetMesh(TriangleMesh &mesh);
|
||||
uLibGetMacro(Solid, G4TessellatedSolid *)
|
||||
|
||||
virtual G4VSolid* GetG4Solid() const override { return (G4VSolid*)m_Solid; }
|
||||
|
||||
const TriangleMesh& GetMesh() const { return m_Mesh; }
|
||||
@@ -115,9 +147,11 @@ private :
|
||||
|
||||
|
||||
class BoxSolid : public Solid {
|
||||
uLibTypeMacro(BoxSolid, Solid)
|
||||
ULIB_SERIALIZE_ACCESS
|
||||
ULIB_DECLARE_PROPERTIES(BoxSolid)
|
||||
|
||||
public:
|
||||
uLibTypeMacro(BoxSolid, Solid)
|
||||
|
||||
BoxSolid(const char *name = "");
|
||||
BoxSolid(const char *name, ContainerBox *box);
|
||||
@@ -128,14 +162,15 @@ public:
|
||||
|
||||
template < typename Ar >
|
||||
void serialize(Ar &ar, const unsigned int version) {
|
||||
ar & boost::serialization::base_object<BaseClass>(*this);
|
||||
ar & m_ContainerBox;
|
||||
// ar & boost::serialization::base_object<BaseClass>(*this);
|
||||
ar & HRP("Density", m_Density, "g/cm3");
|
||||
}
|
||||
|
||||
public slots:
|
||||
void Update();
|
||||
|
||||
private:
|
||||
float m_Density;
|
||||
ContainerBox *m_ContainerBox;
|
||||
G4Box *m_Solid;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user