10#ifndef TEUCHOS_WORKSPACE_HPP 
   11#define TEUCHOS_WORKSPACE_HPP 
   14#include "Teuchos_ArrayView.hpp" 
   15#include "Teuchos_Assert.hpp" 
  101  size_t num_bytes() 
const;
 
  103  char* workspace_ptr();
 
  105  const char* workspace_ptr() 
const;
 
  108  char             *workspace_begin_;
 
  109  char             *workspace_end_;
 
  116  static void* 
operator new(
size_t);
 
  117  static void operator delete(
void*);
 
 
  215  bool          call_constructors_;
 
  220  static void* 
operator new(
size_t);
 
  221  static void operator delete(
void*);
 
 
  243  size_t num_bytes_total() 
const;
 
  246  size_t num_bytes_remaining() 
const;
 
  252  int num_static_allocations() 
const;
 
  258  int num_dyn_allocations() 
const;
 
  262  size_t num_current_bytes_total();
 
  266  size_t num_max_bytes_needed() 
const;
 
  271  void protected_initialize(
size_t num_bytes);
 
  273  char    *workspace_begin_; 
 
  275  char    *workspace_end_;   
 
  279  int     num_static_allocations_; 
 
  281  int     num_dyn_allocations_; 
 
  284  size_t  num_current_bytes_total_; 
 
  285  size_t  num_max_bytes_needed_; 
 
 
  325  if(call_constructors_) {
 
 
  336  if(call_constructors_) {
 
  338    char* 
raw_ptr = raw_workspace_.workspace_ptr();
 
 
  348  return raw_workspace_.num_bytes() / 
sizeof(
T);
 
 
  355  return ( size() ? &(*
this)[0] : 0 );
 
 
  362  return ( size() ? &(*
this)[0] : 0 );
 
 
  372  return reinterpret_cast<T*
>(raw_workspace_.workspace_ptr())[
i];
 
 
  387    return Teuchos::null;
 
 
  397    return Teuchos::null;
 
 
  428void Workspace<T>::operator 
delete(
void*)
 
  439  return workspace_end_ - workspace_begin_;
 
 
  445  return workspace_end_ - curr_ws_ptr_;
 
 
  451  return num_static_allocations_;
 
 
  457  return num_dyn_allocations_;
 
 
  463  return num_current_bytes_total_;
 
 
  469  return num_max_bytes_needed_;
 
 
  492  return workspace_end_ - workspace_begin_;
 
 
  498  return workspace_begin_;
 
 
  504  return workspace_begin_;
 
 
  509void RawWorkspace::operator 
delete(
void*)
 
Reference-counted pointer class and non-member templated function implementations.
 
Smart reference counting pointer class for automatic garbage collection.
 
Encapulsation object for raw temporary workspace that has been allocated. These objects can only be c...
 
size_t num_bytes() const
Return the number of bytes of raw workspace.
 
char * workspace_ptr()
Give a raw pointer to the beginning of the workspace.
 
WorkspaceStore class that can be used to actually reinitialize memory.
 
WorkspaceStoreInitializeable(size_t num_bytes=0)
Default constructs to no memory set and will dynamically allocate all memory requested.
 
void initialize(size_t num_bytes)
Set the size block of memory to be given as workspace.
 
Workspace encapsulation class.
 
void protected_initialize(size_t num_bytes)
 
int num_static_allocations() const
Return the number of static memory allocations granted thus far. This is the number of memory allocat...
 
size_t num_max_bytes_needed() const
Return the maximum storage in bytes needed. This is the maximum total amount of * storage that was ne...
 
int num_dyn_allocations() const
Return the number of dynamic memory allocations granted thus far. This is the number of memory alloca...
 
size_t num_bytes_total() const
Return the total number of bytes that where initially allocated.
 
size_t num_bytes_remaining() const
Return the number of bytes remaining currently.
 
size_t num_current_bytes_total()
Return the total number of bytes currently allocated.. This is the total number of bytes currently be...
 
Templated class for workspace creation.
 
~Workspace()
The destructor on the elements will only be called if call_constructors == true was passed to the con...
 
T * getRawPtr()
Return a raw pointer to the beginning of the array or null if unsized.
 
ArrayView< T > operator()()
Return a non-const array view.
 
T & operator[](size_t i)
Non-const zero based element access.
 
size_t size() const
Return the number of elements in the array.
 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
 
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
 
TEUCHOSCORE_LIB_DLL_EXPORT void print_memory_usage_stats(const WorkspaceStore *workspace_store, std::ostream &out)
Print statistics on memory usage.
 
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Get the global workspace object set by set_default_workspace_store().
 
TEUCHOSCORE_LIB_DLL_EXPORT void set_default_workspace_store(const Teuchos::RCP< WorkspaceStore > &default_workspace_store)
Set pointer to global workspace object.