Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
spm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
spm
Commits
0d34af1a
Commit
0d34af1a
authored
8 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Remove csc_load and csc_save
parent
d7c24050
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spm_io.c
+0
-152
0 additions, 152 deletions
spm_io.c
with
0 additions
and
152 deletions
spm_io.c
+
0
−
152
View file @
0d34af1a
...
...
@@ -314,109 +314,6 @@ readArrayOfFloat( FILE *stream,
return
PASTIX_SUCCESS
;
}
/*
Function: spm_load
Load a spm from disk.
Fill *n*, *colptr*, *rowptr*, *values* and *dof* from *infile*.
Parameters:
n - number of columns
colptr - First cscd starting index of each column in *ja* and *a*
rowptr - Row of each element in first CSCD
values - value of each cscd in first CSCD (can be NULL)
dof - Number of degrees of freedom
outfile - Output stream.
Return:
PASTIX_SUCCESS
*/
int
csc_load
(
pastix_int_t
*
n
,
pastix_int_t
**
colptr
,
pastix_int_t
**
rowptr
,
int
*
valtype
,
void
**
values
,
int
*
dof
,
FILE
*
infile
)
{
int
rc
,
ft
;
long
tmp1
,
tmp2
;
pastix_int_t
nnz
;
/* Read the header file */
if
(
3
!=
fscanf
(
infile
,
"%ld %ld %d
\n
"
,
&
tmp1
,
&
tmp2
,
&
ft
))
{
errorPrint
(
"spmLoad:line 1: Wrong input"
);
return
PASTIX_ERR_FILE
;
}
*
n
=
(
pastix_int_t
)
tmp1
;
*
dof
=
(
int
)
tmp2
;
/* Read the colptr array */
*
colptr
=
NULL
;
MALLOC_INTERN
(
*
colptr
,
(
*
n
)
+
1
,
pastix_int_t
);
assert
(
*
colptr
);
rc
=
readArrayOfInteger
(
infile
,
*
n
+
1
,
*
colptr
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
/* Read the rowptr array */
nnz
=
(
*
colptr
)[
*
n
]
-
(
*
colptr
)[
0
];
*
rowptr
=
NULL
;
MALLOC_INTERN
(
*
rowptr
,
nnz
,
pastix_int_t
);
assert
(
*
rowptr
);
rc
=
readArrayOfInteger
(
infile
,
nnz
,
*
rowptr
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
/* Read values if values is provided and if file contains */
if
(
values
!=
NULL
)
{
pastix_int_t
nval
=
nnz
*
(
*
dof
)
*
(
*
dof
);
(
*
values
)
=
NULL
;
switch
(
ft
)
{
case
PastixComplex64
:
*
values
=
malloc
(
nval
*
sizeof
(
pastix_complex64_t
)
);
readArrayOfComplex64
(
infile
,
nval
,
*
values
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
break
;
case
PastixComplex32
:
*
values
=
malloc
(
nval
*
sizeof
(
pastix_complex32_t
)
);
readArrayOfComplex32
(
infile
,
nval
,
*
values
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
break
;
case
PastixDouble
:
*
values
=
malloc
(
nval
*
sizeof
(
double
)
);
readArrayOfDouble
(
infile
,
nval
,
*
values
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
break
;
case
PastixFloat
:
*
values
=
malloc
(
nval
*
sizeof
(
float
)
);
readArrayOfFloat
(
infile
,
nval
,
*
values
);
if
(
rc
!=
PASTIX_SUCCESS
)
return
rc
;
break
;
}
}
if
(
valtype
!=
NULL
)
{
*
valtype
=
ft
;
}
return
PASTIX_SUCCESS
;
}
/**
*******************************************************************************
*
...
...
@@ -653,55 +550,6 @@ writeArrayOfFloat( FILE *outfile,
return
PASTIX_SUCCESS
;
}
int
csc_save
(
pastix_int_t
n
,
pastix_int_t
*
colptr
,
pastix_int_t
*
rowptr
,
int
ft
,
void
*
values
,
int
dof
,
FILE
*
outfile
)
{
pastix_int_t
i
;
/* Write header N Dof FloatType */
fprintf
(
outfile
,
"%ld %ld %d
\n
"
,
(
long
)
n
,
(
long
)
dof
,
(
values
==
NULL
)
?
0
:
ft
);
/* Write colptr */
for
(
i
=
0
;
i
<
n
+
1
;
i
++
)
{
fprintf
(
outfile
,
"%ld "
,
(
long
)
colptr
[
i
]);
if
(
i
%
4
==
3
)
fprintf
(
outfile
,
"
\n
"
);
}
if
((
i
-
1
)
%
4
!=
3
)
fprintf
(
outfile
,
"
\n
"
);
/* Write rowptr */
for
(
i
=
0
;
i
<
colptr
[
n
]
-
1
;
i
++
)
{
fprintf
(
outfile
,
"%ld "
,
(
long
)
rowptr
[
i
]);
if
(
i
%
4
==
3
)
fprintf
(
outfile
,
"
\n
"
);
}
if
((
i
-
1
)
%
4
!=
3
)
fprintf
(
outfile
,
"
\n
"
);
/* Write the values */
if
(
values
!=
NULL
)
{
/* for (i=0; i<(colptr[n]-1)*dof*dof; i++) */
/* { */
/* #ifdef TYPE_COMPLEX */
/* fprintf(outfile, "%lg %lg ", (double)(creal(values[i])), (double)(cimag(values[i]))); */
/* #else */
/* fprintf(outfile, "%lg ", (double)(values[i])); */
/* #endif */
/* if (i%4 == 3) fprintf(outfile, "\n"); */
/* } */
/* if ((i-1)%4 !=3) fprintf(outfile, "\n"); */
}
return
PASTIX_SUCCESS
;
}
/**
*******************************************************************************
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment