Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
BlaIO.c File Reference

Matrix/vector input/output subroutines. More...

#include "fasp.h"
#include "fasp_functs.h"
#include "hb_io.h"
#include "BlaIOUtil.inl"

Go to the source code of this file.

Functions

void fasp_dcsrvec_read1 (const char *filename, dCSRmat *A, dvector *b)
 Read A and b from a SINGLE disk file. More...
 
void fasp_dcsrvec_read2 (const char *filemat, const char *filerhs, dCSRmat *A, dvector *b)
 Read A and b from two separate disk files. More...
 
void fasp_dcsr_read (const char *filename, dCSRmat *A)
 Read A from matrix disk file in IJ format. More...
 
void fasp_dcoo_read (const char *filename, dCSRmat *A)
 Read A from matrix disk file in IJ format – indices starting from 0. More...
 
void fasp_dcoo_read1 (const char *filename, dCSRmat *A)
 Read A from matrix disk file in IJ format – indices starting from 1. More...
 
void fasp_dcoovec_bin_read (const char *fni, const char *fnj, const char *fna, const char *fnb, dCSRmat *A, dvector *b)
 Read A from matrix disk files in IJ format (three binary files) More...
 
void fasp_dcoo_shift_read (const char *filename, dCSRmat *A)
 Read A from matrix disk file in IJ format – indices starting from 0. More...
 
void fasp_dmtx_read (const char *filename, dCSRmat *A)
 Read A from matrix disk file in MatrixMarket general format. More...
 
void fasp_dmtxsym_read (const char *filename, dCSRmat *A)
 Read A from matrix disk file in MatrixMarket sym format. More...
 
void fasp_dstr_read (const char *filename, dSTRmat *A)
 Read A from a disk file in dSTRmat format. More...
 
void fasp_dbsr_read (const char *filename, dBSRmat *A)
 Read A from a disk file in dBSRmat format. More...
 
void fasp_dvecind_read (const char *filename, dvector *b)
 Read b from matrix disk file. More...
 
void fasp_dvec_read (const char *filename, dvector *b)
 Read b from a disk file in array format. More...
 
void fasp_ivecind_read (const char *filename, ivector *b)
 Read b from matrix disk file. More...
 
void fasp_ivec_read (const char *filename, ivector *b)
 Read b from a disk file in array format. More...
 
void fasp_dcsrvec_write1 (const char *filename, dCSRmat *A, dvector *b)
 Write A and b to a SINGLE disk file. More...
 
void fasp_dcsrvec_write2 (const char *filemat, const char *filerhs, dCSRmat *A, dvector *b)
 Write A and b to two separate disk files. More...
 
void fasp_dcoo_write (const char *filename, dCSRmat *A)
 Write a matrix to disk file in IJ format (coordinate format) More...
 
void fasp_dstr_write (const char *filename, dSTRmat *A)
 Write a dSTRmat to a disk file. More...
 
void fasp_dbsr_print (const char *filename, dBSRmat *A)
 Print a dBSRmat to a disk file in a readable format. More...
 
void fasp_dbsr_write (const char *filename, dBSRmat *A)
 Write a dBSRmat to a disk file. More...
 
void fasp_dvec_write (const char *filename, dvector *vec)
 Write a dvector to disk file. More...
 
void fasp_dvecind_write (const char *filename, dvector *vec)
 Write a dvector to disk file in coordinate format. More...
 
void fasp_ivec_write (const char *filename, ivector *vec)
 Write a ivector to disk file in coordinate format. More...
 
void fasp_dvec_print (const INT n, dvector *u)
 Print first n entries of a vector of REAL type. More...
 
void fasp_ivec_print (const INT n, ivector *u)
 Print first n entries of a vector of INT type. More...
 
void fasp_dcsr_print (const dCSRmat *A)
 Print out a dCSRmat matrix in coordinate format. More...
 
void fasp_dcoo_print (const dCOOmat *A)
 Print out a dCOOmat matrix in coordinate format. More...
 
void fasp_dbsr_write_coo (const char *filename, const dBSRmat *A)
 Print out a dBSRmat matrix in coordinate format for matlab spy. More...
 
void fasp_dcsr_write_coo (const char *filename, const dCSRmat *A)
 Print out a dCSRmat matrix in coordinate format for matlab spy. More...
 
void fasp_dcsr_write_mtx (const char *filename, const dCSRmat *A)
 Print out a dCSRmat matrix in coordinate format for MatrixMarket. More...
 
