ArrayUtils.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ArrayUtils.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: N-D array util functions.
6 > Created Time: 2017/04/30
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_ARRAY_UTILS_H
10 #define CUBBYFLOW_ARRAY_UTILS_H
11 
14 
15 namespace CubbyFlow
16 {
23  template <typename ArrayType, typename T>
24  void SetRange1(size_t size, const T& value, ArrayType* output);
25 
32  template <typename ArrayType, typename T>
33  void SetRange1(size_t begin, size_t end, const T& value, ArrayType* output);
34 
41  template <typename ArrayType1, typename ArrayType2>
42  void CopyRange1(const ArrayType1& input, size_t size, ArrayType2* output);
43 
50  template <typename ArrayType1, typename ArrayType2>
51  void CopyRange1(const ArrayType1& input, size_t begin, size_t end, ArrayType2* output);
52 
61  template <typename ArrayType1, typename ArrayType2>
62  void CopyRange2(const ArrayType1& input, size_t sizeX, size_t sizeY, ArrayType2* output);
63 
72  template <typename ArrayType1, typename ArrayType2>
73  void CopyRange2(const ArrayType1& input, size_t beginX, size_t endX, size_t beginY, size_t endY, ArrayType2* output);
74 
83  template <typename ArrayType1, typename ArrayType2>
84  void CopyRange3(const ArrayType1& input, size_t sizeX, size_t sizeY, size_t sizeZ, ArrayType2* output);
85 
94  template <typename ArrayType1, typename ArrayType2>
95  void CopyRange3(const ArrayType1& input, size_t beginX, size_t endX, size_t beginY, size_t endY, size_t beginZ, size_t endZ, ArrayType2* output);
96 
111  template <typename T>
112  void ExtrapolateToRegion(const ConstArrayAccessor2<T>& input, const ConstArrayAccessor2<char>& valid, unsigned int numberOfIterations, ArrayAccessor2<T> output);
113 
128  template <typename T>
129  void ExtrapolateToRegion(const ConstArrayAccessor3<T>& input, const ConstArrayAccessor3<char>& valid, unsigned int numberOfIterations, ArrayAccessor3<T> output);
130 
137  template <typename ArrayType>
138  void ConvertToCSV(const ArrayType& data, std::ostream* stream);
139 }
140 
142 
143 #endif
void CopyRange3(const ArrayType1 &input, size_t sizeX, size_t sizeY, size_t sizeZ, ArrayType2 *output)
Copies 3-D input array to output array with sizeX and sizeY.
Definition: ArrayUtils-Impl.h:67
void CopyRange2(const ArrayType1 &input, size_t sizeX, size_t sizeY, ArrayType2 *output)
Copies 2-D input array to output array with sizeX and sizeY.
Definition: ArrayUtils-Impl.h:52
void ExtrapolateToRegion(const ConstArrayAccessor2< T > &input, const ConstArrayAccessor2< char > &valid, unsigned int numberOfIterations, ArrayAccessor2< T > output)
Extrapolates 2-D input data from &#39;valid&#39; (1) to &#39;invalid&#39; (0) region.
Definition: ArrayUtils-Impl.h:82
void ConvertToCSV(const ArrayType &data, std::ostream *stream)
Converts 2-D array to Comma Separated Value (CSV) stream.
Definition: ArrayUtils-Impl.h:225
Definition: pybind11Utils.h:24
void SetRange1(size_t size, const T &value, ArrayType *output)
Assigns value to 1-D array output with size.
Definition: ArrayUtils-Impl.h:22
void CopyRange1(const ArrayType1 &input, size_t size, ArrayType2 *output)
Copies input array to output array with size.
Definition: ArrayUtils-Impl.h:37