Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PatchDataMem< X > Class Template Reference

#include <PatchDataMem.hpp>

Inheritance diagram for PatchDataMem< X >:
Collaboration diagram for PatchDataMem< X >:

Public Types

typedef X * iterator
 
typedef const X * const_iterator
 
typedef X * iterator
 
typedef const X * const_iterator
 

Public Member Functions

 PatchDataMem ()
 
 PatchDataMem (size_t size)
 
 PatchDataMem (const PatchDataMem< X > &)
 
 ~PatchDataMem ()
 
size_t size () const
 
bool empty () const
 
const X & operator[] (size_t index) const
 
X & operator[] (size_t index)
 
const X * to_array () const
 
X * to_array ()
 
void resize (size_t new_size)
 
void clear ()
 
PatchDataMem< X > & operator= (const PatchDataMem< X > &)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
 PatchDataMem ()
 
 PatchDataMem (size_t size)
 
 PatchDataMem (const PatchDataMem< X > &)
 
 ~PatchDataMem ()
 
size_t size () const
 
bool empty () const
 
const X & operator[] (size_t index) const
 
X & operator[] (size_t index)
 
const X * to_array () const
 
X * to_array ()
 
void resize (size_t new_size)
 
void clear ()
 
PatchDataMem< X > & operator= (const PatchDataMem< X > &)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 

Private Types

enum  { SHRINK_PERCENT = 10 }
 
enum  { SHRINK_PERCENT = 10 }
 

Private Member Functions

void resize_storage (size_t size)
 
void resize_storage (size_t size)
 

Private Attributes

size_t arrayLength
 
size_t activeSize
 
X * arrayData
 

Detailed Description

template<typename X>
class Mesquite::PatchDataMem< X >

Definition at line 35 of file includeLinks/PatchDataMem.hpp.

Member Typedef Documentation

typedef const X* const_iterator

Definition at line 72 of file includeLinks/PatchDataMem.hpp.

typedef const X* const_iterator

Definition at line 72 of file src/Mesh/PatchDataMem.hpp.

typedef X* iterator

Definition at line 71 of file src/Mesh/PatchDataMem.hpp.

typedef X* iterator

Definition at line 71 of file includeLinks/PatchDataMem.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
SHRINK_PERCENT 

Shink memory when used portion is less than this percent.

Definition at line 37 of file includeLinks/PatchDataMem.hpp.

37  {
38  SHRINK_PERCENT = 10
39  };
Shink memory when used portion is less than this percent.
anonymous enum
private
Enumerator
SHRINK_PERCENT 

Shink memory when used portion is less than this percent.

Definition at line 37 of file src/Mesh/PatchDataMem.hpp.

37  {
38  SHRINK_PERCENT = 10
39  };
Shink memory when used portion is less than this percent.

Constructor & Destructor Documentation

PatchDataMem ( size_t  size)
inline

Definition at line 87 of file includeLinks/PatchDataMem.hpp.

References PatchDataMem< X >::resize().

Here is the call graph for this function:

PatchDataMem ( const PatchDataMem< X > &  other)
inline

Definition at line 94 of file includeLinks/PatchDataMem.hpp.

References PatchDataMem< X >::operator=().

95  : arrayLength(0),
96  activeSize(0),
97  arrayData(0)
98  { operator=(other); }
PatchDataMem< X > & operator=(const PatchDataMem< X > &)

Here is the call graph for this function:

PatchDataMem ( )
inline
PatchDataMem ( size_t  size)
inline
PatchDataMem ( const PatchDataMem< X > &  )
inline
~PatchDataMem ( )
inline

Member Function Documentation

PatchDataMem< X >::iterator begin ( )
inline

Definition at line 129 of file includeLinks/PatchDataMem.hpp.

Referenced by PatchData::generate_vertex_to_element_data().

Here is the caller graph for this function:

iterator begin ( )
inline
PatchDataMem< X >::const_iterator begin ( ) const
inline

Definition at line 133 of file includeLinks/PatchDataMem.hpp.

const_iterator begin ( ) const
inline
void clear ( )
inline

Definition at line 187 of file includeLinks/PatchDataMem.hpp.

References i.

Referenced by PatchData::clear(), PatchData::initialize_data(), and PatchData::reorder().

188 {
189  for (size_t i = 0; i < activeSize; ++i)
190  arrayData[i].~X();
191  activeSize = 0;
192 }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

void clear ( )
inline
bool empty ( ) const
inline
bool empty ( void  ) const
inline

