NAMD
Public Member Functions | List of all members
ObjectArena< Type > Class Template Reference

#include <ComputeMap.h>

Public Member Functions

 ObjectArena (void)
 
 ~ObjectArena (void)
 
void setBlockSize (int n)
 
Type * getNewArray (int n)
 

Detailed Description

template<class Type>
class ObjectArena< Type >

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 18 of file ComputeMap.h.

Constructor & Destructor Documentation

template<class Type>
ObjectArena< Type >::ObjectArena ( void  )
inline

Definition at line 18 of file ObjectArena.h.

18 : blockSize(1024), alignment(1), pos(0), end(0) { };
template<class Type>
ObjectArena< Type >::~ObjectArena ( void  )
inline

Definition at line 19 of file ObjectArena.h.

19  {
20  int i;
21  for( i = 0; i < blocks.size(); ++i ) delete [] blocks[i];
22  }
int size(void) const
Definition: ResizeArray.h:127

Member Function Documentation

template<class Type>
Type* ObjectArena< Type >::getNewArray ( int  n)
inline

Definition at line 49 of file ObjectArena.h.

Referenced by ComputeNonbondedCUDA::build_exclusions(), Molecule::prepare_qm(), and PatchMap::unpack().

49  {
50  Type *rpos = pos;
51  if ( n > (blockSize/2) ) {
52  rpos = new Type[n];
53  blocks.add(rpos);
54  } else if ( ( pos += n ) > end ) {
55  rpos = pos = new Type[blockSize];
56  blocks.add(pos);
57  end = rpos + blockSize;
58  pos += n;
59  }
60  return rpos;
61  }
int add(const Elem &elem)
Definition: ResizeArray.h:97
template<class Type>
void ObjectArena< Type >::setBlockSize ( int  n)
inline

Definition at line 23 of file ObjectArena.h.

Referenced by PatchMap::unpack().

23 { blockSize = n; }

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