| 1 |
/* |
| 2 |
* Copyright(C) 1999-2021, 2024 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 |
/***************************************************************************** |
| 9 |
* |
| 10 |
* exupda - ex_update |
| 11 |
* |
| 12 |
* entry conditions - |
| 13 |
* input parameters: |
| 14 |
* int exoid exodus file id |
| 15 |
* |
| 16 |
* exit conditions - |
| 17 |
* |
| 18 |
* |
| 19 |
*****************************************************************************/ |
| 20 |
|
| 21 |
#include "exodusII.h" // for ex_err, etc |
| 22 |
#include "exodusII_int.h" // for EX_FATAL, EX_NOERR |
| 23 |
#include <assert.h> |
| 24 |
/*! |
| 25 |
* \ingroup Utilities |
| 26 |
* updates an opened EXODUS file (or EXODUS history file) |
| 27 |
* \param exoid exodus file id |
| 28 |
*/ |
| 29 |
|
| 30 |
int ex_update(int exoid) |
| 31 |
{ |
| 32 |
EX_FUNC_ENTER(); |
| 33 |
|
| 34 |
if (exi_check_valid_file_id(exoid, __func__) == EX_FATAL) { |
| 35 |
EX_FUNC_LEAVE(EX_FATAL); |
| 36 |
} |
| 37 |
|
| 38 |
#ifndef NDEBUG |
| 39 |
struct exi_file_item *file = exi_find_file_item(exoid); |
| 40 |
assert(!file->in_define_mode && file->persist_define_mode == 0); |
| 41 |
#endif |
| 42 |
|
| 43 |
int status; |
| 44 |
if ((status = nc_sync(exoid)) != NC_NOERR) { |
| 45 |
char errmsg[MAX_ERR_LENGTH]; |
| 46 |
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to update file id %d", exoid); |
| 47 |
ex_err_fn(exoid, __func__, errmsg, status); |
| 48 |
EX_FUNC_LEAVE(EX_FATAL); |
| 49 |
} |
| 50 |
EX_FUNC_LEAVE(EX_NOERR); |
| 51 |
} |