20 #ifdef LIBMESH_HAVE_PETSC 28 #if !PETSC_VERSION_LESS_THAN(3,2,0) 36 const std::vector<dof_id_type> & indices,
38 const std::string & field_name)
40 const PetscInt *
idx = PETSC_NULL;
42 idx = reinterpret_cast<const PetscInt *>(indices.data());
45 int ierr = ISCreateLibMesh(comm.
get(), cast_int<PetscInt>(indices.size()),
49 ierr = PCFieldSplitSetIS(my_pc, field_name.c_str(), is);
61 std::string sys_prefix =
"--solver_group_";
65 sys_prefix = sys_prefix + sys.
name() +
"_";
68 std::map<std::string, std::vector<dof_id_type>> group_indices;
72 for (
unsigned int v = 0; v != sys.
n_vars(); ++v)
76 std::vector<dof_id_type> var_idx;
80 std::string group_command = sys_prefix + var_name;
82 const std::string empty_string;
85 (group_command, empty_string);
87 if (group_name != empty_string)
89 std::vector<dof_id_type> & indices =
90 group_indices[group_name];
91 const bool prior_indices = !indices.empty();
92 indices.insert(indices.end(), var_idx.begin(),
95 std::sort(indices.begin(), indices.end());
99 indices_to_fieldsplit (sys.
comm(), var_idx, my_pc, var_name);
104 for (
const auto & pr : group_indices)
105 indices_to_fieldsplit(sys.
comm(), pr.second, my_pc, pr.first);
111 #else // #PETSC_VERSION < 3.2.0 121 libMesh::out <<
"WARNING: libMesh does not support setting field splits" <<
122 std::endl <<
"with PETSc " 123 << LIBMESH_DETECTED_PETSC_VERSION_MAJOR <<
'.' 124 << LIBMESH_DETECTED_PETSC_VERSION_MINOR <<
'.' 125 << LIBMESH_DETECTED_PETSC_VERSION_SUBMINOR << std::endl;);
130 #endif // #PETSC_VERSION > 3.2.0 131 #endif // #ifdef LIBMESH_HAVE_PETSC
void local_variable_indices(std::vector< dof_id_type > &idx, const MeshBase &mesh, unsigned int var_num) const
void petsc_auto_fieldsplit(PC my_pc, const System &sys)
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
const std::string & variable_name(const unsigned int i) const
bool on_command_line(std::string arg)
const std::string & name() const
T command_line_value(const std::string &name, T value)
unsigned int n_vars() const
OStreamProxy out(std::cout)
const DofMap & get_dof_map() const