NOX::Direction::Broyden::BroydenMemory Class Reference

Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory. More...

#include <NOX_Direction_Broyden.H>

Collaboration diagram for NOX::Direction::Broyden::BroydenMemory:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BroydenMemory ()
 Constructor.
 ~BroydenMemory ()
 Destructor.
void reset (int m)
 Reset the memory.
void reset ()
 Reset the memory.
void push (const NOX::Abstract::Vector &d)
 Add new information to the memory.
bool empty () const
 Returns true if the memory is empty.
int size () const
 Number of items in memory.
BroydenMemoryUnitoperator[] (int i)
 Return the ith MemoryUnit (unchecked access).

Private Attributes

int mMax
 Maximum number of updates that can be stored.
vector< int > index
 Index Into memory vector.
vector< BroydenMemoryUnitmemory
 Memory.


Detailed Description

Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory.

Store up to $m$ MemoryUnit objects where $m$ is passed to reset(). Every time push() is called, a new MemoryUnit is added. If there are already $m$ MemoryUnit's, the oldest is bumped off the list. The zero-th entry is always the oldest.

Note:
In order to avoid allocating and deallocating memory, we reuse the BroydenMemoryUnit objects rather than destroying and re-constructing them. However, this detail should be transparent to users of this class.

Definition at line 228 of file NOX_Direction_Broyden.H.


Constructor & Destructor Documentation

NOX::Direction::Broyden::BroydenMemory::BroydenMemory (  ) 

Constructor.

Does nothing.

Definition at line 109 of file NOX_Direction_Broyden.C.

NOX::Direction::Broyden::BroydenMemory::~BroydenMemory (  ) 

Destructor.

Does nothing.

Definition at line 113 of file NOX_Direction_Broyden.C.


Member Function Documentation

void NOX::Direction::Broyden::BroydenMemory::reset ( int  m  ) 

Reset the memory.

Sets mMax to the value of m. Sets the size of the memory vector to be at least mMax. Sets the capacity of the index vector to be at least mMax. Sets the size of the index vector to be zero.

Definition at line 117 of file NOX_Direction_Broyden.C.

References index, memory, and mMax.

Referenced by NOX::Direction::Broyden::compute(), and NOX::Direction::Broyden::reset().

void NOX::Direction::Broyden::BroydenMemory::reset (  ) 

Reset the memory.

Sets the size of the index vector to be zero.

Definition at line 130 of file NOX_Direction_Broyden.C.

References index.

void NOX::Direction::Broyden::BroydenMemory::push ( const NOX::Abstract::Vector d  ) 

Add new information to the memory.

We need to calculate where the new udpate should be stored in memory and update the information in index.

Let k denote the index of where the new update should be stored. If there are current m items stored in memory and m < mMax, then we set k = m. Otherwise, we set k equal to the location of the oldest update. The oldest update is deleted to make room for the new update. In both cases, index must be updated appropriately so that the first (zero) entry points to the oldest update and the last entry points to the newest update.

Definition at line 136 of file NOX_Direction_Broyden.C.

References index, memory, and mMax.

Referenced by NOX::Direction::Broyden::compute().

bool NOX::Direction::Broyden::BroydenMemory::empty (  )  const

Returns true if the memory is empty.

Definition at line 163 of file NOX_Direction_Broyden.C.

References index.

Referenced by NOX::Direction::Broyden::compute().

int NOX::Direction::Broyden::BroydenMemory::size (  )  const

Number of items in memory.

Definition at line 168 of file NOX_Direction_Broyden.C.

References index.

Referenced by NOX::Direction::Broyden::compute().

NOX::Direction::Broyden::BroydenMemoryUnit & NOX::Direction::Broyden::BroydenMemory::operator[] ( int  i  ) 

Return the ith MemoryUnit (unchecked access).

The zero entry is the oldest memory. The m-1 entry is the newest entry (where m denotes the memory size).

Definition at line 174 of file NOX_Direction_Broyden.C.

References index, and memory.


Member Data Documentation

Maximum number of updates that can be stored.

Definition at line 292 of file NOX_Direction_Broyden.H.

Referenced by push(), and reset().

Index Into memory vector.

Keeps track of the appropriate index's into the memory vector.

  • index.size() is equal to the number of updates stored.
  • index[0] is the index to the oldest update
  • index.back() = index[index.size()-1] is the index to the newest update

Definition at line 303 of file NOX_Direction_Broyden.H.

Referenced by empty(), operator[](), push(), reset(), and size().

Memory.

The size of this vector is greater than or equal to mMax. We never decrease the size of memory on a reset() call because we want to reserve the potential to reuse memory that has already been allocated.

Definition at line 313 of file NOX_Direction_Broyden.H.

Referenced by operator[](), push(), and reset().


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

Generated on Wed Oct 21 14:28:44 2009 for Nonlinear Solver Project by  doxygen 1.5.9