Skip to content
Snippets Groups Projects
Commit 3ca946cb authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

Merge branch 'GasIsAMutableMaterial' into 'main'

Deal with mutable materials such as a gas mixture.

See merge request !320
parents 87828fbb f620b53d
No related branches found
No related tags found
1 merge request!320Deal with mutable materials such as a gas mixture.
Pipeline #7389102 failed
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#ifndef GEOMODELKERNEL_GEOLOGVOL_H #ifndef GEOMODELKERNEL_GEOLOGVOL_H
#define GEOMODELKERNEL_GEOLOGVOL_H #define GEOMODELKERNEL_GEOLOGVOL_H
/** /**
* @class GeoLogVol * @class GeoLogVol
* *
...@@ -17,7 +16,9 @@ ...@@ -17,7 +16,9 @@
#include "GeoModelKernel/GeoIntrusivePtr.h" #include "GeoModelKernel/GeoIntrusivePtr.h"
#include "GeoModelKernel/GeoMaterial.h" #include "GeoModelKernel/GeoMaterial.h"
#include <vector> #include <vector>
#include <thread>
#include <shared_mutex>
#include <mutex>
class GeoLogVol : public RCBase class GeoLogVol : public RCBase
{ {
public: public:
...@@ -35,7 +36,14 @@ class GeoLogVol : public RCBase ...@@ -35,7 +36,14 @@ class GeoLogVol : public RCBase
// Returns the material of the logical volume. // Returns the material of the logical volume.
const GeoMaterial* getMaterial () const { const GeoMaterial* getMaterial () const {
return m_material; std::shared_lock lock{m_mutex};
return m_material;
}
// In some cases (gases, liquids) materials be updated?
void setMaterial (const GeoMaterial *newMaterial) const {
std::unique_lock guards{m_mutex};
m_material = newMaterial;
} }
protected: protected:
...@@ -47,7 +55,8 @@ class GeoLogVol : public RCBase ...@@ -47,7 +55,8 @@ class GeoLogVol : public RCBase
std::string m_name{}; std::string m_name{};
// Material composition of this volume. // Material composition of this volume.
GeoIntrusivePtr<const GeoMaterial> m_material{}; mutable GeoIntrusivePtr<const GeoMaterial> m_material{};
mutable std::shared_mutex m_mutex{};
// Shape of this volume. // Shape of this volume.
GeoIntrusivePtr<const GeoShape> m_shape{}; GeoIntrusivePtr<const GeoShape> m_shape{};
......
...@@ -301,6 +301,9 @@ void KitchenSinkPlugin::create(GeoVPhysVol *world, bool /*publish*/) { ...@@ -301,6 +301,9 @@ void KitchenSinkPlugin::create(GeoVPhysVol *world, bool /*publish*/) {
); );
world->add(wTransform); world->add(wTransform);
world->add(wPhys); world->add(wPhys);
wLog->setMaterial(Stainless);
} }
//--------------------------------------// //--------------------------------------//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment