FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
domain_assembler_basic_jobs.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8#include <kernel/assembly/domain_assembler.hpp>
9#include <kernel/assembly/function_integral_info.hpp>
10#include <kernel/analytic/function.hpp>
11#include <kernel/lafem/dense_vector.hpp>
12#include <kernel/lafem/dense_vector_blocked.hpp>
13
14namespace FEAT
15{
16 namespace Assembly
17 {
43 template<typename Derived_, typename Vector_, typename Space_,
44 TrafoTags trafo_config_, SpaceTags space_config_>
46 {
47 public:
49 typedef typename Vector_::DataType DataType;
51 typedef typename Vector_::ValueType ValueType;
52
54 static constexpr bool need_scatter = true;
56 static constexpr bool need_combine = false;
57
58 protected:
62 Space_,
63 trafo_config_ | TrafoTags::jac_det,
64 space_config_
66
68 Vector_& vector;
70 const Space_& space;
72 const typename AsmTraits::TrafoType& trafo;
86 typename AsmTraits::template TLocalVector<ValueType> local_vector;
88 typename Vector_::ScatterAxpy scatter_axpy;
91
92 public:
108 explicit DomainAssemblyBasicVectorTaskCRTP(Vector_& vector_, const Space_& space_,
109 const Cubature::DynamicFactory& cubature_factory, DataType alpha_) :
110 vector(vector_),
111 space(space_),
112 trafo(space.get_trafo()),
116 cubature_rule(Cubature::ctor_factory, cubature_factory),
118 scatter_alpha(alpha_)
119 {
120 }
121
122#ifdef DOXYGEN
133
146 void eval(ValueType& val, const DataType& weight, const typename AsmTraits::SpaceBasisData& psi);
147#endif // DOXYGEN
148
155 void prepare(Index cell)
156 {
157 // prepare dof mapping
158 dof_mapping.prepare(cell);
159
160 // prepare trafo evaluator
161 trafo_eval.prepare(cell);
162
163 // prepare space evaluator
164 space_eval.prepare(trafo_eval);
165 }
166
170 void assemble()
171 {
172 // format local vector
173 local_vector.format();
174
175 // fetch number of local dofs
176 const int num_loc_dofs = space_eval.get_num_local_dofs();
177
178 // loop over all quadrature points and integrate
179 for(int k(0); k < cubature_rule.get_num_points(); ++k)
180 {
181 // compute trafo data
182 trafo_eval(trafo_data, cubature_rule.get_point(k));
183
184 // compute basis function data
186
187 // evaluate operator
188 static_cast<Derived_&>(*this).set_point(trafo_data);
189
190 // test function loop
191 for(int i(0); i < num_loc_dofs; ++i)
192 {
193 // evaluate functional and integrate
194 static_cast<Derived_&>(*this).eval(local_vector(i),
195 trafo_data.jac_det * cubature_rule.get_weight(k),
196 space_data.phi[i]);
197 // continue with next test function
198 }
199 // continue with next cubature point
200 }
201 }
202
206 void scatter()
207 {
209 }
210
214 void finish()
215 {
216 // finish evaluators
217 space_eval.finish();
218 trafo_eval.finish();
219
220 // finish dof mapping
221 dof_mapping.finish();
222 }
223
227 void combine()
228 {
229 // nothing to do here
230 }
231 }; // class DomainAssemblyBasicVectorTaskCRTP<...>
232
258 template<typename Derived_, typename Matrix_, typename Space_,
259 TrafoTags trafo_config_, SpaceTags space_config_>
261 {
262 public:
264 typedef typename Matrix_::DataType DataType;
266 typedef typename Matrix_::ValueType ValueType;
267
269 static constexpr bool need_scatter = true;
271 static constexpr bool need_combine = false;
272
273 protected:
275 typedef Assembly::AsmTraits1<
276 DataType,
277 Space_,
278 trafo_config_ | TrafoTags::jac_det,
279 space_config_
281
283 Matrix_& matrix;
285 const Space_& space;
301 typename AsmTraits::template TLocalMatrix<ValueType> local_matrix;
303 typename Matrix_::ScatterAxpy scatter_axpy;
306
307 public:
323 explicit DomainAssemblyBasicMatrixTaskCRTP1(Matrix_& matrix_, const Space_& space_,
324 const Cubature::DynamicFactory& cubature_factory, DataType alpha_) :
325 matrix(matrix_),
326 space(space_),
327 trafo(space.get_trafo()),
331 cubature_rule(Cubature::ctor_factory, cubature_factory),
333 scatter_alpha(alpha_)
334 {
335 }
336
337#ifdef DOXYGEN
348
364 void eval(ValueType& val, const DataType& weight,
365 const typename AsmTraits::TrialBasisData& phi, const typename AsmTraits::TestBasisData& psi);
366#endif // DOXYGEN
367
374 void prepare(Index cell)
375 {
376 // prepare dof mapping
377 dof_mapping.prepare(cell);
378
379 // prepare trafo evaluator
380 trafo_eval.prepare(cell);
381
382 // prepare space evaluator
383 space_eval.prepare(trafo_eval);
384 }
385
389 void assemble()
390 {
391 // format local matrix
392 local_matrix.format();
393
394 // fetch number of local dofs
395 const int num_loc_dofs = space_eval.get_num_local_dofs();
396
397 // loop over all quadrature points and integrate
398 for(int k(0); k < cubature_rule.get_num_points(); ++k)
399 {
400 // compute trafo data
401 trafo_eval(trafo_data, cubature_rule.get_point(k));
402
403 // compute basis function data
405
406 // evaluate operator
407 static_cast<Derived_&>(*this).set_point(trafo_data);
408
409 // test function loop
410 for(int i(0); i < num_loc_dofs; ++i)
411 {
412 // trial function loop
413 for(int j(0); j < num_loc_dofs; ++j)
414 {
415 // evaluate operator and integrate
416 static_cast<Derived_&>(*this).eval(local_matrix(i,j),
417 trafo_data.jac_det * cubature_rule.get_weight(k),
418 space_data.phi[j], space_data.phi[i]);
419 // continue with next trial function
420 }
421 // continue with next test function
422 }
423 // continue with next cubature point
424 }
425 }
426
430 void scatter()
431 {
432 // incorporate local matrix
434 }
435
439 void finish()
440 {
441 // finish evaluators
442 space_eval.finish();
443 trafo_eval.finish();
444
445 // finish dof mapping
446 dof_mapping.finish();
447 }
448
452 void combine()
453 {
454 // nothing to do here
455 }
456 }; // class DomainAssemblyBasicMatrixTaskCRTP1<...>
457
489 template<
490 typename Derived_,
491 typename Matrix_,
492 typename TestSpace_,
493 typename TrialSpace_,
494 TrafoTags trafo_config_,
495 SpaceTags test_config_,
496 SpaceTags trial_config_>
498 {
499 public:
501 typedef typename Matrix_::DataType DataType;
503 typedef typename Matrix_::ValueType ValueType;
504
506 static constexpr bool need_scatter = true;
508 static constexpr bool need_combine = false;
509
510 protected:
512 typedef Assembly::AsmTraits2<
513 DataType,
514 TestSpace_,
515 TrialSpace_,
516 trafo_config_ | TrafoTags::jac_det,
517 test_config_,
518 trial_config_
520
522 Matrix_& matrix;
524 const TestSpace_& test_space;
526 const TrialSpace_& trial_space;
533 typename AsmTraits::TrialEvaluator trial_eval;
536 typename AsmTraits::TrialDofMapping trial_dof_mapping;
543 typename AsmTraits::TrialEvalData trial_data;
545 typename AsmTraits::template TLocalMatrix<ValueType> local_matrix;
547 typename Matrix_::ScatterAxpy scatter_axpy;
550
551 public:
570 explicit DomainAssemblyBasicMatrixTaskCRTP2(Matrix_& matrix_,
571 const TestSpace_& test_space_, const TrialSpace_& trial_space_,
572 const Cubature::DynamicFactory& cubature_factory, DataType alpha_) :
573 matrix(matrix_),
574 test_space(test_space_),
575 trial_space(trial_space_),
576 trafo(test_space.get_trafo()),
579 trial_eval(trial_space),
581 trial_dof_mapping(trial_space),
582 cubature_rule(Cubature::ctor_factory, cubature_factory),
584 scatter_alpha(alpha_)
585 {
586 }
587
588#ifdef DOXYGEN
599
615 void eval(ValueType& val, const DataType& weight,
616 const typename AsmTraits::TrialBasisData& phi, const typename AsmTraits::TestBasisData& psi);
617#endif // DOXYGEN
618
625 void prepare(Index cell)
626 {
627 // prepare dof mapping
628 test_dof_mapping.prepare(cell);
629 trial_dof_mapping.prepare(cell);
630
631 // prepare trafo evaluator
632 trafo_eval.prepare(cell);
633
634 // prepare space evaluators
635 test_eval.prepare(trafo_eval);
636 trial_eval.prepare(trafo_eval);
637 }
638
642 void assemble()
643 {
644 // format local matrix
645 local_matrix.format();
646
647 // fetch number of local dofs
648 const int num_loc_test_dofs = test_eval.get_num_local_dofs();
649 const int num_loc_trial_dofs = trial_eval.get_num_local_dofs();
650
651 // loop over all quadrature points and integrate
652 for(int k(0); k < cubature_rule.get_num_points(); ++k)
653 {
654 // compute trafo data
655 trafo_eval(trafo_data, cubature_rule.get_point(k));
656
657 // compute basis function data
659 trial_eval(trial_data, trafo_data);
660
661 // evaluate operator
662 static_cast<Derived_&>(*this).set_point(trafo_data);
663
664 // test function loop
665 for(int i(0); i < num_loc_test_dofs; ++i)
666 {
667 // trial function loop
668 for(int j(0); j < num_loc_trial_dofs; ++j)
669 {
670 // evaluate operator and integrate
671 static_cast<Derived_&>(*this).eval(local_matrix(i,j),
672 trafo_data.jac_det * cubature_rule.get_weight(k),
673 trial_data.phi[j], test_data.phi[i]);
674 // continue with next trial function
675 }
676 // continue with next test function
677 }
678 // continue with next cubature point
679 }
680 }
681
685 void scatter()
686 {
687 // incorporate local matrix
689 }
690
694 void finish()
695 {
696 // finish evaluators
697 trial_eval.finish();
698 test_eval.finish();
699 trafo_eval.finish();
700
701 // finish dof mapping
702 trial_dof_mapping.finish();
703 test_dof_mapping.finish();
704 }
705
709 void combine()
710 {
711 // nothing to do here
712 }
713 }; // class DomainAssemblyBasicMatrixTaskCRTP2<...>
714
732 template<typename LinearFunctional_, typename Vector_, typename Space_>
734 {
735 public:
736 typedef typename Vector_::DataType DataType;
737 typedef typename Vector_::ValueType ValueType;
738
739 static constexpr TrafoTags trafo_config = LinearFunctional_::trafo_config;
740 static constexpr SpaceTags test_config = LinearFunctional_::test_config;
741
742 class Task :
743 public DomainAssemblyBasicVectorTaskCRTP<Task, Vector_, Space_, trafo_config, test_config>
744 {
745 protected:
748
751
753 typename LinearFunctional_::template Evaluator<AsmTraits> func_eval;
754
755 public:
757 BaseClass(job.vector, job.space, job.cubature_factory, job.alpha),
759 {
760 }
761
762 void prepare(Index cell)
763 {
764 BaseClass::prepare(cell);
765 func_eval.prepare(this->trafo_eval);
766 }
767
768 void set_point(typename AsmTraits::TrafoEvalData& tau)
769 {
770 func_eval.set_point(tau);
771 }
772
773 void eval(ValueType& val, const DataType& weight, typename AsmTraits::TestBasisData& psi)
774 {
775 Tiny::axpy(val, func_eval.eval(psi), weight);
776 }
777
778 void finish()
779 {
780 func_eval.finish();
782 }
783 }; // class Task
784
785 protected:
787 const LinearFunctional_& linear_functional;
789 Vector_& vector;
791 const Space_& space;
795 DataType alpha;
796
797 public:
816 explicit DomainAssemblyLinearFunctionalVectorJob(const LinearFunctional_& linear_functional_,
817 Vector_& vector_, const Space_& space_, const String& cubature_, DataType alpha_ = DataType(1)) :
818 linear_functional(linear_functional_),
819 vector(vector_),
820 space(space_),
821 cubature_factory(cubature_),
822 alpha(alpha_)
823 {
824 }
825 }; // class DomainAssemblyLinearFunctionalVectorJob<...>
826
848 template<typename Trafo_, typename Vector_, typename LinFunc_, typename Space_>
850 Vector_& vector, const LinFunc_& linear_functional, const Space_& space,
851 const String& cubature, const typename Vector_::DataType alpha = typename Vector_::DataType(1))
852 {
853 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
854 XASSERTM(vector.size() == space.get_num_dofs(), "invalid vector length");
855
857 linear_functional, vector, space, cubature, alpha);
858 dom_asm.assemble(job);
859 }
860
881 template<typename Function_, typename Vector_, typename Space_>
883 {
884 public:
885 typedef typename Vector_::DataType DataType;
886 typedef typename Vector_::ValueType ValueType;
887
888 static constexpr TrafoTags trafo_config = TrafoTags::img_point | TrafoTags::jac_det;
889 static constexpr SpaceTags test_config = SpaceTags::value;
890
891 class Task :
892 public DomainAssemblyBasicVectorTaskCRTP<Task, Vector_, Space_, trafo_config, test_config>
893 {
894 protected:
897
900
904 typename Function_::template Evaluator<AnalyticEvalTraits> func_eval;
906 typename AnalyticEvalTraits::ValueType func_value;
907
908 public:
910 BaseClass(job.vector, job.space, job.cubature_factory, job.alpha),
912 {
913 }
914
915 void set_point(typename AsmTraits::TrafoEvalData& tau)
916 {
917 func_value = func_eval.value(tau.img_point);
918 }
919
920 void eval(ValueType& val, const DataType& weight, typename AsmTraits::TestBasisData& psi)
921 {
922 Tiny::axpy(val, func_value, weight * psi.value);
923 }
924 }; // class Task
925
926 protected:
928 const Function_& function;
930 Vector_& vector;
932 const Space_& space;
936 DataType alpha;
937
938 public:
957 explicit DomainAssemblyForceFunctionalVectorJob(const Function_& function_,
958 Vector_& vector_, const Space_& space_, const String& cubature_, DataType alpha_ = DataType(1)) :
959 function(function_),
960 vector(vector_),
961 space(space_),
962 cubature_factory(cubature_),
963 alpha(alpha_)
964 {
965 }
966 }; // class DomainAssemblyForceFunctionalVectorJob<...>
967
989 template<typename Trafo_, typename Vector_, typename Function_, typename Space_>
991 Vector_& vector, const Function_& function, const Space_& space,
992 const String& cubature, const typename Vector_::DataType alpha = typename Vector_::DataType(1))
993 {
994 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
995 XASSERTM(vector.size() == space.get_num_dofs(), "invalid vector length");
996
998 function, vector, space, cubature, alpha);
999 dom_asm.assemble(job);
1000 }
1001
1019 template<typename BilinearOperator_, typename Matrix_, typename Space_>
1021 {
1022 public:
1023 typedef typename Matrix_::DataType DataType;
1024 typedef typename Matrix_::ValueType ValueType;
1025
1026 static constexpr TrafoTags trafo_config = BilinearOperator_::trafo_config;
1027 static constexpr SpaceTags space_config = BilinearOperator_::test_config | BilinearOperator_::trial_config;
1028
1029 class Task :
1030 public DomainAssemblyBasicMatrixTaskCRTP1<Task, Matrix_, Space_, trafo_config, space_config>
1031 {
1032 protected:
1035
1038
1040 typename BilinearOperator_::template Evaluator<AsmTraits> oper_eval;
1041
1042 public:
1044 BaseClass(job.matrix, job.space, job.cubature_factory, job.alpha),
1046 {
1047 }
1048
1049 void prepare(Index cell)
1050 {
1051 BaseClass::prepare(cell);
1052 oper_eval.prepare(this->trafo_eval);
1053 }
1054
1055 void set_point(typename AsmTraits::TrafoEvalData& tau)
1056 {
1057 oper_eval.set_point(tau);
1058 }
1059
1060 void eval(ValueType& val, const DataType& weight,
1061 typename AsmTraits::TrialBasisData& phi, typename AsmTraits::TestBasisData& psi)
1062 {
1063 val += weight * oper_eval.eval(phi, psi);
1064 }
1065
1066 void finish()
1067 {
1068 oper_eval.finish();
1070 }
1071 }; // class Task
1072
1073 protected:
1075 const BilinearOperator_& bilinear_operator;
1077 Matrix_& matrix;
1079 const Space_& space;
1083 DataType alpha;
1084
1085 public:
1104 explicit DomainAssemblyBilinearOperatorMatrixJob1(const BilinearOperator_& bilinear_operator_,
1105 Matrix_& matrix_, const Space_& space_, const String& cubature_, DataType alpha_ = DataType(1)) :
1106 bilinear_operator(bilinear_operator_),
1107 matrix(matrix_),
1108 space(space_),
1109 cubature_factory(cubature_),
1110 alpha(alpha_)
1111 {
1112 }
1113 }; // class DomainAssemblyBilinearOperatorMatrixJob1<...>
1114
1136 template<typename Trafo_, typename Matrix_, typename BilOp_, typename Space_>
1138 const BilOp_& bilinear_operator, const Space_& space, const String& cubature,
1139 const typename Matrix_::DataType alpha = typename Matrix_::DataType(1))
1140 {
1141 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
1142 XASSERTM(matrix.columns() == space.get_num_dofs(), "invalid matrix column count");
1143 XASSERTM(matrix.rows() == space.get_num_dofs(), "invalid matrix row count");
1144
1146 bilinear_operator, matrix, space, cubature, alpha);
1147 dom_asm.assemble(job);
1148 }
1149
1170 template<typename BilinearOperator_, typename Matrix_, typename TestSpace_, typename TrialSpace_>
1172 {
1173 public:
1174 typedef typename Matrix_::DataType DataType;
1175 typedef typename Matrix_::ValueType ValueType;
1176
1177 static constexpr TrafoTags trafo_config = BilinearOperator_::trafo_config;
1178 static constexpr SpaceTags test_config = BilinearOperator_::test_config;
1179 static constexpr SpaceTags trial_config = BilinearOperator_::trial_config;
1180
1181 class Task :
1182 public DomainAssemblyBasicMatrixTaskCRTP2<Task, Matrix_, TestSpace_, TrialSpace_, trafo_config, test_config, trial_config>
1183 {
1184 protected:
1187
1190
1192 typename BilinearOperator_::template Evaluator<AsmTraits> oper_eval;
1193
1194 public:
1198 {
1199 }
1200
1201 void prepare(Index cell)
1202 {
1203 BaseClass::prepare(cell);
1204 oper_eval.prepare(this->trafo_eval);
1205 }
1206
1207 void set_point(typename AsmTraits::TrafoEvalData& tau)
1208 {
1209 oper_eval.set_point(tau);
1210 }
1211
1212 void eval(ValueType& val, const DataType& weight,
1213 typename AsmTraits::TrialBasisData& phi, typename AsmTraits::TestBasisData& psi)
1214 {
1215 Tiny::axpy(val, oper_eval.eval(phi, psi), weight);
1216 }
1217
1218 void finish()
1219 {
1220 oper_eval.finish();
1222 }
1223 }; // class Task
1224
1225 protected:
1227 const BilinearOperator_& bilinear_operator;
1229 Matrix_& matrix;
1231 const TestSpace_& test_space;
1233 const TrialSpace_& trial_space;
1237 DataType alpha;
1238
1239 public:
1261 explicit DomainAssemblyBilinearOperatorMatrixJob2(const BilinearOperator_& bilinear_operator_,
1262 Matrix_& matrix_, const TestSpace_& test_space_, const TrialSpace_& trial_space_,
1263 const String& cubature_, DataType alpha_ = DataType(1)) :
1264 bilinear_operator(bilinear_operator_),
1265 matrix(matrix_),
1266 test_space(test_space_),
1267 trial_space(trial_space_),
1268 cubature_factory(cubature_),
1269 alpha(alpha_)
1270 {
1271 }
1272 }; // class DomainAssemblyBilinearOperatorMatrixJob2<...>
1273
1298 template<typename Trafo_, typename Matrix_, typename BilOp_, typename TestSpace_, typename TrialSpace_>
1300 Matrix_& matrix, const BilOp_& bilinear_operator, const TestSpace_& test_space,
1301 const TrialSpace_& trial_space, const String& cubature,
1302 const typename Matrix_::DataType alpha = typename Matrix_::DataType(1))
1303 {
1304 XASSERTM(dom_asm.get_trafo() == test_space.get_trafo(), "domain assembler and test space have different trafos");
1305 XASSERTM(dom_asm.get_trafo() == trial_space.get_trafo(), "domain assembler and trial space have different trafos");
1306 XASSERTM(matrix.columns() == trial_space.get_num_dofs(), "invalid matrix column count");
1307 XASSERTM(matrix.rows() == test_space.get_num_dofs(), "invalid matrix row count");
1308
1310 bilinear_operator, matrix, test_space, trial_space, cubature, alpha);
1311 dom_asm.assemble(job);
1312 }
1313
1338 template<typename BilinearOperator_, typename Vector_, typename VectorSol_, typename Space_>
1340 {
1341 public:
1342 typedef typename Vector_::DataType DataType;
1343 typedef typename Vector_::ValueType ValueType;
1344
1345 static constexpr TrafoTags trafo_config = BilinearOperator_::trafo_config;
1346 static constexpr SpaceTags space_config = BilinearOperator_::test_config | BilinearOperator_::trial_config;
1347
1348 class Task :
1349 public DomainAssemblyBasicVectorTaskCRTP<Task, Vector_, Space_, trafo_config, space_config>
1350 {
1351 protected:
1354
1357 typedef typename BilinearOperator_::template Evaluator<AsmTraits>::ValueType MatValType;
1358
1360 typename BilinearOperator_::template Evaluator<AsmTraits> oper_eval;
1361
1363 const VectorSol_& vec_sol;
1364
1366 typename VectorSol_::GatherAxpy sol_gather;
1367
1369 typename AsmTraits::template TLocalMatrix<MatValType> local_matrix;
1370 typename AsmTraits::template TLocalVector<ValueType> local_vec_sol;
1371
1372
1373 public:
1375 BaseClass(job.vector, job.space, job.cubature_factory, job.alpha),
1377 vec_sol(job.vec_sol),
1379 {
1380 }
1381
1382 void prepare(Index cell)
1383 {
1384 BaseClass::prepare(cell);
1385 oper_eval.prepare(this->trafo_eval);
1386 local_vec_sol.format();
1387 sol_gather(local_vec_sol, this->dof_mapping);
1388 }
1389
1390 void set_point(typename AsmTraits::TrafoEvalData& tau)
1391 {
1392 oper_eval.set_point(tau);
1393 }
1394
1395 void eval(MatValType& val, const DataType& weight,
1396 typename AsmTraits::TrialBasisData& phi, typename AsmTraits::TestBasisData& psi)
1397 {
1398 val += weight * oper_eval.eval(phi, psi);
1399 }
1400
1405 {
1406 // format local matrix
1407 local_matrix.format();
1408 this->local_vector.format();
1409
1410 // fetch number of local dofs
1411 const int num_loc_dofs = this->space_eval.get_num_local_dofs();
1412
1413 // loop over all quadrature points and integrate
1414 for(int k(0); k < this->cubature_rule.get_num_points(); ++k)
1415 {
1416 // compute trafo data
1417 this->trafo_eval(this->trafo_data, this->cubature_rule.get_point(k));
1418
1419 // compute basis function data
1420 this->space_eval(this->space_data, this->trafo_data);
1421
1422 // evaluate operator
1423 this->set_point(this->trafo_data);
1424
1425 // test function loop
1426 for(int i(0); i < num_loc_dofs; ++i)
1427 {
1428 // trial function loop
1429 for(int j(0); j < num_loc_dofs; ++j)
1430 {
1431 // evaluate operator and integrate
1432 this->eval(local_matrix(i,j),
1433 this->trafo_data.jac_det * this->cubature_rule.get_weight(k),
1434 this->space_data.phi[j], this->space_data.phi[i]);
1435 // continue with next trial function
1436 }
1437 // continue with next test function
1438 }
1439 // continue with next cubature point
1440 }
1441 // apply to local vector
1442 for(int i(0); i < num_loc_dofs; ++i)
1443 for(int j(0); j < num_loc_dofs; ++j)
1444 this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_vec_sol[j]);
1445 }
1446
1447 void finish()
1448 {
1449 oper_eval.finish();
1451 }
1452 }; // class Task
1453
1454 protected:
1456 const BilinearOperator_& bilinear_operator;
1458 Vector_& vector;
1460 const VectorSol_& vec_sol;
1462 const Space_& space;
1466 DataType alpha;
1467
1468 public:
1487 explicit DomainAssemblyBilinearOperatorApplyVectorJob1(const BilinearOperator_& bilinear_operator_,
1488 Vector_& vector_, const VectorSol_& vec_sol_, const Space_& space_, const String& cubature_, DataType alpha_ = DataType(1)) :
1489 bilinear_operator(bilinear_operator_),
1490 vector(vector_),
1491 vec_sol(vec_sol_),
1492 space(space_),
1493 cubature_factory(cubature_),
1494 alpha(alpha_)
1495 {
1496 }
1497 }; // class DomainAssemblyBilinearOperatorApplyVectorJob1<...>
1498
1523 template<typename Trafo_, typename Vector_, typename VectorSol_, typename BilOp_, typename Space_>
1525 const VectorSol_& vec_sol, const BilOp_& bilinear_operator, const Space_& space, const String& cubature,
1526 const typename Vector_::DataType alpha = typename Vector_::DataType(1))
1527 {
1528 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
1529 XASSERTM(vector.size() == space.get_num_dofs(), "invalid vector size");
1530
1532 bilinear_operator, vector, vec_sol, space, cubature, alpha);
1533 dom_asm.assemble(job);
1534 }
1535
1553 template<typename DataType_, typename Function_, typename Trafo_, int max_der_>
1555 {
1556 public:
1557 static_assert(Function_::can_value, "function cannot compute values");
1558 static_assert(Function_::can_grad || (max_der_ < 1), "function gradients are required but not available");
1559 static_assert(Function_::can_hess || (max_der_ < 2), "function hessians are required but not available");
1560
1562 typedef DataType_ DataType;
1563
1566
1569
1570 public:
1574 class Task
1575 {
1576 public:
1578 static constexpr bool need_scatter = false;
1580 static constexpr bool need_combine = true;
1581
1582 protected:
1583 static constexpr TrafoTags trafo_config = TrafoTags::img_point | TrafoTags::jac_det;
1585 typedef typename Trafo_::template Evaluator<typename Trafo_::ShapeType, DataType>::Type TrafoEvaluator;
1589 typename TrafoEvaluator::template ConfigTraits<trafo_config>::EvalDataType trafo_data;
1591 typename Assembly::Intern::CubatureTraits<TrafoEvaluator>::RuleType cubature_rule;
1593 typename Function_::template Evaluator<AnalyticEvalTraits> func_eval;
1598
1599 public:
1601 trafo_eval(job._trafo),
1602 trafo_data(),
1603 cubature_rule(Cubature::ctor_factory, job._cubature_factory),
1604 func_eval(job._function),
1605 loc_integral(),
1607 {
1608 }
1609
1610 void prepare(Index cell)
1611 {
1612 trafo_eval.prepare(cell);
1613 }
1614
1615 void assemble()
1616 {
1617 // loop over all quadrature points and integrate
1618 for(int k(0); k < cubature_rule.get_num_points(); ++k)
1619 {
1620 // compute trafo data
1621 trafo_eval(trafo_data, cubature_rule.get_point(k));
1622
1623 // call helper to integrate
1624 Intern::AnaFunIntJobHelper<max_der_>::work(loc_integral,
1625 cubature_rule.get_weight(k) * trafo_data.jac_det, func_eval, trafo_data.img_point);
1626 }
1627 }
1628
1629 void scatter()
1630 {
1631 // nothing to do here
1632 }
1633
1634 void finish()
1635 {
1636 trafo_eval.finish();
1637 }
1638
1639 void combine()
1640 {
1642 }
1643 }; // class Task
1644
1645 protected:
1647 const Trafo_& _trafo;
1649 const Function_& _function;
1654
1655 public:
1668 explicit DomainAssemblyAnalyticFunctionIntegralJob(const Function_& function, const Trafo_& trafo, const String& cubature) :
1669 _trafo(trafo),
1670 _function(function),
1671 _cubature_factory(cubature),
1672 _integral()
1673 {
1674 _integral.max_der = max_der_;
1675 }
1676
1681 {
1682 return _integral;
1683 }
1684 }; // class DomainAssemblyAnalyticFunctionIntegralJob<...>
1685
1705 template<int max_der_, typename DataType_, typename Trafo_, typename Function_>
1707 DomainAssembler<Trafo_>& dom_asm, const Function_& function, const String& cubature)
1708 {
1710 dom_asm.assemble(job);
1711 return job.result();
1712 }
1713
1730 template<typename Vector_, typename Space_, int max_der_>
1732 {
1733 public:
1735 typedef typename Vector_::DataType DataType;
1737 typedef typename Vector_::ValueType ValueType;
1738
1739 typedef typename DiscreteFunctionIntegral<Vector_, Space_>::Type FunctionIntegralType;
1740
1741 public:
1742 class Task
1743 {
1744 public:
1746 static constexpr bool need_scatter = false;
1748 static constexpr bool need_combine = true;
1749
1750 protected:
1751 static constexpr SpaceTags space_tags = SpaceTags::value |
1752 (max_der_ >= 1 ? SpaceTags::grad : SpaceTags::none) |
1753 (max_der_ >= 2 ? SpaceTags::hess : SpaceTags::none);
1754
1758 const Vector_& vector;
1760 const Space_& space;
1776 typename AsmTraits::template TLocalVector<ValueType> local_vector;
1778 typename Vector_::GatherAxpy gather_axpy;
1780 FunctionIntegralType loc_integral;
1782 FunctionIntegralType& job_integral;
1783
1784 public:
1786 vector(job._vector),
1787 space(job._space),
1788 trafo(space.get_trafo()),
1792 cubature_rule(Cubature::ctor_factory, job._cubature_factory),
1793 trafo_data(),
1794 space_data(),
1795 local_vector(),
1797 loc_integral(),
1799 {
1800 }
1801
1802 void prepare(Index cell)
1803 {
1804 // prepare dof mapping
1805 dof_mapping.prepare(cell);
1806
1807 // prepare trafo evaluator
1808 trafo_eval.prepare(cell);
1809
1810 // prepare space evaluator
1811 space_eval.prepare(trafo_eval);
1812 }
1813
1814 void assemble()
1815 {
1816 // format local vector
1817 local_vector.format();
1818
1819 // gather local vector data
1821
1822 // fetch number of local dofs
1823 const int num_loc_dofs = space_eval.get_num_local_dofs();
1824
1825 // loop over all quadrature points and integrate
1826 for(int k(0); k < cubature_rule.get_num_points(); ++k)
1827 {
1828 // compute trafo data
1829 trafo_eval(trafo_data, cubature_rule.get_point(k));
1830
1831 // compute basis function data
1833
1834 // do the dirty work
1835 Intern::DiscFunIntJobHelper<max_der_>::work(loc_integral,
1836 cubature_rule.get_weight(k) * trafo_data.jac_det, space_data, local_vector, num_loc_dofs);
1837 }
1838 }
1839
1840 void scatter()
1841 {
1842 // nothing to do here
1843 }
1844
1845 void finish()
1846 {
1847 trafo_eval.finish();
1848 }
1849
1850 void combine()
1851 {
1853 }
1854 }; // class Task
1855
1856 protected:
1858 const Vector_& _vector;
1860 const Space_& _space;
1864 FunctionIntegralType _integral;
1865
1866 public:
1879 explicit DomainAssemblyDiscreteFunctionIntegralJob(const Vector_& vector, const Space_& space, const String& cubature) :
1880 _vector(vector),
1881 _space(space),
1882 _cubature_factory(cubature),
1883 _integral()
1884 {
1885 _integral.max_der = max_der_;
1886 }
1887
1888 // \returns The integral of the discrete function
1889 FunctionIntegralType& result()
1890 {
1891 return _integral;
1892 }
1893 }; // class DomainAssemblyDiscreteFunctionIntegralJob<...>
1894
1914 template<int max_der_, typename Vector_, typename Trafo_, typename Space_>
1916 DomainAssembler<Trafo_>& dom_asm, const Vector_& vector, const Space_& space, const String& cubature)
1917 {
1918 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
1919 XASSERTM(vector.size() == space.get_num_dofs(), "invalid coefficient vector length");
1921 dom_asm.assemble(job);
1922 return job.result();
1923 }
1924
1947 template<typename Function_, typename Vector_, typename Space_, int max_der_>
1949 {
1950 public:
1952 typedef typename Vector_::DataType DataType;
1954 typedef typename Vector_::ValueType ValueType;
1955
1957 static_assert(Intern::ErrCompatHelper<Function_, Vector_>::valid, "function and vector are incompatible");
1958
1961
1964
1965 public:
1966 class Task
1967 {
1968 public:
1970 static constexpr bool need_scatter = false;
1972 static constexpr bool need_combine = true;
1973
1974 protected:
1975 static constexpr TrafoTags trafo_config = TrafoTags::img_point | TrafoTags::jac_det;
1976 static constexpr SpaceTags space_tags = SpaceTags::value |
1977 (max_der_ >= 1 ? SpaceTags::grad : SpaceTags::none) |
1978 (max_der_ >= 2 ? SpaceTags::hess : SpaceTags::none);
1979
1983 const Vector_& vector;
1985 const Space_& space;
2001 typename AsmTraits::template TLocalVector<ValueType> local_vector;
2003 typename Vector_::GatherAxpy gather_axpy;
2005 typename Function_::template Evaluator<AnalyticEvalTraits> func_eval;
2010
2011 public:
2013 vector(job._vector),
2014 space(job._space),
2015 trafo(space.get_trafo()),
2019 cubature_rule(Cubature::ctor_factory, job._cubature_factory),
2020 trafo_data(),
2021 space_data(),
2022 local_vector(),
2024 func_eval(job._function),
2025 loc_integral(),
2027 {
2028 }
2029
2030 void prepare(Index cell)
2031 {
2032 // prepare dof mapping
2033 dof_mapping.prepare(cell);
2034
2035 // prepare trafo evaluator
2036 trafo_eval.prepare(cell);
2037
2038 // prepare space evaluator
2039 space_eval.prepare(trafo_eval);
2040 }
2041
2042 void assemble()
2043 {
2044 // format local vector
2045 local_vector.format();
2046
2047 // gather local vector data
2049
2050 // fetch number of local dofs
2051 const int num_loc_dofs = space_eval.get_num_local_dofs();
2052
2053 // loop over all quadrature points and integrate
2054 for(int k(0); k < cubature_rule.get_num_points(); ++k)
2055 {
2056 // compute trafo data
2057 trafo_eval(trafo_data, cubature_rule.get_point(k));
2058
2059 // compute basis function data
2061
2062 // do the dirty work
2063 Intern::ErrFunIntJobHelper<max_der_>::work(loc_integral,
2064 cubature_rule.get_weight(k) * trafo_data.jac_det, func_eval, trafo_data.img_point,
2065 space_data, local_vector, num_loc_dofs);
2066 }
2067 }
2068
2069 void scatter()
2070 {
2071 // nothing to do here
2072 }
2073
2074 void finish()
2075 {
2076 trafo_eval.finish();
2077 }
2078
2079 void combine()
2080 {
2082 }
2083 }; // class Task
2084
2085 protected:
2087 const Function_& _function;
2089 const Vector_& _vector;
2091 const Space_& _space;
2096
2097 public:
2113 explicit DomainAssemblyErrorFunctionIntegralJob(const Function_& function, const Vector_& vector, const Space_& space, const String& cubature) :
2114 _function(function),
2115 _vector(vector),
2116 _space(space),
2117 _cubature_factory(cubature),
2118 _integral()
2119 {
2120 _integral.max_der = max_der_;
2121 }
2122
2123 // \returns The integral of the discrete function
2124 FunctionIntegralType& result()
2125 {
2126 return _integral;
2127 }
2128 }; // class DomainAssemblyErrorFunctionIntegralJob<...>
2129
2152 template<int max_der_, typename Function_, typename Vector_, typename Trafo_, typename Space_>
2154 DomainAssembler<Trafo_>& dom_asm, const Function_& function,
2155 const Vector_& vector, const Space_& space, const String& cubature)
2156 {
2157 XASSERTM(dom_asm.get_trafo() == space.get_trafo(), "domain assembler and space have different trafos");
2158 XASSERTM(vector.size() == space.get_num_dofs(), "invalid coefficient vector length");
2160 dom_asm.assemble(job);
2161 return job.result();
2162 }
2163
2164 namespace Intern
2165 {
2166 template<typename DT_, typename IT_, int max_der_>
2168 {
2170 };
2171
2172 template<typename DT_, typename IT_>
2173 struct OutVectorHelper<DT_, IT_, 0>
2174 {
2176 };
2177 }
2178
2202 template<typename Function_, typename Vector_, typename Space_, int max_der_>
2204 {
2205 public:
2207 typedef typename Vector_::DataType DataType;
2209 typedef typename Vector_::ValueType ValueType;
2210
2212 static_assert(Intern::ErrCompatHelper<Function_, Vector_>::valid, "function and vector are incompatible");
2213
2216
2219
2222
2225
2226 public:
2227 class Task
2228 {
2229 public:
2231 static constexpr bool need_scatter = true;
2233 static constexpr bool need_combine = true;
2234
2235 protected:
2236 static constexpr TrafoTags trafo_config = TrafoTags::img_point | TrafoTags::jac_det;
2237 static constexpr SpaceTags space_tags = SpaceTags::value |
2238 (max_der_ >= 1 ? SpaceTags::grad : SpaceTags::none) |
2239 (max_der_ >= 2 ? SpaceTags::hess : SpaceTags::none);
2240
2244 const Vector_& vector;
2246 const Space_& space;
2264 typename AsmTraits::template TLocalVector<ValueType> local_vector;
2266 typename Vector_::GatherAxpy gather_axpy;
2268 typename Function_::template Evaluator<AnalyticEvalTraits> func_eval;
2275
2276 public:
2277 explicit Task(CellErrorFunctionIntegralJob& job) :
2278 vector(job._vector),
2279 space(job._space),
2280 out_vector(job._out_vec),
2281 trafo(space.get_trafo()),
2285 cubature_rule(Cubature::ctor_factory, job._cubature_factory),
2286 trafo_data(),
2287 space_data(),
2288 local_vector(),
2290 func_eval(job._function),
2291 loc_integral(),
2294 {
2295 }
2296
2297 void prepare(Index cell)
2298 {
2299 // prepare dof mapping
2300 dof_mapping.prepare(cell);
2301
2302 // prepare trafo evaluator
2303 trafo_eval.prepare(cell);
2304
2305 // prepare space evaluator
2306 space_eval.prepare(trafo_eval);
2307 }
2308
2309 void assemble()
2310 {
2311 // format local vector
2312 local_vector.format();
2313
2314 // gather local vector data
2316
2317 // fetch number of local dofs
2318 const int num_loc_dofs = space_eval.get_num_local_dofs();
2319
2320 // format cell local integral value
2321 cell_integral.format();
2322
2323 // loop over all quadrature points and integrate
2324 for(int k(0); k < cubature_rule.get_num_points(); ++k)
2325 {
2326 // compute trafo data
2327 trafo_eval(trafo_data, cubature_rule.get_point(k));
2328
2329 // compute basis function data
2331
2332 // do the dirty work
2333 Intern::ErrFunIntJobHelper<max_der_>::work(cell_integral,
2334 cubature_rule.get_weight(k) * trafo_data.jac_det, func_eval, trafo_data.img_point,
2335 space_data, local_vector, num_loc_dofs);
2336 }
2337 // add our cell value
2339 }
2340
2341 void scatter()
2342 {
2343 // get cell index
2344 Index cell = dof_mapping.get_current_cell_index();
2345 if constexpr(max_der_ == 0)
2346 {
2347 out_vector(cell, cell_integral.norm_h0_sqr);
2348 }
2349 else
2350 {
2351 // construct tiny vector
2352 Tiny::Vector<DataType, max_der_+1> loc_vec;
2353 loc_vec[0] = cell_integral.norm_h0_sqr;
2354 loc_vec[1] = cell_integral.norm_h1_sqr;
2355 if constexpr(max_der_ > 1)
2356 loc_vec[2] = cell_integral.norm_h2_sqr;
2357 //scatter the tiny vector
2358 out_vector(cell, loc_vec);
2359 }
2360 }
2361
2362 void finish()
2363 {
2364 trafo_eval.finish();
2365 }
2366
2367 void combine()
2368 {
2370 }
2371 }; // class Task
2372
2373 protected:
2375 const Function_& _function;
2377 const Vector_& _vector;
2379 const Space_& _space;
2386
2387 public:
2403 explicit CellErrorFunctionIntegralJob(const Function_& function, const Vector_& vector, const Space_& space, const String& cubature) :
2404 _function(function),
2405 _vector(vector),
2406 _space(space),
2407 _cubature_factory(cubature),
2408 _integral()
2409 {
2410 _integral.max_der = max_der_;
2411 _out_vec = OutVectorType(_space.get_mesh().get_num_elements());
2412 _out_vec.format();
2413 }
2414
2417 {
2418 FunctionCellIntegralType output(_integral, std::move(_out_vec));
2419 _out_vec = OutVectorType(_space.get_mesh().get_num_elements());
2420 _out_vec.format();
2421 return output;
2422 }
2423 }; // class CellErrorFunctionIntegralJob<...>
2424 } // namespace Assembly
2425} // namespace FEAT
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
Common single-space assembly traits class template.
Definition: asm_traits.hpp:83
TrafoType::template Evaluator< ShapeType, DataType >::Type TrafoEvaluator
trafo evaluator type
Definition: asm_traits.hpp:104
SpaceEvalData::BasisDataType SpaceBasisData
basis function data types
Definition: asm_traits.hpp:148
SpaceEvaluator::template ConfigTraits< space_config >::EvalDataType SpaceEvalData
space evaluation data types
Definition: asm_traits.hpp:142
Intern::CubatureTraits< TrafoEvaluator >::RuleType CubatureRuleType
cubature rule type
Definition: asm_traits.hpp:186
SpaceType::TrafoType TrafoType
trafo type
Definition: asm_traits.hpp:97
SpaceType::DofMappingType DofMapping
dof-mapping types
Definition: asm_traits.hpp:155
TrafoEvaluator::template ConfigTraits< trafo_config >::EvalDataType TrafoEvalData
trafo evaluation data type
Definition: asm_traits.hpp:138
SpaceType::template Evaluator< TrafoEvaluator >::Type SpaceEvaluator
space evaluator types
Definition: asm_traits.hpp:110
Common test-/trial-space assembly traits class template.
Definition: asm_traits.hpp:227
TestSpaceType::DofMappingType TestDofMapping
dof-mapping types
Definition: asm_traits.hpp:291
Intern::CubatureTraits< TrafoEvaluator >::RuleType CubatureRuleType
cubature rule type
Definition: asm_traits.hpp:318
TrafoType::template Evaluator< ShapeType, DataType >::Type TrafoEvaluator
trafo evaluator type
Definition: asm_traits.hpp:246
TestEvalData::BasisDataType TestBasisData
basis function data types
Definition: asm_traits.hpp:286
TestSpaceType::template Evaluator< TrafoEvaluator >::Type TestEvaluator
space evaluator types
Definition: asm_traits.hpp:252
TestSpaceType::TrafoType TrafoType
trafo type
Definition: asm_traits.hpp:239
TestEvaluator::template ConfigTraits< test_config >::EvalDataType TestEvalData
space evaluation data types
Definition: asm_traits.hpp:281
TrafoEvaluator::template ConfigTraits< trafo_config >::EvalDataType TrafoEvalData
trafo evaluation data type
Definition: asm_traits.hpp:277
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
AsmTraits::template TLocalVector< ValueType > local_vector
the local vector to be assembled
Function_::template Evaluator< AnalyticEvalTraits > func_eval
the function evaluator
AsmTraits::DofMapping dof_mapping
the space dof-mapping
AsmTraits::SpaceEvalData space_data
the space evaluation data
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
Vector_::GatherAxpy gather_axpy
the vector gather object
AsmTraits::TrafoEvaluator trafo_eval
the trafo evaluator
static constexpr bool need_scatter
this task doesn't need to scatter
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
const Vector_ & vector
the vector that is to be integrated
AsmTraits::SpaceEvaluator space_eval
the space evaluator
const Space_ & space
the finite element space to be used
Assembly::AsmTraits1< DataType, Space_, trafo_config, space_tags > AsmTraits
our assembly traits
static constexpr bool need_combine
this task needs to combine
Assembly job for the elementwise integration of a analytic vs discrete error function.
OutVectorType _out_vec
the vector of the cell data
CellErrorFunctionIntegralJob(const Function_ &function, const Vector_ &vector, const Space_ &space, const String &cubature)
Constructor.
const Vector_ & _vector
the vector that is to be integrated
Cubature::DynamicFactory _cubature_factory
the cubature factory
Intern::OutVectorHelper< DataType, Index, max_der_ >::VectorType OutVectorType
our output vectortype
Analytic::EvalTraits< DataType, Function_ > AnalyticEvalTraits
declare our analytic eval traits
DiscreteFunctionIntegral< Vector_, Space_ >::Type FunctionIntegralType
make sure that function and vector are compatible
FunctionCellIntegralInfo< FunctionIntegralType, OutVectorType > FunctionCellIntegralType
our cell fucntion integral type
Vector_::DataType DataType
the data-type of the vector
const Function_ & _function
the function to be integrated
FunctionIntegralType _integral
the function integral
const Space_ & _space
the finite element space to be used
Vector_::ValueType ValueType
the value-type of the vector
Domain Integral Assembler class template.
const Trafo_ & get_trafo() const
Returns a reference to the domain assembler's trafo.
void assemble(Job_ &job)
Executes a domain assembly job (in parallel) by (multiple) worker threads.
Assembly::Intern::CubatureTraits< TrafoEvaluator >::RuleType cubature_rule
the cubature rule
static constexpr bool need_scatter
this task doesn't need to scatter
TrafoEvaluator::template ConfigTraits< trafo_config >::EvalDataType trafo_data
trafo eval data type
Trafo_::template Evaluator< typenameTrafo_::ShapeType, DataType >::Type TrafoEvaluator
trafo evaluator
Function_::template Evaluator< AnalyticEvalTraits > func_eval
the function evaluator
Assembly job for the integration of an analytic function.
FunctionIntegralType & result()
Returns the assembled function integral info.
DataType_ DataType
the datatype to be used by the assembly
DomainAssemblyAnalyticFunctionIntegralJob(const Function_ &function, const Trafo_ &trafo, const String &cubature)
Constructor.
Analytic::EvalTraits< DataType, Function_ > AnalyticEvalTraits
declare our analytic eval traits
AnalyticFunctionIntegral< DataType, Function_ >::Type FunctionIntegralType
our function integral type
Basic Matrix assembly task CRTP base-class for identical test-/trial-space.
Matrix_::ScatterAxpy scatter_axpy
the matrix scatter object
static constexpr bool need_scatter
this task needs to scatter
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
const Space_ & space
the test-/trial-space to be used
AsmTraits::TrafoEvaluator trafo_eval
the trafo evaluator
AsmTraits::SpaceEvalData space_data
the space evaluation data
void prepare(Index cell)
Prepares the task for the assembly on a given mesh cell.
Matrix_ & matrix
the matrix that is to be assembled
void finish()
Finishes the assembly on the current cell.
Matrix_::ValueType ValueType
the value-type of the matrix
DomainAssemblyBasicMatrixTaskCRTP1(Matrix_ &matrix_, const Space_ &space_, const Cubature::DynamicFactory &cubature_factory, DataType alpha_)
Constructor.
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
AsmTraits::template TLocalMatrix< ValueType > local_matrix
the local matrix to be assembled
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
AsmTraits::SpaceEvaluator space_eval
the space evaluator
void set_point(typename AsmTraits::TrafoEvalData &tau)
Sets the current cubature point.
void eval(ValueType &val, const DataType &weight, const typename AsmTraits::TrialBasisData &phi, const typename AsmTraits::TestBasisData &psi)
Evaluates the bilinearform for a test-/trial-basis function pair.
AsmTraits::DofMapping dof_mapping
the space dof-mapping
Assembly::AsmTraits1< DataType, Space_, trafo_config_|TrafoTags::jac_det, space_config_ > AsmTraits
our assembly traits
static constexpr bool need_combine
this task has no combine
Matrix_::DataType DataType
the data-type of the matrix
Basic Matrix assembly task CRTP base-class for (possibly different) test-/trial-spaces.
const TestSpace_ & test_space
the test-space to be used
AsmTraits::TestDofMapping test_dof_mapping
the space dof-mappings
void eval(ValueType &val, const DataType &weight, const typename AsmTraits::TrialBasisData &phi, const typename AsmTraits::TestBasisData &psi)
Evaluates the bilinearform for a test-/trial-basis function pair.
Matrix_::ValueType ValueType
the value-type of the matrix
AsmTraits::template TLocalMatrix< ValueType > local_matrix
the local matrix to be assembled
void set_point(typename AsmTraits::TrafoEvalData &tau)
Sets the current cubature point.
static constexpr bool need_combine
this task has no combine
AsmTraits::TestEvalData test_data
the space evaluation data
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
const TrialSpace_ & trial_space
the trial-space to be used
Assembly::AsmTraits2< DataType, TestSpace_, TrialSpace_, trafo_config_|TrafoTags::jac_det, test_config_, trial_config_ > AsmTraits
our assembly traits
void finish()
Finishes the assembly on the current cell.
AsmTraits::TestEvaluator test_eval
the space evaluators
static constexpr bool need_scatter
this task needs to scatter
DomainAssemblyBasicMatrixTaskCRTP2(Matrix_ &matrix_, const TestSpace_ &test_space_, const TrialSpace_ &trial_space_, const Cubature::DynamicFactory &cubature_factory, DataType alpha_)
Constructor.
void prepare(Index cell)
Prepares the task for the assembly on a given mesh cell.
Matrix_::ScatterAxpy scatter_axpy
the matrix scatter object
Matrix_ & matrix
the matrix that is to be assembled
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
AsmTraits::TrafoEvaluator trafo_eval
the trafo evaluator
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
Matrix_::DataType DataType
the data-type of the matrix
DomainAssemblyBasicVectorTaskCRTP(Vector_ &vector_, const Space_ &space_, const Cubature::DynamicFactory &cubature_factory, DataType alpha_)
Constructor.
void finish()
Finishes the assembly on the current cell.
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
const Space_ & space
the test-/trial-space to be used
AsmTraits::SpaceEvaluator space_eval
the space evaluator
AsmTraits::TrafoEvaluator trafo_eval
the trafo evaluator
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
Vector_::ScatterAxpy scatter_axpy
the vector scatter object
static constexpr bool need_scatter
this task needs to scatter
Vector_::ValueType ValueType
the value-type of the vector
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
AsmTraits::template TLocalVector< ValueType > local_vector
the local vector to be assembled
static constexpr bool need_combine
this task has no combine
Assembly::AsmTraits1< DataType, Space_, trafo_config_|TrafoTags::jac_det, space_config_ > AsmTraits
our assembly traits
Vector_::DataType DataType
the data-type of the vector
AsmTraits::DofMapping dof_mapping
the space dof-mapping
void eval(ValueType &val, const DataType &weight, const typename AsmTraits::SpaceBasisData &psi)
Evaluates the linearform for a test-basis function.
AsmTraits::SpaceEvalData space_data
the space evaluation data
Vector_ & vector
the vector that is to be assembled
void set_point(typename AsmTraits::TrafoEvalData &tau)
Sets the current cubature point.
void prepare(Index cell)
Prepares the task for the assembly on a given mesh cell.
VectorSol_::GatherAxpy sol_gather
the gather axpy for the local solution vector
BilinearOperator_::template Evaluator< AsmTraits > oper_eval
the bilinear operator evaluator
DomainAssemblyBasicVectorTaskCRTP< Task, Vector_, Space_, trafo_config, space_config > BaseClass
our base-class typedef
AsmTraits::template TLocalMatrix< MatValType > local_matrix
the local matrix that is used to assemble the local vector
const VectorSol_ & vec_sol
the local solution vector that the bilinear operator is applied to
Vector assembly job for BilinearOperator and identical test-/trial-spaces.
DomainAssemblyBilinearOperatorApplyVectorJob1(const BilinearOperator_ &bilinear_operator_, Vector_ &vector_, const VectorSol_ &vec_sol_, const Space_ &space_, const String &cubature_, DataType alpha_=DataType(1))
Constructor.
const BilinearOperator_ & bilinear_operator
a reference to the bilinear operator that is to be assembled
const Space_ & space
a reference to the finite element space to be used as test-/trial-space
Vector_ & vector
a reference to the vector that is to be assembled
const VectorSol_ & vec_sol
a reference to the vector the biliniear operator is applied on
Cubature::DynamicFactory cubature_factory
the cubature factory to be used for integration
DomainAssemblyBasicMatrixTaskCRTP1< Task, Matrix_, Space_, trafo_config, space_config > BaseClass
our base-class typedef
BilinearOperator_::template Evaluator< AsmTraits > oper_eval
the bilinear operator evaluator
Matrix assembly job for BilinearOperator and identical test-/trial-spaces.
Matrix_ & matrix
a reference to the matrix that is to be assembled
DomainAssemblyBilinearOperatorMatrixJob1(const BilinearOperator_ &bilinear_operator_, Matrix_ &matrix_, const Space_ &space_, const String &cubature_, DataType alpha_=DataType(1))
Constructor.
const BilinearOperator_ & bilinear_operator
a reference to the bilinear operator that is to be assembled
Cubature::DynamicFactory cubature_factory
the cubature factory to be used for integration
const Space_ & space
a reference to the finite element space to be used as test-/trial-space
DomainAssemblyBasicMatrixTaskCRTP2< Task, Matrix_, TestSpace_, TrialSpace_, trafo_config, test_config, trial_config > BaseClass
our base-class typedef
BilinearOperator_::template Evaluator< AsmTraits > oper_eval
the bilinear operator evaluator
Matrix assembly job for BilinearOperator and (possibly different) test-/trial-spaces.
DomainAssemblyBilinearOperatorMatrixJob2(const BilinearOperator_ &bilinear_operator_, Matrix_ &matrix_, const TestSpace_ &test_space_, const TrialSpace_ &trial_space_, const String &cubature_, DataType alpha_=DataType(1))
Constructor.
const TestSpace_ & test_space
a reference to the finite element space to be used as test-space
const BilinearOperator_ & bilinear_operator
a reference to the bilinear operator that is to be assembled
const TrialSpace_ & trial_space
a reference to the finite element space to be used as trial-space
Cubature::DynamicFactory cubature_factory
the cubature factory to be used for integration
Matrix_ & matrix
a reference to the matrix that is to be assembled
AsmTraits::template TLocalVector< ValueType > local_vector
the local vector to be assembled
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
Assembly::AsmTraits1< DataType, Space_, TrafoTags::jac_det, space_tags > AsmTraits
our assembly traits
static constexpr bool need_scatter
this task doesn't need to scatter
Assembly job for the integration of a discrete finite element function.
DomainAssemblyDiscreteFunctionIntegralJob(const Vector_ &vector, const Space_ &space, const String &cubature)
Constructor.
const Vector_ & _vector
the vector that is to be integrated
const Space_ & _space
the finite element space to be used
Assembly::AsmTraits1< DataType, Space_, trafo_config, space_tags > AsmTraits
our assembly traits
AsmTraits::template TLocalVector< ValueType > local_vector
the local vector to be assembled
static constexpr bool need_scatter
this task doesn't need to scatter
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
AsmTraits::SpaceEvalData space_data
the space evaluation data
Function_::template Evaluator< AnalyticEvalTraits > func_eval
the function evaluator
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
Assembly job for the integration of a analytic vs discrete error function.
const Vector_ & _vector
the vector that is to be integrated
const Function_ & _function
the function to be integrated
DomainAssemblyErrorFunctionIntegralJob(const Function_ &function, const Vector_ &vector, const Space_ &space, const String &cubature)
Constructor.
const Space_ & _space
the finite element space to be used
Analytic::EvalTraits< DataType, Function_ > AnalyticEvalTraits
declare our analytic eval traits
DiscreteFunctionIntegral< Vector_, Space_ >::Type FunctionIntegralType
make sure that function and vector are compatible
Vector_::ValueType ValueType
the value-type of the vector
Cubature::DynamicFactory _cubature_factory
the cubature factory
AnalyticEvalTraits::ValueType func_value
the function value in the current point
Function_::template Evaluator< AnalyticEvalTraits > func_eval
the function evaluator
DomainAssemblyBasicVectorTaskCRTP< Task, Vector_, Space_, trafo_config, test_config > BaseClass
our base-class typedef
Analytic::EvalTraits< DataType, Function_ > AnalyticEvalTraits
declare our analytic eval traits
Vector assembly job for a force functional represented by an analytic function.
const Function_ & function
a reference to the linear functional that is to be assembled
Vector_ & vector
a reference to the vector that is to be assembled
Cubature::DynamicFactory cubature_factory
the cubature factory to be used for integration
const Space_ & space
a reference to the finite element space to be used as test-/trial-space
DomainAssemblyForceFunctionalVectorJob(const Function_ &function_, Vector_ &vector_, const Space_ &space_, const String &cubature_, DataType alpha_=DataType(1))
Constructor.
LinearFunctional_::template Evaluator< AsmTraits > func_eval
the bilinear operator evaluator
DomainAssemblyBasicVectorTaskCRTP< Task, Vector_, Space_, trafo_config, test_config > BaseClass
our base-class typedef
Vector assembly job for LinearFunctional implementations.
Cubature::DynamicFactory cubature_factory
the cubature factory to be used for integration
Vector_ & vector
a reference to the vector that is to be assembled
DomainAssemblyLinearFunctionalVectorJob(const LinearFunctional_ &linear_functional_, Vector_ &vector_, const Space_ &space_, const String &cubature_, DataType alpha_=DataType(1))
Constructor.
const LinearFunctional_ & linear_functional
a reference to the linear functional that is to be assembled
const Space_ & space
a reference to the finite element space to be used as test-/trial-space
void format(DT_ value=DT_(0))
Reset all elements of the container to a given value or zero if missing.
Definition: container.hpp:851
Blocked Dense data vector class template.
Dense data vector class template.
String class implementation.
Definition: string.hpp:46
void assemble_force_function_vector(DomainAssembler< Trafo_ > &dom_asm, Vector_ &vector, const Function_ &function, const Space_ &space, const String &cubature, const typename Vector_::DataType alpha=typename Vector_::DataType(1))
Assembles a force function into a vector.
void assemble_linear_functional_vector(DomainAssembler< Trafo_ > &dom_asm, Vector_ &vector, const LinFunc_ &linear_functional, const Space_ &space, const String &cubature, const typename Vector_::DataType alpha=typename Vector_::DataType(1))
Assembles a linear functional into a vector.
void assemble_bilinear_operator_matrix_2(DomainAssembler< Trafo_ > &dom_asm, Matrix_ &matrix, const BilOp_ &bilinear_operator, const TestSpace_ &test_space, const TrialSpace_ &trial_space, const String &cubature, const typename Matrix_::DataType alpha=typename Matrix_::DataType(1))
Assembles a bilinear operator into a matrix with different test- and trial-spaces.
AnalyticFunctionIntegral< DataType_, Function_ >::Type integrate_analytic_function(DomainAssembler< Trafo_ > &dom_asm, const Function_ &function, const String &cubature)
Assembles the integral of an analytic function.
void assemble_bilinear_operator_matrix_1(DomainAssembler< Trafo_ > &dom_asm, Matrix_ &matrix, const BilOp_ &bilinear_operator, const Space_ &space, const String &cubature, const typename Matrix_::DataType alpha=typename Matrix_::DataType(1))
Assembles a bilinear operator into a matrix with identical test- and trial-spaces.
DiscreteFunctionIntegral< Vector_, Space_ >::Type integrate_error_function(DomainAssembler< Trafo_ > &dom_asm, const Function_ &function, const Vector_ &vector, const Space_ &space, const String &cubature)
Assembles the integral of an (analytic - discrete) error function.
void assemble_bilinear_operator_apply_vector_1(DomainAssembler< Trafo_ > &dom_asm, Vector_ &vector, const VectorSol_ &vec_sol, const BilOp_ &bilinear_operator, const Space_ &space, const String &cubature, const typename Vector_::DataType alpha=typename Vector_::DataType(1))
Assembles the application of a bilinear operator into a vector with identical test- and trial-spaces.
DiscreteFunctionIntegral< Vector_, Space_ >::Type integrate_discrete_function(DomainAssembler< Trafo_ > &dom_asm, const Vector_ &vector, const Space_ &space, const String &cubature)
Assembles the integral of a discrete finite element function.
CUDA_HOST_DEVICE void axpy(T_ &y, const T_ &x, const T_ &alpha)
Performs an AXPY of two scalars.
FEAT namespace.
Definition: adjactor.hpp:12
SpaceTags
Space configuration tags enum.
Definition: eval_tags.hpp:97
@ value
specifies whether the space should supply basis function values
@ hess
specifies whether the space should supply basis function hessians
@ grad
specifies whether the space should supply basis function gradients
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
Definition: eval_tags.hpp:22
@ img_point
specifies whether the trafo should supply image point coordinates
@ jac_det
specifies whether the trafo should supply jacobian determinants
Helper class to determine the FunctionIntegralInfo type for discrete functions.