Awkward Array: include/awkward/partition/PartitionedArray.h Source File

Loading...
Searching...
No Matches
PartitionedArray.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_PARTITIONEDARRAY_H_
4#define AWKWARD_PARTITIONEDARRAY_H_
5
6#include "awkward/Content.h"
7
8namespace awkward {
9 class PartitionedArray;
10 using PartitionedArrayPtr = std::shared_ptr<PartitionedArray>;
11
17 class LIBAWKWARD_EXPORT_SYMBOL PartitionedArray {
18 public:
19 PartitionedArray(const ContentPtrVec& partitions);
20
24 virtual ~PartitionedArray();
25
27 const ContentPtrVec
28 partitions() const;
29
31 int64_t
32 numpartitions() const;
33
35 const ContentPtr
36 partition(int64_t partitionid) const;
37
39 virtual int64_t
40 start(int64_t partitionid) const = 0;
41
43 virtual int64_t
44 stop(int64_t partitionid) const = 0;
45
48 virtual void
49 partitionid_index_at(int64_t at,
50 int64_t& partitionid,
51 int64_t& index) const = 0;
52
54 virtual PartitionedArrayPtr
55 repartition(const std::vector<int64_t>& stops) const = 0;
56
58 virtual const std::string
59 classname() const = 0;
60
69 virtual const std::string
70 tostring() const = 0;
71
83 const std::string
84 tojson(bool pretty, int64_t maxdecimals) const;
85
100 void
101 tojson(FILE* destination,
102 bool pretty,
103 int64_t maxdecimals,
104 int64_t buffersize) const;
105
107 virtual int64_t
108 length() const = 0;
109
114 virtual const PartitionedArrayPtr
115 shallow_copy() const = 0;
116
122 const ContentPtr
123 getitem_at(int64_t at) const;
124
129 const ContentPtr
130 getitem_at_nowrap(int64_t at) const;
131
143 const PartitionedArrayPtr
144 getitem_range(int64_t start, int64_t stop, int64_t step) const;
145
153 const PartitionedArrayPtr
154 getitem_range_nowrap(int64_t start, int64_t stop, int64_t step) const;
155
159 virtual const PartitionedArrayPtr
160 copy_to(kernel::lib ptr_lib) const = 0;
161
162 protected:
163 const ContentPtrVec partitions_;
164 };
165}
166
167#endif // AWKWARD_PARTITIONEDARRAY_H_
Content.h
awkward::PartitionedArray
Abstract superclass of all PartitionedArray node types. PartitionedArrays contain a list of Content,...
Definition: PartitionedArray.h:17
awkward::PartitionedArray::copy_to
virtual const PartitionedArrayPtr copy_to(kernel::lib ptr_lib) const =0
Recursively copies components of the array from main memory to a GPU (if ptr_lib == kernel::lib::cuda...
awkward::PartitionedArray::tojson
const std::string tojson(bool pretty, int64_t maxdecimals) const
Returns a JSON representation of this array.
awkward::PartitionedArray::start
virtual int64_t start(int64_t partitionid) const =0
Logical starting index for a given partitionid.
awkward::PartitionedArray::partitions
const ContentPtrVec partitions() const
The partitions as a std::vector<std::shared_ptr<Content>>.
awkward::PartitionedArray::getitem_at
const ContentPtr getitem_at(int64_t at) const
Returns the element at a given position in the array, handling negative indexing and bounds-checking ...
awkward::PartitionedArray::numpartitions
int64_t numpartitions() const
The number of partitions in this array.
awkward::PartitionedArray::tostring
virtual const std::string tostring() const =0
Returns a string representation of this array (multi-line XML).
awkward::PartitionedArray::getitem_range_nowrap
const PartitionedArrayPtr getitem_range_nowrap(int64_t start, int64_t stop, int64_t step) const
Subinterval of this array, without handling negative indexing or bounds-checking.
awkward::PartitionedArray::repartition
virtual PartitionedArrayPtr repartition(const std::vector< int64_t > &stops) const =0
Returns this array with a specified (irregular) partitioning.
awkward::PartitionedArray::stop
virtual int64_t stop(int64_t partitionid) const =0
Logical stopping index for a given partitionid.
awkward::PartitionedArray::tojson
void tojson(FILE *destination, bool pretty, int64_t maxdecimals, int64_t buffersize) const
Writes a JSON representation of this array to a destination file.
awkward::PartitionedArray::partitions_
const ContentPtrVec partitions_
Definition: PartitionedArray.h:163
awkward::PartitionedArray::classname
virtual const std::string classname() const =0
User-friendly name of this class.
awkward::PartitionedArray::shallow_copy
virtual const PartitionedArrayPtr shallow_copy() const =0
Copies this node without copying any nodes hierarchically nested within it or any array/index/identit...
awkward::PartitionedArray::partitionid_index_at
virtual void partitionid_index_at(int64_t at, int64_t &partitionid, int64_t &index) const =0
Gets the partitionid and index for a given logical position in the full array, without handling negat...
awkward::PartitionedArray::~PartitionedArray
virtual ~PartitionedArray()
Virtual destructor acts as a first non-inline virtual function that determines a specific translation...
awkward::PartitionedArray::PartitionedArray
PartitionedArray(const ContentPtrVec &partitions)
awkward::PartitionedArray::getitem_range
const PartitionedArrayPtr getitem_range(int64_t start, int64_t stop, int64_t step) const
Subinterval of this array, handling negative indexing and bounds-checking like Python.
awkward::PartitionedArray::getitem_at_nowrap
const ContentPtr getitem_at_nowrap(int64_t at) const
Returns the element at a given position in the array, without handling negative indexing or bounds-ch...
awkward::PartitionedArray::partition
const ContentPtr partition(int64_t partitionid) const
Returns a single partition as a std::shared_ptr<Content>.
awkward::PartitionedArray::length
virtual int64_t length() const =0
The length of the full array, summed over all partitions.
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward::kernel::lib
lib
Definition: kernel-dispatch.h:20
awkward
Definition: BitMaskedArray.h:15
awkward::ContentPtrVec
std::vector< std::shared_ptr< Content > > ContentPtrVec
Definition: Content.h:16
awkward::ContentPtr
std::shared_ptr< Content > ContentPtr
Definition: Content.h:15
awkward::PartitionedArrayPtr
std::shared_ptr< PartitionedArray > PartitionedArrayPtr
Definition: PartitionedArray.h:10