IAP GITLAB

Skip to content
Snippets Groups Projects

Interface change of DoDecay() and DoInteraction()

Merged Maximilian Reininghaus requested to merge addsecondary_interface into history
All threads resolved!
3 files
+ 29
88
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 28
81
@@ -22,74 +22,6 @@
#include <utility>
#include <vector>
// definition of stack-data object to store geometry information
template <typename TEnvType>
/**
* @class GeometryData
*
* definition of stack-data object to store geometry information
*/
class GeometryData {
public:
using BaseNodeType = typename TEnvType::BaseNodeType;
// these functions are needed for the Stack interface
void Clear() { fNode.clear(); }
unsigned int GetSize() const { return fNode.size(); }
unsigned int GetCapacity() const { return fNode.size(); }
void Copy(const int i1, const int i2) { fNode[i2] = fNode[i1]; }
void Swap(const int i1, const int i2) { std::swap(fNode[i1], fNode[i2]); }
// custom data access function
void SetNode(const int i, BaseNodeType const* v) { fNode[i] = v; }
auto const* GetNode(const int i) const { return fNode[i]; }
// these functions are also needed by the Stack interface
void IncrementSize() { fNode.push_back(nullptr); }
void DecrementSize() {
if (fNode.size() > 0) { fNode.pop_back(); }
}
// custom private data section
private:
std::vector<const BaseNodeType*> fNode;
};
/**
* @class GeometryDataInterface
*
* corresponding defintion of a stack-readout object, the iteractor
* dereference operator will deliver access to these function
// defintion of a stack-readout object, the iteractor dereference
// operator will deliver access to these function
*/
template <typename T, typename TEnvType>
class GeometryDataInterface : public T {
public:
using T::GetIndex;
using T::GetStackData;
using T::SetParticleData;
using BaseNodeType = typename TEnvType::BaseNodeType;
// default version for particle-creation from input data
void SetParticleData(const std::tuple<BaseNodeType const*> v) {
SetNode(std::get<0>(v));
}
void SetParticleData(GeometryDataInterface& parent,
const std::tuple<BaseNodeType const*>) {
SetNode(parent.GetNode()); // copy Node from parent particle!
}
void SetParticleData() { SetNode(nullptr); }
void SetParticleData(GeometryDataInterface& parent) {
SetNode(parent.GetNode()); // copy Node from parent particle!
}
void SetNode(BaseNodeType const* v) { GetStackData().SetNode(GetIndex(), v); }
auto const* GetNode() const { return GetStackData().GetNode(GetIndex()); }
};
namespace corsika::setup {
namespace detail {
@@ -132,28 +64,43 @@ namespace corsika::setup {
// ---------------------------------------
// this is the FINAL stack we use in C8:
// the version without history
// using Stack = detail::StackWithGeometry;
// the version with history
using Stack = detail::StackWithHistory;
/*
See Issue 161
unfortunately clang does not support this in the same way (yet) as
gcc, so we have to distinguish here. If clang cataches up, we
could remove the clang branch here and also in
corsika::Cascade. The gcc code is much more generic and
universal. If we could do the gcc version, we won't had to define
StackView globally, we could do it with MakeView whereever it is
actually needed. Keep an eye on this!
*/
namespace detail {
/*
See Issue 161
unfortunately clang does not support this in the same way (yet) as
gcc, so we have to distinguish here. If clang cataches up, we
could remove the clang branch here and also in
corsika::Cascade. The gcc code is much more generic and
universal. If we could do the gcc version, we won't had to define
StackView globally, we could do it with MakeView whereever it is
actually needed. Keep an eye on this!
*/
#if defined(__clang__)
using StackView = corsika::stack::SecondaryView<
using TheStackView = corsika::stack::SecondaryView<
typename corsika::setup::Stack::StackImpl,
// CHECK with CLANG: corsika::setup::Stack::PIType>;
// corsika::setup::detail::StackWithGeometryInterface>;
corsika::setup::detail::StackWithHistoryInterface>;
#elif defined(__GNUC__) || defined(__GNUG__)
using StackView = corsika::history::HistorySecondaryView<corsika::stack::MakeView<corsika::setup::Stack>::type>;
using TheStackView = corsika::stack::MakeView<corsika::setup::Stack>::type;
#endif
}
// ---------------------------------------
// this is the FINAL stackitertor (particle type) we use in C8:
// the version without history
//using StackView = detail::StackView;
// the one with history
using StackView = corsika::history::HistorySecondaryView<detail::TheStackView>;
} // namespace corsika::setup
Loading