v0.14.0
PetscSmartObj.cpp
Go to the documentation of this file.
1 
2 
3 template <> void intrusive_ptr_release<Vec>(Vec obj) {
4  int cnt = 0;
5  PetscErrorCode ierr =
6  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
7  if (!ierr) {
8  if (cnt) {
9  ierr = VecDestroy(&obj);
10  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
11  CHKERRABORT(comm, ierr);
12  }
13  }
14 }
15 
16 template <> void intrusive_ptr_release<Mat>(Mat obj) {
17  int cnt = 0;
18  PetscErrorCode ierr =
19  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
20  if (!ierr) {
21  if (cnt) {
22  ierr = MatDestroy(&obj);
23  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
24  CHKERRABORT(comm, ierr);
25  }
26  }
27 }
28 
29 template <> void intrusive_ptr_release<DM>(DM obj) {
30  int cnt = 0;
31  PetscErrorCode ierr =
32  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
33  if (!ierr) {
34  if (cnt) {
35  ierr = DMDestroy(&obj);
36  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
37  CHKERRABORT(comm, ierr);
38  }
39  }
40 }
41 
42 template <> void intrusive_ptr_release<IS>(IS obj) {
43  int cnt = 0;
44  PetscErrorCode ierr =
45  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
46  if (!ierr) {
47  if (cnt) {
48  ierr = ISDestroy(&obj);
49  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
50  CHKERRABORT(comm, ierr);
51  }
52  }
53 }
54 
55 template <> void intrusive_ptr_release<AO>(AO obj) {
56  int cnt = 0;
57  PetscErrorCode ierr =
58  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
59  if (!ierr) {
60  if (cnt) {
61  ierr = AODestroy(&obj);
62  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
63  CHKERRABORT(comm, ierr);
64  }
65  }
66 }
67 
68 template <> void intrusive_ptr_release<KSP>(KSP obj) {
69  int cnt = 0;
70  PetscErrorCode ierr =
71  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
72  if (!ierr) {
73  if (cnt) {
74  ierr = KSPDestroy(&obj);
75  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
76  CHKERRABORT(comm, ierr);
77  }
78  }
79 }
80 
81 template <> void intrusive_ptr_release<SNES>(SNES obj) {
82  int cnt = 0;
83  PetscErrorCode ierr =
84  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
85  if (!ierr) {
86  if (cnt) {
87  ierr = SNESDestroy(&obj);
88  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
89  CHKERRABORT(comm, ierr);
90  }
91  }
92 }
93 
94 template <> void intrusive_ptr_release<TS>(TS obj) {
95  int cnt = 0;
96  PetscErrorCode ierr =
97  PetscObjectGetReference(MoFEM::getPetscObject(obj), &cnt);
98  if (!ierr) {
99  if (cnt) {
100  ierr = TSDestroy(&obj);
101  auto comm = PetscObjectComm(MoFEM::getPetscObject(obj));
102  CHKERRABORT(comm, ierr);
103  }
104  }
105 }
intrusive_ptr_release< Vec >
void intrusive_ptr_release< Vec >(Vec obj)
Definition: PetscSmartObj.cpp:3
MoFEM::getPetscObject
PetscObject getPetscObject(T obj)
Definition: PetscSmartObj.hpp:9
intrusive_ptr_release< Mat >
void intrusive_ptr_release< Mat >(Mat obj)
Definition: PetscSmartObj.cpp:16
intrusive_ptr_release< IS >
void intrusive_ptr_release< IS >(IS obj)
Definition: PetscSmartObj.cpp:42
intrusive_ptr_release< AO >
void intrusive_ptr_release< AO >(AO obj)
Definition: PetscSmartObj.cpp:55
intrusive_ptr_release< KSP >
void intrusive_ptr_release< KSP >(KSP obj)
Definition: PetscSmartObj.cpp:68
intrusive_ptr_release< DM >
void intrusive_ptr_release< DM >(DM obj)
Definition: PetscSmartObj.cpp:29
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
intrusive_ptr_release< SNES >
void intrusive_ptr_release< SNES >(SNES obj)
Definition: PetscSmartObj.cpp:81
intrusive_ptr_release< TS >
void intrusive_ptr_release< TS >(TS obj)
Definition: PetscSmartObj.cpp:94