Developer documentation
Version 3.0.3-105-gd3941f44
types.h File Reference
#include <cinttypes>
#include <complex>
#include <cstddef>
#include <deque>
#include <map>
#include <memory>
#include <iostream>
#include <vector>
#include <Eigen/Geometry>
#include "connectome/connectome.h"
#include "surface/polygon.h"

Go to the source code of this file.

Classes

class  __has_custom_new_operator< T >
 
struct  MR::container_cast< T >
 
struct  MR::is_complex< ValueType >
 check whether type is complex: More...
 
struct  MR::is_complex< std::complex< ValueType > >
 
struct  MR::is_data_type< ValueType >
 check whether type is compatible with MRtrix3's file IO backend: More...
 
class  MR::vector< X, N >
 
class  MR::vector< X, 0 >
 
class  MR::deque< X, N >
 
class  MR::deque< X, 0 >
 
class  MR::Surface::Vox
 

Namespaces

namespace  MR
 
namespace  MR::Helper
 
namespace  std
 
namespace  MR::Surface
 

Macros

#define NOMEMALIGN
 
#define PRI_SIZET   "zu"
 
#define EIGEN_DENSEBASE_PLUGIN   "eigen_plugins/dense_base.h"
 
#define EIGEN_MATRIXBASE_PLUGIN   "eigen_plugins/dense_base.h"
 
#define EIGEN_ARRAYBASE_PLUGIN   "eigen_plugins/dense_base.h"
 
#define EIGEN_MATRIX_PLUGIN   "eigen_plugins/matrix.h"
 
#define EIGEN_ARRAY_PLUGIN   "eigen_plugins/array.h"
 
#define VLA(name, type, num)   type name[num]
 
#define VLA_MAX(name, type, num, max)   type name[num]
 
#define NON_POD_VLA(name, type, num)   type name[num]
 
#define NON_POD_VLA_MAX(name, type, num, max)   type name[num]
 
#define FORCE_INLINE   inline
 
#define EIGEN_DEFAULT_ALIGN_BYTES   16
 
#define MEMALIGN(...)
 
#define CHECK_MEM_ALIGN(...)
 

Typedefs

using MR::float32 = float
 
using MR::float64 = double
 
using MR::cdouble = std::complex< double >
 
using MR::cfloat = std::complex< float >
 
using MR::default_type = double
 the default type used throughout MRtrix More...
 
using MR::transform_type = Eigen::Transform< default_type, 3, Eigen::AffineCompact >
 the type for the affine transform of an image: More...
 
using MR::KeyValues = std::map< std::string, std::string >
 used in various places for storing key-value pairs More...
 
using MR::Surface::Vertex = Eigen::Vector3d
 
using MR::Surface::VertexList = vector< Vertex >
 
using MR::Surface::Triangle = Polygon< 3 >
 
using MR::Surface::TriangleList = vector< Triangle >
 
using MR::Surface::Quad = Polygon< 4 >
 
using MR::Surface::QuadList = vector< Quad >
 
using MR::Surface::label_vector_type = Eigen::Array< Connectome::node_t, Eigen::Dynamic, 1 >
 

Functions

void * __aligned_malloc (std::size_t size)
 
void __aligned_free (void *ptr)
 
template<typename X , typename... Args>
std::shared_ptr< X > MR::make_shared (Args &&... args)
 
template<typename X , typename... Args>
std::unique_ptr< X > MR::make_unique (Args &&... args)
 
template<typename X >
constexpr std::enable_if< std::is_arithmetic< X >::value &&std::is_unsigned< X >::value, X >::type MR::abs (X x)
 
template<typename X >
constexpr std::enable_if< std::is_arithmetic< X >::value &&!std::is_unsigned< X >::value, X >::type MR::abs (X x)
 
template<class T >
ostream & std::operator<< (ostream &stream, const vector< T > &V)
 
template<class T , std::size_t N>
ostream & std::operator<< (ostream &stream, const array< T, N > &V)
 

Variables

