libMesh
Loading...
Searching...
No Matches
single_predicates.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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#include "libmesh/enum_elem_type.h"
21#include "libmesh/boundary_info.h"
22#include "libmesh/dof_map.h"
23#include "libmesh/distributed_mesh.h"
24
25namespace libMesh
26{
27
28namespace Predicates
29{
30
31// The bid predicate returns true if has_boundary_id(node, id) returns true.
32template <typename T>
33bool
34bid<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.
41template <typename T>
42bool
43bnd<T>::operator()(const T & it) const
44{
45 return (_bndry_info.n_boundary_ids(*it) > 0);
46}
47
48template <typename T>
49bool
50evaluable<T>::operator()(const T & it) const
51{
52 return _dof_map.is_evaluable(**it, _var_num);
53}
54
55template <typename T>
56bool
58{
59 for (const auto * const dof_map : _dof_maps)
60 {
61 libmesh_assert(dof_map);
62 if (!dof_map->is_evaluable(**it))
63 return false;
64 }
65
66 return true;
67}
68
69
70// Instantiate with the useful values of T
71#define INSTANTIATE_NODAL_PREDICATES(IterType) \
72 template LIBMESH_EXPORT bool bid<IterType>::operator()(const IterType &) const; \
73 template LIBMESH_EXPORT bool bnd<IterType>::operator()(const IterType &) const; \
74 template LIBMESH_EXPORT bool evaluable<IterType>::operator()(const IterType &) const; \
75 template LIBMESH_EXPORT bool multi_evaluable<IterType>::operator()(const IterType &) const
76
77#define INSTANTIATE_ELEM_PREDICATES(IterType) \
78 template LIBMESH_EXPORT bool evaluable<IterType>::operator()(const IterType &) const; \
79 template LIBMESH_EXPORT bool multi_evaluable<IterType>::operator()(const IterType &) const
80
81// Handle commas in macro arguments
82#define LIBMESH_COMMA ,
83
84// This should probably be replaced with
85// FooMesh::element_iterator_imp, etc
86INSTANTIATE_ELEM_PREDICATES(std::vector<Elem *>::iterator);
87INSTANTIATE_ELEM_PREDICATES(std::vector<Elem *>::const_iterator);
88INSTANTIATE_NODAL_PREDICATES(std::vector<Node *>::iterator);
89INSTANTIATE_NODAL_PREDICATES(std::vector<Node *>::const_iterator);
94
95
96} // namespace Predicates
97
98} // namespace libMesh
INSTANTIATE_ELEM_PREDICATES(std::vector< Elem * >::iterator)
INSTANTIATE_NODAL_PREDICATES(std::vector< Node * >::iterator)
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(ctx)
virtual bool operator()(const T &it) const override
virtual bool operator()(const T &it) const override
virtual bool operator()(const T &it) const override
virtual bool operator()(const T &it) const override