Skip to content

Commit 3cbe610

Browse files
committed
INCOMPLETE REFACTORING
1 parent 75f5db5 commit 3cbe610

File tree

4 files changed

+214
-93
lines changed

4 files changed

+214
-93
lines changed

include/deal.II/dofs/dof_handler.h

+14-4
Original file line numberDiff line numberDiff line change
@@ -689,15 +689,13 @@ class DoFHandler : public Subscriptor
689689
* function set_fe().
690690
*/
691691
void
692-
distribute_dofs(const FiniteElement<dim, spacedim> &fe,
693-
const dealii::types::global_dof_index &virtual_dofs = 0);
692+
distribute_dofs(const FiniteElement<dim, spacedim> &fe);
694693

695694
/**
696695
* Same as above but taking an hp::FECollection object.
697696
*/
698697
void
699-
distribute_dofs(const hp::FECollection<dim, spacedim> &fe,
700-
const dealii::types::global_dof_index &virtual_dofs = 0);
698+
distribute_dofs(const hp::FECollection<dim, spacedim> &fe);
701699

702700
/**
703701
* Distribute level degrees of freedom on each level for geometric
@@ -707,6 +705,16 @@ class DoFHandler : public Subscriptor
707705
void
708706
distribute_mg_dofs();
709707

708+
/**
709+
* FIXME: documentation
710+
*
711+
* Distribute virtual degrees of freedom. [...]
712+
*
713+
* @pre The locally owned index set must be contiguous.
714+
*/
715+
void
716+
distribute_virtual_dofs(const dealii::types::global_dof_index virtual_dofs);
717+
710718
/**
711719
* Returns whether this DoFHandler has hp-capabilities.
712720
*/
@@ -1190,6 +1198,8 @@ class DoFHandler : public Subscriptor
11901198
locally_owned_dofs() const;
11911199

11921200
/**
1201+
* FIXME: documentation
1202+
*
11931203
* Return an IndexSet describing the subset of locally owned virtual DoFs.
11941204
*/
11951205
const IndexSet &

include/deal.II/dofs/dof_handler_policy.h

+38-14
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace internal
7373
* argument.
7474
*/
7575
virtual NumberCache
76-
distribute_dofs(const types::global_dof_index virtual_dofs) const = 0;
76+
distribute_dofs() const = 0;
7777

7878
/**
7979
* Distribute the multigrid dofs on each level of the DoFHandler
@@ -83,14 +83,22 @@ namespace internal
8383
virtual std::vector<NumberCache>
8484
distribute_mg_dofs() const = 0;
8585

86+
/**
87+
* FIXME: documentation
88+
*/
89+
virtual NumberCache
90+
distribute_virtual_dofs(
91+
const types::global_dof_index virtual_dofs) const = 0;
92+
8693
/**
8794
* Renumber degrees of freedom as specified by the first argument.
8895
*
8996
* Return an updated NumberCache for the DoFHandler after renumbering.
9097
*/
9198
virtual NumberCache
9299
renumber_dofs(
93-
const std::vector<types::global_dof_index> &new_numbers) const = 0;
100+
const std::vector<types::global_dof_index> &new_numbers,
101+
const types::global_dof_index &n_locally_owned_dofs) const = 0;
94102

95103
/**
96104
* Renumber multilevel degrees of freedom on one level of a multigrid
@@ -124,17 +132,21 @@ namespace internal
124132

125133
// documentation is inherited
126134
virtual NumberCache
127-
distribute_dofs(
128-
const types::global_dof_index virtual_dofs) const override;
135+
distribute_dofs() const override;
129136

130137
// documentation is inherited
131138
virtual std::vector<NumberCache>
132139
distribute_mg_dofs() const override;
133140

141+
virtual NumberCache
142+
distribute_virtual_dofs(
143+
const types::global_dof_index virtual_dofs) const override;
144+
134145
// documentation is inherited
135146
virtual NumberCache
136-
renumber_dofs(const std::vector<types::global_dof_index> &new_numbers)
137-
const override;
147+
renumber_dofs(
148+
const std::vector<types::global_dof_index> &new_numbers,
149+
const types::global_dof_index &n_locally_owned_dofs) const override;
138150

139151
// documentation is inherited
140152
virtual NumberCache
@@ -175,15 +187,21 @@ namespace internal
175187
* number_cache.locally_owned_dofs are updated consistently.
176188
*/
177189
virtual NumberCache
178-
distribute_dofs(
179-
const types::global_dof_index virtual_dofs) const override;
190+
distribute_dofs() const override;
180191

181192
/**
182193
* This function is not yet implemented.
183194
*/
184195
virtual std::vector<NumberCache>
185196
distribute_mg_dofs() const override;
186197

