Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romin Tomasetti
gmsh
Commits
af4fc861
Commit
af4fc861
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
don't crash if system is empty
parent
c9ce5938
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Solver/linearSystemCSR.h
+6
-4
6 additions, 4 deletions
Solver/linearSystemCSR.h
with
6 additions
and
4 deletions
Solver/linearSystemCSR.h
+
6
−
4
View file @
af4fc861
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#include
"linearSystem.h"
#include
"linearSystem.h"
#include
"sparsityPattern.h"
#include
"sparsityPattern.h"
typedef
int
INDEX_TYPE
;
typedef
int
INDEX_TYPE
;
typedef
struct
{
typedef
struct
{
int
nmax
;
int
nmax
;
...
@@ -52,9 +51,8 @@ class linearSystemCSR : public linearSystem<scalar> {
...
@@ -52,9 +51,8 @@ class linearSystemCSR : public linearSystem<scalar> {
_sparsity
.
insertEntry
(
i
,
j
);
_sparsity
.
insertEntry
(
i
,
j
);
}
}
virtual
void
preAllocateEntries
();
virtual
void
preAllocateEntries
();
virtual
void
addToMatrix
(
int
il
,
int
ic
,
const
scalar
&
val
)
virtual
void
addToMatrix
(
int
il
,
int
ic
,
const
scalar
&
val
)
{
{
if
(
!
_entriesPreAllocated
)
if
(
!
_entriesPreAllocated
)
preAllocateEntries
();
preAllocateEntries
();
INDEX_TYPE
*
jptr
=
(
INDEX_TYPE
*
)
_jptr
->
array
;
INDEX_TYPE
*
jptr
=
(
INDEX_TYPE
*
)
_jptr
->
array
;
...
@@ -125,18 +123,22 @@ class linearSystemCSR : public linearSystem<scalar> {
...
@@ -125,18 +123,22 @@ class linearSystemCSR : public linearSystem<scalar> {
}
}
virtual
void
addToRightHandSide
(
int
row
,
const
scalar
&
val
)
virtual
void
addToRightHandSide
(
int
row
,
const
scalar
&
val
)
{
{
if
(
!
_b
)
return
;
if
(
val
!=
scalar
())
(
*
_b
)[
row
]
+=
val
;
if
(
val
!=
scalar
())
(
*
_b
)[
row
]
+=
val
;
}
}
virtual
void
addToSolution
(
int
row
,
const
scalar
&
val
)
virtual
void
addToSolution
(
int
row
,
const
scalar
&
val
)
{
{
if
(
!
_x
)
return
;
if
(
val
!=
scalar
())
(
*
_x
)[
row
]
+=
val
;
if
(
val
!=
scalar
())
(
*
_x
)[
row
]
+=
val
;
}
}
virtual
void
getFromRightHandSide
(
int
row
,
scalar
&
val
)
const
virtual
void
getFromRightHandSide
(
int
row
,
scalar
&
val
)
const
{
{
if
(
!
_b
)
return
;
val
=
(
*
_b
)[
row
];
val
=
(
*
_b
)[
row
];
}
}
virtual
void
getFromSolution
(
int
row
,
scalar
&
val
)
const
virtual
void
getFromSolution
(
int
row
,
scalar
&
val
)
const
{
{
if
(
!
_x
)
return
;
val
=
(
*
_x
)[
row
];
val
=
(
*
_x
)[
row
];
}
}
virtual
void
zeroMatrix
()
virtual
void
zeroMatrix
()
...
@@ -156,9 +158,9 @@ class linearSystemCSR : public linearSystem<scalar> {
...
@@ -156,9 +158,9 @@ class linearSystemCSR : public linearSystem<scalar> {
if
(
!
_x
)
return
;
if
(
!
_x
)
return
;
for
(
unsigned
int
i
=
0
;
i
<
_x
->
size
();
i
++
)
(
*
_x
)[
i
]
=
scalar
();
for
(
unsigned
int
i
=
0
;
i
<
_x
->
size
();
i
++
)
(
*
_x
)[
i
]
=
scalar
();
}
}
virtual
double
normInfRightHandSide
()
const
virtual
double
normInfRightHandSide
()
const
{
{
if
(
!
_b
)
return
0.
;
double
nor
=
0.
;
double
nor
=
0.
;
double
temp
;
double
temp
;
for
(
unsigned
int
i
=
0
;
i
<
_b
->
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
_b
->
size
();
i
++
){
...
...
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