18 #ifndef LIBMESH_PETSC_DM_WRAPPER_H 19 #define LIBMESH_PETSC_DM_WRAPPER_H 23 #ifdef LIBMESH_HAVE_PETSC 27 #include <unordered_map> 67 std::vector<std::unique_ptr<DM>>
_dms;
70 std::vector<std::unique_ptr<PetscSection>>
_sections;
83 { libmesh_assert(level <
_dms.size());
84 return *(
_dms[level].get()); }
91 { libmesh_assert(level <
_sections.size());
136 PetscSection & section,
137 std::unordered_map<dof_id_type,dof_id_type> & node_map,
138 std::unordered_map<dof_id_type,dof_id_type> & elem_map,
139 std::map<dof_id_type,unsigned int> & scalar_map);
146 PetscSection & section,
147 const std::unordered_map<dof_id_type,dof_id_type> & node_map,
148 const std::unordered_map<dof_id_type,dof_id_type> & elem_map,
149 const std::map<dof_id_type,unsigned int> & scalar_map);
162 PetscSection & section);
168 #endif // #ifdef LIBMESH_HAVE_PETSC 170 #endif // LIBMESH_PETSC_DM_WRAPPER_H void set_point_range_in_section(const System &system, PetscSection §ion, std::unordered_map< dof_id_type, dof_id_type > &node_map, std::unordered_map< dof_id_type, dof_id_type > &elem_map, std::map< dof_id_type, unsigned int > &scalar_map)
Helper function for build_section.
dof_id_type check_section_n_dofs(const System &system, PetscSection §ion)
Helper function to sanity check PetscSection construction.
DM & get_dm(unsigned int level)
Get reference to DM for the given mesh level.
std::vector< std::unique_ptr< PetscSF > > _star_forests
Vector of star forests for all grid levels.
void add_dofs_to_section(const System &system, PetscSection §ion, const std::unordered_map< dof_id_type, dof_id_type > &node_map, const std::unordered_map< dof_id_type, dof_id_type > &elem_map, const std::map< dof_id_type, unsigned int > &scalar_map)
Helper function for build_section.
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::vector< std::unique_ptr< PetscSection > > _sections
Vector of PETScSections for all grid levels.
PetscSection & get_section(unsigned int level)
Get reference to PetscSection for the given mesh level.
PetscSF & get_star_forest(unsigned int level)
Get reference to PetscSF for the given mesh level.
void add_dofs_helper(const System &system, const DofObject &dof_object, dof_id_type local_id, PetscSection §ion)
Helper function to reduce code duplication when setting dofs in section.
std::vector< std::unique_ptr< DM > > _dms
Vector of DMs for all grid levels.
void init_dm_data(unsigned int n_levels)
Init all the n_mesh_level dependent data structures.
void build_section(const System &system, PetscSection §ion)
Takes System, empty PetscSection and populates the PetscSection.
void build_sf(const System &system, PetscSF &star_forest)
Takes System, empty PetscSF and populates the PetscSF.
void clear()
Destroys and clears all build DM-related data.
void init_and_attach_petscdm(System &system, SNES &snes)