Gromacs  2016.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Functions
gmx::internal Namespace Reference

Description

Internal GROMACS namespace.

This namespace is used to contain some implementation-specific functions and classes. These are not meant for direct user access, but typically reside in public headers because of implementation reasons.

Namespaces

 anonymous_namespace{selection.cpp}
 

Classes

class  AnalysisDataHandleImpl
 Private implementation class for AnalysisDataHandle. More...
 
class  AnalysisDataStorageImpl
 Private implementation class for AnalysisDataStorage. More...
 
class  AnalysisDataStorageFrameData
 Internal representation for a single stored frame. More...
 
class  BasicAverageHistogramModule
 Implements average histogram module that averages per-frame histograms. More...
 
class  BasicHistogramImpl
 Base class for private implementation classes for histogram modules. More...
 
class  EnumIndexStoreInterface
 Interface for handling storage of the enum indexes. More...
 
class  EnumIndexStore
 Type-specific implementation for EnumIndexStoreInterface. More...
 
class  OptionsImpl
 Private implementation class for Options. More...
 
class  SelectionData
 Internal data for a single selection. More...
 
class  IExceptionInfo
 Base class for ExceptionInfo. More...
 

Typedefs

typedef std::unique_ptr
< AnalysisDataStorageFrame
AnalysisDataFrameBuilderPointer
 Smart pointer type for managing a storage frame builder.
 
typedef std::vector
< std::exception_ptr > 
NestedExceptionList
 Internal container type for storing a list of nested exceptions.
 
typedef std::unique_ptr
< IExceptionInfo
ExceptionInfoPointer
 Smart pointer to manage IExceptionInfo ownership.
 

Functions

AbstractOptionStoragecreateEnumOptionStorage (const AbstractOption &option, const char *const *enumValues, int count, int defaultValue, int defaultValueIfSet, EnumIndexStoreInterface *store)
 Helper to create EnumOptionStorage instances. More...
 
static void * alignedMallocGeneric (std::size_t bytes, std::size_t alignment)
 Allocate aligned memory in a fully portable way. More...
 
static void alignedFreeGeneric (void *p)
 Free aligned memory. More...
 
void * alignedMalloc (std::size_t bytes)
 Allocate aligned memory. More...
 
void alignedFree (void *p)
 Free aligned memory. More...
 
template<typename T >
static void ignoreValueHelper (const T &)
 Helper for ignoring values in macros. More...
 
void current_function_helper ()
 Helper for defining GMX_CURRENT_FUNCTION.
 
void printFatalErrorHeader (FILE *fp, const char *title, const char *func, const char *file, int line)
 Formats a common header for fatal error messages. More...
 
void printFatalErrorMessageLine (FILE *fp, const char *text, int indent)
 Formats a line of fatal error message text. More...
 
void printFatalErrorFooter (FILE *fp)
 Formats a common footer for fatal error messages. More...
 
void assertHandler (const char *condition, const char *msg, const char *func, const char *file, int line)
 Called when an assert fails. More...
 

Function Documentation

void gmx::internal::alignedFree ( void *  p)

Free aligned memory.

Parameters
pMemory pointer previously returned from gmx::internal::alignedMalloc()
Note
This routine should only be called with pointers obtained from gmx::internal::alignedMalloc(), and absolutely not any pointers obtained the system malloc().
static void gmx::internal::alignedFreeGeneric ( void *  p)
static

Free aligned memory.

Parameters
pMemory pointer previously returned from gmx::internal::alignedFreePortable().

Since this routine relies on the original pointer being stored just before the memory area p points to, bad things will happen if you call this routine with a pointer obtained any other way, or if you call the system free() with a pointer obtained from std::alignedMalloc().

Note
This is an internal routine that should only be called from gmx::alignedFree().
void * gmx::internal::alignedMalloc ( std::size_t  bytes)

Allocate aligned memory.

Parameters
bytesAmount of memory (bytes) to allocate. It is valid to ask for 0 bytes, which will return a non-null pointer that is properly aligned and padded (but that you should not use).
Returns
Valid pointer if the allocation worked, otherwise nullptr.

The memory will always be aligned to 128 bytes, which is our estimate of the longest cache lines on architectures currently in use. It will also be padded by the same amount at the end of the area, to help avoid false cache sharing.

Note
Memory allocated with this routine must be released with gmx::internal::alignedFree(), and absolutely not the system free().
static void* gmx::internal::alignedMallocGeneric ( std::size_t  bytes,
std::size_t  alignment 
)
static

Allocate aligned memory in a fully portable way.

Parameters
bytesAmount of memory (bytes) to allocate. The routine will return nullptr if the allocation fails. However, note that asking for zero bytes will return a pointer that is non-null and properly aligned (but obviously you cannot use it, since you promised not to access data beyond the 0 bytes you asked for).
alignmentAlignment specification in bytes, must be a power of 2.
Returns
Nonzero pointer if the allocation worked, otherwise nullptr. This routine should only be called from alignedMalloc(), which also does the checking for valid values. This particular function is used for platforms where we have no control of the alignment of memory returned by the system. Instead, we increase the amount of memory requested internally such that we both can create a pointer inside this memory that fulfills the memory alignment requested, and that we have room to store the original pointer just before this area.
Note
This is an internal routine that should only be called from gmx::alignedMalloc(). Just like system-provided routines, it provides memory that is aligned - but not padded.