void fasp_dstr_print (const dSTRmat *A)
 Print out a dSTRmat matrix in coordinate format. More...
 
void fasp_matrix_read (const char *filename, void *A)
 Read matrix from different kinds of formats from both ASCII and binary files. More...
 
void fasp_matrix_read_bin (const char *filename, void *A)
 Read matrix in binary format. More...
 
void fasp_matrix_write (const char *filename, void *A, const INT flag)
 write matrix from different kinds of formats from both ASCII and binary files More...
 
void fasp_vector_read (const char *filerhs, void *b)
 Read RHS vector from different kinds of formats in ASCII or binary files. More...
 
void fasp_vector_write (const char *filerhs, void *b, const INT flag)
 write RHS vector from different kinds of formats in both ASCII and binary files More...
 
void fasp_hb_read (const char *input_file, dCSRmat *A, dvector *b)
 Read matrix and right-hans side from a HB format file. More...
 

Variables

int ilength
 
int dlength
 

Detailed Description

Matrix/vector input/output subroutines.

Note
Read, write or print a matrix or a vector in various formats
This file contains Level-1 (Bla) functions. It requires: AuxArray.c, AuxConvert.c, AuxMemory.c, AuxMessage.c, AuxVector.c, BlaFormat.c, BlaSparseBSR.c, BlaSparseCOO.c, BlaSparseCSR.c, and BlaSpmvCSR.c

Copyright (C) 2009–Present by the FASP team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file BlaIO.c.

Function Documentation

◆ fasp_dbsr_print()

void fasp_dbsr_print ( const char *  filename,
dBSRmat A 
)

Print a dBSRmat to a disk file in a readable format.

Parameters
filenameFile name for A
APointer to the dBSRmat matrix A
Author
Chensong Zhang
Date
01/07/2021

Definition at line 1292 of file BlaIO.c.

◆ fasp_dbsr_read()

void fasp_dbsr_read ( const char *  filename,
dBSRmat A 
)

Read A from a disk file in dBSRmat format.

Parameters
filenameFile name for matrix A
APointer to the dBSRmat A
Note
This routine reads a dBSRmat matrix from a disk file in the following format:
File format:
  • ROW, COL, NNZ
  • nb: size of each block
  • storage_manner: storage manner of each block
  • ROW+1: length of IA
  • IA(i), i=0:ROW
  • NNZ: length of JA
  • JA(i), i=0:NNZ-1
  • NNZ*nb*nb: length of val
  • val(i), i=0:NNZ*nb*nb-1
Author
Xiaozhe Hu
Date
10/29/2010

Definition at line 807 of file BlaIO.c.

◆ fasp_dbsr_write()

void fasp_dbsr_write ( const char *  filename,
dBSRmat A 
)

Write a dBSRmat to a disk file.

Parameters
filenameFile name for A
APointer to the dBSRmat matrix A
Note
The routine writes the specified REAL vector in BSR format. Refer to the reading subroutine fasp_dbsr_read.
Author
Shiquan Zhang
Date
10/29/2010

Definition at line 1336 of file BlaIO.c.

◆ fasp_dbsr_write_coo()

void fasp_dbsr_write_coo ( const char *  filename,
const dBSRmat A 
)

Print out a dBSRmat matrix in coordinate format for matlab spy.

Parameters
filenameName of file to write to
APointer to the dBSRmat matrix A
Author
Chunsheng Feng
Date
11/14/2013

Modified by Chensong Zhang on 06/14/2014: Fix index problem.

Definition at line 1568 of file BlaIO.c.

◆ fasp_dcoo_print()

void fasp_dcoo_print ( const dCOOmat A)

Print out a dCOOmat matrix in coordinate format.

Parameters
APointer to the dCOOmat matrix A
Author
Ziteng Wang
Date
12/24/2012

Definition at line 1545 of file BlaIO.c.

◆ fasp_dcoo_read()

void fasp_dcoo_read ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in IJ format – indices starting from 0.

Parameters
filenameFile name for matrix
APointer to the CSR matrix
Note
File format:
  • nrow ncol nnz % number of rows, number of columns, and nnz
  • i j a_ij % i, j a_ij in each line
After reading, it converts the matrix to dCSRmat format.
Author
Xuehai Huang, Chensong Zhang
Date
03/29/2009

Definition at line 332 of file BlaIO.c.

◆ fasp_dcoo_read1()

void fasp_dcoo_read1 ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in IJ format – indices starting from 1.

