COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CCopasiArray Class Reference

#include <CCopasiArray.h>

Inheritance diagram for CCopasiArray:
Inheritance graph
[legend]
Collaboration diagram for CCopasiArray:
Collaboration graph
[legend]

Public Member Functions

 CCopasiArray ()
 
 CCopasiArray (const index_type &sizes)
 
size_t dimensionality () const
 
data_typeoperator[] (const index_type &index)
 
const data_typeoperator[] (const index_type &index) const
 
void resize (const index_type &sizes)
 
const index_typesize () const
 
virtual ~CCopasiArray ()
 
- Public Member Functions inherited from CCopasiAbstractArray
virtual ~CCopasiAbstractArray ()
 

Private Attributes

std::vector< data_typemData
 
size_t mDim
 
std::vector< size_t > mFactors
 
std::vector< size_t > mSizes
 

Additional Inherited Members

- Public Types inherited from CCopasiAbstractArray
typedef C_FLOAT64 data_type
 
typedef std::vector< size_t > index_type
 

Detailed Description

this class contains an n-dimensional array

Definition at line 54 of file CCopasiArray.h.

Constructor & Destructor Documentation

CCopasiArray::CCopasiArray ( )

Definition at line 21 of file CCopasiArray.cpp.

References mData.

22  : mDim(0) {mData.resize(1);}
std::vector< data_type > mData
Definition: CCopasiArray.h:70
CCopasiArray::CCopasiArray ( const index_type sizes)

Definition at line 24 of file CCopasiArray.cpp.

References resize().

25 {
26  resize(sizes);
27 }
void resize(const index_type &sizes)
virtual CCopasiArray::~CCopasiArray ( )
inlinevirtual

Definition at line 62 of file CCopasiArray.h.

62 {};

Member Function Documentation

size_t CCopasiArray::dimensionality ( ) const
inlinevirtual

Implements CCopasiAbstractArray.

Definition at line 79 of file CCopasiArray.h.

References mDim.

Referenced by CSensMethod::do_scaling().

80  {return mDim;}
CCopasiArray::data_type & CCopasiArray::operator[] ( const index_type index)
virtual

Implements CCopasiAbstractArray.

Definition at line 48 of file CCopasiArray.cpp.

References mData, mDim, and mFactors.

49 {
50 #ifdef COPASI_DEBUG
51  assert(index.size() == mDim);
52 #endif
53 
54  size_t tmpindex = 0;
55  index_type::const_iterator itIndex, it, itEnd = mFactors.end();
56 
57  for (itIndex = index.begin(), it = mFactors.begin(); it != itEnd; ++it, ++itIndex)
58  tmpindex += *itIndex * *it;
59 
60  return mData[tmpindex];
61 }
std::vector< data_type > mData
Definition: CCopasiArray.h:70
std::vector< size_t > mFactors
Definition: CCopasiArray.h:73
const CCopasiArray::data_type & CCopasiArray::operator[] ( const index_type index) const
virtual

Implements CCopasiAbstractArray.

Definition at line 63 of file CCopasiArray.cpp.

References mData, mDim, and mFactors.

64 {
65 #ifdef COPASI_DEBUG
66  assert(index.size() == mDim);
67 #endif
68 
69  size_t tmpindex = 0;
70  index_type::const_iterator itIndex, it, itEnd = mFactors.end();
71 
72  for (itIndex = index.begin(), it = mFactors.begin(); it != itEnd; ++it, ++itIndex)
73  tmpindex += *itIndex * *it;
74 
75  return mData[tmpindex];
76 }
std::vector< data_type > mData
Definition: CCopasiArray.h:70
std::vector< size_t > mFactors
Definition: CCopasiArray.h:73
void CCopasiArray::resize ( const index_type sizes)

Definition at line 29 of file CCopasiArray.cpp.

References mData, mDim, mFactors, and mSizes.

Referenced by CSensMethod::calculate_one_level(), CCopasiArray(), CSensMethod::do_target_calculation(), and CSensMethod::initialize().

30 {
31  mDim = sizes.size();
32  mSizes = sizes;
33  mFactors.resize(mDim);
34 
35  size_t tmpDataSize = 1;
36  index_type::const_reverse_iterator it, itEnd = sizes.rend();
37  index_type::reverse_iterator itFaktor;
38 
39  for (it = sizes.rbegin(), itFaktor = mFactors.rbegin(); it != itEnd; ++it, ++itFaktor)
40  {
41  *itFaktor = tmpDataSize;
42  tmpDataSize *= *it;
43  }
44 
45  mData.resize(tmpDataSize);
46 }
std::vector< data_type > mData
Definition: CCopasiArray.h:70
std::vector< size_t > mFactors
Definition: CCopasiArray.h:73
std::vector< size_t > mSizes
Definition: CCopasiArray.h:71
const index_type& CCopasiArray::size ( ) const
inlinevirtual

Implements CCopasiAbstractArray.

Definition at line 76 of file CCopasiArray.h.

References mSizes.

Referenced by CSensMethod::do_collapsing(), and CSensMethod::do_collapsing_innerloop().

77  {return mSizes;}
std::vector< size_t > mSizes
Definition: CCopasiArray.h:71

Member Data Documentation

std::vector<data_type> CCopasiArray::mData
private

Definition at line 70 of file CCopasiArray.h.

Referenced by CCopasiArray(), operator[](), and resize().

size_t CCopasiArray::mDim
private

Definition at line 72 of file CCopasiArray.h.

Referenced by dimensionality(), operator[](), and resize().

std::vector<size_t> CCopasiArray::mFactors
private

Definition at line 73 of file CCopasiArray.h.

Referenced by operator[](), and resize().

std::vector<size_t> CCopasiArray::mSizes
private

Definition at line 71 of file CCopasiArray.h.

Referenced by resize(), and size().


The documentation for this class was generated from the following files: