43#include "error_handlers.h"
124 for(
int i=0; i <
data_.size(); i++){
159 int addsize = insarr.
Length();
162 data_.insert(
data_.begin()+ix,ptr,ptr+addsize);
205 s[0] =
this ->
XSize();
218 f_out = fopen(filename,
"wb");
229 f_in = fopen(filename,
"rb");
240 f_out.open(filename, ios::out | ios::binary);
250 f_in.open(filename, ios::in | ios::binary);
326 void Resize(
const int& nx,
const int& t) {
334 for(
int i=0; i < (int)
data_.size(); i++){
369 int addsize = insarr.
Length();
372 data_.insert(
data_.begin()+ix,ptr,ptr+addsize);
415 s[0] =
this ->
XSize();
428 f_out = fopen(filename,
"wb");
439 f_in = fopen(filename,
"rb");
449 f_out.open(filename, ios::out | ios::binary);
459 f_in.open(filename, ios::in | ios::binary);
475 for(
int i = 0; i < n; ++i){
476 data_.push_back(inarray[i]);
552 void Resize(
const int& nx,
const double& t) {
560 for(
int i=0; i < (int)
data_.size(); i++){
595 int addsize = insarr.
Length();
598 data_.insert(
data_.begin()+ix,ptr,ptr+addsize);
603 void insert(
const double& insval,
int ix){
641 s[0] =
this ->
XSize();
646 void assign(
const int x,
const double val){
654 f_out = fopen(filename,
"wb");
665 f_in = fopen(filename,
"rb");
675 f_out.open(filename, ios::out | ios::binary);
685 f_in.open(filename, ios::in | ios::binary);
702 for(
int i = 0; i < n; ++i){
703 data_.push_back(inarray[i]);
Array1D()
Default constructor, which does not allocate any memory.
Definition Array1D.h:507
vector< double > flatten()
Definition Array1D.h:716
void PushBack(const double &t)
Add element to the end of the vector.
Definition Array1D.h:566
void ReadBinary(char *filename)
Definition Array1D.h:663
void assign(const int x, const double val)
Definition Array1D.h:646
double & operator()(int ix)
Definition Array1D.h:586
void ReadBinary4py(char *filename, int n)
Definition Array1D.h:682
void Clear()
Function to clear the memory.
Definition Array1D.h:533
const double & operator()(int ix) const
Definition Array1D.h:587
void DumpBinary(char *filename)
Dump contents of the array to a file in binary format.
Definition Array1D.h:652
void insert(const double &insval, int ix)
Insert a given value to the position ix.
Definition Array1D.h:603
int XSize() const
Returns size in the x-direction.
Definition Array1D.h:539
Array1D & operator=(const Array1D &obj)
Assignment operator copies the data structure by value.
Definition Array1D.h:520
void SetValue(const double &t)
Set all values in the array to the given value.
Definition Array1D.h:559
int Length() const
Returns length (i.e. size in the x-direction)
Definition Array1D.h:542
void Resize(const int &nx, const double &t)
Resizes the array and sets ALL entries to the specified value.
Definition Array1D.h:552
void DumpBinary4py(char *filename)
Definition Array1D.h:673
double * GetArrayPointer()
Return a pointer to the first element of the data in the vector so we can use it access the data in a...
Definition Array1D.h:574
void Resize(const int &nx)
Resizes the array.
Definition Array1D.h:545
const double * GetConstArrayPointer() const
Return a const point to the first element of the data in the vector so we can use it access the data ...
Definition Array1D.h:581
void getnpdblArray(double *outarray)
Definition Array1D.h:708
Array1D(const int &nx, const double &t)
Constructor that allocates and initializes the data to a value t.
Definition Array1D.h:515
int xsize_
Definition Array1D.h:501
void DumpBinary(FILE *f_out) const
Dump contents of the array to a file in binary format.
Definition Array1D.h:619
double & operator[](int i)
Definition Array1D.h:636
void setArray(vector< double > inarray)
Definition Array1D.h:692
Array1D(const int &nx)
Constructor that allocates the memory.
Definition Array1D.h:510
void setnpdblArray(vector< double > inarray, int n)
Definition Array1D.h:699
string type()
Definition Array1D.h:720
vector< int > shape()
Definition Array1D.h:639
Array1D(const Array1D &obj)
Copy constructor.
Definition Array1D.h:527
void erase(int ix)
Erase the value from the position ix.
Definition Array1D.h:611
void ReadBinary(FILE *f_in)
Read contents of the array from a file in binary format.
Definition Array1D.h:625
vector< double > data_
Definition Array1D.h:503
~Array1D()
Destructor that frees up the memory.
Definition Array1D.h:530
void insert(Array1D< double > &insarr, int ix)
Insert a given array to the position ix.
Definition Array1D.h:591
Array1D(const int &nx, const int &t)
Constructor that allocates and initializes the data to a value t.
Definition Array1D.h:289
string type()
Definition Array1D.h:492
void insert(const int &insval, int ix)
Insert a given value to the position ix.
Definition Array1D.h:377
void Clear()
Function to clear the memory.
Definition Array1D.h:307
void erase(int ix)
Erase the value from the position ix.
Definition Array1D.h:385
vector< int > data_
Definition Array1D.h:278
vector< int > flatten()
Definition Array1D.h:488
Array1D & operator=(const Array1D &obj)
Assignment operator copies the data structure by value.
Definition Array1D.h:294
void DumpBinary(char *filename)
Dump contents of the array to a file in binary format.
Definition Array1D.h:426
void Resize(const int &nx)
Resizes the array.
Definition Array1D.h:319
void DumpBinary4py(char *filename)
Definition Array1D.h:447
void getnpintArray(long *outarray)
Definition Array1D.h:480
int & operator[](int i)
Definition Array1D.h:410
Array1D()
Default constructor, which does not allocate any memory.
Definition Array1D.h:281
int Length() const
Returns length (i.e. size in the x-direction)
Definition Array1D.h:316
void ReadBinary4py(char *filename, int n)
Definition Array1D.h:456
void insert(Array1D< int > &insarr, int ix)
Insert a given array to the position ix.
Definition Array1D.h:365
void SetValue(const int &t)
Set all values in the array to the given value.
Definition Array1D.h:333
void setnpintArray(vector< int > inarray, int n)
Definition Array1D.h:472
void ReadBinary(char *filename)
Definition Array1D.h:437
~Array1D()
Destructor that frees up the memory.
Definition Array1D.h:304
const int * GetConstArrayPointer() const
Return a const point to the first element of the data in the vector so we can use it access the data ...
Definition Array1D.h:355
void assign(const int x, const int val)
Definition Array1D.h:420
void setArray(vector< int > inarray)
Definition Array1D.h:466
void PushBack(const int &t)
Add element to the end of the vector.
Definition Array1D.h:340
Array1D(const Array1D &obj)
Copy constructor.
Definition Array1D.h:301
int xsize_
Definition Array1D.h:276
Array1D(const int &nx)
Constructor that allocates the memory.
Definition Array1D.h:284
void ReadBinary(FILE *f_in)
Read contents of the array from a file in binary format.
Definition Array1D.h:399
void Resize(const int &nx, const int &t)
Resizes the array and sets ALL entries to the specified value.
Definition Array1D.h:326
int XSize() const
Returns size in the x-direction.
Definition Array1D.h:313
const int & operator()(int ix) const
Definition Array1D.h:361
int & operator()(int ix)
Definition Array1D.h:360
int * GetArrayPointer()
Return a pointer to the first element of the data in the vector so we can use it access the data in a...
Definition Array1D.h:348
void DumpBinary(FILE *f_out) const
Dump contents of the array to a file in binary format.
Definition Array1D.h:393
vector< int > shape()
Definition Array1D.h:413
Stores data of any type T in a 1D array.
Definition Array1D.h:61
void ReadBinary(char *filename)
Definition Array1D.h:227
const T & operator()(int ix) const
Definition Array1D.h:151
void setArray(vector< T > inarray)
Definition Array1D.h:257
T & operator()(int ix)
Definition Array1D.h:150
vector< int > shape()
Definition Array1D.h:203
Array1D(const int &nx)
Constructor that allocates the memory.
Definition Array1D.h:74
const T * GetConstArrayPointer() const
Return a const point to the first element of the data in the vector so we can use it access the data ...
Definition Array1D.h:145
int XSize() const
Returns size in the x-direction.
Definition Array1D.h:103
Array1D(const Array1D &obj)
Copy constructor.
Definition Array1D.h:91
~Array1D()
Destructor that frees up the memory.
Definition Array1D.h:94
void DumpBinary(FILE *f_out) const
Dump contents of the array to a file in binary format.
Definition Array1D.h:183
vector< T > data_
Definition Array1D.h:68
void PushBack(const T &t)
Add element to the end of the vector.
Definition Array1D.h:130
void SetValue(const T &t)
Set all values in the array to the given value.
Definition Array1D.h:123
Array1D & operator=(const Array1D &obj)
Assignment operator copies the data structure by value.
Definition Array1D.h:84
void insert(const T &insval, int ix)
Insert a given value to the position ix.
Definition Array1D.h:167
void Clear()
Function to clear the memory.
Definition Array1D.h:97
void Resize(const int &nx, const T &t)
Resizes the array and sets ALL entries to the specified value.
Definition Array1D.h:116
Array1D(const int &nx, const T &t)
Constructor that allocates and initializes the data to a value t.
Definition Array1D.h:79
void Resize(const int &nx)
Resizes the array.
Definition Array1D.h:109
T * GetArrayPointer()
Return a pointer to the first element of the data in the vector so we can use it access the data in a...
Definition Array1D.h:138
string type()
Definition Array1D.h:268
vector< T > flatten()
Definition Array1D.h:264
void ReadBinary(FILE *f_in)
Read contents of the array from a file in binary format.
Definition Array1D.h:189
void DumpBinary(char *filename)
Dump contents of the array to a file in binary format.
Definition Array1D.h:216
void assign(const int x, const T val)
Definition Array1D.h:210
int xsize_
Definition Array1D.h:67
void ReadBinary4py(char *filename, int n)
Definition Array1D.h:247
int Length() const
Returns length (i.e. size in the x-direction)
Definition Array1D.h:106
T & operator[](int i)
Definition Array1D.h:200
void DumpBinary4py(char *filename)
Definition Array1D.h:238
Array1D()
Default constructor, which does not allocate any memory.
Definition Array1D.h:71
void insert(Array1D< T > &insarr, int ix)
Insert a given array to the position ix.
Definition Array1D.h:155
void erase(int ix)
Erase the value from the position ix.
Definition Array1D.h:175