198+
/**
199+
* This function is not yet implemented.
200+
*/
201+
virtual NumberCache
202+
distribute_virtual_dofs(
203+
const types::global_dof_index virtual_dofs) const override;
204+
187205
/**
188206
* Renumber degrees of freedom as specified by the first argument.
189207
*
@@ -194,8 +212,9 @@ namespace internal
194212
* parallel::distributed case.
195213
*/
196214
virtual NumberCache
197-
renumber_dofs(const std::vector<types::global_dof_index> &new_numbers)
198-
const override;
215+
renumber_dofs(
216+
const std::vector<types::global_dof_index> &new_numbers,
217+
const types::global_dof_index &n_locally_owned_dofs) const override;
199218

200219
// documentation is inherited
201220
virtual NumberCache
@@ -228,17 +247,22 @@ namespace internal
228247

229248
// documentation is inherited
230249
virtual NumberCache
231-
distribute_dofs(
232-
const types::global_dof_index virtual_dofs) const override;
250+
distribute_dofs() const override;
233251

234252
// documentation is inherited
235253
virtual std::vector<NumberCache>
236254
distribute_mg_dofs() const override;
237255

238256
// documentation is inherited
239257
virtual NumberCache
240-
renumber_dofs(const std::vector<types::global_dof_index> &new_numbers)
241-
const override;
258+
distribute_virtual_dofs(
259+
const types::global_dof_index virtual_dofs) const override;
260+
261+
// documentation is inherited
262+
virtual NumberCache
263+
renumber_dofs(
264+
const std::vector<types::global_dof_index> &new_numbers,
265+
const types::global_dof_index &n_locally_owned_dofs) const override;
242266

243267
// documentation is inherited
244268
virtual NumberCache

source/dofs/dof_handler.cc

+17-10
Original file line numberDiff line numberDiff line change
@@ -2133,19 +2133,17 @@ std::size_t DoFHandler<dim, spacedim>::memory_consumption() const
21332133
template <int dim, int spacedim>
21342134
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
21352135
void DoFHandler<dim, spacedim>::distribute_dofs(
2136-
const FiniteElement<dim, spacedim> &fe,
2137-
const dealii::types::global_dof_index &virtual_dofs)
2136+
const FiniteElement<dim, spacedim> &fe)
21382137
{
2139-
this->distribute_dofs(hp::FECollection<dim, spacedim>(fe), virtual_dofs);
2138+
this->distribute_dofs(hp::FECollection<dim, spacedim>(fe));
21402139
}
21412140

21422141

21432142

21442143
template <int dim, int spacedim>
21452144
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
21462145
void DoFHandler<dim, spacedim>::distribute_dofs(
2147-
const hp::FECollection<dim, spacedim> &ff,
2148-
const dealii::types::global_dof_index &virtual_dofs)
2146+
const hp::FECollection<dim, spacedim> &ff)
21492147
{
21502148
Assert(this->tria != nullptr,
21512149
ExcMessage(
@@ -2256,7 +2254,7 @@ void DoFHandler<dim, spacedim>::distribute_dofs(
22562254
}
22572255

22582256
// hand the actual work over to the policy
2259-
this->number_cache = this->policy->distribute_dofs(virtual_dofs);
2257+
this->number_cache = this->policy->distribute_dofs();
22602258

22612259
// do some housekeeping: compress indices
22622260
// if(hp_capability_enabled)
@@ -2313,6 +2311,16 @@ void DoFHandler<dim, spacedim>::distribute_mg_dofs()
23132311

23142312

23152313

2314+
template <int dim, int spacedim>
2315+
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
2316+
void DoFHandler<dim, spacedim>::distribute_virtual_dofs(
2317+
const types::global_dof_index virtual_dofs)
2318+
{
2319+
this->number_cache = this->policy->distribute_virtual_dofs(virtual_dofs);
2320+
}
2321+
2322+
2323+
23162324
template <int dim, int spacedim>
23172325
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
23182326
void DoFHandler<dim, spacedim>::initialize_local_block_info()
@@ -2410,11 +2418,10 @@ void DoFHandler<dim, spacedim>::renumber_dofs(
24102418
// [0...n_dofs()) into itself but only globally, not on each processor
24112419
if (this->n_locally_owned_dofs() == this->n_dofs())
24122420
{
2413-
std::vector<types::global_dof_index> tmp(new_numbers);
2421+
auto tmp = new_numbers;
24142422
std::sort(tmp.begin(), tmp.end());
2415-
std::vector<types::global_dof_index>::const_iterator p = tmp.begin();
2416-
types::global_dof_index i = 0;
2417-
for (; p != tmp.end(); ++p, ++i)
2423+
types::global_dof_index i = 0;
2424+
for (auto p = tmp.begin(); p != tmp.end(); ++p, ++i)
24182425
Assert(*p == i, ExcNewNumbersNotConsecutive(i));
24192426
}
24202427
else

0 commit comments

Comments
 (0)