Skip to content

Commit

Permalink
processClass annotation for startIndex and numberTransitionsBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMarre committed May 31, 2023
1 parent 5b1aeef commit cd84064
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 132 deletions.
155 changes: 99 additions & 56 deletions include/picongpu/particles/atomicPhysics2/atomicData/AtomicData.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp"
#include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp"

#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp"

#include <cstdint>
#include <memory>

Expand All @@ -36,16 +38,19 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* for use on device.
*
* @tparam T_DataBoxType dataBox type used for storage
* @tparam T_Number dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_Number, typename T_Value>
template<
typename T_Number,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateNumberOfTransitionsDataBox_Down : public DataBox<T_Number, T_Value>
{
public:
using dataBoxType = AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value>;
using S_DataBox = DataBox<T_Number, T_Value>;
static constexpr auto processClassGroup = T_ProcessClassGroup;

private:
/** start collection index of the block of autonomous transitions
Expand Down Expand Up @@ -115,12 +120,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* @tparam T_Number dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_Number, typename T_Value>
template<
typename T_Number,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateNumberOfTransitionsDataBuffer_Down : public DataBuffer<T_Number, T_Value>
{
public:
using S_DataBuffer = DataBuffer<T_Number, T_Value>;
using DataBoxType = AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value, T_ProcessClassGroup>;

private:
std::unique_ptr<typename S_DataBuffer::BufferNumber> bufferNumberOfTransitionsBlockTransitionsDown;
Expand All @@ -138,16 +148,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData
bufferOffset.reset(new typename S_DataBuffer::BufferNumber(layoutAtomicStates, false));
}

HINLINE AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value> getHostDataBox()
HINLINE DataBoxType getHostDataBox()
{
return AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value>(
return DataBoxType(
bufferNumberOfTransitionsBlockTransitionsDown->getHostBuffer().getDataBox(),
bufferOffset->getHostBuffer().getDataBox());
}

HINLINE AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value> getDeviceDataBox()
HINLINE DataBoxType getDeviceDataBox()
{
return AtomicStateNumberOfTransitionsDataBox_Down<T_Number, T_Value>(
return DataBoxType(
bufferNumberOfTransitionsBlockTransitionsDown->getDeviceBuffer().getDataBox(),
bufferOffset->getHostBuffer().getDataBox());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp"
#include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp"

#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp"

#include <cstdint>
#include <memory>

Expand All @@ -36,15 +38,20 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* for use on device.
*
* @tparam T_DataBoxType dataBox type used for storage
* @tparam T_Number dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_Number, typename T_Value>
template<
typename T_Number,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup
>
class AtomicStateNumberOfTransitionsDataBox_UpDown : public DataBox<T_Number, T_Value>
{
public:
using S_DataBox = DataBox<T_Number, T_Value>;
static constexpr auto processClassGroup = T_ProcessClassGroup;

private:
//! start collection index of the block of upward transitions from the atomic state in the corresponding upward
Expand Down Expand Up @@ -138,12 +145,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* @tparam T_Number dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_Number, typename T_Value>
template<
typename T_Number,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateNumberOfTransitionsDataBuffer_UpDown : public DataBuffer<T_Number, T_Value>
{
public:
using dataBoxType = AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value>;
using DataBoxType = AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value, T_ProcessClassGroup>;
using S_DataBuffer = DataBuffer<T_Number, T_Value>;

private:
Expand All @@ -163,17 +174,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData
bufferOffset.reset(new typename S_DataBuffer::BufferNumber(layoutAtomicStates, false));
}

HINLINE AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value> getHostDataBox()
HINLINE DataBoxType getHostDataBox()
{
return AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value>(
return DataBoxType(
bufferNumberOfTransitionsDown->getHostBuffer().getDataBox(),
bufferNumberOfTransitionsUp->getHostBuffer().getDataBox(),
bufferOffset->getHostBuffer().getDataBox());
}

HINLINE AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value> getDeviceDataBox()
HINLINE DataBoxType getDeviceDataBox()
{
return AtomicStateNumberOfTransitionsDataBox_UpDown<T_Number, T_Value>(
return DataBoxType(
bufferNumberOfTransitionsDown->getDeviceBuffer().getDataBox(),
bufferNumberOfTransitionsUp->getDeviceBuffer().getDataBox(),
bufferOffset->getDeviceBuffer().getDataBox());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp"
#include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp"

#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp"

#include <cstdint>
#include <memory>
#include <stdexcept>
Expand All @@ -39,13 +41,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* @tparam T_CollectionIndex dataType of collectionIndex, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_atomicNumber atomic number of element this data corresponds to, eg. Cu -> 29
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_CollectionIndex, typename T_Value>
template<
typename T_CollectionIndex,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateStartIndexBlockDataBox_Down : public DataBox<T_CollectionIndex, T_Value>
{
public:
using S_DataBox = DataBox<T_CollectionIndex, T_Value>;
static constexpr auto processClassGroup = T_ProcessClassGroup;

private:
/** start collection index of the block of autonomous transitions
Expand Down Expand Up @@ -93,12 +99,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* @tparam T_CollectionIndex dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_CollectionIndex, typename T_Value>
template<
typename T_CollectionIndex,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateStartIndexBlockDataBuffer_Down : public DataBuffer<T_CollectionIndex, T_Value>
{
public:
using dataBoxType = AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value>;
using DataBoxType = AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value, T_ProcessClassGroup>;
using S_DataBuffer = DataBuffer<T_CollectionIndex, T_Value>;

private:
Expand All @@ -115,15 +125,15 @@ namespace picongpu::particles::atomicPhysics2::atomicData
typename S_DataBuffer::BufferNumber(layoutAtomicStates, false));
}

HINLINE AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value> getHostDataBox()
HINLINE DataBoxType getHostDataBox()
{
return AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value>(
return DataBoxType(
bufferStartIndexBlockTransitionsDown->getHostBuffer().getDataBox());
}

HINLINE AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value> getDeviceDataBox()
HINLINE DataBoxType getDeviceDataBox()
{
return AtomicStateStartIndexBlockDataBox_Down<T_CollectionIndex, T_Value>(
return DataBoxType(
bufferStartIndexBlockTransitionsDown->getDeviceBuffer().getDataBox());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp"
#include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp"

#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp"

#include <cstdint>
#include <memory>

Expand All @@ -36,16 +38,19 @@ namespace picongpu::particles::atomicPhysics2::atomicData
*
* for use on device.
*
* @tparam T_DataBoxType dataBox type used for storage
* @tparam T_CollectionIndex dataType of collectionIndex, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_CollectionIndex, typename T_Value>
template<
typename T_CollectionIndex,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateStartIndexBlockDataBox_UpDown : public DataBox<T_CollectionIndex, T_Value>
{
public:
using dataBoxType = AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value>;
using S_DataBox = DataBox<T_CollectionIndex, T_Value>;
static constexpr auto processClassGroup = T_ProcessClassGroup;

private:
//! start collection index of the block of downward transitions from the atomic state in the corresponding
Expand Down Expand Up @@ -116,11 +121,15 @@ namespace picongpu::particles::atomicPhysics2::atomicData
* @tparam T_CollectionIndex dataType used for number storage, typically uint32_t
* @tparam T_Value dataType used for value storage, typically float_X
*/
template<typename T_CollectionIndex, typename T_Value>
template<
typename T_CollectionIndex,
typename T_Value,
particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup>
class AtomicStateStartIndexBlockDataBuffer_UpDown : public DataBuffer<T_CollectionIndex, T_Value>
{
public:
using S_DataBuffer = DataBuffer<T_CollectionIndex, T_Value>;
using DataBoxType = AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value, T_ProcessClassGroup>;

private:
std::unique_ptr<typename S_DataBuffer::BufferNumber> bufferStartIndexBlockTransitionsDown;
Expand All @@ -139,16 +148,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData
typename S_DataBuffer::BufferNumber(layoutAtomicStates, false));
}

