intrusive_ptr for managing petsc objects
More...
#include <include/PetscSmartObj.hpp>
|
using | Derived = boost::intrusive_ptr< typename std::remove_pointer< OBJ >::type > |
|
template<typename OBJ>
struct MoFEM::SmartPetscObj< OBJ >
intrusive_ptr for managing petsc objects
It manages destruction, referencing and dereferencing petsc objects. It is similar how smart_ptr pointers works, but applied for petsc objects like Vec, DM, Mat, etc.
DEPRECATED auto createSmartGhostVector(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt nghost, const PetscInt ghosts[])
intrusive_ptr for managing petsc objects
- Template Parameters
-
- Examples
- EshelbianPlasticity.cpp, HookeElement.cpp, approx_sphere.cpp, build_large_problem.cpp, child_and_parent.cpp, dm_build_partitioned_mesh.cpp, dynamic_first_order_con_law.cpp, eigen_elastic.cpp, elasticity.cpp, ep.cpp, free_surface.cpp, hanging_node_approx.cpp, heat_equation.cpp, higher_derivatives.cpp, level_set.cpp, mixed_poisson.cpp, navier_stokes.cpp, nonlinear_elastic.cpp, operators_tests.cpp, petsc_smart_ptr_objects.cpp, photon_diffusion.cpp, plastic.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, reaction_diffusion.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, shallow_wave.cpp, simple_contact.cpp, simple_contact_thermal.cpp, tensor_divergence_operator.cpp, test_cache_on_entities.cpp, test_jacobian_of_simple_contact_element.cpp, thermo_elastic.cpp, and wave_equation.cpp.
Definition at line 78 of file PetscSmartObj.hpp.
◆ Derived
template<typename OBJ >
using MoFEM::SmartPetscObj< OBJ >::Derived = boost::intrusive_ptr<typename std::remove_pointer<OBJ>::type> |
◆ SmartPetscObj() [1/2]
◆ SmartPetscObj() [2/2]
Construct a new Smart Petsc Obj object.
- Note
- If add_red is set to true, you have to destroy OBJ.
- Parameters
-
Definition at line 95 of file PetscSmartObj.hpp.
96 : boost::intrusive_ptr<typename std::remove_pointer<OBJ>::type>(
o,
97 add_ref) {
98 }
◆ operator OBJ()
◆ operator PetscObject()
Definition at line 101 of file PetscSmartObj.hpp.
101 {
102 return reinterpret_cast<PetscObject>(this->get());
103 }
◆ use_count()
- Examples
- petsc_smart_ptr_objects.cpp.
Definition at line 105 of file PetscSmartObj.hpp.
105 {
106 if (this->get()) {
107 int cnt;
110 return cnt;
111 } else
112 return 0;
113 }
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscObject getPetscObject(T obj)
The documentation for this struct was generated from the following file: