| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions |
| 3 |
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 4 |
* NTESS, the U.S. Government retains certain rights in this software. |
| 5 |
* |
| 6 |
* See packages/seacas/LICENSE for details |
| 7 |
*/ |
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <math.h> |
| 11 |
#include <prototypes.h> |
| 12 |
#include <stdlib.h> |
| 13 |
|
| 14 |
#ifndef max |
| 15 |
#define max(A, B) ((A) > (B) ? (A) : (B)) |
| 16 |
#endif |
| 17 |
#ifndef min |
| 18 |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
| 19 |
#endif |
| 20 |
#ifndef sign |
| 21 |
#define sign(A) ((A) < 0 ? -1 : 1) |
| 22 |
#endif |
| 23 |
#ifndef absval |
| 24 |
#define absval(A) ((A) < 0 ? -(A) : (A)) |
| 25 |
#endif |
| 26 |
#ifndef TRUE |
| 27 |
#define TRUE 1 |
| 28 |
#endif |
| 29 |
#ifndef FALSE |
| 30 |
#define FALSE 0 |
| 31 |
#endif |
| 32 |
|
| 33 |
/* Define constants that are needed in various places */ |
| 34 |
#if defined(M_PI) |
| 35 |
#define PI M_PI |
| 36 |
#define TWOPI (2.0 * M_PI) |
| 37 |
#define HALFPI (0.5 * M_PI) |
| 38 |
#else |
| 39 |
#define PI 3.141592653589793 |
| 40 |
#define TWOPI 6.283185307179586 |
| 41 |
#define HALFPI 1.570796326794896 |
| 42 |
#endif |