20#include "fasp_functs.h"
41 FILE *fp=fopen(filename,
"w");
43 printf(
"### ERROR: Opening file %s failed!\n",filename);
47 printf(
"%s: writing vector to `%s'...\n", __FUNCTION__, filename);
49 for (i=0;i<m;++i) fprintf(fp,
"%0.15le\n",vec->
val[i]);
72 REAL *A_data = A -> val;
75 INT num_rowsA = A -> row;
76 INT num_nonzeros = A_i[num_rowsA] - A_i[0];
80 INT symmetry_type = 0;
91 for (i = 0; i < num_rowsA; ++i) {
93 for (j = A_i[i]; j < A_i[i+1]; ++j) {
96 if (rowsum*rowsum > 0.0) {
103 if (symmetry_type == 0) {
104 if (rowsum_type == 0)
110 if (rowsum_type == 0)
117 fp = fopen(filefrm,
"w");
118 fprintf(fp,
"%s %d\n",
"f", 4);
119 fprintf(fp,
"%d %d %d %d %d\n", num_nonzeros, num_rowsA, matrix_type, 1, 0);
123 fp = fopen(fileamg,
"w");
124 for (j = 0; j <= num_rowsA; ++j) {
125 fprintf(fp,
"%d\n", A_i[j] + file_base);
127 for (j = 0; j < num_nonzeros; ++j) {
128 fprintf(fp,
"%d\n", A_j[j] + file_base);
131 for (j = 0; j < num_nonzeros; ++j) {
132 fprintf(fp,
"%.15le\n", A_data[j]);
136 fprintf(fp,
"### WARNING: No matrix data!\n");
void fasp_dcsr_diagpref(dCSRmat *A)
Re-order the column and data arrays of a CSR matrix, so that the first entry in each row is the diago...
INT fasp_check_symm(const dCSRmat *A)
Check symmetry of a sparse matrix of CSR format.
void dvector2SAMGInput(dvector *vec, char *filename)
Write a dvector to disk file in SAMG format (coordinate format)
INT dCSRmat2SAMGInput(dCSRmat *A, char *filefrm, char *fileamg)
Write SAMG Input data from a sparse matrix of CSR format.
Main header file for the FASP project.
#define FASP_SUCCESS
Definition of return status and error messages.
Sparse matrix of REAL type in CSR format.
Vector with n entries of REAL type.
REAL * val
actual vector entries