libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
wrapped_petsc.C
浏览该文件的文档.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2023 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #include "libmesh/libmesh_config.h"
19 
20 #ifdef LIBMESH_HAVE_PETSC
21 
22 // libMesh includes
23 #include "libmesh/wrapped_petsc.h"
24 #include "libmesh/petsc_macro.h"
25 
26 // PETSc includes
27 #ifdef I
28 # define LIBMESH_SAW_I
29 #endif
30 
31 #include <petscksp.h>
32 #include <petscvec.h>
33 #include <petscis.h>
34 #include <petscmat.h>
35 #include <petscviewer.h>
36 #include <petscpc.h>
37 #include <petscsnes.h>
38 #include <petscdm.h>
39 #include <petscsf.h>
40 // PetscSection got its own header file in 3.12, prior to that it was
41 // defined in petscis.h
42 #if !PETSC_VERSION_LESS_THAN(3,12,0)
43 #include <petscsection.h>
44 #endif
45 
46 #ifndef LIBMESH_SAW_I
47 # undef I // Avoid complex.h contamination
48 #endif
49 
50 namespace libMesh
51 {
52 
53 // Specializations of the destroy() method for different PETSc classes
54 // This could also be macro-ized, but maybe it's not necessary?
55 template <> void WrappedPetsc<Vec>::destroy() { VecDestroy(&obj); }
56 template <> void WrappedPetsc<KSP>::destroy() { KSPDestroy(&obj); }
57 template <> void WrappedPetsc<IS>::destroy() { ISDestroy(&obj); }
58 template <> void WrappedPetsc<Mat>::destroy() { MatDestroy(&obj); }
59 template <> void WrappedPetsc<VecScatter>::destroy() { VecScatterDestroy(&obj); }
60 template <> void WrappedPetsc<PetscViewer>::destroy() { PetscViewerDestroy(&obj); }
61 template <> void WrappedPetsc<MatNullSpace>::destroy() { MatNullSpaceDestroy(&obj); }
62 template <> void WrappedPetsc<DM>::destroy() { DMDestroy(&obj); }
63 template <> void WrappedPetsc<MatPartitioning>::destroy() { MatPartitioningDestroy(&obj); }
64 template <> void WrappedPetsc<SNES>::destroy() { SNESDestroy(&obj); }
65 template <> void WrappedPetsc<PC>::destroy() { PCDestroy(&obj); }
66 template <> void WrappedPetsc<PetscSection>::destroy() { PetscSectionDestroy(&obj); }
67 
68 }
69 
70 #endif // LIBMESH_HAVE_PETSC
void destroy()
必须特例化以调用适当的XXXDestroy()例程,以便实例化WrappedPetsc&lt;T&gt;对象。