Types.h File Reference
Fields

Contains typedefs for the commonly used types in Field3D. More...

`#include <vector>`
`#include <limits>`
`#include "StdMathLib.h"`

Go to the source code of this file.

## Classes

struct | Interval
| Represents a single integration interval. The interval is assumed to be inclusive, i.e. [t0,t1]. More...

## Typedefs

typedef std::vector< Interval > | IntervalVec

## Functions

template<typename From_T, typename To_T>
To_T | clampForType (const From_T v)

## Detailed Description

Contains typedefs for the commonly used types in Field3D.

Definition in file Types.h.

## Typedef Documentation

## IntervalVec

typedef std::vector<Interval> IntervalVec

Definition at line 87 of file Types.h.

## Function Documentation

## clampForType()

template<typename From_T, typename To_T>

To_T clampForType | ( | const From_T | v | ) |

Definition at line 94 of file Types.h.

{
// Different behavior for integer vs fp types
To_T lowestTo;
From_T lowest;
if (std::numeric_limits<To_T>::is_integer) {
lowestTo = std::numeric_limits<To_T>::min();
lowest = static_cast<From_T>(lowestTo);
} else {
lowestTo = -std::numeric_limits<To_T>::max();
lowest = static_cast<From_T>(lowestTo);
}
const To_T highestTo = std::numeric_limits<To_T>::max();
const From_T highest = static_cast<From_T>(highestTo);
// Perform check
if (v < lowest) {
return lowest;
} else if (v > highest) {
return highest;
}
return v;
}

Referenced by discreteBounds().