Parameters
filenameFile name for matrix
APointer to the CSR matrix
Note
File format:
  • nrow ncol nnz % number of rows, number of columns, and nnz
  • i j a_ij % i, j a_ij in each line
Author
Xiaozhe Hu, Chensong Zhang
Date
03/24/2013

Modified by Chensong Zhang on 01/12/2019: Convert COO to CSR

Definition at line 384 of file BlaIO.c.

◆ fasp_dcoo_shift_read()

void fasp_dcoo_shift_read ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in IJ format – indices starting from 0.

Parameters
filenameFile name for matrix
APointer to the CSR matrix
Note
File format:
  • nrow ncol nnz % number of rows, number of columns, and nnz
  • i j a_ij % i, j a_ij in each line
i and j suppose to start with index 1!!!
After read in, it shifts the index to C fashion and converts the matrix to dCSRmat format.
Author
Xiaozhe Hu
Date
04/01/2014

Definition at line 514 of file BlaIO.c.

◆ fasp_dcoo_write()

void fasp_dcoo_write ( const char *  filename,
dCSRmat A 
)

Write a matrix to disk file in IJ format (coordinate format)

Parameters
Apointer to the dCSRmat matrix
filenamechar for vector file name
Note
The routine writes the specified REAL vector in COO format. Refer to the reading subroutine fasp_dcoo_read.
File format:
  • The first line of the file gives the number of rows, the number of columns, and the number of nonzeros.
  • Then gives nonzero values in i j a(i,j) format.
Author
Chensong Zhang
Date
03/29/2009

Definition at line 1207 of file BlaIO.c.

◆ fasp_dcoovec_bin_read()

void fasp_dcoovec_bin_read ( const char *  fni,
const char *  fnj,
const char *  fna,
const char *  fnb,
dCSRmat A,
dvector b 
)

Read A from matrix disk files in IJ format (three binary files)

Parameters
fniFile name for matrix i-index
fnjFile name for matrix j-index
fnaFile name for matrix values
fnbFile name for vector values
APointer to the CSR matrix
bPointer to the vector
Note
After reading, it converts the matrix to dCSRmat format.
Author
Chensong Zhang
Date
08/27/2022

Definition at line 437 of file BlaIO.c.

◆ fasp_dcsr_print()

void fasp_dcsr_print ( const dCSRmat A)

Print out a dCSRmat matrix in coordinate format.

Parameters
APointer to the dCSRmat matrix A
Author
Xuehai Huang
Date
03/29/2009

Definition at line 1523 of file BlaIO.c.

◆ fasp_dcsr_read()

void fasp_dcsr_read ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in IJ format.

Parameters
filenameChar for matrix file name
APointer to the CSR matrix
Author
Ziteng Wang
Date
12/25/2012

Definition at line 252 of file BlaIO.c.

◆ fasp_dcsr_write_coo()

void fasp_dcsr_write_coo ( const char *  filename,
const dCSRmat A 
)

Print out a dCSRmat matrix in coordinate format for matlab spy.

Parameters
filenameName of file to write to
APointer to the dCSRmat matrix A
Author
Chunsheng Feng
Date
11/14/2013
Note
Output indices start from 1 instead of 0!

Definition at line 1623 of file BlaIO.c.

◆ fasp_dcsr_write_mtx()

void fasp_dcsr_write_mtx ( const char *  filename,
const dCSRmat A 
)

Print out a dCSRmat matrix in coordinate format for MatrixMarket.

Parameters
filenameName of file to write to
APointer to the dCSRmat matrix A
Author
Chensong Zhang
Date
08/28/2022
Note
Output indices start from 1 instead of 0!

Definition at line 1664 of file BlaIO.c.

◆ fasp_dcsrvec_read1()

void fasp_dcsrvec_read1 ( const char *  filename,
dCSRmat A,
dvector b 
)

Read A and b from a SINGLE disk file.

Parameters
filenameFile name
APointer to the CSR matrix
bPointer to the dvector
Note
This routine reads a dCSRmat matrix and a dvector vector from a single disk file. The difference between this and fasp_dcoovec_read is that this routine support non-square matrices.
File format:
  • nrow ncol % number of rows and number of columns
  • ia(j), j=0:nrow % row index
  • ja(j), j=0:nnz-1 % column index
  • a(j), j=0:nnz-1 % entry value
  • n % number of entries
  • b(j), j=0:n-1 % entry value
Author
Xuehai Huang
Date
03/29/2009

Modified by Chensong Zhang on 03/14/2012

Definition at line 63 of file BlaIO.c.

◆ fasp_dcsrvec_read2()