constexpr size_t MR::malloc_align = alignof (::max_align_t)
 
constexpr default_type MR::NaN = std::numeric_limits<default_type>::quiet_NaN()
 
constexpr default_type MR::Inf = std::numeric_limits<default_type>::infinity()
 

Macro Definition Documentation

◆ CHECK_MEM_ALIGN

#define CHECK_MEM_ALIGN (   ...)
Value:
static_assert ( (alignof(__VA_ARGS__) <= ::MR::malloc_align) || __has_custom_new_operator<__VA_ARGS__>::value, \
"class requires over-alignment, but no operator new defined! Please insert MEMALIGN() into class definition.")
constexpr size_t malloc_align
Definition: types.h:59

used to verify that the class is set up approriately for memory alignment when dynamically allocated. This checks whether the class's alignment requirements exceed that of the default allocator, and if so whether it has custom operator new methods defined to deal with this. Conversely, it also checks whether a custom allocator has been defined needlessly, which is to be avoided for performance reasons.

The compiler will check whether this is indeed needed, and fail with an appropriate warning if this is not true. In this case, you need to replace MEMALIGN with NOMEMALIGN.

See also
NOMEMALIGN
MEMALIGN

Definition at line 206 of file types.h.

◆ EIGEN_ARRAY_PLUGIN

#define EIGEN_ARRAY_PLUGIN   "eigen_plugins/array.h"

Definition at line 76 of file types.h.

◆ EIGEN_ARRAYBASE_PLUGIN

#define EIGEN_ARRAYBASE_PLUGIN   "eigen_plugins/dense_base.h"

Definition at line 74 of file types.h.

◆ EIGEN_DEFAULT_ALIGN_BYTES

#define EIGEN_DEFAULT_ALIGN_BYTES   16

Definition at line 162 of file types.h.

◆ EIGEN_DENSEBASE_PLUGIN

#define EIGEN_DENSEBASE_PLUGIN   "eigen_plugins/dense_base.h"

Definition at line 72 of file types.h.

◆ EIGEN_MATRIX_PLUGIN

#define EIGEN_MATRIX_PLUGIN   "eigen_plugins/matrix.h"

Definition at line 75 of file types.h.

◆ EIGEN_MATRIXBASE_PLUGIN

#define EIGEN_MATRIXBASE_PLUGIN   "eigen_plugins/dense_base.h"

Definition at line 73 of file types.h.

◆ FORCE_INLINE

#define FORCE_INLINE   inline

Definition at line 156 of file types.h.

◆ MEMALIGN

#define MEMALIGN (   ...)
Value:
public: \
FORCE_INLINE void* operator new (std::size_t size) { return (alignof(__VA_ARGS__)>::MR::malloc_align) ? __aligned_malloc (size) : ::operator new (size); } \
FORCE_INLINE void* operator new[] (std::size_t size) { return (alignof(__VA_ARGS__)>::MR::malloc_align) ? __aligned_malloc (size) : ::operator new[] (size); } \
FORCE_INLINE void operator delete (void* ptr) { if (alignof(__VA_ARGS__)>::MR::malloc_align) __aligned_free (ptr); else ::operator delete (ptr); } \
FORCE_INLINE void operator delete[] (void* ptr) { if (alignof(__VA_ARGS__)>::MR::malloc_align) __aligned_free (ptr); else ::operator delete[] (ptr); }
void __aligned_free(void *ptr)
Definition: types.h:182
void * __aligned_malloc(std::size_t size)
Definition: types.h:174

Definition at line 185 of file types.h.

◆ NOMEMALIGN

#define NOMEMALIGN

◆ PRI_SIZET

#define PRI_SIZET   "zu"

Definition at line 39 of file types.h.

Function Documentation

◆ __aligned_free()

void __aligned_free ( void *  ptr)
inline

Definition at line 182 of file types.h.

◆ __aligned_malloc()

void * __aligned_malloc ( std::size_t  size)
inline

Definition at line 174 of file types.h.