HINLINE AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value> getHostDataBox()
HINLINE DataBoxType getHostDataBox()
{
return AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value>(
return DataBoxType(
bufferStartIndexBlockTransitionsDown->getHostBuffer().getDataBox(),
bufferStartIndexBlockTransitionsUp->getHostBuffer().getDataBox());
}

HINLINE AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value> getDeviceDataBox()
HINLINE DataBoxType getDeviceDataBox()
{
return AtomicStateStartIndexBlockDataBox_UpDown<T_CollectionIndex, T_Value>(
return DataBoxType(
bufferStartIndexBlockTransitionsDown->getDeviceBuffer().getDataBox(),
bufferStartIndexBlockTransitionsUp->getDeviceBuffer().getDataBox());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "picongpu/particles/atomicPhysics2/atomicData/AtomicTuples.def"
#include "picongpu/particles/atomicPhysics2/atomicData/TransitionData.hpp"

#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp"

#include <cstdint>
#include <memory>
#include <stdexcept>
Expand Down Expand Up @@ -53,12 +55,18 @@ namespace picongpu::particles::atomicPhysics2::atomicData
* The configNumber of a given state is always the same, its collection index depends
* on input file,it should therefore only be used internally!
*/
template<typename T_Number, typename T_Value, typename T_CollectionIndex, typename T_ConfigNumberDataType>
template<
typename T_Number,
typename T_Value,
typename T_CollectionIndex,
typename T_ConfigNumberDataType>
class AutonomousTransitionDataBox : public TransitionDataBox<T_Number, T_Value, T_CollectionIndex>
{
public:
using S_TransitionDataBox = TransitionDataBox<T_Number, T_Value, T_CollectionIndex>;
using S_AutonomousTransitionTuple = AutonomousTransitionTuple<T_ConfigNumberDataType>;
static constexpr auto processClassGroup
= particles::atomicPhysics2::processClass::ProcessClassGroup::autonomousBased;

private:
typename S_TransitionDataBox::S_DataBox::BoxValue m_boxTransitionRate; // unit: 1/UNIT_TIME
Expand Down Expand Up @@ -153,12 +161,20 @@ namespace picongpu::particles::atomicPhysics2::atomicData
* @tparam T_Value dataType used for value storage, typically float_X
* @tparam T_CollectionIndex data type used for configNumber storage, typically uint32_t
* @tparam T_ConfigNumberDataType dataType used for configNumber storage, typically uint64_t
* @tparam T_ProcessClassGroup processClassGroup current data corresponds to
*/
template<typename T_Number, typename T_Value, typename T_CollectionIndex, typename T_ConfigNumberDataType>
template<
typename T_Number,
typename T_Value,
typename T_CollectionIndex,
typename T_ConfigNumberDataType>
class AutonomousTransitionDataBuffer : public TransitionDataBuffer<T_Number, T_Value, T_CollectionIndex>
{
public:
using S_TransitionDataBuffer = TransitionDataBuffer<T_Number, T_Value, T_CollectionIndex>;
using DataBoxType = AutonomousTransitionDataBox<T_Number, T_Value, T_CollectionIndex, T_ConfigNumberDataType>;
static constexpr auto processClassGroup
= particles::atomicPhysics2::processClass::ProcessClassGroup::autonomousBased;

private:
std::unique_ptr<typename S_TransitionDataBuffer::BufferValue> bufferTransitionRate;
Expand All @@ -179,20 +195,18 @@ namespace picongpu::particles::atomicPhysics2::atomicData
new typename S_TransitionDataBuffer::BufferValue(layoutAutonomousTransitions, false));
}

HINLINE AutonomousTransitionDataBox<T_Number, T_Value, T_CollectionIndex, T_ConfigNumberDataType>
getHostDataBox()
HINLINE DataBoxType getHostDataBox()
{
return AutonomousTransitionDataBox<T_Number, T_Value, T_CollectionIndex, T_ConfigNumberDataType>(
return DataBoxType(
bufferTransitionRate->getHostBuffer().getDataBox(),
this->bufferLowerStateCollectionIndex->getHostBuffer().getDataBox(),
this->bufferUpperStateCollectionIndex->getHostBuffer().getDataBox(),
this->m_numberTransitions);
}

HINLINE AutonomousTransitionDataBox<T_Number, T_Value, T_CollectionIndex, T_ConfigNumberDataType>
getDeviceDataBox()
HINLINE DataBoxType getDeviceDataBox()
{
return AutonomousTransitionDataBox<T_Number, T_Value, T_CollectionIndex, T_ConfigNumberDataType>(
return DataBoxType(
bufferTransitionRate->getDeviceBuffer().getDataBox(),
this->bufferLowerStateCollectionIndex->getDeviceBuffer().getDataBox(),
this->bufferUpperStateCollectionIndex->getDeviceBuffer().getDataBox(),
Expand Down
Loading

0 comments on commit cd84064

Please sign in to comment.