$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H 00021 #define LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H 00022 00023 // Local Includes 00024 #include "libmesh/system_subset.h" 00025 #include "libmesh/id_types.h" 00026 #include "libmesh/parallel_object.h" 00027 00028 // C++ includes 00029 #include <cstddef> 00030 #include <set> 00031 00032 namespace libMesh 00033 { 00034 00035 // Forward Declarations 00036 00045 // ------------------------------------------------------------ 00046 // SystemSubset class definition 00047 class SystemSubsetBySubdomain : public SystemSubset, 00048 public ParallelObject 00049 { 00050 public: 00051 00056 class SubdomainSelection : public ReferenceCountedObject<SubdomainSelection> 00057 { 00058 public: 00059 00063 SubdomainSelection (void); 00064 00068 virtual ~SubdomainSelection (void); 00069 00074 virtual bool operator()(const subdomain_id_type& subdomain_id)const=0; 00075 00076 private: 00083 SubdomainSelection(const SubdomainSelection&); 00084 00091 SubdomainSelection& operator=(const SubdomainSelection&); 00092 00093 }; // subclass \p SubdomainSelection 00094 00098 class SubdomainSelectionByList : public SubdomainSelection 00099 { 00100 public: 00105 explicit 00106 SubdomainSelectionByList (const std::set<subdomain_id_type>& list); 00107 00112 virtual bool operator()(const subdomain_id_type& subdomain_id)const; 00113 00114 protected: 00118 const std::set<subdomain_id_type>& _list; 00119 }; 00120 00129 SystemSubsetBySubdomain (const System& system, 00130 const SubdomainSelection& subdomain_selection, 00131 const std::set<unsigned int>* const var_nums = NULL); 00132 00141 SystemSubsetBySubdomain (const System& system, 00142 const std::set<subdomain_id_type>& subdomain_ids, 00143 const std::set<unsigned int>* const var_nums = NULL); 00144 00148 virtual ~SystemSubsetBySubdomain (); 00149 00155 virtual const std::vector<unsigned int>& dof_ids(void)const; 00156 00164 void init (const SubdomainSelection& subdomain_selection); 00165 00173 void init (const std::set<subdomain_id_type>& subdomain_ids); 00174 00175 protected: 00176 00181 void set_var_nums (const std::set<unsigned int>* const var_nums); 00182 00189 std::set<unsigned int> _var_nums; 00190 00194 std::vector<unsigned int> _dof_ids; 00195 00196 }; // class SystemSubset 00197 00198 } // namespace libMesh 00199 00200 #endif // LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H