1
/* ========================================================================== */
2
/* === UMFPACK_save_symbolic ================================================ */
3
/* ========================================================================== */
5
/* -------------------------------------------------------------------------- */
6
/* UMFPACK Version 4.1 (Apr. 30, 2003), Copyright (c) 2003 by Timothy A. */
7
/* Davis. All Rights Reserved. See ../README for License. */
8
/* email: davis@cise.ufl.edu CISE Department, Univ. of Florida. */
9
/* web: http://www.cise.ufl.edu/research/sparse/umfpack */
10
/* -------------------------------------------------------------------------- */
13
User-callable. Saves a Symbolic object to a file. It can later be read
14
back in via a call to umfpack_*_load_symbolic.
17
#include "umf_internal.h"
18
#include "umf_valid_symbolic.h"
20
#define WRITE(object,type,n) \
22
ASSERT (object != (type *) NULL) ; \
23
if (fwrite (object, sizeof (type), n, f) != n) \
26
return (UMFPACK_ERROR_file_IO) ; \
30
/* ========================================================================== */
31
/* === UMFPACK_save_symbolic ================================================ */
32
/* ========================================================================== */
34
GLOBAL Int UMFPACK_save_symbolic
40
SymbolicType *Symbolic ;
44
/* get the Symbolic object */
45
Symbolic = (SymbolicType *) SymbolicHandle ;
47
/* make sure the Symbolic object is valid */
48
if (!UMF_valid_symbolic (Symbolic))
50
return (UMFPACK_ERROR_invalid_Symbolic_object) ;
53
/* get the filename, or use the default name if filename is NULL */
54
if (user_filename == (char *) NULL)
56
filename = "symbolic.umf" ;
60
filename = user_filename ;
62
f = fopen (filename, "wb") ;
65
return (UMFPACK_ERROR_file_IO) ;
68
/* write the Symbolic object to the file, in binary */
69
WRITE (Symbolic, SymbolicType, 1) ;
70
WRITE (Symbolic->Cperm_init, Int, Symbolic->n_col+1) ;
71
WRITE (Symbolic->Rperm_init, Int, Symbolic->n_row+1) ;
72
WRITE (Symbolic->Front_npivcol, Int, Symbolic->nfr+1) ;
73
WRITE (Symbolic->Front_parent, Int, Symbolic->nfr+1) ;
74
WRITE (Symbolic->Front_1strow, Int, Symbolic->nfr+1) ;
75
WRITE (Symbolic->Front_leftmostdesc, Int, Symbolic->nfr+1) ;
76
WRITE (Symbolic->Chain_start, Int, Symbolic->nchains+1) ;
77
WRITE (Symbolic->Chain_maxrows, Int, Symbolic->nchains+1) ;
78
WRITE (Symbolic->Chain_maxcols, Int, Symbolic->nchains+1) ;
79
WRITE (Symbolic->Cdeg, Int, Symbolic->n_col+1) ;
80
WRITE (Symbolic->Rdeg, Int, Symbolic->n_row+1) ;
81
if (Symbolic->esize > 0)
83
/* only when dense rows are present */
84
WRITE (Symbolic->Esize, Int, Symbolic->esize) ;
86
if (Symbolic->prefer_diagonal)
88
/* only when diagonal pivoting is prefered */
89
WRITE (Symbolic->Diagonal_map, Int, Symbolic->n_col+1) ;