chombo-discharge
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MultiIndex Class Reference

SpaceDim multi-index type for use with higher order Taylor series. More...

#include <CD_MultiIndex.H>

Public Member Functions

 MultiIndex ()=delete
 Weak construction is bad.
 
 MultiIndex (const MultiIndex &a_index)=default
 Copy constructor.
 
 MultiIndex (const int a_order)
 Full constructor.
 
 ~MultiIndex ()=default
 Destructor.
 
void define (const int a_order)
 Define function.
 
int factorial () const
 Factorial function.
 
IntVect getCurrentIndex () const
 Get index.
 
int getOrder () const
 Get highest order for this index.
 
int getLinearIndex (const IntVect a_MultiIndex) const
 Get the linear index (i.e. column number) for a given multi-index.
 
IntVect getMultiIndex (const int a_linearIndex) const
 Get a multi-index corresponding to the linear index (i.e. column number)
 
MultiIndexoperator= (const MultiIndex &a_other)=default
 Assignment operator.
 
int operator[] (const int a_dir) const
 Get one index.
 
void operator++ ()
 Increment multi-index lexicographically.
 
void reset ()
 Reset multi-index to point to the first index.
 
bool ok () const
 Check that multi-index is ok.
 
int norm () const
 Get norm of multi-index.
 
int getNumIndices () const
 Return number of indices in MultiIndex range.
 
Real pow (const RealVect &a_vec)
 Power function for multi-indices.
 

Protected Member Functions

int factorial (const int a_n) const
 Base factorial function.
 
void makeIndices ()
 Fill m_indices.
 
void makeMaps ()
 Fill maps.
 

Protected Attributes

int m_order
 Maximum order representable by this multi-index.
 
IntVect m_curIndex
 Current idnex.
 
std::vector< IntVect >::iterator m_iter
 Pointer to index.
 
std::vector< IntVectm_indices
 All indices.
 
std::map< IntVect, intm_mapToLinearIndex
 Map for going from lexicographically ordered multi-index to linear index.
 
std::map< int, IntVectm_mapToMultiIndex
 Map going from linear index to multi-index.
 

Detailed Description

SpaceDim multi-index type for use with higher order Taylor series.

Note
The next() and hasNext() functions are just temporary functions; I'm just too lazy to write an iterator class (yet)

Constructor & Destructor Documentation

◆ MultiIndex() [1/2]

MultiIndex::MultiIndex ( const MultiIndex a_index)
default

Copy constructor.

Parameters
[in,out]a_indexDescription

◆ MultiIndex() [2/2]

MultiIndex::MultiIndex ( const int  a_order)

Full constructor.

Parameters
[in]a_orderMulti-index order

Member Function Documentation

◆ define()

void MultiIndex::define ( const int  a_order)

Define function.

Parameters
[in]a_orderDescription

◆ factorial() [1/2]

int MultiIndex::factorial ( ) const

Factorial function.

Returns
Return value

◆ factorial() [2/2]

int MultiIndex::factorial ( const int  a_n) const
protected

Base factorial function.

Returns
Return value
Parameters
[in]a_nDescription

◆ getCurrentIndex()

IntVect MultiIndex::getCurrentIndex ( ) const

Get index.

Returns
Current index

◆ getLinearIndex()

int MultiIndex::getLinearIndex ( const IntVect  a_MultiIndex) const

Get the linear index (i.e. column number) for a given multi-index.

Returns
Linear index
Parameters
[in]a_MultiIndexDescription

◆ getMultiIndex()

IntVect MultiIndex::getMultiIndex ( const int  a_linearIndex) const

Get a multi-index corresponding to the linear index (i.e. column number)

Returns
Multi index
Parameters
[in]a_linearIndexDescription

◆ getNumIndices()

int MultiIndex::getNumIndices ( ) const

Return number of indices in MultiIndex range.

Returns
Num indices

◆ getOrder()

int MultiIndex::getOrder ( ) const

Get highest order for this index.

Returns
Order

◆ norm()

int MultiIndex::norm ( ) const

Get norm of multi-index.

Returns |alpha| + |alpha2| + ....

Returns
Return value

◆ ok()

bool MultiIndex::ok ( ) const

Check that multi-index is ok.

Returns
Return value

◆ operator=()

MultiIndex & MultiIndex::operator= ( const MultiIndex a_other)
default

Assignment operator.

Returns
Return value
Parameters
[in,out]a_otherDescription

◆ operator[]()

int MultiIndex::operator[] ( const int  a_dir) const

Get one index.

Returns
Return value
Parameters
[in]a_dirDescription

◆ pow()

Real MultiIndex::pow ( const RealVect a_vec)

Power function for multi-indices.

Returns
Return value
Parameters
[in,out]a_vecDescription

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