void fasp_dcsrvec_read2 ( const char *  filemat,
const char *  filerhs,
dCSRmat A,
dvector b 
)

Read A and b from two separate disk files.

Parameters
filematFile name for matrix
filerhsFile name for right-hand side
APointer to the dCSR matrix
bPointer to the dvector
Note
This routine reads a dCSRmat matrix and a dvector vector from a disk file.
CSR matrix file format:
  • nrow % number of columns (rows)
  • ia(j), j=0:nrow % row index
  • ja(j), j=0:nnz-1 % column index
  • a(j), j=0:nnz-1 % entry value
RHS file format:
  • n % number of entries
  • b(j), j=0:nrow-1 % entry value
Indices start from 1, NOT 0!!!
Author
Zhiyang Zhou
Date
2010/08/06

Modified by Chensong Zhang on 2012/01/05

Definition at line 164 of file BlaIO.c.

◆ fasp_dcsrvec_write1()

void fasp_dcsrvec_write1 ( const char *  filename,
dCSRmat A,
dvector b 
)

Write A and b to a SINGLE disk file.

Parameters
filenameFile name
APointer to the CSR matrix
bPointer to the dvector
Note
This routine writes a dCSRmat matrix and a dvector vector to a single disk file.
File format:
  • nrow ncol % number of rows and number of columns
  • ia(j), j=0:nrow % row index
  • ja(j), j=0:nnz-1 % column index
  • a(j), j=0:nnz-1 % entry value
  • n % number of entries
  • b(j), j=0:n-1 % entry value
Author
Feiteng Huang
Date
05/19/2012

Modified by Chensong on 12/26/2012

Definition at line 1079 of file BlaIO.c.

◆ fasp_dcsrvec_write2()

void fasp_dcsrvec_write2 ( const char *  filemat,
const char *  filerhs,
dCSRmat A,
dvector b 
)

Write A and b to two separate disk files.

Parameters
filematFile name for matrix
filerhsFile name for right-hand side
APointer to the dCSR matrix
bPointer to the dvector
Note
This routine writes a dCSRmat matrix and a dvector vector to two disk files.
CSR matrix file format:
  • nrow % number of columns (rows)
  • ia(j), j=0:nrow % row index
  • ja(j), j=0:nnz-1 % column index
  • a(j), j=0:nnz-1 % entry value
RHS file format:
  • n % number of entries
  • b(j), j=0:nrow-1 % entry value
Indices start from 1, NOT 0!!!
Author
Feiteng Huang
Date
05/19/2012

Definition at line 1145 of file BlaIO.c.

◆ fasp_dmtx_read()

void fasp_dmtx_read ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in MatrixMarket general format.

Parameters
filenameFile name for matrix
APointer to the CSR matrix
Note
File format: This routine reads a MatrixMarket general matrix from a mtx file. And it converts the matrix to dCSRmat format. For details of mtx format, please refer to http://math.nist.gov/MatrixMarket/.
Indices start from 1, NOT 0!!!
Author
Chensong Zhang
Date
09/05/2011

Definition at line 567 of file BlaIO.c.

◆ fasp_dmtxsym_read()

void fasp_dmtxsym_read ( const char *  filename,
dCSRmat A 
)

Read A from matrix disk file in MatrixMarket sym format.

Parameters
filenameFile name for matrix
APointer to the CSR matrix
Note
File format: This routine reads a MatrixMarket symmetric matrix from a mtx file. And it converts the matrix to dCSRmat format. For details of mtx format, please refer to http://math.nist.gov/MatrixMarket/.
Indices start from 1, NOT 0!!!
Author
Chensong Zhang
Date
09/02/2011

Definition at line 624 of file BlaIO.c.

◆ fasp_dstr_print()

void fasp_dstr_print ( const dSTRmat A)

Print out a dSTRmat matrix in coordinate format.

Parameters
APointer to the dSTRmat matrix A
Author
Ziteng Wang
Date
12/24/2012

Definition at line 1701 of file BlaIO.c.

◆ fasp_dstr_read()

void fasp_dstr_read ( const char *  filename,
dSTRmat A 
)

Read A from a disk file in dSTRmat format.

Parameters
filenameFile name for the matrix
APointer to the dSTRmat
Note
This routine reads a dSTRmat matrix from a disk file. After done, it converts the matrix to dCSRmat format.
File format:
  • nx, ny, nz
  • nc: number of components
  • nband: number of bands
  • n: size of diagonal, you must have diagonal
  • diag(j), j=0:n-1
  • offset, length: offset and length of off-diag1
  • offdiag(j), j=0:length-1
