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
0a9a5a41
Commit
0a9a5a41
authored
8 years ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Add function to updtae expended, and global fields
parent
dfb71d05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spm.c
+76
-0
76 additions, 0 deletions
spm.c
spm.h
+19
-18
19 additions, 18 deletions
spm.h
spm_dofs.c
+5
-50
5 additions, 50 deletions
spm_dofs.c
with
100 additions
and
68 deletions
spm.c
+
76
−
0
View file @
0a9a5a41
...
...
@@ -108,6 +108,82 @@ spmInit( pastix_spm_t *spm )
spm
->
values
=
NULL
;
}
/**
*******************************************************************************
*
* @ingroup pastix_spm
*
* @brief Update all the computed fields based on the static values stored
*
*******************************************************************************
*
* @param[in,out] spm
* The sparse matrix to init.
*
*******************************************************************************/
void
spmUpdateFields
(
pastix_spm_t
*
spm
)
{
/**
* Compute the local expended field for multi-dofs
*/
if
(
spm
->
dof
>
0
)
{
spm
->
nexp
=
spm
->
n
*
spm
->
dof
;
spm
->
nnzexp
=
spm
->
nnz
*
spm
->
dof
*
spm
->
dof
;
}
else
{
pastix_int_t
i
,
j
,
k
,
dofi
,
dofj
,
baseval
;
pastix_int_t
*
dofptr
,
*
colptr
,
*
rowptr
;
baseval
=
spmFindBase
(
spm
);
colptr
=
spm
->
colptr
;
rowptr
=
spm
->
rowptr
;
dofptr
=
spm
->
dofs
;
spm
->
nexp
=
dofptr
[
spm
->
n
]
-
baseval
;
spm
->
nnzexp
=
0
;
switch
(
spm
->
fmttype
)
{
case
PastixCSR
:
/* Swap pointers to call CSC */
colptr
=
spm
->
rowptr
;
rowptr
=
spm
->
colptr
;
case
PastixCSC
:
for
(
j
=
0
;
j
<
spm
->
n
;
j
++
,
colptr
++
)
{
dofj
=
dofptr
[
j
+
1
]
-
dofptr
[
j
];
for
(
k
=
colptr
[
0
];
k
<
colptr
[
1
];
k
++
,
rowptr
++
)
{
i
=
*
rowptr
-
baseval
;
dofi
=
dofptr
[
i
+
1
]
-
dofptr
[
i
];
spm
->
nnzexp
+=
dofi
*
dofj
;
}
}
break
;
case
PastixIJV
:
for
(
k
=
0
;
k
<
spm
->
nnz
;
k
++
,
rowptr
++
,
colptr
++
)
{
i
=
*
rowptr
-
baseval
;
j
=
*
colptr
-
baseval
;
dofi
=
dofptr
[
i
+
1
]
-
dofptr
[
i
];
dofj
=
dofptr
[
j
+
1
]
-
dofptr
[
j
];
spm
->
nnzexp
+=
dofi
*
dofj
;
}
}
}
/* TODO: add communicator */
spm
->
gN
=
spm
->
n
;
spm
->
gnnz
=
spm
->
nnz
;
spm
->
gNexp
=
spm
->
nexp
;
spm
->
gnnzexp
=
spm
->
nnzexp
;
}
/**
*******************************************************************************
*
...
...
This diff is collapsed.
Click to expand it.
spm.h
+
19
−
18
View file @
0a9a5a41
...
...
@@ -61,32 +61,32 @@ typedef enum pastix_driver_e {
*/
struct
pastix_spm_s
{
int
mtxtype
;
/**< Matrix structure: PastixGeneral, PastixSymmetric
or PastixHermitian. */
or PastixHermitian.
*/
pastix_coeftype_t
flttype
;
/**< avals datatype: PastixPattern, PastixFloat, PastixDouble,
PastixComplex32 or PastixComplex64 */
pastix_fmttype_t
fmttype
;
/**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV */
PastixComplex32 or PastixComplex64
*/
pastix_fmttype_t
fmttype
;
/**< Matrix storage format: PastixCSC, PastixCSR, PastixIJV
*/
pastix_int_t
gN
;
/**< Global number of vertices in the compressed graph
*/
pastix_int_t
n
;
/**< Local number of vertices in the compressed graph */
pastix_int_t
gnnz
;
/**< Global number of non zeroes in the compressed graph
*/
pastix_int_t
nnz
;
/**< Local number of non zeroes in the compressed graph */
pastix_int_t
gN
;
/**< Global number of vertices in the compressed graph
(Computed)
*/
pastix_int_t
n
;
/**< Local number of vertices in the compressed graph
*/
pastix_int_t
gnnz
;
/**< Global number of non zeroes in the compressed graph
(Computed)
*/
pastix_int_t
nnz
;
/**< Local number of non zeroes in the compressed graph
*/
pastix_int_t
gNexp
;
/**< Global number of vertices in the compressed graph
*/
pastix_int_t
nexp
;
/**< Local number of vertices in the compressed graph
*/
pastix_int_t
gnnzexp
;
/**< Global number of non zeroes in the compressed graph
*/
pastix_int_t
nnzexp
;
/**< Local number of non zeroes in the compressed graph
*/
pastix_int_t
gNexp
;
/**< Global number of vertices in the compressed graph
(Computed)
*/
pastix_int_t
nexp
;
/**< Local number of vertices in the compressed graph
(Computed)
*/
pastix_int_t
gnnzexp
;
/**< Global number of non zeroes in the compressed graph
(Computed)
*/
pastix_int_t
nnzexp
;
/**< Local number of non zeroes in the compressed graph
(Computed)
*/
pastix_int_t
dof
;
/**< Number of degrees of freedom per unknown,
if > 0, constant degree of freedom
otherwise, irregular degree of freedom (refer to dofs) */
otherwise, irregular degree of freedom (refer to dofs)
*/
pastix_int_t
*
dofs
;
/**< Array of the first column of each element in the
expanded matrix [+baseval] */
pastix_order_t
layout
;
/**< PastixColMajor, or PastixRowMajor */
expanded matrix [+baseval]
*/
pastix_order_t
layout
;
/**< PastixColMajor, or PastixRowMajor
*/
pastix_int_t
*
colptr
;
/**< List of indirections to rows for each vertex [+baseval] */
pastix_int_t
*
rowptr
;
/**< List of edges for each vertex [+baseval] */
pastix_int_t
*
loc2glob
;
/**< Corresponding numbering from local to global [+baseval] */
void
*
values
;
/**< Values stored in the matrix */
pastix_int_t
*
colptr
;
/**< List of indirections to rows for each vertex [+baseval]
*/
pastix_int_t
*
rowptr
;
/**< List of edges for each vertex [+baseval]
*/
pastix_int_t
*
loc2glob
;
/**< Corresponding numbering from local to global [+baseval]
*/
void
*
values
;
/**< Values stored in the matrix
*/
};
int
...
...
@@ -145,6 +145,7 @@ void spmInit( pastix_spm_t *spm );
void
spmExit
(
pastix_spm_t
*
spm
);
pastix_spm_t
*
spmCopy
(
const
pastix_spm_t
*
spm
);
void
spmBase
(
pastix_spm_t
*
spm
,
int
baseval
);
void
spmUpdateFields
(
pastix_spm_t
*
spm
);
int
spmConvert
(
int
ofmttype
,
pastix_spm_t
*
ospm
);
void
*
spm2Dense
(
const
pastix_spm_t
*
spm
);
pastix_int_t
spmFindBase
(
const
pastix_spm_t
*
spm
);
...
...
This diff is collapsed.
Click to expand it.
spm_dofs.c
+
5
−
50
View file @
0a9a5a41
...
...
@@ -44,15 +44,11 @@ spmDofExtend( const int type,
* Generate constant dof
*/
if
(
type
==
0
)
{
newspm
->
dof
=
dof
;
newspm
->
nexp
=
spm
->
n
*
dof
;
newspm
->
gNexp
=
spm
->
gN
*
dof
;
newspm
->
nnzexp
=
spm
->
nnz
*
dof
*
dof
;
newspm
->
gnnzexp
=
spm
->
gnnz
*
dof
*
dof
;
newspm
->
dof
=
dof
;
}
else
{
pastix_int_t
i
,
j
,
k
,
dofi
,
dofj
,
baseval
;
pastix_int_t
*
dofptr
,
*
colptr
,
*
rowptr
;
pastix_int_t
i
,
dofi
,
baseval
;
pastix_int_t
*
dofptr
;
baseval
=
spmFindBase
(
spm
);
...
...
@@ -69,51 +65,10 @@ spmDofExtend( const int type,
dofi
=
1
+
(
rand
()
%
dof
);
dofptr
[
1
]
=
dofptr
[
0
]
+
dofi
;
}
newspm
->
nexp
=
*
dofptr
-
baseval
;
newspm
->
gNexp
=
newspm
->
nexp
;
/**
* Count the number of non zeroes
*/
newspm
->
nnzexp
=
0
;
colptr
=
newspm
->
colptr
;
rowptr
=
newspm
->
rowptr
;
dofptr
=
newspm
->
dofs
;
switch
(
spm
->
fmttype
)
{
case
PastixCSR
:
/* Swap pointers to call CSC */
colptr
=
newspm
->
rowptr
;
rowptr
=
newspm
->
colptr
;
case
PastixCSC
:
for
(
j
=
0
;
j
<
newspm
->
n
;
j
++
,
colptr
++
)
{
dofj
=
dofptr
[
j
+
1
]
-
dofptr
[
j
];
for
(
k
=
colptr
[
0
];
k
<
colptr
[
1
];
k
++
,
rowptr
++
)
{
i
=
*
rowptr
-
baseval
;
dofi
=
dofptr
[
i
+
1
]
-
dofptr
[
i
];
newspm
->
nnzexp
+=
dofi
*
dofj
;
}
}
break
;
case
PastixIJV
:
for
(
k
=
0
;
k
<
newspm
->
nnz
;
k
++
,
rowptr
++
,
colptr
++
)
{
i
=
*
rowptr
-
baseval
;
j
=
*
colptr
-
baseval
;
dofi
=
dofptr
[
i
+
1
]
-
dofptr
[
i
];
dofj
=
dofptr
[
j
+
1
]
-
dofptr
[
j
];
newspm
->
nnzexp
+=
dofi
*
dofj
;
}
}
newspm
->
gnnzexp
=
newspm
->
nnzexp
;
}
spmUpdateFields
(
newspm
);
switch
(
spm
->
flttype
)
{
case
PastixFloat
:
s_spmDofExtend
(
newspm
);
...
...
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