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)
119 std::vector<std::vector<dof_id_type>> dof_ids_per_processor(this->
n_processors());
122 std::vector<dof_id_type> dof_indices;
125 for (
const auto & elem :
mesh.active_local_element_ptr_range())
126 if (subdomain_selection(elem->subdomain_id()))
131 for (
const auto & dof : dof_indices)
134 dof_ids_per_processor[proc].push_back(dof);
139 std::vector<Parallel::Request> request_per_processor(this->
n_processors());
140 for (
unsigned int proc=0; proc<this->
n_processors(); proc++)
144 this->
comm().
send(proc,dof_ids_per_processor[proc],request_per_processor[proc]);
147 for (
unsigned int proc=0; proc<this->
n_processors(); proc++)
149 std::vector<dof_id_type> received_dofs;
152 received_dofs = dof_ids_per_processor[proc];
158 for (std::size_t i=0; i<received_dofs.size(); i++)
159 _dof_ids.push_back(received_dofs[i]);
165 std::vector<unsigned int>::iterator new_end = std::unique (
_dof_ids.begin(),
_dof_ids.end());
169 for (
unsigned int proc=0; proc<this->
n_processors(); proc++)
173 request_per_processor[proc].wait();
180 init (
const std::set<subdomain_id_type> & subdomain_ids)
183 this->
init(selection);
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
void init(const SubdomainSelection &subdomain_selection)
virtual ~SystemSubsetBySubdomain()
void set_var_nums(const std::set< unsigned int > *const var_nums)
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
virtual bool operator()(const subdomain_id_type &subdomain_id) const override
uint8_t processor_id_type
const Parallel::Communicator & comm() const
virtual ~SubdomainSelection()
const MeshBase & get_mesh() const
Manages the degrees of freedom (DOFs) in a simulation.
processor_id_type n_processors() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
virtual const std::vector< unsigned int > & dof_ids() const override
An object whose state is distributed along a set of processors.
std::set< unsigned int > _var_nums
void swap(Iterator &lhs, Iterator &rhs)
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
SystemSubsetBySubdomain(const System &system, const SubdomainSelection &subdomain_selection, const std::set< unsigned int > *const var_nums=nullptr)
SubdomainSelectionByList(const std::set< subdomain_id_type > &list)
dof_id_type first_dof(const processor_id_type proc) const
unsigned int n_vars() const
dof_id_type end_dof(const processor_id_type proc) const
processor_id_type processor_id() const
const DofMap & get_dof_map() const
std::vector< unsigned int > _dof_ids