system_subset_by_subdomain.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H
21 #define LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H
22 
23 // Local Includes
24 #include "libmesh/system_subset.h"
25 #include "libmesh/id_types.h"
27 
28 // C++ includes
29 #include <cstddef>
30 #include <set>
31 
32 namespace libMesh
33 {
34 
35 // Forward Declarations
36 
46  public ParallelObject
47 {
48 public:
49 
54  class SubdomainSelection : public ReferenceCountedObject<SubdomainSelection>
55  {
56  public:
57 
62 
66  virtual ~SubdomainSelection ();
67 
72  virtual bool operator() (const subdomain_id_type & subdomain_id) const = 0;
73 
74  private:
82 
90  }; // subclass \p SubdomainSelection
91 
92 
93 
98  {
99  public:
104  explicit
105  SubdomainSelectionByList (const std::set<subdomain_id_type> & list);
106 
111  virtual bool operator() (const subdomain_id_type & subdomain_id) const override;
112 
113  protected:
117  const std::set<subdomain_id_type> & _list;
118  };
119 
128  SystemSubsetBySubdomain (const System & system,
129  const SubdomainSelection & subdomain_selection,
130  const std::set<unsigned int> * const var_nums = nullptr);
131 
140  SystemSubsetBySubdomain (const System & system,
141  const std::set<subdomain_id_type> & subdomain_ids,
142  const std::set<unsigned int> * const var_nums = nullptr);
143 
147  virtual ~SystemSubsetBySubdomain ();
148 
155  virtual const std::vector<unsigned int> & dof_ids () const override;
156 
164  void init (const SubdomainSelection & subdomain_selection);
165 
173  void init (const std::set<subdomain_id_type> & subdomain_ids);
174 
175 protected:
176 
181  void set_var_nums (const std::set<unsigned int> * const var_nums);
182 
189  std::set<unsigned int> _var_nums;
190 
194  std::vector<unsigned int> _dof_ids;
195 
196 }; // class SystemSubset
197 
198 } // namespace libMesh
199 
200 #endif // LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H
SubdomainSelection & operator=(const SubdomainSelection &)
void init(const SubdomainSelection &subdomain_selection)
virtual bool operator()(const subdomain_id_type &subdomain_id) const =0
void set_var_nums(const std::set< unsigned int > *const var_nums)
virtual bool operator()(const subdomain_id_type &subdomain_id) const override
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
virtual const std::vector< unsigned int > & dof_ids() const override
An object whose state is distributed along a set of processors.
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)