Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model
2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
f
g
h
i
k
l
m
n
r
s
t
u
v
w
Typedefs
Enumerations
a
b
c
d
e
f
i
k
l
m
n
p
r
t
u
v
Enumerator
_
a
b
c
d
e
f
g
h
i
l
m
n
p
q
s
t
u
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
c
d
f
g
h
l
m
p
s
v
w
Enumerations
Enumerator
c
d
e
f
h
i
j
m
n
o
p
r
s
t
w
y
Related Symbols
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
p
r
s
u
Variables
b
c
d
e
g
h
k
l
m
n
p
r
s
t
u
w
z
Typedefs
Macros
_
a
b
c
g
h
i
k
m
n
r
s
t
u
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
src
pythonbindings
pism_python.cc
Go to the documentation of this file.
1
// Copyright (C) 2011, 2014, 2015, 2016, 2017, 2023 David Maxwell and Constantine Khroulev
2
//
3
// This file is part of PISM.
4
//
5
// PISM is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software
7
// Foundation; either version 3 of the License, or (at your option) any later
8
// version.
9
//
10
// PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with PISM; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
#include <signal.h>
20
#include <errno.h>
21
#include <petscsys.h>
22
23
#include "pism/pythonbindings/pism_python.hh"
24
#include "pism/util/error_handling.hh"
25
26
namespace
pism
{
27
namespace
python {
28
29
void
set_abort_on_sigint
(
bool
abort) {
30
gSIGINT_is_fatal
= abort;
31
}
29
void
set_abort_on_sigint
(
bool
abort) {
…
}
32
33
SigInstaller::SigInstaller
(
int
sig,
void
(*new_handler)(
int
)) {
34
m_old_handler
= signal(sig, new_handler);
35
m_sig
= sig;
36
}
33
SigInstaller::SigInstaller
(
int
sig,
void
(*new_handler)(
int
)) {
…
}
37
38
void
SigInstaller::release
() {
39
if
(
m_old_handler
!=
nullptr
) {
40
signal(
m_sig
,
m_old_handler
);
41
}
42
m_old_handler
= NULL;
43
}
38
void
SigInstaller::release
() {
…
}
44
45
SigInstaller::~SigInstaller
() {
46
release
();
47
}
45
SigInstaller::~SigInstaller
() {
…
}
48
49
int
gSignalSet
= 0;
50
bool
gSIGINT_is_fatal
;
51
52
int
check_signal
() {
53
int
rv =
gSignalSet
;
54
if
(rv != 0) {
55
gSignalSet
= 0;
56
}
57
return
0;
58
}
52
int
check_signal
() {
…
}
59
60
void
sigint_handler
(
int
sig) {
61
if
(sig == SIGINT) {
62
if
(
gSIGINT_is_fatal
) {
63
throw
pism::RuntimeError
(
ErrorLocation
(),
"caught signal SIGTERM."
);
64
}
65
66
PetscPrintf(PETSC_COMM_WORLD,
"\nCaught signal SIGTERM, waiting to exit.\n"
);
67
gSignalSet
= SIGINT;
68
}
69
}
60
void
sigint_handler
(
int
sig) {
…
}
70
71
}
// end of namespace python
27
namespace
python {
…
}
72
}
// end of namespace pism
pism::ErrorLocation
Definition
error_handling.hh:32
pism::RuntimeError
Definition
error_handling.hh:46
pism::python::SigInstaller::release
void release()
Restores the signal handler to its previous value.
Definition
pism_python.cc:38
pism::python::SigInstaller::~SigInstaller
~SigInstaller()
Definition
pism_python.cc:45
pism::python::SigInstaller::m_sig
int m_sig
Definition
pism_python.hh:47
pism::python::SigInstaller::SigInstaller
SigInstaller(int sig, void(*new_handler)(int))
Installs handle new_handler for signal sig.
Definition
pism_python.cc:33
pism::python::SigInstaller::m_old_handler
void(* m_old_handler)(int)
Definition
pism_python.hh:46
pism::python::sigint_handler
void sigint_handler(int sig)
Definition
pism_python.cc:60
pism::python::gSignalSet
int gSignalSet
Definition
pism_python.cc:49
pism::python::set_abort_on_sigint
void set_abort_on_sigint(bool abort)
Definition
pism_python.cc:29
pism::python::gSIGINT_is_fatal
bool gSIGINT_is_fatal
Definition
pism_python.cc:50
pism::python::check_signal
int check_signal()
Definition
pism_python.cc:52
pism
Definition
AgeColumnSystem.cc:23
Generated by
1.9.8