Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
copy_data.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_meshworker_copy_data_h
17 #define dealii_meshworker_copy_data_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/types.h>
22 
24 #include <deal.II/lac/vector.h>
25 
26 #include <vector>
27 
29 
30 namespace MeshWorker
31 {
49  template <int n_matrices = 1,
50  int n_vectors = n_matrices,
51  int n_dof_indices = n_matrices>
52  struct CopyData
53  {
58  explicit CopyData(const unsigned int size);
59 
63  explicit CopyData(
64  const std::array<std::array<unsigned int, 2>, n_matrices> &matrix_sizes,
65  const std::array<unsigned int, n_vectors> & vector_sizes,
66  const std::array<unsigned int, n_dof_indices> &dof_indices_sizes);
67 
72  default;
73 
77  std::array<FullMatrix<double>, n_matrices> matrices;
78 
82  std::array<Vector<double>, n_vectors> vectors;
83 
87  std::array<std::vector<types::global_dof_index>, n_dof_indices>
89  };
90 
91 
92 #ifndef DOXYGEN
93  //
94  // Template definitions
95  //
96  template <int n_matrices, int n_vectors, int n_dof_indices>
98  const unsigned int size)
99  {
100  for (auto &m : matrices)
101  m.reinit({size, size});
102  for (auto &v : vectors)
103  v.reinit(size);
104  for (auto &d : local_dof_indices)
105  d.resize(size);
106  }
107 
108 
109 
110  template <int n_matrices, int n_vectors, int n_dof_indices>
112  const std::array<std::array<unsigned int, 2>, n_matrices> &matrix_sizes,
113  const std::array<unsigned int, n_vectors> & vector_sizes,
114  const std::array<unsigned int, n_dof_indices> &dof_indices_sizes)
115  {
116  for (unsigned int i = 0; i < n_matrices; ++i)
117  matrices[i].reinit(matrix_sizes[i++]);
118 
119  for (unsigned int i = 0; i < n_vectors; ++i)
120  vectors[i].reinit(vector_sizes[i++]);
121 
122  for (unsigned int i = 0; i < n_dof_indices; ++i)
123  local_dof_indices[i].resize(dof_indices_sizes[i++]);
124  }
125 
126 #endif // DOXYGEN
127 } // namespace MeshWorker
128 
130 
131 #endif
MeshWorker::CopyData
Definition: copy_data.h:52
types.h
MeshWorker
Definition: assemble_flags.h:30
MeshWorker::CopyData::matrices
std::array< FullMatrix< double >, n_matrices > matrices
Definition: copy_data.h:77
Physics::Elasticity::Kinematics::d
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
MeshWorker::CopyData::CopyData
CopyData(const unsigned int size)
internal::reinit
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
Definition: matrix_block.h:621
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
MeshWorker::CopyData::local_dof_indices
std::array< std::vector< types::global_dof_index >, n_dof_indices > local_dof_indices
Definition: copy_data.h:88
vector.h
config.h
MeshWorker::CopyData::vectors
std::array< Vector< double >, n_vectors > vectors
Definition: copy_data.h:82
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
full_matrix.h