libMesh
Loading...
Searching...
No Matches
dof_map_base.h
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#ifndef LIBMESH_DOF_MAP_BASE_H
19#define LIBMESH_DOF_MAP_BASE_H
20
21#include "libmesh/id_types.h"
22#include "libmesh/parallel_object.h"
23#include <vector>
24
25namespace libMesh
26{
27class Variable;
28class Elem;
29class Node;
30
52{
53public:
55
61 virtual unsigned int n_variables() const = 0;
62
66 virtual const Variable & variable(const unsigned int c) const = 0;
67
71 dof_id_type first_dof(const processor_id_type proc) const;
72
73 dof_id_type first_dof() const { return this->first_dof(this->processor_id()); }
74
81 dof_id_type end_dof(const processor_id_type proc) const;
82
83 dof_id_type end_dof() const { return this->end_dof(this->processor_id()); }
84
90 virtual void dof_indices(const Elem * const elem,
91 std::vector<dof_id_type> & di,
92 const unsigned int vn,
93 int p_level = -12345) const = 0;
94
99 virtual void dof_indices(const Node * const node,
100 std::vector<dof_id_type> & di,
101 const unsigned int vn) const = 0;
105 dof_id_type n_dofs() const { return _n_dfs; }
106
111
115 dof_id_type n_local_dofs() const { return this->n_dofs_on_processor(this->processor_id()); }
116
117 virtual void clear();
118
119#ifdef LIBMESH_ENABLE_AMR
124
129
130 dof_id_type first_old_dof() const { return this->first_old_dof(this->processor_id()); }
131
138 dof_id_type end_old_dof(const processor_id_type proc) const;
139
140 dof_id_type end_old_dof() const { return this->end_old_dof(this->processor_id()); }
141#endif // LIBMESH_ENABLE_AMR
142
143protected:
150
154 std::vector<dof_id_type> _first_df;
155
159 std::vector<dof_id_type> _end_df;
160
165
166#ifdef LIBMESH_ENABLE_AMR
167
172
176 std::vector<dof_id_type> _first_old_df;
177
181 std::vector<dof_id_type> _end_old_df;
182#endif
183};
184
186{
187 libmesh_assert_less(proc, _first_df.size());
188 return _first_df[proc];
189}
190
192{
193 libmesh_assert_less(proc, _end_df.size());
194 return _end_df[proc];
195}
196
198{
199 libmesh_assert_less(proc, _first_df.size());
200 return cast_int<dof_id_type>(_end_df[proc] - _first_df[proc]);
201}
202
203#ifdef LIBMESH_ENABLE_AMR
205{
206 libmesh_assert_less(proc, _first_old_df.size());
207 return _first_old_df[proc];
208}
209
211{
212 libmesh_assert_less(proc, _end_old_df.size());
213 return _end_old_df[proc];
214}
215#endif // LIBMESH_ENABLE_AMR
216}
217#endif // LIBMESH_DOF_MAP_BASE_H
This base class provides a minimal set of interfaces for satisfying user requests for.
dof_id_type n_dofs() const
std::size_t compute_dof_info(dof_id_type n_local_dofs)
compute the key degree of freedom information given the local number of degrees of freedom on this pr...
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
dof_id_type end_dof() const
std::vector< dof_id_type > _first_df
First DOF index on processor p.
virtual void dof_indices(const Node *const node, std::vector< dof_id_type > &di, const unsigned int vn) const =0
Fills the vector di with the global degree of freedom indices for the node, for one variable vn.
dof_id_type first_old_dof() const
virtual void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di, const unsigned int vn, int p_level=-12345) const =0
Fills the vector di with the global degree of freedom indices for the element.
dof_id_type end_old_dof() const
dof_id_type _n_dfs
Total number of degrees of freedom.
dof_id_type _n_old_dfs
Total number of degrees of freedom on old dof objects.
std::vector< dof_id_type > _first_old_df
First old DOF index on processor p.
virtual void clear()
dof_id_type n_old_dofs() const
dof_id_type first_dof() const
virtual unsigned int n_variables() const =0
dof_id_type n_local_dofs() const
virtual const Variable & variable(const unsigned int c) const =0
std::vector< dof_id_type > _end_old_df
Last old DOF index (plus 1) on processor p.
This is the base class from which all geometric element types are derived.
Definition elem.h:96
A Node is like a Point, but with more information.
Definition node.h:55
An object whose state is distributed along a set of processors.
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
This class defines the notion of a variable in the system.
Definition variable.h:51
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t dof_id_type
Definition id_types.h:67
uint8_t processor_id_type
Definition id_types.h:104