Definition at line 125 of file includeLinks/PatchDataMem.hpp.

Referenced by PatchData::generate_vertex_to_element_data(), and PatchData::get_vertex_element_adjacencies().

126  { return !activeSize; }

Here is the caller graph for this function:

PatchDataMem< X >::iterator end ( )
inline

Definition at line 137 of file includeLinks/PatchDataMem.hpp.

Referenced by PatchData::generate_vertex_to_element_data().

Here is the caller graph for this function:

iterator end ( )
inline
const_iterator end ( ) const
inline
PatchDataMem< X > & operator= ( const PatchDataMem< X > &  other)
inline

Definition at line 195 of file includeLinks/PatchDataMem.hpp.

References PatchDataMem< X >::activeSize, PatchDataMem< X >::arrayData, and i.

Referenced by PatchDataMem< X >::PatchDataMem().

196 {
197  clear();
198 
199  if (other.activeSize)
200  {
201  if (arrayLength < other.activeSize ||
202  (SHRINK_PERCENT * other.activeSize) < arrayLength)
203  resize_storage( other.activeSize );
204 
205  activeSize = other.activeSize;
206  for (size_t i = 0; i < activeSize; ++i)
207  {
208  //arrayData[i].X( other.arrayData[i] );
209  new (arrayData + i) X( other.arrayData[i] );
210  }
211  }
212 
213  return *this;
214 }
Shink memory when used portion is less than this percent.
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

PatchDataMem<X>& operator= ( const PatchDataMem< X > &  )
inline
const X & operator[] ( size_t  index) const
inline

Definition at line 117 of file includeLinks/PatchDataMem.hpp.

118  { return arrayData[index]; }
const X& operator[] ( size_t  index) const
inline
X & operator[] ( size_t  index)
inline

Definition at line 121 of file includeLinks/PatchDataMem.hpp.

122  { return arrayData[index]; }
X& operator[] ( size_t  index)
inline
void resize ( size_t  new_size)
inline
void resize ( size_t  new_size)
inline

Definition at line 161 of file includeLinks/PatchDataMem.hpp.

References i.

Referenced by PatchData::allocate_storage(), PatchData::generate_vertex_to_element_data(), MeshSet::get_next_elem_on_vert_patch(), MeshSet::get_next_global_patch(), PatchData::get_subpatch(), PatchData::initialize_data(), and PatchDataMem< X >::PatchDataMem().

162 {
163  if (new_size > activeSize)
164  {
165  if (new_size > arrayLength)
166  resize_storage( new_size );
167 
168  for (size_t i = activeSize; i < new_size; ++i)
169  {
170  //arrayData[i].X();
171  new (arrayData + i) X();
172  }
173  activeSize = new_size;
174  }
175  else if (new_size < activeSize)
176  {
177  for (size_t i = new_size; i < activeSize; ++i)
178  arrayData[i].~X();
179  activeSize = new_size;
180 
181  if (activeSize && ((SHRINK_PERCENT*activeSize) < arrayLength))
182  resize_storage( new_size );
183  }
184 }
Shink memory when used portion is less than this percent.
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

void resize_storage ( size_t  size)
inlineprivate

Definition at line 145 of file includeLinks/PatchDataMem.hpp.

References i.

146 {
147  assert( new_size >= activeSize );
148  X* new_array = (X*)malloc( sizeof(X) * new_size );
149  for (size_t i = 0; i < activeSize; ++i)
150  {
151  //new_array[i].X( arrayData[i] );
152  new (new_array + i) X( arrayData[i] );
153  arrayData[i].~X();
154  }
155  free( arrayData );
156  arrayData = new_array;
157  arrayLength = new_size;
158 }
blockLoc i
Definition: read.cpp:79
void resize_storage ( size_t  size)
inlineprivate
size_t size ( ) const
inline
size_t size ( ) const
inline
const X* to_array ( ) const
inline
const X * to_array ( ) const
inline

Definition at line 109 of file includeLinks/PatchDataMem.hpp.

X * to_array ( )
inline

Definition at line 113 of file includeLinks/PatchDataMem.hpp.

X* to_array ( )
inline

Member Data Documentation

size_t activeSize
private

Definition at line 44 of file includeLinks/PatchDataMem.hpp.

Referenced by PatchDataMem< X >::operator=().

X * arrayData
private

Definition at line 45 of file includeLinks/PatchDataMem.hpp.

Referenced by PatchDataMem< X >::operator=().

size_t arrayLength
private

Definition at line 43 of file includeLinks/PatchDataMem.hpp.


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