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
87038c1d
Commit
87038c1d
authored
4 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
spm.c: Remove useless test
parent
67370692
No related branches found
No related tags found
1 merge request
!36
Make spmSymmetrize and spmMergeDuplicate distributed and multi-dofs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/spm.c
+21
-27
21 additions, 27 deletions
src/spm.c
with
21 additions
and
27 deletions
src/spm.c
+
21
−
27
View file @
87038c1d
...
@@ -565,10 +565,6 @@ spmSort( spmatrix_t *spm )
...
@@ -565,10 +565,6 @@ spmSort( spmatrix_t *spm )
spm_int_t
spm_int_t
spmMergeDuplicate
(
spmatrix_t
*
spm
)
spmMergeDuplicate
(
spmatrix_t
*
spm
)
{
{
if
(
(
spm
->
dof
<
1
)
&&
(
spm
->
flttype
!=
SpmPattern
)
)
{
assert
(
0
);
fprintf
(
stderr
,
"Error: spmMergeDuplicate should not be called with non expanded matrices with variadic degrees of freedom and values
\n
"
);
}
switch
(
spm
->
flttype
)
{
switch
(
spm
->
flttype
)
{
case
SpmPattern
:
case
SpmPattern
:
return
p_spmMergeDuplicate
(
spm
);
return
p_spmMergeDuplicate
(
spm
);
...
@@ -615,10 +611,6 @@ spmMergeDuplicate( spmatrix_t *spm )
...
@@ -615,10 +611,6 @@ spmMergeDuplicate( spmatrix_t *spm )
spm_int_t
spm_int_t
spmSymmetrize
(
spmatrix_t
*
spm
)
spmSymmetrize
(
spmatrix_t
*
spm
)
{
{
if
(
(
spm
->
dof
!=
1
)
&&
(
spm
->
flttype
!=
SpmPattern
)
)
{
assert
(
0
);
fprintf
(
stderr
,
"ERROR: spmSymmetrize should not be called with non expanded matrices including values
\n
"
);
}
switch
(
spm
->
flttype
)
{
switch
(
spm
->
flttype
)
{
case
SpmPattern
:
case
SpmPattern
:
return
p_spmSymmetrize
(
spm
);
return
p_spmSymmetrize
(
spm
);
...
@@ -671,20 +663,13 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
...
@@ -671,20 +663,13 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
spmatrix_t
*
spm_out
)
spmatrix_t
*
spm_out
)
{
{
spmatrix_t
*
newspm
=
NULL
;
spmatrix_t
*
newspm
=
NULL
;
spm_int_t
count
;
spm_int_t
count
;
int
modified
=
0
;
/*
/*
* Let's work on a copy
* Let's work on a copy
* If multi-dof with variables, we need to expand the spm
*/
*/
if
(
(
spm_in
->
dof
!=
1
)
&&
(
spm_in
->
flttype
!=
SpmPattern
)
)
{
newspm
=
spmCopy
(
spm_in
);
fprintf
(
stderr
,
"spmCheckAndCorrect: spm is expanded due to multiple degrees of freedom
\n
"
);
newspm
=
malloc
(
sizeof
(
spmatrix_t
)
);
spmExpand
(
spm_in
,
newspm
);
}
else
{
newspm
=
spmCopy
(
spm_in
);
}
/* PaStiX works on CSC matrices */
/* PaStiX works on CSC matrices */
if
(
spmConvert
(
SpmCSC
,
newspm
)
!=
SPM_SUCCESS
)
{
if
(
spmConvert
(
SpmCSC
,
newspm
)
!=
SPM_SUCCESS
)
{
...
@@ -694,13 +679,21 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
...
@@ -694,13 +679,21 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
return
0
;
return
0
;
}
}
if
(
spm_in
->
fmttype
!=
newspm
->
fmttype
)
{
modified
=
1
;
}
/* Sort the rowptr for each column */
/* Sort the rowptr for each column */
spmSort
(
newspm
);
spmSort
(
newspm
);
/* Merge the duplicated entries by summing the values */
/* Merge the duplicated entries by summing the values */
count
=
spmMergeDuplicate
(
newspm
);
count
=
spmMergeDuplicate
(
newspm
);
if
(
count
>
0
)
{
if
(
count
>
0
)
fprintf
(
stderr
,
"spmCheckAndCorrect: %ld entries have been merged
\n
"
,
(
long
)
count
);
{
modified
=
1
;
if
(
spm_in
->
clustnum
==
0
)
{
fprintf
(
stderr
,
"spmCheckAndCorrect: %ld entries have been merged
\n
"
,
(
long
)
count
);
}
}
}
/*
/*
...
@@ -710,23 +703,23 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
...
@@ -710,23 +703,23 @@ spmCheckAndCorrect( const spmatrix_t *spm_in,
*/
*/
if
(
newspm
->
mtxtype
==
SpmGeneral
)
{
if
(
newspm
->
mtxtype
==
SpmGeneral
)
{
count
=
spmSymmetrize
(
newspm
);
count
=
spmSymmetrize
(
newspm
);
if
(
count
>
0
)
{
if
(
count
>
0
)
fprintf
(
stderr
,
"spmCheckAndCorrect: %ld entries have been added for symmetry
\n
"
,
(
long
)
count
);
{
modified
=
1
;
if
(
spm_in
->
clustnum
==
0
)
{
fprintf
(
stderr
,
"spmCheckAndCorrect: %ld entries have been added for symmetry
\n
"
,
(
long
)
count
);
}
}
}
}
}
else
{
else
{
//spmToLower( newspm );
//spmToLower( newspm );
}
}
spmUpdateComputedFields
(
newspm
);
/*
/*
* Check if we return the new one, or the original one because no changes
* Check if we return the new one, or the original one because no changes
* have been made
* have been made
*/
*/
if
((
spm_in
->
fmttype
!=
newspm
->
fmttype
)
||
if
(
modified
)
{
(
spm_in
->
nnzexp
!=
newspm
->
nnzexp
)
)
{
memcpy
(
spm_out
,
newspm
,
sizeof
(
spmatrix_t
)
);
memcpy
(
spm_out
,
newspm
,
sizeof
(
spmatrix_t
)
);
free
(
newspm
);
free
(
newspm
);
return
1
;
return
1
;
...
@@ -1695,6 +1688,7 @@ spm_create_asc_values( const spmatrix_t *spm )
...
@@ -1695,6 +1688,7 @@ spm_create_asc_values( const spmatrix_t *spm )
break
;
break
;
}
}
assert
((
valtmp
-
values
)
==
spm
->
nnz
);
assert
((
valtmp
-
values
)
==
spm
->
nnz
);
assert
(
values
[
spm
->
nnz
]
==
spm
->
nnzexp
);
values
=
realloc
(
values
,
spm
->
nnz
*
sizeof
(
spm_int_t
)
);
values
=
realloc
(
values
,
spm
->
nnz
*
sizeof
(
spm_int_t
)
);
return
values
;
return
values
;
...
...
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