Flow123d  JS_before_hm-2203-gd2ee21200
dofhandler.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file dofhandler.hh
15  * @brief Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between local and global dofs.
16  * @author Jan Stebel
17  */
18 
19 #ifndef DOFHANDLER_HH_
20 #define DOFHANDLER_HH_
21 
22 #include <vector> // for vector
23 #include <unordered_map> // for unordered_map
24 #include "system/index_types.hh" // for LongIdx
25 #include "mesh/mesh.h"
26 #include "mesh/accessors.hh"
27 #include "mesh/range_wrapper.hh"
29 #include "fem/discrete_space.hh" // for DiscreteSpace
30 #include "la/vector_mpi.hh" // for VectorMPI
31 #include "petscvec.h" // for Vec
32 
33 
34 template<unsigned int dim> class FiniteElement;
35 class DHCellAccessor;
36 class Mesh;
37 class Distribution;
38 class Dof;
39 
40 
41 /**
42  * Class DOFHandlerBase provides an abstract interface for various dof handlers:
43  * - basic handler for a given spatial dimension
44  * - multi-dimensional handler for all spatial dimensions (1D-3D)
45  * - handler for a specific region / part of mesh
46  */
48 public:
49 
50  /**
51  * @brief Constructor.
52  * @param _mesh The mesh.
53  */
55  : n_global_dofs_(0), lsize_(0), loffset_(0), max_elem_dofs_(0), mesh_(&_mesh), dof_ds_(0) {}
56 
57  /**
58  * @brief Getter for the number of all mesh dofs required by the given
59  * finite element.
60  */
61  unsigned int n_global_dofs() const { return n_global_dofs_; }
62 
63  /**
64  * @brief Returns the number of dofs on the current process.
65  */
66  unsigned int lsize() const { return lsize_; }
67 
68  /**
69  * @brief Returns max. number of dofs on one element.
70  */
71  unsigned int max_elem_dofs() const { return max_elem_dofs_; }
72 
73  std::shared_ptr<Distribution> distr() const { return dof_ds_; }
74 
75  /**
76  * @brief Returns the mesh.
77  */
78  MeshBase *mesh() const { return mesh_; }
79 
80  /**
81  * @brief Compute hash value of DOF handler.
82  */
83  virtual std::size_t hash() const =0;
84 
85  /// Destructor.
86  virtual ~DOFHandlerBase();
87 
88 protected:
89 
90  /**
91  * @brief Fill vector of the global indices of dofs associated to the @p cell.
92  *
93  * @param cell The cell.
94  * @param indices Vector of dof indices on the cell.
95  */
96  virtual unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector<LongIdx> &indices) const = 0;
97 
98  /**
99  * @brief Returns a vector of the indices of dofs associated to the @p cell on the local process.
100  *
101  * @param loc_ele_idx local element index.
102  */
103  virtual LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const =0;
104 
105  /**
106  * @brief Number of global dofs assigned by the handler.
107  */
108  unsigned int n_global_dofs_;
109 
110  /**
111  * @brief Number of dofs associated to local process.
112  */
113  unsigned int lsize_;
114 
115  /**
116  * @brief Index of the first dof on the local process.
117  */
118  unsigned int loffset_;
119 
120  /// Max. number of dofs per element.
121  unsigned int max_elem_dofs_;
122 
123  /**
124  * @brief Pointer to the mesh to which the dof handler is associated.
125  */
127 
128  /**
129  * @brief Distribution of dofs associated to local process.
130  */
131  std::shared_ptr<Distribution> dof_ds_;
132 
133 };
134 
135 
136 
137 
138 /**
139  * @brief Provides the numbering of the finite element degrees of freedom
140  * on the computational mesh.
141  *
142  * Class DOFHandlerMultiDim distributes the degrees of freedom (dof) for
143  * a particular triplet of 1d, 2d and 3d finite elements on the computational mesh
144  * and provides mappings between local and global dofs.
145  * The template parameter @p dim denotes the spatial dimension of
146  * the reference finite element.
147  *
148  * Currently the functionality is restricted to finite elements with internal and nodal dofs,
149  * i.e. the neighboring elements can share only dofs on nodes.
150  */
152 public:
153 
154  /**
155  * @brief Constructor.
156  * @param _mesh The mesh.
157  * @param make_elem_part Allow switch off make_element_partitioning, necessary for boundary DOF handler.
158  */
159  DOFHandlerMultiDim(MeshBase &_mesh, bool make_elem_part = true);
160 
161 
162  /**
163  * @brief Distributes degrees of freedom on the mesh needed
164  * for the given discrete space.
165  *
166  * By default, the dof handler is parallel, meaning that each
167  * processor has access to dofs on the local elements and on one
168  * layer of ghost elements (owned by neighbouring elements).
169  * This can be changed by setting @p sequential to true.
170  *
171  * @param ds The discrete space consisting of finite elements for each mesh element.
172  * @param sequential If true then each processor will have information about all dofs.
173  */
174  void distribute_dofs(std::shared_ptr<DiscreteSpace> ds);
175 
176  /** @brief Returns sequential version of the current dof handler.
177  *
178  * Collective on all processors.
179  */
180  std::shared_ptr<DOFHandlerMultiDim> sequential();
181 
182  /**
183  * @brief Returns scatter context from parallel to sequential vectors.
184  *
185  * For sequential dof handler it returns null pointer.
186  * Collective on all processors.
187  */
188  std::shared_ptr<VecScatter> sequential_scatter();
189 
190  /**
191  * @brief Allocates PETSc vector according to the dof distribution.
192  */
193  virtual VectorMPI create_vector();
194 
195  /**
196  * @brief Returns the global index of local edge.
197  *
198  * @param loc_edg Local index of edge.
199  */
200  inline LongIdx edge_index(int loc_edg) const { return edg_4_loc[loc_edg]; }
201 
202  /**
203  * @brief Returns the global index of local neighbour.
204  *
205  * @param loc_nb Local index of neighbour.
206  */
207  inline LongIdx nb_index(int loc_nb) const { return nb_4_loc[loc_nb]; }
208 
209  /**
210  * @brief Returns number of local edges.
211  */
212  inline unsigned int n_loc_edges() const { return edg_4_loc.size(); }
213 
214  /**
215  * @brief Returns number of local neighbours.
216  */
217  inline unsigned int n_loc_nb() const { return nb_4_loc.size(); }
218 
219  /// Output structure of dof handler.
220  void print() const;
221 
222  /**
223  * Implements @p DOFHandlerBase::hash.
224  */
225  std::size_t hash() const override;
226 
227  /// Returns range of DOF handler cells (only range of own without ghost cells)
229 
230  /// Returns range over own and ghost cells of DOF handler
232 
233  /// Returns range over ghosts DOF handler cells
235 
236  /// Return size of own range (number of own cells)
237  inline unsigned int n_own_cells() const {
238  return el_ds_->lsize();
239  }
240 
241  /// Return size of local range (number of local cells)
242  inline unsigned int n_local_cells() const {
243  return el_ds_->lsize()+ghost_4_loc.size();
244  }
245 
246  /// Return size of ghost range (number of ghost cells)
247  inline unsigned int n_ghost_cells() const {
248  return ghost_4_loc.size();
249  }
250 
251  /// Return DHCellAccessor appropriate to ElementAccessor of given idx
252  const DHCellAccessor cell_accessor_from_element(unsigned int elm_idx) const;
253 
254  /// Return pointer to discrete space for which the handler distributes dofs.
255  std::shared_ptr<DiscreteSpace> ds() const { return ds_; }
256 
257  /// Get the map between local dof indices and the global ones.
259 
260  /// Destructor.
261  ~DOFHandlerMultiDim() override;
262 
263 
264 
265  friend class DHCellAccessor;
266  friend class DHCellSide;
267  friend class DHNeighbSide;
268  friend class SubDOFHandlerMultiDim;
269 
270 protected:
271 
272  /**
273  * Returns true if element is on local process.
274  * @param index Global element index.
275  */
276  bool el_is_local(int index) const;
277 
278  /**
279  * @brief Prepare parallel distribution of elements, edges and neighbours.
280  */
281  void make_elem_partitioning();
282 
283  /**
284  * @brief Initialize vector of starting indices for elements.
285  */
286  void init_cell_starts();
287 
288  /**
289  * @brief Initialize auxiliary vector of starting indices of nodal/edge dofs.
290  *
291  * @param node_dof_starts Vector of nodal starting indices (output).
292  * @param edge_dof_starts Vector of edge starting indices (output).
293  */
294  void init_dof_starts(std::vector<LongIdx> &node_dof_starts,
295  std::vector<LongIdx> &edge_dof_starts);
296 
297  /**
298  * @brief Initialize node_status and edge_status.
299  *
300  * Set VALID_NFACE for nodes/edges owned by local elements and
301  * INVALID_NFACE for nodes/edges owned by ghost elements.
302  *
303  * @param node_status Vector of nodal status (output).
304  * @param edge_status Vector of edge status (output).
305  */
306  void init_status(std::vector<short int> &node_status,
307  std::vector<short int> &edge_status);
308 
309  /**
310  * @brief Obtain dof numbers on ghost elements from other processor.
311  * @param proc Neighbouring processor.
312  * @param dofs Array where dofs are stored (output).
313  */
314  void receive_ghost_dofs(unsigned int proc,
315  std::vector<LongIdx> &dofs);
316 
317  /**
318  * @brief Send dof numbers to other processor.
319  * @param proc Neighbouring processor.
320  */
321  void send_ghost_dofs(unsigned int proc);
322 
323  /**
324  * @brief Update dofs on local elements from ghost element dofs.
325  *
326  * @param proc Neighbouring processor.
327  * @param update_cells Vector of global indices of elements which need to be updated
328  * from ghost elements.
329  * @param dofs Vector of dof indices on ghost elements from processor @p proc.
330  * @param node_dof_starts Vector of starting indices of nodal dofs.
331  * @param node_dofs Vector of nodal dof indices (output).
332  * @param edge_dof_starts Vector of starting indices of edge dofs.
333  * @param edge_dofs Vector of edge dof indices (output).
334  */
335  void update_local_dofs(unsigned int proc,
336  const std::vector<bool> &update_cells,
337  const std::vector<LongIdx> &dofs,
338  const std::vector<LongIdx> &node_dof_starts,
339  std::vector<LongIdx> &node_dofs,
340  const std::vector<LongIdx> &edge_dof_starts,
341  std::vector<LongIdx> &edge_dofs);
342 
343  /**
344  * @brief Communicate local dof indices to all processors and create new sequential dof handler.
345  *
346  * Collective on all processors.
347  */
348  void create_sequential();
349 
350  /**
351  * @brief Returns the global indices of dofs associated to the @p cell.
352  *
353  * @param cell The cell.
354  * @param indices Array of dof indices on the cell.
355  */
356  unsigned int get_dof_indices(const DHCellAccessor &cell,
357  std::vector<LongIdx> &indices) const override;
358 
359  /**
360  * @brief Returns the indices of dofs associated to the @p cell on the local process.
361  *
362  * @param loc_ele_idx local element index.
363  */
364  inline LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const override
365  {
366  unsigned int ndofs = cell_starts[loc_ele_idx+1]-cell_starts[loc_ele_idx];
367  // create armadillo vector on top of existing array
368  // vec(ptr_aux_mem, number_of_elements, copy_aux_mem = true, strict = false)
369  IntIdx* mem_ptr = const_cast<IntIdx*>(&(dof_indices[cell_starts[loc_ele_idx]]));
370  return LocDofVec(mem_ptr, ndofs, false, false);
371  }
372 
373 
374 
375  /**
376  * Flags used during distribution of dofs to mark n-face and dof status.
377  *
378  * INVALID_NFACE means that on this node/edge/side/cell the current processor
379  * will not distribute dofs.
380  * VALID_NFACE means that on this node/edge/side/cell the current processor
381  * will distribute dofs.
382  * ASSIGNED_NFACE means that dofs on this n-face are already distributed.
383  *
384  * INVALID_DOF marks dofs whose global number has to be set by neighbouring processor.
385  */
386  static const int INVALID_NFACE;
387  static const int VALID_NFACE;
388  static const int ASSIGNED_NFACE;
389  static const int INVALID_DOF;
390 
391 
392  /// Pointer to the discrete space for which the handler distributes dofs.
393  std::shared_ptr<DiscreteSpace> ds_;
394 
395  /// Indicator for parallel/sequential dof handler.
397 
398  /// Sequential dof handler associated to the current (parallel) one.
399  std::shared_ptr<DOFHandlerMultiDim> dh_seq_;
400 
401  /// Scatter context for parallel to sequential vectors.
402  std::shared_ptr<VecScatter> scatter_to_seq_;
403 
404  /**
405  * @brief Starting indices for local (owned+ghost) element dofs.
406  *
407  * E.g. dof_indices[cell_starts[idx]] = dof number for first dof on the
408  * cell with local index idx within the parallel structure. To use with
409  * DHCellAccessor use the following:
410  *
411  * DHCellAccessor<3> cell;
412  * ...
413  * // i-th dof number on the cell
414  * dof_indices[cell_starts[cell.local_idx()]+i] = ...
415  *
416  * For sequential dof handler, dofs from all elements are stored and
417  * elements are ordered as in mesh_->get_row_4_el().
418  */
420 
421  /**
422  * @brief Dof numbers on local and ghost elements.
423  *
424  * Dofs are ordered accordingly with cell_starts and local dof order
425  * given by the finite element. See cell_starts for more description.
426  */
428 
429  /**
430  * @brief Maps local and ghost dof indices to global ones.
431  *
432  * First lsize_ entries correspond to dofs owned by local processor,
433  * the remaining entries are ghost dofs sorted by neighbouring processor id.
434  */
436 
437  /**
438  * @brief Maps global element index into local/ghost index (obsolete).
439  */
440  std::unordered_map<LongIdx,LongIdx> global_to_local_el_idx_;
441 
442  /// Distribution of elements
444 
445  /// Local edge index -> global edge index
447 
448  /// Local neighbour index -> global neighbour index
450 
451  /// Indices of ghost cells (neighbouring with local elements).
453 
454  /// Processors of ghost elements.
455  set<unsigned int> ghost_proc;
456 
457  /// Arrays of ghost cells for each neighbouring processor.
459 
460 };
461 
462 
464 {
465 public:
466 
467  /** @brief Creates a new dof handler for a component of FESystem.
468  *
469  * The @p component_idx indicates the index of finite-element
470  * from @p dh for which the new sub- handler is made.
471  * The numbering of dofs in sub-handler is compatible
472  * with the original handler.
473  */
474  SubDOFHandlerMultiDim(std::shared_ptr<DOFHandlerMultiDim> dh, unsigned int component_idx);
475 
476  /** @brief Update values in subvector from parent vector.
477  *
478  * @p vec Vector aligned with the parent dof handler.
479  * @p subvec Vctor aligned with the current sub-handler.
480  */
481  void update_subvector(const VectorMPI &vec, VectorMPI &subvec);
482 
483  /** @brief Update values in parent vector from values of subvector.
484  *
485  * @p vec Vector aligned with parent dof handler.
486  * @p subvec Vector aligned with the current sub-handler.
487  */
488  void update_parent_vector(VectorMPI &vec, const VectorMPI &subvec);
489 
490  /// Local indices in the parent handler.
492 
493 
494 private:
495 
496  /// Get global dof indices of ghost dofs for sub-handler.
497  void receive_sub_ghost_dofs(unsigned int proc, vector<LongIdx> &dofs);
498 
499  /// Send global indices of dofs that are ghost on other processors.
500  void send_sub_ghost_dofs(unsigned int proc, const map<LongIdx,LongIdx> &global_to_local_dof_idx);
501 
502  /// Parent dof handler.
503  std::shared_ptr<DOFHandlerMultiDim> parent_;
504 
505  /// Index of FE in parent FESystem.
506  unsigned int fe_idx_;
507 
508  /// Local indices in the parent handler.
510 };
511 
512 
513 
514 
515 #endif /* DOFHANDLER_HH_ */
DOFHandlerMultiDim::ghost_range
Range< DHCellAccessor > ghost_range() const
Returns range over ghosts DOF handler cells.
Definition: dofhandler.cc:671
LocDofVec
arma::Col< IntIdx > LocDofVec
Definition: index_types.hh:28
DOFHandlerMultiDim::local_to_global_dof_idx_
std::vector< LongIdx > local_to_global_dof_idx_
Maps local and ghost dof indices to global ones.
Definition: dofhandler.hh:435
general_iterator.hh
Template Iter serves as general template for internal iterators.
DOFHandlerMultiDim::INVALID_DOF
static const int INVALID_DOF
Definition: dofhandler.hh:389
Armor::vec
ArmaVec< double, N > vec
Definition: armor.hh:885
DOFHandlerMultiDim::global_to_local_el_idx_
std::unordered_map< LongIdx, LongIdx > global_to_local_el_idx_
Maps global element index into local/ghost index (obsolete).
Definition: dofhandler.hh:440
DOFHandlerMultiDim::ghost_proc
set< unsigned int > ghost_proc
Processors of ghost elements.
Definition: dofhandler.hh:455
vector_mpi.hh
Distribution::lsize
unsigned int lsize(int proc) const
get local size
Definition: distribution.hh:115
DOFHandlerMultiDim::get_local_to_global_map
const std::vector< LongIdx > & get_local_to_global_map() const
Get the map between local dof indices and the global ones.
Definition: dofhandler.hh:258
discrete_space.hh
Declaration of class which provides the finite element for every mesh cell.
DOFHandlerMultiDim::ds
std::shared_ptr< DiscreteSpace > ds() const
Return pointer to discrete space for which the handler distributes dofs.
Definition: dofhandler.hh:255
DOFHandlerMultiDim::nb_index
LongIdx nb_index(int loc_nb) const
Returns the global index of local neighbour.
Definition: dofhandler.hh:207
DOFHandlerMultiDim::SubDOFHandlerMultiDim
friend class SubDOFHandlerMultiDim
Definition: dofhandler.hh:268
DOFHandlerBase::hash
virtual std::size_t hash() const =0
Compute hash value of DOF handler.
DOFHandlerBase::get_loc_dof_indices
virtual LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const =0
Returns a vector of the indices of dofs associated to the cell on the local process.
IntIdx
int IntIdx
Definition: index_types.hh:25
DOFHandlerBase::mesh
MeshBase * mesh() const
Returns the mesh.
Definition: dofhandler.hh:78
DHNeighbSide
Class allows to iterate over sides of neighbour.
Definition: dh_cell_accessor.hh:352
DOFHandlerBase::mesh_
MeshBase * mesh_
Pointer to the mesh to which the dof handler is associated.
Definition: dofhandler.hh:126
SubDOFHandlerMultiDim::update_subvector
void update_subvector(const VectorMPI &vec, VectorMPI &subvec)
Update values in subvector from parent vector.
Definition: dofhandler.cc:881
DOFHandlerMultiDim::n_loc_nb
unsigned int n_loc_nb() const
Returns number of local neighbours.
Definition: dofhandler.hh:217
DOFHandlerMultiDim::ghost_4_loc
vector< LongIdx > ghost_4_loc
Indices of ghost cells (neighbouring with local elements).
Definition: dofhandler.hh:452
std::vector< LongIdx >
DOFHandlerBase::~DOFHandlerBase
virtual ~DOFHandlerBase()
Destructor.
Definition: dofhandler.cc:41
DOFHandlerMultiDim::el_ds_
Distribution * el_ds_
Distribution of elements.
Definition: dofhandler.hh:443
DOFHandlerMultiDim::local_range
Range< DHCellAccessor > local_range() const
Returns range over own and ghost cells of DOF handler.
Definition: dofhandler.cc:664
DOFHandlerMultiDim::ghost_proc_el
map< unsigned int, vector< LongIdx > > ghost_proc_el
Arrays of ghost cells for each neighbouring processor.
Definition: dofhandler.hh:458
DOFHandlerMultiDim::get_loc_dof_indices
LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const override
Returns the indices of dofs associated to the cell on the local process.
Definition: dofhandler.hh:364
index_types.hh
SubDOFHandlerMultiDim::receive_sub_ghost_dofs
void receive_sub_ghost_dofs(unsigned int proc, vector< LongIdx > &dofs)
Get global dof indices of ghost dofs for sub-handler.
Definition: dofhandler.cc:838
DOFHandlerBase::get_dof_indices
virtual unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const =0
Fill vector of the global indices of dofs associated to the cell.
DHCellSide
Side accessor allows to iterate over sides of DOF handler cell.
Definition: dh_cell_accessor.hh:176
Distribution
Definition: distribution.hh:50
DOFHandlerMultiDim::update_local_dofs
void update_local_dofs(unsigned int proc, const std::vector< bool > &update_cells, const std::vector< LongIdx > &dofs, const std::vector< LongIdx > &node_dof_starts, std::vector< LongIdx > &node_dofs, const std::vector< LongIdx > &edge_dof_starts, std::vector< LongIdx > &edge_dofs)
Update dofs on local elements from ghost element dofs.
Definition: dofhandler.cc:213
accessors.hh
DOFHandlerMultiDim::dh_seq_
std::shared_ptr< DOFHandlerMultiDim > dh_seq_
Sequential dof handler associated to the current (parallel) one.
Definition: dofhandler.hh:399
DOFHandlerMultiDim::edge_index
LongIdx edge_index(int loc_edg) const
Returns the global index of local edge.
Definition: dofhandler.hh:200
DOFHandlerMultiDim::el_is_local
bool el_is_local(int index) const
Definition: dofhandler.cc:646
DOFHandlerMultiDim
Provides the numbering of the finite element degrees of freedom on the computational mesh.
Definition: dofhandler.hh:151
SubDOFHandlerMultiDim::update_parent_vector
void update_parent_vector(VectorMPI &vec, const VectorMPI &subvec)
Update values in parent vector from values of subvector.
Definition: dofhandler.cc:891
DOFHandlerMultiDim::VALID_NFACE
static const int VALID_NFACE
Definition: dofhandler.hh:387
DOFHandlerMultiDim::own_range
Range< DHCellAccessor > own_range() const
Returns range of DOF handler cells (only range of own without ghost cells)
Definition: dofhandler.cc:657
DOFHandlerMultiDim::INVALID_NFACE
static const int INVALID_NFACE
Definition: dofhandler.hh:386
DOFHandlerMultiDim::distribute_dofs
void distribute_dofs(std::shared_ptr< DiscreteSpace > ds)
Distributes degrees of freedom on the mesh needed for the given discrete space.
Definition: dofhandler.cc:303
DOFHandlerMultiDim::n_local_cells
unsigned int n_local_cells() const
Return size of local range (number of local cells)
Definition: dofhandler.hh:242
DOFHandlerMultiDim::receive_ghost_dofs
void receive_ghost_dofs(unsigned int proc, std::vector< LongIdx > &dofs)
Obtain dof numbers on ghost elements from other processor.
Definition: dofhandler.cc:161
DOFHandlerBase::lsize
unsigned int lsize() const
Returns the number of dofs on the current process.
Definition: dofhandler.hh:66
SubDOFHandlerMultiDim
Definition: dofhandler.hh:463
DOFHandlerMultiDim::create_vector
virtual VectorMPI create_vector()
Allocates PETSc vector according to the dof distribution.
Definition: dofhandler.cc:530
DOFHandlerBase::n_global_dofs_
unsigned int n_global_dofs_
Number of global dofs assigned by the handler.
Definition: dofhandler.hh:108
DOFHandlerBase::loffset_
unsigned int loffset_
Index of the first dof on the local process.
Definition: dofhandler.hh:118
SubDOFHandlerMultiDim::parent_
std::shared_ptr< DOFHandlerMultiDim > parent_
Parent dof handler.
Definition: dofhandler.hh:503
DOFHandlerMultiDim::sequential
std::shared_ptr< DOFHandlerMultiDim > sequential()
Returns sequential version of the current dof handler.
Definition: dofhandler.cc:61
Dof
Definition: finite_element.hh:70
DOFHandlerBase::DOFHandlerBase
DOFHandlerBase(MeshBase &_mesh)
Constructor.
Definition: dofhandler.hh:54
mesh.h
DOFHandlerMultiDim::init_status
void init_status(std::vector< short int > &node_status, std::vector< short int > &edge_status)
Initialize node_status and edge_status.
Definition: dofhandler.cc:115
std::map
Definition: doxy_dummy_defs.hh:11
DOFHandlerBase::distr
std::shared_ptr< Distribution > distr() const
Definition: dofhandler.hh:73
FiniteElement
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
Definition: discrete_space.hh:26
DOFHandlerMultiDim::init_dof_starts
void init_dof_starts(std::vector< LongIdx > &node_dof_starts, std::vector< LongIdx > &edge_dof_starts)
Initialize auxiliary vector of starting indices of nodal/edge dofs.
Definition: dofhandler.cc:89
DOFHandlerMultiDim::n_loc_edges
unsigned int n_loc_edges() const
Returns number of local edges.
Definition: dofhandler.hh:212
LongIdx
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
Definition: index_types.hh:24
DOFHandlerMultiDim::cell_accessor_from_element
const DHCellAccessor cell_accessor_from_element(unsigned int elm_idx) const
Return DHCellAccessor appropriate to ElementAccessor of given idx.
Definition: dofhandler.cc:678
DOFHandlerMultiDim::n_ghost_cells
unsigned int n_ghost_cells() const
Return size of ghost range (number of ghost cells)
Definition: dofhandler.hh:247
Mesh
Definition: mesh.h:355
SubDOFHandlerMultiDim::parent_indices
const std::vector< LongIdx > & parent_indices()
Local indices in the parent handler.
Definition: dofhandler.hh:491
DOFHandlerMultiDim::~DOFHandlerMultiDim
~DOFHandlerMultiDim() override
Destructor.
Definition: dofhandler.cc:556
DOFHandlerMultiDim::nb_4_loc
vector< LongIdx > nb_4_loc
Local neighbour index -> global neighbour index.
Definition: dofhandler.hh:449
Range
Range helper class.
Definition: range_wrapper.hh:65
DOFHandlerMultiDim::ds_
std::shared_ptr< DiscreteSpace > ds_
Pointer to the discrete space for which the handler distributes dofs.
Definition: dofhandler.hh:393
DOFHandlerBase
Definition: dofhandler.hh:47
DHCellAccessor
Cell accessor allow iterate over DOF handler cells.
Definition: dh_cell_accessor.hh:43
DOFHandlerMultiDim::cell_starts
std::vector< LongIdx > cell_starts
Starting indices for local (owned+ghost) element dofs.
Definition: dofhandler.hh:419
DOFHandlerMultiDim::print
void print() const
Output structure of dof handler.
Definition: dofhandler.cc:685
DOFHandlerMultiDim::make_elem_partitioning
void make_elem_partitioning()
Prepare parallel distribution of elements, edges and neighbours.
Definition: dofhandler.cc:561
SubDOFHandlerMultiDim::fe_idx_
unsigned int fe_idx_
Index of FE in parent FESystem.
Definition: dofhandler.hh:506
MeshBase
Base class for Mesh and BCMesh.
Definition: mesh.h:96
DOFHandlerMultiDim::dof_indices
std::vector< IntIdx > dof_indices
Dof numbers on local and ghost elements.
Definition: dofhandler.hh:427
DOFHandlerBase::max_elem_dofs_
unsigned int max_elem_dofs_
Max. number of dofs per element.
Definition: dofhandler.hh:121
DOFHandlerMultiDim::create_sequential
void create_sequential()
Communicate local dof indices to all processors and create new sequential dof handler.
Definition: dofhandler.cc:441
DOFHandlerBase::lsize_
unsigned int lsize_
Number of dofs associated to local process.
Definition: dofhandler.hh:113
DOFHandlerMultiDim::DOFHandlerMultiDim
DOFHandlerMultiDim(MeshBase &_mesh, bool make_elem_part=true)
Constructor.
Definition: dofhandler.cc:49
SubDOFHandlerMultiDim::send_sub_ghost_dofs
void send_sub_ghost_dofs(unsigned int proc, const map< LongIdx, LongIdx > &global_to_local_dof_idx)
Send global indices of dofs that are ghost on other processors.
Definition: dofhandler.cc:863
SubDOFHandlerMultiDim::parent_dof_idx_
std::vector< LongIdx > parent_dof_idx_
Local indices in the parent handler.
Definition: dofhandler.hh:509
DOFHandlerMultiDim::scatter_to_seq_
std::shared_ptr< VecScatter > scatter_to_seq_
Scatter context for parallel to sequential vectors.
Definition: dofhandler.hh:402
DOFHandlerBase::n_global_dofs
unsigned int n_global_dofs() const
Getter for the number of all mesh dofs required by the given finite element.
Definition: dofhandler.hh:61
DOFHandlerMultiDim::sequential_scatter
std::shared_ptr< VecScatter > sequential_scatter()
Returns scatter context from parallel to sequential vectors.
Definition: dofhandler.cc:68
DOFHandlerMultiDim::is_parallel_
bool is_parallel_
Indicator for parallel/sequential dof handler.
Definition: dofhandler.hh:396
DOFHandlerMultiDim::ASSIGNED_NFACE
static const int ASSIGNED_NFACE
Definition: dofhandler.hh:388
VectorMPI
Definition: vector_mpi.hh:43
DOFHandlerMultiDim::hash
std::size_t hash() const override
Definition: dofhandler.cc:652
DOFHandlerMultiDim::send_ghost_dofs
void send_ghost_dofs(unsigned int proc)
Send dof numbers to other processor.
Definition: dofhandler.cc:182
DOFHandlerMultiDim::get_dof_indices
unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const override
Returns the global indices of dofs associated to the cell.
Definition: dofhandler.cc:544
DOFHandlerBase::max_elem_dofs
unsigned int max_elem_dofs() const
Returns max. number of dofs on one element.
Definition: dofhandler.hh:71
DOFHandlerBase::dof_ds_
std::shared_ptr< Distribution > dof_ds_
Distribution of dofs associated to local process.
Definition: dofhandler.hh:131
DOFHandlerMultiDim::init_cell_starts
void init_cell_starts()
Initialize vector of starting indices for elements.
Definition: dofhandler.cc:75
DOFHandlerMultiDim::n_own_cells
unsigned int n_own_cells() const
Return size of own range (number of own cells)
Definition: dofhandler.hh:237
range_wrapper.hh
Implementation of range helper class.
DOFHandlerMultiDim::edg_4_loc
vector< LongIdx > edg_4_loc
Local edge index -> global edge index.
Definition: dofhandler.hh:446