Author
Xuehai Huang
Date
03/29/2009

Definition at line 699 of file BlaIO.c.

◆ fasp_dstr_write()

void fasp_dstr_write ( const char *  filename,
dSTRmat A 
)

Write a dSTRmat to a disk file.

Parameters
filenameFile name for A
APointer to the dSTRmat matrix A
Note
The routine writes the specified REAL vector in STR format. Refer to the reading subroutine fasp_dstr_read.
Author
Shiquan Zhang
Date
03/29/2010

Definition at line 1241 of file BlaIO.c.

◆ fasp_dvec_print()

void fasp_dvec_print ( const INT  n,
dvector u 
)

Print first n entries of a vector of REAL type.

Parameters
nAn interger (if n=0, then print all entries)
uPointer to a dvector
Author
Chensong Zhang
Date
03/29/2009

Definition at line 1482 of file BlaIO.c.

◆ fasp_dvec_read()

void fasp_dvec_read ( const char *  filename,
dvector b 
)

Read b from a disk file in array format.

Parameters
filenameFile name for vector b
bPointer to the dvector b (output)
Note
File Format:
  • nrow
  • val_j, j=0:nrow-1
Author
Chensong Zhang
Date
03/29/2009

Definition at line 938 of file BlaIO.c.

◆ fasp_dvec_write()

void fasp_dvec_write ( const char *  filename,
dvector vec 
)

Write a dvector to disk file.

Parameters
vecPointer to the dvector
filenameFile name
Author
Xuehai Huang
Date
03/29/2009

Definition at line 1388 of file BlaIO.c.

◆ fasp_dvecind_read()

void fasp_dvecind_read ( const char *  filename,
dvector b 
)

Read b from matrix disk file.

Parameters
filenameFile name for vector b
bPointer to the dvector b (output)
Note
File Format:
  • nrow
  • ind_j, val_j, j=0:nrow-1
Because the index is given, order is not important!
Author
Chensong Zhang
Date
03/29/2009

Definition at line 887 of file BlaIO.c.

◆ fasp_dvecind_write()

void fasp_dvecind_write ( const char *  filename,
dvector vec 
)

Write a dvector to disk file in coordinate format.

Parameters
vecPointer to the dvector
filenameFile name
Note
The routine writes the specified REAL vector in IJ format.
  • The first line of the file is the length of the vector;
  • After that, each line gives index and value of the entries.
Author
Xuehai Huang
Date
03/29/2009

Definition at line 1420 of file BlaIO.c.

◆ fasp_hb_read()

fasp_hb_read ( const char *  input_file,
dCSRmat A,
dvector b 
)

Read matrix and right-hans side from a HB format file.

Parameters
input_fileFile name of vector file
APointer to the matrix
bPointer to the vector
Note
Modified from the C code hb_io_prb.c by John Burkardt, which is NOT part of the FASP project!
Author
Xiaoehe Hu
Date
05/30/2014

Definition at line 2206 of file BlaIO.c.

◆ fasp_ivec_print()

void fasp_ivec_print ( const INT  n,
ivector u 
)

Print first n entries of a vector of INT type.

Parameters
nAn interger (if n=0, then print all entries)
uPointer to an ivector
Author
Chensong Zhang
Date
03/29/2009

Definition at line 1503 of file BlaIO.c.

◆ fasp_ivec_read()

void fasp_ivec_read ( const char *  filename,
ivector b 
)

Read b from a disk file in array format.

Parameters
filenameFile name for vector b
bPointer to the dvector b (output)
Note
File Format:
  • nrow
  • val_j, j=0:nrow-1
Author
Xuehai Huang
Date
03/29/2009

Definition at line 1029 of file BlaIO.c.

◆ fasp_ivec_write()

void fasp_ivec_write ( const char *  filename,
ivector vec 
)

Write a ivector to disk file in coordinate format.

Parameters
vecPointer to the dvector
filenameFile name
Note
The routine writes the specified INT vector in IJ format.
  • The first line of the file is the length of the vector;
  • After that, each line gives index and value of the entries.
Author
Xuehai Huang
Date
03/29/2009

Definition at line 1452 of file BlaIO.c.

◆ fasp_ivecind_read()

void fasp_ivecind_read ( const char *  filename,
ivector b 
)

Read b from matrix disk file.

Parameters
filenameFile name for vector b
bPointer to the dvector b (output)
Note
File Format:
  • nrow
  • ind_j, val_j ... j=0:nrow-1
