|
OOFEM 3.0
|
#include <intarrayf.h>
Private Attributes | |
| T | values |
| Stored values. | |
Iterator for for-each loops: | |
| T::iterator | begin () |
| T::iterator | end () |
| T::const_iterator | begin () const |
| T::const_iterator | end () const |
| IntArray (int n=0) | |
| Constructor for sized array. Data is zeroed. | |
| IntArray (const IntArray &src) | |
| Copy constructor. Creates the array from another array. | |
| IntArray (IntArray &&src) | |
| Move constructor. Creates the array from another array. | |
| IntArray (std ::initializer_list< int >list) | |
| Initializer list constructor. | |
| ~IntArray ()=default | |
| Destructor. | |
| IntArray & | operator= (const IntArray &src) |
| Assignment operator. | |
| IntArray & | operator= (IntArray &&src) |
| Move operator. | |
| IntArray & | operator= (std ::initializer_list< int >list) |
| Assignment operator. | |
| int & | at (int i) |
| int | at (int i) const |
| int & | operator() (int i) |
| int & | operator[] (int i) |
| const int & | operator() (int i) const |
| const int & | operator[] (int i) const |
| void | checkBounds (int i) const |
| void | resizeWithValues (int n, int allocChunk=0) |
| void | resize (int n) |
| void | clear () |
| void | preallocate (int futureSize) |
| void | enumerate (int maxVal) |
| void | followedBy (const IntArray &b, int allocChunk=0) |
| void | followedBy (int b, int allocChunk=0) |
| int | giveSize () const |
| bool | isEmpty () const |
| bool | containsOnlyZeroes () const |
| int | findSorted (int value) const |
| int | minimum () const |
| int | maximum () const |
| void | findNonzeros (const IntArray &logical) |
| bool | containsSorted (int value) const |
| void | insertSorted (int value, int allocChunk=0) |
| bool | insertSortedOnce (int value, int allocChunk=0) |
| void | eraseSorted (int value) |
| int | findCommonValuesSorted (const IntArray &iarray, IntArray &common, int allocChunk=0) const |
| int | findFirstIndexOf (int value) const |
| bool | contains (int value) const |
| void | insertOnce (int p) |
| void | sort () |
| void | erase (int pos) |
| void | add (int val) |
| void | zero () |
| Sets all component to zero. | |
| void | printYourself () const |
| Prints receiver on stdout. | |
| void | pY () const |
| Abbreviation for printYourself(). | |
| void | printYourself (const std::string name) const |
| void | printYourselfToFile (const std::string filename, const bool showDimensions=true) const |
| bool | isAllFinite () const |
| Returns true if no element is NAN or infinite. | |
| const int * | givePointer () const |
| int * | givePointer () |
| contextIOResultType | storeYourself (DataStream &stream) const |
| contextIOResultType | restoreYourself (DataStream &stream) |
| int | givePackSize (DataStream &buff) const |
| std::ostream & | operator<< (std ::ostream &out, const IntArray &x) |
Definition at line 54 of file intarrayf.h.
|
default |
Destructor.
| void oofem::IntArrayF< T >::add | ( | int | val | ) |
Adds given scalar to all values of receiver
| val | Value to add. |
|
inline |
Coefficient access function. Returns l-value of coefficient at given position of the receiver.
| i | Position of coefficient in array. |
Definition at line 93 of file intarrayf.h.
References checkBounds(), and values.
|
inline |
Coefficient access function. Returns value of coefficient at given position of the receiver.
| i | position of coefficient in array. |
Definition at line 106 of file intarrayf.h.
References checkBounds(), and values.
|
inline |
Definition at line 63 of file intarrayf.h.
|
inline |
Definition at line 65 of file intarrayf.h.
|
inline |
Checks size of receiver towards requested bounds. Current implementation will call exit(1) if dimension mismatch found.
| i | Required size of receiver |
Definition at line 148 of file intarrayf.h.
References giveSize(), and OOFEM_ERROR.
Referenced by at(), at(), operator[](), and operator[]().
|
inline |
Clears the array (zero size).
Definition at line 174 of file intarrayf.h.
|
inline |
Definition at line 280 of file intarrayf.h.
References findFirstIndexOf().
| bool oofem::IntArrayF< T >::containsOnlyZeroes | ( | ) | const |
Checks if receiver is all zero.
|
inline |
Checks if sorted receiver contains a given value.
Definition at line 235 of file intarrayf.h.
References findSorted().
|
inline |
Definition at line 64 of file intarrayf.h.
|
inline |
Definition at line 66 of file intarrayf.h.
| void oofem::IntArrayF< T >::enumerate | ( | int | maxVal | ) |
Resizes receiver and enumerates from 1 to the maximum value given.
| maxVal | to enumerate to. |
| void oofem::IntArrayF< T >::erase | ( | int | pos | ) |
Erase the element at given position (1-based index) Receiver will shrink accordingly, the values at positions (pos+1,...,size) will be moved to positions (pos,...,size-1)
| pos | Position to erase. |
| void oofem::IntArrayF< T >::eraseSorted | ( | int | value | ) |
Erase the element of given value. If the value is found receiver will shrink accordingly, while preserving a sorted state.
| value | Value to erase. |
| int oofem::IntArrayF< T >::findCommonValuesSorted | ( | const IntArray & | iarray, |
| IntArray & | common, | ||
| int | allocChunk = 0 ) const |
Extracts common values in receiver and iarray. Assumes that receiver as well as iarray are sorted. The size of array common is changed accordingly.
| iarray | Array to search for values common with receiver. |
| common | Array of common values. |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated. |
References IntArray().
| int oofem::IntArrayF< T >::findFirstIndexOf | ( | int | value | ) | const |
Finds index of first occurrence of given value in array.
| value | Scanned value. |
Referenced by contains().
| void oofem::IntArrayF< T >::findNonzeros | ( | const IntArray & | logical | ) |
Finds all indices where the input array is nonzero
| logical | Array of logical values (0 = false, nonzero = true) to have index extracted. |
References IntArray().
| int oofem::IntArrayF< T >::findSorted | ( | int | value | ) | const |
Finds the first occurrence of given value, assuming that the receiver is sorted.
Referenced by containsSorted().
| void oofem::IntArrayF< T >::followedBy | ( | const IntArray & | b, |
| int | allocChunk = 0 ) |
Appends array b at the end of receiver.
| b | Array to be appended at the end of receiver |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated to prevent excessive reallocation. |
References IntArray().
| void oofem::IntArrayF< T >::followedBy | ( | int | b, |
| int | allocChunk = 0 ) |
Appends given Number at the end of receiver.
| b | value to be appended. |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated to prevent excessive reallocation. |
| int oofem::IntArrayF< T >::givePackSize | ( | DataStream & | buff | ) | const |
Returns how much space is needed to pack receivers message.
| buff | Buffer used for packing. |
References IntArray().
|
inline |
Definition at line 334 of file intarrayf.h.
References values.
|
inline |
Breaks encapsulation. Avoid using this unless absolutely necessary.
Definition at line 333 of file intarrayf.h.
References values.
|
inline |
Definition at line 200 of file intarrayf.h.
References values.
Referenced by checkBounds().
| void oofem::IntArrayF< T >::insertOnce | ( | int | p | ) |
Insert once (does not make any assumption about receiver state or ordering, quite inefficient). More efficient version insertSortedOnce exist.
| p | Value to insert. |
| void oofem::IntArrayF< T >::insertSorted | ( | int | value, |
| int | allocChunk = 0 ) |
Inserts given value into a receiver, which is assumed to be sorted. The size of receiver is changed accordingly.
| value | value to insert. |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated. |
| bool oofem::IntArrayF< T >::insertSortedOnce | ( | int | value, |
| int | allocChunk = 0 ) |
Inserts given value into a receiver, which is assumed to be sorted. The value is inserted only if it does not exist. The size of receiver is changed accordingly.
| value | Value to insert. |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated. |
|
inline |
Copy constructor. Creates the array from another array.
Definition at line 72 of file intarrayf.h.
References IntArray(), and values.
|
inline |
Constructor for sized array. Data is zeroed.
Definition at line 70 of file intarrayf.h.
References values.
Referenced by findCommonValuesSorted(), findNonzeros(), followedBy(), givePackSize(), IntArray(), IntArray(), operator=(), operator=(), and operator=().
|
inline |
Move constructor. Creates the array from another array.
Definition at line 74 of file intarrayf.h.
References IntArray(), and values.
|
inline |
| bool oofem::IntArrayF< T >::isAllFinite | ( | ) | const |
Returns true if no element is NAN or infinite.
|
inline |
Checks if receiver is empty (i.e., zero sized).
Definition at line 205 of file intarrayf.h.
References values.
| int oofem::IntArrayF< T >::maximum | ( | ) | const |
Finds the maximum component in the array.
| int oofem::IntArrayF< T >::minimum | ( | ) | const |
Finds the minimum component in the array.
|
inline |
Coefficient access function. Returns value of coefficient at given position of the receiver. Provides 0-based indexing access.
| i | Position of coefficient in array. |
Definition at line 119 of file intarrayf.h.
References operator[]().
|
inline |
Coefficient access function. Returns value of coefficient at given position of the receiver. Provides 0-based indexing access.
| i | position of coefficient in array. |
Definition at line 133 of file intarrayf.h.
References operator[]().
|
inline |
Assignment operator.
Definition at line 81 of file intarrayf.h.
References IntArray(), oofem::IntArray::values, and values.
|
inline |
|
inline |
|
inline |
Definition at line 120 of file intarrayf.h.
References checkBounds(), and values.
Referenced by operator()(), and operator()().
|
inline |
Definition at line 134 of file intarrayf.h.
References checkBounds(), and values.
| void oofem::IntArrayF< T >::preallocate | ( | int | futureSize | ) |
Preallocates receiver to given futureSize if larger then allocatedSize.
| futureSize | Size to be allocated. |
| void oofem::IntArrayF< T >::printYourself | ( | ) | const |
Prints receiver on stdout.
| void oofem::IntArrayF< T >::printYourself | ( | const std::string | name | ) | const |
Prints receiver on stdout with custom name.
| name | Display name of reciever. |
| void oofem::IntArrayF< T >::printYourselfToFile | ( | const std::string | filename, |
| const bool | showDimensions = true ) const |
Print receiver to file
| filename | Name of recieving file. |
| showDimensions | Determins if dimesions should be included in output |
| void oofem::IntArrayF< T >::pY | ( | ) | const |
Abbreviation for printYourself().
| void oofem::IntArrayF< T >::resize | ( | int | n | ) |
Checks size of receiver towards requested bounds. Data is always zeroed.
| n | New size of array. |
| void oofem::IntArrayF< T >::resizeWithValues | ( | int | n, |
| int | allocChunk = 0 ) |
Checks size of receiver towards requested bounds. If dimension mismatch, size is adjusted accordingly and memory is copied over.
| n | New size of array. |
| allocChunk | If reallocation needed, an additional space for allocChunk values will be allocated to prevent excessive reallocation. |
| contextIOResultType oofem::IntArrayF< T >::restoreYourself | ( | DataStream & | stream | ) |
Restores array from image on stream.
| void oofem::IntArrayF< T >::sort | ( | ) |
Sorts array.
| contextIOResultType oofem::IntArrayF< T >::storeYourself | ( | DataStream & | stream | ) | const |
Stores array to output stream.
| void oofem::IntArrayF< T >::zero | ( | ) |
Sets all component to zero.
|
friend |
Definition at line 375 of file intarray.C.
|
private |
Stored values.
Definition at line 58 of file intarrayf.h.
Referenced by at(), at(), givePointer(), givePointer(), giveSize(), IntArray(), IntArray(), IntArray(), IntArray(), isEmpty(), operator=(), operator=(), operator=(), operator[](), and operator[]().