libMesh
single_predicates.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 // Local includes
19 #include "libmesh/single_predicates.h"
20 
21 #include "libmesh/boundary_info.h"
22 #include "libmesh/dof_map.h"
23 #include "libmesh/mapvector.h"
24 
25 namespace libMesh
26 {
27 
28 namespace Predicates
29 {
30 
31 // The bid predicate returns true if has_boundary_id(node, id) returns true.
32 template <typename T>
33 bool
34 bid<T>::operator()(const T & it) const
35 {
36  return _bndry_info.has_boundary_id(*it, _bid);
37 }
38 
39 
40 // The bnd predicate returns true if n_boundary_ids(node) > 0.
41 template <typename T>
42 bool
43 bnd<T>::operator()(const T & it) const
44 {
45  return (_bndry_info.n_boundary_ids(*it) > 0);
46 }
47 
48 template <typename T>
49 bool
50 evaluable<T>::operator()(const T & it) const
51 {
52  return _dof_map.is_evaluable(**it, _var_num);
53 }
54 
55 
56 // Instantiate with the useful values of T
57 #define INSTANTIATE_NODAL_PREDICATES(IterType) \
58  template bool bid<IterType>::operator()(const IterType &) const; \
59  template bool bnd<IterType>::operator()(const IterType &) const; \
60  template bool evaluable<IterType>::operator()(const IterType &) const
61 
62 #define INSTANTIATE_ELEM_PREDICATES(IterType) \
63  template bool evaluable<IterType>::operator()(const IterType &) const
64 
65 // Handle commas in macro arguments
66 #define LIBMESH_COMMA ,
67 
68 // This should probably be replaced with
69 // FooMesh::element_iterator_imp, etc
70 INSTANTIATE_ELEM_PREDICATES(std::vector<Elem *>::iterator);
71 INSTANTIATE_ELEM_PREDICATES(std::vector<Elem *>::const_iterator);
72 INSTANTIATE_NODAL_PREDICATES(std::vector<Node *>::iterator);
73 INSTANTIATE_NODAL_PREDICATES(std::vector<Node *>::const_iterator);
78 
79 
80 } // namespace Predicates
81 
82 } // namespace libMesh
INSTANTIATE_NODAL_PREDICATES(std::vector< Node * >::iterator)
INSTANTIATE_ELEM_PREDICATES(std::vector< Elem * >::iterator)
The libMesh namespace provides an interface to certain functionality in the library.
virtual bool operator()(const T &it) const libmesh_override
virtual bool operator()(const T &it) const libmesh_override
virtual bool operator()(const T &it) const libmesh_override