| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2022 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 <cstdlib> |
| 11 |
|
| 12 |
template <typename INT> int check_monot(INT *vector, size_t length) |
| 13 |
{ |
| 14 |
/* |
| 15 |
* This function checks to see if an integer vector is in monotonically |
| 16 |
* increasing order. It returns TRUE (i.e., 1), if this is so. It returns |
| 17 |
* false (i.e., 0), if this is not so. |
| 18 |
*/ |
| 19 |
size_t i; |
| 20 |
for (i = 1; i < length; i++) { |
| 21 |
if (vector[i] < vector[i - 1]) { |
| 22 |
return (0); |
| 23 |
} |
| 24 |
} |
| 25 |
return (1); |
| 26 |
} |