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
18 public:
19 PartitionedArray(const ContentPtrVec& partitions);
20
25
27 const ContentPtrVec
28 partitions() const;
29
31 int64_t
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
50 int64_t& partitionid,
51 int64_t& index) const = 0;
52
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
144 getitem_range(int64_t start, int64_t stop, int64_t step) const;
145
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:
164 };
165}
166
167#endif // AWKWARD_PARTITIONEDARRAY_H_
Abstract superclass of all PartitionedArray node types. PartitionedArrays contain a list of Content,...
Definition: PartitionedArray.h:17
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...
const std::string tojson(bool pretty, int64_t maxdecimals) const
Returns a JSON representation of this array.
virtual int64_t start(int64_t partitionid) const =0
Logical starting index for a given partitionid.
const ContentPtrVec partitions() const
The partitions as a std::vector<std::shared_ptr<Content>>.
const ContentPtr getitem_at(int64_t at) const
Returns the element at a given position in the array, handling negative indexing and bounds-checking ...
int64_t numpartitions() const
The number of partitions in this array.
virtual const std::string tostring() const =0
Returns a string representation of this array (multi-line XML).
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.
virtual PartitionedArrayPtr repartition(const std::vector< int64_t > &stops) const =0
Returns this array with a specified (irregular) partitioning.
virtual int64_t stop(int64_t partitionid) const =0
Logical stopping index for a given partitionid.
void tojson(FILE *destination, bool pretty, int64_t maxdecimals, int64_t buffersize) const
Writes a JSON representation of this array to a destination file.
const ContentPtrVec partitions_
Definition: PartitionedArray.h:163
virtual const std::string classname() const =0
User-friendly name of this class.
virtual const PartitionedArrayPtr shallow_copy() const =0
Copies this node without copying any nodes hierarchically nested within it or any array/index/identit...
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...
virtual ~PartitionedArray()
Virtual destructor acts as a first non-inline virtual function that determines a specific translation...
PartitionedArray(const ContentPtrVec &partitions)
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.
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...
const ContentPtr partition(int64_t partitionid) const
Returns a single partition as a std::shared_ptr<Content>.
virtual int64_t length() const =0
The length of the full array, summed over all partitions.
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
lib
Definition: kernel-dispatch.h:20
Definition: BitMaskedArray.h:15
std::vector< std::shared_ptr< Content > > ContentPtrVec
Definition: Content.h:16
std::shared_ptr< Content > ContentPtr
Definition: Content.h:15
std::shared_ptr< PartitionedArray > PartitionedArrayPtr
Definition: PartitionedArray.h:10