DataVectorTaipan.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#if !defined escript_DataVectorTaipan_H
#define escript_DataVectorTaipan_H
#include "system_dep.h"
#include "Assert.h"
#include "DataTypes.h"
#include "WrappedArray.h"
namespace escript
{
namespace DataTypes
{
class ESCRIPT_DLL_API DataVectorTaipan {
public:
//
// The type of the elements stored in the vector.
typedef double ElementType;
//
// The underlying type used to implement the vector.
typedef ElementType * VectorStorageType;
//
// Various types exported to clients of this class.
typedef const ElementType * const_pointer;
typedef ElementType value_type;
typedef long size_type;
typedef ElementType & reference;
typedef const ElementType & const_reference;
DataVectorTaipan();
DataVectorTaipan(const DataVectorTaipan& other);
DataVectorTaipan(const size_type size,
const value_type val=0.0,
const size_type blockSize=1);
~DataVectorTaipan();
void
resize(const size_type newSize,
const value_type newVal=0.0,
const size_type newBlockSize=1);
void
copyFromArray(const escript::WrappedArray& value, size_type copies);
void
copyFromArrayToOffset(const escript::WrappedArray& value, size_type offset, size_type copies);
inline
size_type
size() const;
DataVectorTaipan&
operator=(const DataVectorTaipan& other);
bool
operator==(const DataVectorTaipan& other) const;
bool
operator!=(const DataVectorTaipan& other) const;
inline
reference
operator[](const size_type i);
inline
const_reference
operator[](const size_type i) const;
protected:
private:
size_type m_size;
size_type m_dim;
size_type m_N;
//
// The container for the elements contained in this DataVectorTaipan.
VectorStorageType m_array_data;
};
ESCRIPT_DLL_API void releaseUnusedMemory();
inline
DataVectorTaipan::size_type
DataVectorTaipan::size() const
{
return m_size;
}
inline
DataVectorTaipan::reference
DataVectorTaipan::operator[](const DataVectorTaipan::size_type i)
{
ESYS_ASSERT(i<size(), "DataVectorTaipan: invalid index specified. " << i << " of " << size());
return m_array_data[i];
}
inline
DataVectorTaipan::const_reference
DataVectorTaipan::operator[](const DataVectorTaipan::size_type i) const
{
ESYS_ASSERT(i<size(),"DataVectorTaipan: invalid index specified. " << i << " of " << size());
return m_array_data[i];
}
} // end of namespace
} // end of namespace
#endif
WrappedArray.h
escript::DataTypes::DataVectorTaipan::ElementType
double ElementType
Definition: DataVectorTaipan.h:50
escript::DataTypes::DataVectorTaipan::value_type
ElementType value_type
Definition: DataVectorTaipan.h:60
escript
Definition: AbstractContinuousDomain.cpp:22
escript::DataTypes::DataVectorTaipan::reference
ElementType & reference
Definition: DataVectorTaipan.h:62
escript::DataTypes::DataVectorTaipan::VectorStorageType
ElementType * VectorStorageType
Definition: DataVectorTaipan.h:54
escript::DataTypes::DataVectorTaipan::size
size_type size() const
Return the number of elements in this DataVectorTaipan.
Definition: DataVectorTaipan.h:217
system_dep.h
escript::DataTypes::DataVectorTaipan::operator[]
reference operator[](const size_type i)
Return a reference to the element at position i in this DataVectorTaipan. Will throw an exception if ...
Definition: DataVectorTaipan.h:224
escript::DataTypes::DataVectorTaipan::const_reference
const ElementType & const_reference
Definition: DataVectorTaipan.h:63
DataTypes
escript::DataTypes::DataVectorTaipan::m_N
size_type m_N
Definition: DataVectorTaipan.h:198
escript::DataTypes::releaseUnusedMemory
void releaseUnusedMemory()
releases unused memory in the memory manager.
Definition: DataVectorTaipan.cpp:40
DataTypes.h
Assert.h
escript::DataTypes::DataVectorTaipan::m_array_data
VectorStorageType m_array_data
Definition: DataVectorTaipan.h:202
escript::DataTypes::DataVectorTaipan::const_pointer
const ElementType * const_pointer
Definition: DataVectorTaipan.h:59
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
escript::DataTypes::DataVectorTaipan::m_dim
size_type m_dim
Definition: DataVectorTaipan.h:197
ESYS_ASSERT
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false...
Definition: Assert.h:78
escript::WrappedArray
Definition: WrappedArray.h:31
escript::DataTypes::DataVectorTaipan::size_type
long size_type
Definition: DataVectorTaipan.h:61
escript::DataTypes::DataVectorTaipan
DataVectorTaipan implements an arbitrarily long vector of data values. DataVectorTaipan is the underl...
Definition: DataVectorTaipan.h:44
escript::DataTypes::DataVectorTaipan::m_size
size_type m_size
Definition: DataVectorTaipan.h:196