refactor: improve Geant4 solid synchronization and update documentation for VTK integration
This commit is contained in:
@@ -107,6 +107,8 @@ void Solid::SetTransform(Matrix4f transform) {
|
||||
}
|
||||
|
||||
std::cout << "Solid " << GetName() << " position: " << pos << " rotation: " << m << std::endl;
|
||||
|
||||
this->Updated();
|
||||
}
|
||||
|
||||
void Solid::SetParent(Solid *parent) {
|
||||
@@ -181,11 +183,14 @@ void TessellatedSolid::Update() {
|
||||
BoxSolid::BoxSolid(const char *name) :
|
||||
BaseClass(name),
|
||||
m_ContainerBox(new ContainerBox()),
|
||||
m_Solid(new G4Box(name, 1, 1, 1))
|
||||
{}
|
||||
m_Solid(new G4Box(name, 0.5, 0.5, 0.5))
|
||||
{
|
||||
Object::connect(m_ContainerBox, &ContainerBox::Updated, this, &BoxSolid::Update);
|
||||
Update();
|
||||
}
|
||||
|
||||
BoxSolid::BoxSolid(const char *name, ContainerBox *box) : BaseClass(name) {
|
||||
m_Solid = new G4Box(name, 1, 1, 1);
|
||||
m_Solid = new G4Box(name, 0.5, 0.5, 0.5);
|
||||
m_ContainerBox = box;
|
||||
Object::connect(box, &ContainerBox::Updated, this, &BoxSolid::Update);
|
||||
if (m_Logical) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
void SetMaterial(G4Material *material);
|
||||
|
||||
void SetSizeUnit(const char *unit);
|
||||
|
||||
// Implementiamo SetParent qui, per tutti.
|
||||
virtual void SetParent(Solid *parent);
|
||||
|
||||
@@ -71,11 +72,8 @@ public:
|
||||
|
||||
template < typename Ar >
|
||||
void serialize(Ar &ar, const unsigned int version) {
|
||||
ar & m_Name;
|
||||
ar & boost::serialization::make_nvp("Name", m_Name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -123,6 +121,7 @@ public:
|
||||
|
||||
BoxSolid(const char *name = "");
|
||||
BoxSolid(const char *name, ContainerBox *box);
|
||||
|
||||
virtual G4VSolid* GetG4Solid() const override { return (G4VSolid*)m_Solid; }
|
||||
|
||||
ContainerBox* GetObject() const { return m_ContainerBox; }
|
||||
|
||||
@@ -25,6 +25,32 @@ int main() {
|
||||
TEST1(solid.GetMaterial()->GetName() == "G4_AIR");
|
||||
}
|
||||
|
||||
// Test BoxSolid //
|
||||
{
|
||||
Geant::BoxSolid boxsolid("test_boxsolid");
|
||||
boxsolid.SetNistMaterial("G4_AIR");
|
||||
TEST1(boxsolid.GetLogical() != nullptr);
|
||||
// TEST1(boxsolid.GetSolid() != nullptr);
|
||||
}
|
||||
|
||||
// Test BoxSolid with a container box //
|
||||
{
|
||||
ContainerBox box;
|
||||
|
||||
// box.SetPosition(Vector3f(1,1,1));
|
||||
// box.SetRotation(Rotation(Vector3f(0,1,0), 45_deg));
|
||||
|
||||
Geant::BoxSolid boxsolid("test_boxsolid", &box);
|
||||
boxsolid.SetNistMaterial("G4_AIR");
|
||||
TEST1(boxsolid.GetLogical() != nullptr);
|
||||
// TEST1(boxsolid.GetSolid() != nullptr);
|
||||
// TEST1(boxsolid.GetSolid()->GetXHalfLength() == 0.5);
|
||||
// TEST1(boxsolid.GetSolid()->GetYHalfLength() == 0.5);
|
||||
// TEST1(boxsolid.GetSolid()->GetZHalfLength() == 0.5);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Test TessellatedSolid with a simple mesh //
|
||||
{
|
||||
Geant::TessellatedSolid tsolid("test_tessellated");
|
||||
|
||||
Reference in New Issue
Block a user