Author
Chensong Zhang
Date
03/29/2009

Definition at line 989 of file BlaIO.c.

◆ fasp_matrix_read()

fasp_matrix_read ( const char *  filename,
void *  A 
)

Read matrix from different kinds of formats from both ASCII and binary files.

Parameters
filenameFile name of matrix file
APointer to the matrix
Note
Flags for matrix file format:
  • fileflag % fileflag = 1: binary, fileflag = 0000: ASCII
  • formatflag % a 3-digit number for internal use, see below
  • matrix % different types of matrix
Meaning of formatflag:
  • matrixflag % first digit of formatflag
    • matrixflag = 1: CSR format
    • matrixflag = 2: BSR format
    • matrixflag = 3: STR format
    • matrixflag = 4: COO format
    • matrixflag = 5: MTX format
    • matrixflag = 6: MTX symmetrical format
  • ilength % third digit of formatflag, length of INT
  • dlength % fourth digit of formatflag, length of REAL
Author
Ziteng Wang
Date
12/24/2012

Modified by Chensong Zhang on 05/01/2013

Definition at line 1735 of file BlaIO.c.

◆ fasp_matrix_read_bin()

void fasp_matrix_read_bin ( const char *  filename,
void *  A 
)

Read matrix in binary format.

Parameters
filenameFile name of matrix file
APointer to the matrix
Author
Xiaozhe Hu
Date
04/14/2013

Modified by Chensong Zhang on 05/01/2013: Use it to read binary files!!!

Definition at line 1849 of file BlaIO.c.

◆ fasp_matrix_write()

fasp_matrix_write ( const char *  filename,
void *  A,
const INT  flag 
)

write matrix from different kinds of formats from both ASCII and binary files

Parameters
filenameFile name of matrix file
APointer to the matrix
flagType of file and matrix, a 3-digit number
Note
Meaning of flag:
  • fileflag % fileflag = 1: binary, fileflag = 0: ASCII
  • matrixflag
    • matrixflag = 1: CSR format
    • matrixflag = 2: BSR format
    • matrixflag = 3: STR format
Matrix file format:
  • fileflag % fileflag = 1: binary, fileflag = 0000: ASCII
  • formatflag % a 3-digit number
  • matrixflag % different kinds of matrix judged by formatflag
Author
Ziteng Wang
Date
12/24/2012

Definition at line 1921 of file BlaIO.c.

◆ fasp_vector_read()

fasp_vector_read ( const char *  filerhs,
void *  b 
)

Read RHS vector from different kinds of formats in ASCII or binary files.

Parameters
filerhsFile name of vector file
bPointer to the vector
Note
Matrix file format:
  • fileflag % fileflag = 1: binary, fileflag = 0000: ASCII
  • formatflag % a 3-digit number
  • vector % different kinds of vector judged by formatflag
Meaning of formatflag:
  • vectorflag % first digit of formatflag
    • vectorflag = 1: dvec format
    • vectorflag = 2: ivec format
    • vectorflag = 3: dvecind format
    • vectorflag = 4: ivecind format
  • ilength % second digit of formatflag, length of INT
  • dlength % third digit of formatflag, length of REAL
Author
Ziteng Wang
Date
12/24/2012

Definition at line 2011 of file BlaIO.c.

◆ fasp_vector_write()

fasp_vector_write ( const char *  filerhs,
void *  b,
const INT  flag 
)

write RHS vector from different kinds of formats in both ASCII and binary files

Parameters
filerhsFile name of vector file
bPointer to the vector
flagType of file and vector, a 2-digit number
Note
Meaning of the flags
  • fileflag % fileflag = 1: binary, fileflag = 0: ASCII
    • vectorflag
      • vectorflag = 1: dvec format
      • vectorflag = 2: ivec format
      • vectorflag = 3: dvecind format
      • vectorflag = 4: ivecind format
Matrix file format:
  • fileflag % fileflag = 1: binary, fileflag = 0000: ASCII
    • formatflag % a 2-digit number
  • vectorflag % different kinds of vector judged by formatflag
Author
Ziteng Wang
Date
12/24/2012

Modified by Chensong Zhang on 05/02/2013: fix a bug when writing in binary format

Definition at line 2119 of file BlaIO.c.

Variable Documentation

◆ dlength

int dlength

Length of REAL in byte

Definition at line 24 of file BlaIO.c.

◆ ilength

int ilength

Length of INT in byte

Definition at line 23 of file BlaIO.c.