Go to the documentation of this file.
24 #include "libmesh/system_subset_by_subdomain.h"
25 #include "libmesh/system.h"
26 #include "libmesh/dof_map.h"
27 #include "libmesh/parallel.h"
28 #include "libmesh/elem.h"
54 return _list.find(subdomain_id)!=_list.end();
63 const std::set<unsigned int> *
const var_nums):
70 this->
init(subdomain_selection);
75 const std::set<subdomain_id_type> & subdomain_ids,
76 const std::set<unsigned int> *
const var_nums):
83 this->
init(subdomain_ids);
91 const std::vector<unsigned int> &
103 if (var_nums !=
nullptr)
117 std::vector<std::vector<dof_id_type>> dof_ids_per_processor(this->
n_processors());
120 std::vector<dof_id_type> dof_indices;
123 for (
const auto & elem :
mesh.active_local_element_ptr_range())
124 if (subdomain_selection(elem->subdomain_id()))
129 for (
const auto & dof : dof_indices)
132 dof_ids_per_processor[proc].push_back(dof);
137 std::vector<Parallel::Request> request_per_processor(this->
n_processors());
140 this->
comm().send(proc,dof_ids_per_processor[proc],request_per_processor[proc]);
143 std::vector<dof_id_type> received_dofs;
145 received_dofs = dof_ids_per_processor[proc];
147 this->
comm().receive(proc,received_dofs);
148 _dof_ids.insert(
_dof_ids.end(), received_dofs.begin(), received_dofs.end());
154 std::vector<unsigned int>::iterator new_end = std::unique (
_dof_ids.begin(),
_dof_ids.end());
162 request_per_processor[proc].wait();
169 init (
const std::set<subdomain_id_type> & subdomain_ids)
172 this->
init(selection);
Manages consistently variables, degrees of freedom, and coefficient vectors.
unsigned int n_vars() const
std::set< unsigned int > _var_nums
The set of all variable numbers that are contained in the subset.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
SubdomainSelection()
Constructor.
virtual ~SubdomainSelection()
Destructor.
virtual const std::vector< unsigned int > & dof_ids() const override
The libMesh namespace provides an interface to certain functionality in the library.
SystemSubsetBySubdomain(const System &system, const SubdomainSelection &subdomain_selection, const std::set< unsigned int > *const var_nums=nullptr)
Constructor.
const Parallel::Communicator & comm() const
dof_id_type first_dof(const processor_id_type proc) const
virtual bool operator()(const subdomain_id_type &subdomain_id) const override
Method that decides whether a given subdomain id is included in the subset or nor.
std::vector< unsigned int > _dof_ids
The actual set of the dof ids.
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
This is the MeshBase class.
const System & _system
A reference to the System we belong to.
processor_id_type n_processors() const
void init(const SubdomainSelection &subdomain_selection)
Initializes the class.
const MeshBase & get_mesh() const
processor_id_type processor_id() const
This is a base class for classes which represent subsets of the dofs of a System.
Selection of subdomain ids by a list.
void set_var_nums(const std::set< unsigned int > *const var_nums)
Sets _var_nums to either a copy of var_nums or, if that is nullptr, a set of all variable numbers tha...
virtual ~SystemSubsetBySubdomain()
Destructor.
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
This class handles the numbering of degrees of freedom on a mesh.
SubdomainSelectionByList(const std::set< subdomain_id_type > &list)
Constructor.
const DofMap & get_dof_map() const
Subclass for user-specified selection of subdomain ids to be included in a SystemSubset.
An object whose state is distributed along a set of processors.
dof_id_type end_dof(const processor_id_type proc) const