-
Notifications
You must be signed in to change notification settings - Fork 707
/
fe_point_evaluation.h
3826 lines (3357 loc) · 140 KB
/
fe_point_evaluation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ------------------------------------------------------------------------
//
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2020 - 2024 by the deal.II authors
//
// This file is part of the deal.II library.
//
// Part of the source code is dual licensed under Apache-2.0 WITH
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
// governing the source code and code contributions can be found in
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
//
// ------------------------------------------------------------------------
#ifndef dealii_fe_point_evaluation_h
#define dealii_fe_point_evaluation_h
#include <deal.II/base/config.h>
#include <deal.II/base/array_view.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/polynomial.h>
#include <deal.II/base/signaling_nan.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/vectorization.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/fe/mapping.h>
#include <deal.II/matrix_free/evaluation_flags.h>
#include <deal.II/matrix_free/evaluation_kernels_face.h>
#include <deal.II/matrix_free/mapping_info_storage.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/matrix_free/tensor_product_point_kernels.h>
#include <deal.II/non_matching/mapping_info.h>
DEAL_II_NAMESPACE_OPEN
namespace internal
{
namespace FEPointEvaluation
{
DeclException1(
ExcFEPointEvaluationAccessToUninitializedMappingField,
std::string,
<< "You are requesting information from an FEPointEvaluationBase "
<< "object for which this kind of information has not been computed. "
<< "What information these objects compute is determined by the update_* "
<< "flags you pass to MappingInfo() in the Constructor. Here, "
<< "the operation you are attempting requires the <" << arg1
<< "> flag to be set, but it was apparently not specified "
<< "upon initialization.");
/**
* Struct to distinguish between the value and gradient types of different
* numbers of components used by the FlexibleEvaluator class.
*/
template <int dim,
int spacedim,
int n_components,
typename Number,
typename Enable = void>
struct EvaluatorTypeTraits
{
using ScalarNumber =
typename internal::VectorizedArrayTrait<Number>::value_type;
using VectorizedArrayType =
typename dealii::internal::VectorizedArrayTrait<
Number>::vectorized_value_type;
using value_type = Tensor<1, n_components, Number>;
using scalar_value_type = Tensor<1, n_components, ScalarNumber>;
using vectorized_value_type =
Tensor<1, n_components, VectorizedArrayType>;
using unit_gradient_type =
Tensor<1, n_components, Tensor<1, dim, Number>>;
using real_gradient_type = std::conditional_t<
n_components == spacedim,
Tensor<2, spacedim, Number>,
Tensor<1, n_components, Tensor<1, spacedim, Number>>>;
using scalar_unit_gradient_type =
Tensor<1, n_components, Tensor<1, dim, ScalarNumber>>;
using vectorized_unit_gradient_type =
Tensor<1, n_components, Tensor<1, dim, VectorizedArrayType>>;
using interface_vectorized_unit_gradient_type =
Tensor<1, dim, Tensor<1, n_components, VectorizedArrayType>>;
static void
read_value(const ScalarNumber vector_entry,
const unsigned int component,
scalar_value_type &result)
{
AssertIndexRange(component, n_components);
result[component] = vector_entry;
}
static scalar_value_type
sum_value(const scalar_value_type &result)
{
return result;
}
static scalar_value_type
sum_value(const vectorized_value_type &result)
{
scalar_value_type result_scalar = {};
for (unsigned int c = 0; c < n_components; ++c)
result_scalar[c] = result[c].sum();
return result_scalar;
}
static ScalarNumber
sum_value(const unsigned int component,
const vectorized_value_type &result)
{
AssertIndexRange(component, n_components);
return result[component].sum();
}
static void
set_gradient(const interface_vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
unit_gradient_type &result)
{
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int d = 0; d < dim; ++d)
result[i][d] =
internal::VectorizedArrayTrait<Number>::get_from_vectorized(
value[d][i], vector_lane);
}
static void
get_gradient(interface_vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
const unit_gradient_type &result)
{
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int d = 0; d < dim; ++d)
internal::VectorizedArrayTrait<Number>::get_from_vectorized(
value[d][i], vector_lane) = result[i][d];
}
static void
get_gradient(interface_vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
const DerivativeForm<1, dim, n_components, Number> &result)
{
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int d = 0; d < dim; ++d)
internal::VectorizedArrayTrait<Number>::get_from_vectorized(
value[d][i], vector_lane) = result[i][d];
}
static void
set_zero_gradient(real_gradient_type &value,
const unsigned int vector_lane)
{
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int d = 0; d < spacedim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[i][d],
vector_lane) = 0.;
}
static void
set_value(const vectorized_value_type &value,
const unsigned int vector_lane,
scalar_value_type &result)
{
for (unsigned int i = 0; i < n_components; ++i)
result[i] = value[i][vector_lane];
}
static void
set_value(const vectorized_value_type &value,
const unsigned int,
vectorized_value_type &result)
{
result = value;
}
static void
get_value(vectorized_value_type &value,
const unsigned int vector_lane,
const scalar_value_type &result)
{
for (unsigned int i = 0; i < n_components; ++i)
value[i][vector_lane] = result[i];
}
static void
get_value(vectorized_value_type &value,
const unsigned int,
const vectorized_value_type &result)
{
value = result;
}
static void
set_zero_value(value_type &value, const unsigned int vector_lane)
{
for (unsigned int i = 0; i < n_components; ++i)
internal::VectorizedArrayTrait<Number>::get(value[i], vector_lane) =
0.;
}
static void
access(value_type &value,
const unsigned int vector_lane,
const unsigned int component,
const ScalarNumber &shape_value)
{
internal::VectorizedArrayTrait<Number>::get(value[component],
vector_lane) += shape_value;
}
static ScalarNumber
access(const value_type &value,
const unsigned int vector_lane,
const unsigned int component)
{
return internal::VectorizedArrayTrait<Number>::get(value[component],
vector_lane);
}
static void
access(real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int component,
const Tensor<1, spacedim, ScalarNumber> &shape_gradient)
{
for (unsigned int d = 0; d < spacedim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[component][d],
vector_lane) +=
shape_gradient[d];
}
static Tensor<1, spacedim, ScalarNumber>
access(const real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int component)
{
Tensor<1, spacedim, ScalarNumber> result;
for (unsigned int d = 0; d < spacedim; ++d)
result[d] =
internal::VectorizedArrayTrait<Number>::get(value[component][d],
vector_lane);
return result;
}
};
template <int dim, int spacedim, typename Number>
struct EvaluatorTypeTraits<dim, spacedim, 1, Number>
{
using ScalarNumber =
typename internal::VectorizedArrayTrait<Number>::value_type;
using VectorizedArrayType =
typename dealii::internal::VectorizedArrayTrait<
Number>::vectorized_value_type;
using value_type = Number;
using scalar_value_type = ScalarNumber;
using vectorized_value_type = VectorizedArrayType;
using unit_gradient_type = Tensor<1, dim, Number>;
using real_gradient_type = Tensor<1, spacedim, Number>;
using scalar_unit_gradient_type = Tensor<1, dim, ScalarNumber>;
using vectorized_unit_gradient_type = Tensor<1, dim, VectorizedArrayType>;
using interface_vectorized_unit_gradient_type =
vectorized_unit_gradient_type;
static void
read_value(const ScalarNumber vector_entry,
const unsigned int,
scalar_value_type &result)
{
result = vector_entry;
}
static scalar_value_type
sum_value(const scalar_value_type &result)
{
return result;
}
static scalar_value_type
sum_value(const vectorized_value_type &result)
{
return result.sum();
}
static ScalarNumber
sum_value(const unsigned int, const vectorized_value_type &result)
{
return result.sum();
}
static void
set_gradient(const vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
scalar_unit_gradient_type &result)
{
for (unsigned int d = 0; d < dim; ++d)
result[d] = value[d][vector_lane];
}
static void
set_gradient(const vectorized_unit_gradient_type &value,
const unsigned int,
vectorized_unit_gradient_type &result)
{
result = value;
}
static void
get_gradient(vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
const scalar_unit_gradient_type &result)
{
for (unsigned int d = 0; d < dim; ++d)
value[d][vector_lane] = result[d];
}
static void
get_gradient(vectorized_unit_gradient_type &value,
const unsigned int,
const vectorized_unit_gradient_type &result)
{
value = result;
}
static void
set_zero_gradient(real_gradient_type &value,
const unsigned int vector_lane)
{
for (unsigned int d = 0; d < spacedim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[d], vector_lane) =
0.;
}
static void
set_value(const vectorized_value_type &value,
const unsigned int vector_lane,
scalar_value_type &result)
{
result = value[vector_lane];
}
static void
set_value(const vectorized_value_type &value,
const unsigned int,
vectorized_value_type &result)
{
result = value;
}
static void
get_value(vectorized_value_type &value,
const unsigned int vector_lane,
const scalar_value_type &result)
{
value[vector_lane] = result;
}
static void
get_value(vectorized_value_type &value,
const unsigned int,
const vectorized_value_type &result)
{
value = result;
}
static void
set_zero_value(value_type &value, const unsigned int vector_lane)
{
internal::VectorizedArrayTrait<Number>::get(value, vector_lane) = 0.;
}
static void
access(value_type &value,
const unsigned int vector_lane,
const unsigned int,
const ScalarNumber &shape_value)
{
internal::VectorizedArrayTrait<Number>::get(value, vector_lane) +=
shape_value;
}
static ScalarNumber
access(const value_type &value,
const unsigned int vector_lane,
const unsigned int)
{
return internal::VectorizedArrayTrait<Number>::get(value, vector_lane);
}
static void
access(real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int,
const Tensor<1, spacedim, ScalarNumber> &shape_gradient)
{
for (unsigned int d = 0; d < spacedim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[d], vector_lane) +=
shape_gradient[d];
}
static Tensor<1, spacedim, ScalarNumber>
access(const real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int)
{
Tensor<1, spacedim, ScalarNumber> result;
for (unsigned int d = 0; d < spacedim; ++d)
result[d] =
internal::VectorizedArrayTrait<Number>::get(value[d], vector_lane);
return result;
}
};
template <int dim, typename Number>
struct EvaluatorTypeTraits<dim,
dim,
dim,
Number,
std::enable_if_t<dim != 1>>
{
using ScalarNumber =
typename internal::VectorizedArrayTrait<Number>::value_type;
using VectorizedArrayType =
typename dealii::internal::VectorizedArrayTrait<
Number>::vectorized_value_type;
using value_type = Tensor<1, dim, Number>;
using scalar_value_type = Tensor<1, dim, ScalarNumber>;
using vectorized_value_type = Tensor<1, dim, VectorizedArrayType>;
using unit_gradient_type = Tensor<2, dim, Number>;
using real_gradient_type = unit_gradient_type;
using scalar_unit_gradient_type = Tensor<2, dim, ScalarNumber>;
using vectorized_unit_gradient_type = Tensor<2, dim, VectorizedArrayType>;
using interface_vectorized_unit_gradient_type =
Tensor<1, dim, Tensor<1, dim, VectorizedArrayType>>;
static void
read_value(const ScalarNumber vector_entry,
const unsigned int component,
scalar_value_type &result)
{
AssertIndexRange(component, dim);
result[component] = vector_entry;
}
static scalar_value_type
sum_value(const scalar_value_type &result)
{
return result;
}
static scalar_value_type
sum_value(const vectorized_value_type &result)
{
scalar_value_type result_scalar = {};
for (unsigned int c = 0; c < dim; ++c)
result_scalar[c] = result[c].sum();
return result_scalar;
}
static ScalarNumber
sum_value(const unsigned int component,
const vectorized_value_type &result)
{
AssertIndexRange(component, dim);
return result[component].sum();
}
static void
set_gradient(const interface_vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
unit_gradient_type &result)
{
for (unsigned int i = 0; i < dim; ++i)
for (unsigned int d = 0; d < dim; ++d)
result[i][d] =
internal::VectorizedArrayTrait<Number>::get_from_vectorized(
value[d][i], vector_lane);
}
static void
get_gradient(interface_vectorized_unit_gradient_type &value,
const unsigned int vector_lane,
const unit_gradient_type &result)
{
for (unsigned int i = 0; i < dim; ++i)
for (unsigned int d = 0; d < dim; ++d)
internal::VectorizedArrayTrait<Number>::get_from_vectorized(
value[d][i], vector_lane) = result[i][d];
}
static void
set_zero_gradient(unit_gradient_type &value,
const unsigned int vector_lane)
{
for (unsigned int i = 0; i < dim; ++i)
for (unsigned int d = 0; d < dim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[i][d],
vector_lane) = 0.;
}
static void
set_value(const vectorized_value_type &value,
const unsigned int vector_lane,
scalar_value_type &result)
{
for (unsigned int i = 0; i < dim; ++i)
result[i] = value[i][vector_lane];
}
static void
set_value(const vectorized_value_type &value,
const unsigned int,
vectorized_value_type &result)
{
result = value;
}
static void
get_value(vectorized_value_type &value,
const unsigned int vector_lane,
const scalar_value_type &result)
{
for (unsigned int i = 0; i < dim; ++i)
value[i][vector_lane] = result[i];
}
static void
get_value(vectorized_value_type &value,
const unsigned int,
const vectorized_value_type &result)
{
value = result;
}
static void
set_zero_value(value_type &value, const unsigned int vector_lane)
{
for (unsigned int i = 0; i < dim; ++i)
internal::VectorizedArrayTrait<Number>::get(value[i], vector_lane) =
0.;
}
static void
access(value_type &value,
const unsigned int vector_lane,
const unsigned int component,
const ScalarNumber &shape_value)
{
internal::VectorizedArrayTrait<Number>::get(value[component],
vector_lane) += shape_value;
}
static ScalarNumber
access(const value_type &value,
const unsigned int vector_lane,
const unsigned int component)
{
return internal::VectorizedArrayTrait<Number>::get(value[component],
vector_lane);
}
static void
access(real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int component,
const Tensor<1, dim, ScalarNumber> &shape_gradient)
{
for (unsigned int d = 0; d < dim; ++d)
internal::VectorizedArrayTrait<Number>::get(value[component][d],
vector_lane) +=
shape_gradient[d];
}
static Tensor<1, dim, ScalarNumber>
access(const real_gradient_type &value,
const unsigned int vector_lane,
const unsigned int component)
{
Tensor<1, dim, ScalarNumber> result;
for (unsigned int d = 0; d < dim; ++d)
result[d] =
internal::VectorizedArrayTrait<Number>::get(value[component][d],
vector_lane);
return result;
}
};
template <int dim, int spacedim>
bool
is_fast_path_supported(const FiniteElement<dim, spacedim> &fe,
const unsigned int base_element_number);
template <int dim, int spacedim>
bool
is_fast_path_supported(const Mapping<dim, spacedim> &mapping);
template <int dim, int spacedim>
std::vector<Polynomials::Polynomial<double>>
get_polynomial_space(const FiniteElement<dim, spacedim> &fe);
} // namespace FEPointEvaluation
} // namespace internal
/**
* Base class of FEPointEvaluation and FEFacePointEvaluation. This class needs
* usually not be called in user code and does not have any public
* constructor. The usage is through the class
* FEPointEvaluation/FEFacePointEvaluation instead.
*/
template <int n_components_,
int dim,
int spacedim = dim,
typename Number = double>
class FEPointEvaluationBase
{
public:
static constexpr unsigned int dimension = dim;
static constexpr unsigned int n_components = n_components_;
using number_type = Number;
using ScalarNumber =
typename internal::VectorizedArrayTrait<Number>::value_type;
using VectorizedArrayType = typename dealii::internal::VectorizedArrayTrait<
Number>::vectorized_value_type;
using ETT = typename internal::FEPointEvaluation::
EvaluatorTypeTraits<dim, spacedim, n_components, Number>;
using value_type = typename ETT::value_type;
using scalar_value_type = typename ETT::scalar_value_type;
using vectorized_value_type = typename ETT::vectorized_value_type;
using gradient_type = typename ETT::real_gradient_type;
using interface_vectorized_unit_gradient_type =
typename ETT::interface_vectorized_unit_gradient_type;
protected:
/**
* Constructor.
*
* @param mapping The Mapping class describing the actual geometry of a cell
* passed to the evaluate() function.
*
* @param fe The FiniteElement object that is used for the evaluation, which
* is typically the same on all cells to be evaluated.
*
* @param update_flags Specify the quantities to be computed by the mapping
* during the call of reinit(). During evaluate() or integrate(), this data
* is queried to produce the desired result (e.g., the gradient of a finite
* element solution).
*
* @param first_selected_component For multi-component FiniteElement
* objects, this parameter allows to select a range of `n_components`
* components starting from this parameter.
*/
FEPointEvaluationBase(const Mapping<dim, spacedim> &mapping,
const FiniteElement<dim, spacedim> &fe,
const UpdateFlags update_flags,
const unsigned int first_selected_component = 0);
/**
* Constructor to make the present class able to re-use the geometry
* data also used by other `FEPointEvaluationBase` objects.
*
* @param mapping_info The MappingInfo class describes the geometry-related
* data for evaluating finite-element solutions. This object enables to
* construct such an object on the outside, possibly re-using it between
* several objects or between several calls to the same cell and unit points.
*
* @param fe The FiniteElement object that is used for the evaluation, which
* is typically the same on all cells to be evaluated.
*
* @param first_selected_component For multi-component FiniteElement
* objects, this parameter allows to select a range of `n_components`
* components starting from this parameter.
*
* @param is_interior Defines if interior or exterior. Only makes sense for
* faces.
*/
FEPointEvaluationBase(
NonMatching::MappingInfo<dim, spacedim, Number> &mapping_info,
const FiniteElement<dim, spacedim> &fe,
const unsigned int first_selected_component = 0,
const bool is_interior = true);
/**
* Copy constructor.
*/
FEPointEvaluationBase(FEPointEvaluationBase &other) noexcept;
/**
* Move constructor.
*/
FEPointEvaluationBase(FEPointEvaluationBase &&other) noexcept;
/**
* Destructor.
*/
~FEPointEvaluationBase();
public:
/**
* Return the value at quadrature point number @p point_index after a call to
* FEPointEvaluation::evaluate() with EvaluationFlags::values set, or
* the value that has been stored there with a call to
* FEPointEvaluationBase::submit_value(). If the object is vector-valued, a
* vector-valued return argument is given.
*/
const value_type &
get_value(const unsigned int point_index) const;
/**
* Write a value to the field containing the values on points
* with component point_index. Access to the same field as through
* get_value(). If applied before the function
* FEPointEvaluation::integrate() with EvaluationFlags::values set is
* called, this specifies the value which is tested by all basis function on
* the current cell and integrated over.
*/
void
submit_value(const value_type &value, const unsigned int point_index);
/**
* Return the gradient in real coordinates at the point with index
* `point_index` after a call to FEPointEvaluation::evaluate() with
* EvaluationFlags::gradients set, or the gradient that has been stored there
* with a call to FEPointEvaluationBase::submit_gradient(). The gradient in
* real coordinates is obtained by taking the unit gradient (also accessible
* via get_unit_gradient()) and applying the inverse Jacobian of the mapping.
* If the object is vector-valued, a vector-valued return argument is given.
*/
const gradient_type &
get_gradient(const unsigned int point_index) const;
/**
* Write a contribution that is tested by the gradient to the field
* containing the values on points with the given `point_index`. Access to
* the same field as through get_gradient(). If applied before the function
* FEPointEvaluation::integrate(EvaluationFlags::gradients) is called,
* this specifies what is tested by all basis function gradients on the
* current cell and integrated over.
*/
void
submit_gradient(const gradient_type &, const unsigned int point_index);
/**
* Return the Jacobian of the transformation on the current cell with the
* given point index. Prerequisite: This class needs to be constructed with
* UpdateFlags containing `update_jacobian`.
*/
DerivativeForm<1, dim, spacedim, Number>
jacobian(const unsigned int point_index) const;
/**
* Return the inverse of the Jacobian of the transformation on the current
* cell with the given point index. Prerequisite: This class needs to be
* constructed with UpdateFlags containing `update_inverse_jacobian` or
* `update_gradients`.
*/
DerivativeForm<1, spacedim, dim, Number>
inverse_jacobian(const unsigned int point_index) const;
/**
* Return the Jacobian determinant multiplied by the quadrature weight. This
* class or the MappingInfo object passed to this function needs to be
* constructed with UpdateFlags containing `update_JxW_values`.
*/
Number
JxW(const unsigned int point_index) const;
/**
* Return the position in real coordinates of the given point index among
* the points passed to reinit().
*
* @deprecated Use the function quadrature_point() instead.
*/
DEAL_II_DEPRECATED_EARLY Point<spacedim, Number>
real_point(const unsigned int point_index) const;
/**
* Return the position in real coordinates of the given point index among
* the points passed to reinit().
*/
Point<spacedim, Number>
quadrature_point(const unsigned int point_index) const;
/**
* Return the position in unit/reference coordinates of the given point
* index, i.e., the respective point passed to the reinit() function.
*/
Point<dim, Number>
unit_point(const unsigned int point_index) const;
/**
 * Take values collected at quadrature points via the submit_value()
* function, multiply by the Jacobian determinant
* and quadrature weights (JxW) and sum the values for all quadrature
 * points on the cell. The result is a scalar, representing the integral
 * of the function over the cell.
 */
scalar_value_type
integrate_value() const;
/**
* Return an object that can be thought of as an array containing all indices
* from zero to n_quadrature_points. This allows to write code using
* range-based for loops.
*/
inline std_cxx20::ranges::iota_view<unsigned int, unsigned int>
quadrature_point_indices() const;
/**
* Returns how many lanes of a quadrature batch are active.
*/
unsigned int
n_active_entries_per_quadrature_batch(unsigned int q);
protected:
static constexpr std::size_t n_lanes_user_interface =
internal::VectorizedArrayTrait<Number>::width();
static constexpr std::size_t n_lanes_internal =
internal::VectorizedArrayTrait<VectorizedArrayType>::width();
static constexpr std::size_t stride =
internal::VectorizedArrayTrait<Number>::stride();
/**
* Common setup function for both constructors. Does the setup for both fast
* and slow path.
*
* @param first_selected_component For multi-component FiniteElement
* objects, this parameter allows to select a range of `n_components`
* components starting from this parameter.
*/
void
setup(const unsigned int first_selected_component);
/**
* Shared functionality of all @p reinit() functions. Resizes data fields and
* precomputes the @p shapes vector, holding the evaluation of 1D basis
* functions of tensor product polynomials, if necessary.
*/
template <bool is_face, bool is_linear>
void
do_reinit();
/**
* Number of quadrature batches of the current cell/face.
*/
const unsigned int n_q_batches;
/**
* Number of quadrature points/batches of the current cell/face.
*/
const unsigned int n_q_points;
/**
* Number of quadrature points of the current cell/face.
*/
const unsigned int n_q_points_scalar;
/**
* Pointer to the Mapping object passed to the constructor.
*/
SmartPointer<const Mapping<dim, spacedim>> mapping;
/**
* Pointer to the FiniteElement object passed to the constructor.
*/
SmartPointer<const FiniteElement<dim, spacedim>> fe;
/**
* Description of the 1d polynomial basis for tensor product elements used
* for the fast path of this class using tensor product evaluators.
*/
std::vector<Polynomials::Polynomial<double>> poly;
/**
* Store whether the linear path should be used.
*/
bool use_linear_path;
/**
* Renumbering between the unknowns of unknowns implied by the FiniteElement
* class and a lexicographic numbering used for the tensorized code path.
*/
std::vector<unsigned int> renumber;
/**
* Temporary array to store the `solution_values` passed to the evaluate()
* function in a format compatible with the tensor product evaluators. For
* vector-valued setups, this array uses a `Tensor<1, n_components,
* ScalarNumber>` type to collect the unknowns for a particular basis
* function.
*/
std::vector<scalar_value_type> solution_renumbered;
/**
* Temporary array to store a vectorized version of the `solution_values`
* computed during `integrate()` in a format compatible with the tensor
* product evaluators. For vector-valued setups, this array uses a
* `Tensor<1, n_components, VectorizedArrayType>` format.
*/
AlignedVector<vectorized_value_type> solution_renumbered_vectorized;
/**
* Temporary array for the face path (scalar).
*/
AlignedVector<ScalarNumber> scratch_data_scalar;
/**
* Temporary array to store the values at the points.
*/
std::vector<value_type> values;
/**
* Temporary array to store the gradients in real coordinates at the points.
*/
std::vector<gradient_type> gradients;
/**
* Pointer to first unit point batch of current cell/face from MappingInfo,
* set internally during do_reinit().
*/
const Point<dim, VectorizedArrayType> *unit_point_ptr;
/**
* Pointer to first unit point batch of current face from MappingInfo,
* set internally during do_reinit(). Needed for face path.
*/
const Point<dim - 1, VectorizedArrayType> *unit_point_faces_ptr;
/**
* Pointer to real point of first quadrature point of current cell/face from
* MappingInfo, set internally during do_reinit().
*/
const Point<spacedim, Number> *real_point_ptr;
/**
* Pointer to Jacobian of first quadrature point of current cell/face from
* MappingInfo, set internally during do_reinit().
*/
const DerivativeForm<1, dim, spacedim, Number> *jacobian_ptr;
/**
* Pointer to inverse Jacobian of first quadrature point of current cell/face
* from MappingInfo, set internally during do_reinit().
*/
const DerivativeForm<1, spacedim, dim, Number> *inverse_jacobian_ptr;
/**
* Pointer to normal vector of first quadrature point of current cell/face
* from MappingInfo, set internally during do_reinit().
*/
const Tensor<1, spacedim, Number> *normal_ptr;
/**
* Pointer to Jacobian determinant times quadrature weight of first quadrature
* point of current cell/face from MappingInfo, set internally during
* do_reinit().
*/
const Number *JxW_ptr;
/**
* Cell type describing the geometry of the cell and compression of jacobians.
*/
internal::MatrixFreeFunctions::GeometryType cell_type;
/**
* Number of unknowns per component, i.e., number of unique basis functions,
* for the chosen FiniteElement (or base element).
*/
unsigned int dofs_per_component;
/**
* Number of unknowns per component, i.e., number of unique basis functions,
* for a restriction to the face of the chosen FiniteElement (or base
* element). This means a (dim-1)-dimensional basis.
*/
unsigned int dofs_per_component_face;
/**
* Scalar ShapeInfo object needed for face path.
*/
internal::MatrixFreeFunctions::ShapeInfo<ScalarNumber> shape_info;
/**
* The first selected component in the active base element.
*/
unsigned int component_in_base_element;
/**
* For complicated FiniteElement objects this variable informs us about
* which unknowns actually carry degrees of freedom in the selected