Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
Set of utilities for allocating temporary workspace.

The goal of this set of utilities is to allow the user to create arrays of uninitialized or default initialized objects as automatic variables on the stack to be used for temporary workspace without requiring expensive calls opeator new or operator delete. More...

Classes

class  Teuchos::RawWorkspace
 Encapulsation object for raw temporary workspace that has been allocated. These objects can only be created on the stack and should not be included as the member of any other classes. More...
 
class  Teuchos::Workspace< T >
 Templated class for workspace creation. More...
 
class  Teuchos::WorkspaceStore
 Workspace encapsulation class. More...
 
class  Teuchos::WorkspaceStoreInitializeable
 WorkspaceStore class that can be used to actually reinitialize memory. More...
 

Functions

TEUCHOSCORE_LIB_DLL_EXPORT void Teuchos::set_default_workspace_store (const Teuchos::RCP< WorkspaceStore > &default_workspace_store)
 Set pointer to global workspace object. More...
 
TEUCHOSCORE_LIB_DLL_EXPORT
Teuchos::RCP< WorkspaceStore > 
Teuchos::get_default_workspace_store ()
 Get the global workspace object set by set_default_workspace_store(). More...
 
TEUCHOSCORE_LIB_DLL_EXPORT void Teuchos::print_memory_usage_stats (const WorkspaceStore *workspace_store, std::ostream &out)
 Print statistics on memory usage. More...
 

Detailed Description

The goal of this set of utilities is to allow the user to create arrays of uninitialized or default initialized objects as automatic variables on the stack to be used for temporary workspace without requiring expensive calls opeator new or operator delete.

Function Documentation

void Teuchos::set_default_workspace_store ( const Teuchos::RCP< WorkspaceStore > &  default_workspace_store)

Set pointer to global workspace object.

This function sets a smart pointer to a workspace object can be set at any time and will serve as the default workspace. This object can serve as a single workspace that can be used by all of the functions in an entire process thread for all of its temporary workspace memory needs. By default this pointer is set to NULL and it is up to some entity to set this pointer to a valid object. If the application is to be threaded, then sharing a single Teuchos::WorkspaceStore object between threads will result in incorrect behavior and could potentially crash the program in some cases and the implementation of this set function and its corresponding get function must be modified.

Postconditions:

Definition at line 18 of file Teuchos_Workspace.cpp.

Teuchos::RCP< Teuchos::WorkspaceStore > Teuchos::get_default_workspace_store ( )

Get the global workspace object set by set_default_workspace_store().

Definition at line 23 of file Teuchos_Workspace.cpp.

void Teuchos::print_memory_usage_stats ( const WorkspaceStore *  workspace_store,
std::ostream &  out 
)

Print statistics on memory usage.

Parameters
workspace_store[in] If workspace_store!=NULL then statistics about its memory usage to this point are printed to out.
out[in/out] Stream used for printing to.

Definition at line 28 of file Teuchos_Workspace.cpp.