8#ifndef KERNEL_ASSEMBLY_BURGERS_VELO_MATERIAL_ASSEMBLY_JOB_HPP
9#define KERNEL_ASSEMBLY_BURGERS_VELO_MATERIAL_ASSEMBLY_JOB_HPP 1
11#include <kernel/assembly/base.hpp>
12#include <kernel/assembly/asm_traits.hpp>
13#include <kernel/cubature/dynamic_factory.hpp>
14#include <kernel/lafem/dense_vector.hpp>
15#include <kernel/lafem/sparse_matrix_bcsr.hpp>
16#include <kernel/lafem/dense_vector_blocked.hpp>
17#include <kernel/global/vector.hpp>
59 template<
typename DataType_,
typename Space_,
typename ViscFunc_,
typename ViscDerFunc_,
typename ConvVector_>
60 class BurgersVeloMaterialAssemblyJobBase
64 typedef DataType_ DataType;
67 typedef Space_ SpaceType;
70 typedef ConvVector_ ConvVectorType;
73 typedef ViscFunc_ ViscosityFunctionType;
76 typedef ViscDerFunc_ ViscosityDerivFunctionType;
79 ViscosityFunctionType visco_func;
82 ViscosityDerivFunctionType visco_der_func;
97 DataType_ frechet_beta;
115 const ConvVector_& convection_vector;
121 Cubature::DynamicFactory cubature_factory;
124 DataType frechet_material;
142 explicit BurgersVeloMaterialAssemblyJobBase(
const ConvVector_& conv_vector,
const Space_& space_,
const String& cubature,
143 ViscosityFunctionType _visc_fun, ViscosityDerivFunctionType _visc_der_fun) :
144 visco_func(_visc_fun),
145 visco_der_func(_visc_der_fun),
150 frechet_beta(DataType_(0)),
152 sd_delta(DataType_(0)),
154 sd_v_norm(DataType_(0)),
155 reg_eps(DataType_(1E-100)),
156 convection_vector(conv_vector),
158 cubature_factory(cubature),
159 frechet_material(DataType(0)),
173 template<
typename IndexType_,
int conv_dim_>
174 static DataType calc_sd_v_norm(
const LAFEM::DenseVectorBlocked<DataType_, IndexType_, conv_dim_>& convect)
176 const auto* vals = convect.elements();
177 DataType_ r = DataType_(0);
178 for(Index i(0); i < convect.size(); ++i)
179 r = Math::max(r, vals[i].norm_euclid());
195 template<
typename LocalVector_,
typename Mirror_>
196 static DataType calc_sd_v_norm(
const Global::Vector<LocalVector_, Mirror_>& convect)
198 const auto* gate = convect.get_gate();
200 return gate->max(calc_sd_v_norm(convect.local()));
202 return calc_sd_v_norm(convect.local());
211 template<
typename VectorType_>
212 void set_sd_v_norm(
const VectorType_& convect)
214 this->sd_v_norm = calc_sd_v_norm(convect);
247 template<
typename Job_,
typename DataType_,
typename Function_>
248 class BurgersVeloMaterialAssemblyTaskBase
252 static constexpr bool need_scatter =
true;
254 static constexpr bool need_combine =
false;
257 typedef DataType_ DataType;
260 typedef typename Job_::SpaceType SpaceType;
263 typedef typename Job_::ConvVectorType ConvVectorType;
266 static constexpr int shape_dim = SpaceType::shape_dim;
269 static constexpr int conv_dim = ConvVectorType::BlockSize;
272 typedef AsmTraits1<DataType, SpaceType, TrafoTags::jac_det, SpaceTags::value|SpaceTags::grad> AsmTraits;
275 typedef Function_ FunctionType;
281 const FunctionType visco_func;
284 const DataType tol_eps;
287 const bool deformation;
293 const DataType theta;
299 const DataType frechet_beta;
302 const DataType sd_delta;
305 const DataType sd_nu;
308 const DataType sd_v_norm;
311 const DataType material_frechet;
317 const bool need_diff, need_conv, need_conv_frechet, need_reac, need_streamdiff, need_material_frechet;
320 DataType_ gamma_dot, reg_eps, nu_loc;
323 bool need_loc_v, need_loc_grad_v, need_mean_v, need_local_h;
326 const SpaceType& space;
328 const typename AsmTraits::TrafoType& trafo;
330 typename AsmTraits::TrafoEvaluator trafo_eval;
332 typename AsmTraits::SpaceEvaluator space_eval;
334 typename AsmTraits::DofMapping dof_mapping;
336 typename AsmTraits::CubatureRuleType cubature_rule;
338 typename AsmTraits::TrafoEvalData trafo_data;
340 typename AsmTraits::SpaceEvalData space_data;
342 typename ConvVectorType::GatherAxpy gather_conv;
345 static constexpr int max_local_dofs = AsmTraits::max_local_test_dofs;
351 Tiny::Vector<Tiny::Vector<DataType, conv_dim>, max_local_dofs> local_conv_dofs;
354 Tiny::Vector<DataType, conv_dim> loc_v, mean_v;
357 Tiny::Matrix<DataType, conv_dim, conv_dim> loc_grad_v;
360 Tiny::Matrix<DataType, conv_dim, conv_dim> strain_rate_tensor_2;
363 Tiny::Vector<DataType, max_local_dofs> streamdiff_coeffs;
366 Tiny::Vector<DataType, shape_dim> barycenter;
372 DataType local_delta;
375 DataType alpha = DataType(1);
384 explicit BurgersVeloMaterialAssemblyTaskBase(
const Job_& job_) :
386 visco_func(job_.visco_func),
387 tol_eps(Math::
sqrt(Math::
eps<DataType>())),
388 deformation(job_.deformation),
392 frechet_beta(job_.frechet_beta),
393 sd_delta(job_.sd_delta),
395 sd_v_norm(job_.sd_v_norm),
396 material_frechet(job_.frechet_material),
399 need_conv(Math::
abs(beta) > DataType(0)),
400 need_conv_frechet(Math::
abs(frechet_beta) > DataType(0)),
401 need_reac(Math::
abs(theta) > DataType(0)),
402 need_streamdiff((Math::
abs(sd_delta) > DataType(0)) && (sd_v_norm > tol_eps)),
403 need_material_frechet(material_frechet > DataType(0)),
405 reg_eps(job_.reg_eps),
407 need_loc_v(need_conv),
408 need_loc_grad_v(true),
409 need_mean_v(need_streamdiff),
410 need_local_h(need_streamdiff),
412 trafo(space.get_trafo()),
416 cubature_rule(Cubature::ctor_factory, job_.cubature_factory),
419 gather_conv(job_.convection_vector),
425 strain_rate_tensor_2(),
428 local_h(DataType(0)),
429 local_delta(DataType(0)),
433 for(
int i(0); i < shape_dim; ++i)
434 barycenter[i] = Shape::ReferenceCell<typename SpaceType::ShapeType>::template centre<DataType>(i);
443 void prepare(
const Index cell)
446 dof_mapping.prepare(cell);
449 trafo_eval.prepare(cell);
452 space_eval.prepare(trafo_eval);
455 num_local_dofs = space_eval.get_num_local_dofs();
458 local_conv_dofs.format();
459 gather_conv(local_conv_dofs, dof_mapping);
462 if(need_mean_v || need_local_h || need_streamdiff)
465 local_h = local_delta = DataType(0);
468 trafo_eval(trafo_data, barycenter);
469 space_eval(space_data, trafo_data);
473 for(
int i(0); i < num_local_dofs; ++i)
474 mean_v.axpy(space_data.phi[i].value, local_conv_dofs[i]);
477 const DataType local_norm_v = mean_v.norm_euclid();
480 if(local_norm_v > tol_eps)
483 local_h = trafo_eval.width_directed(mean_v) * local_norm_v;
486 const DataType local_re = (local_norm_v * local_h) / this->sd_nu;
489 local_delta = this->sd_delta * (local_h / this->sd_v_norm) * (DataType(2)*local_re) / (DataType(1) + local_re);
504 void prepare_point(
int cubature_point)
507 trafo_eval(trafo_data, cubature_rule.get_point(cubature_point));
510 space_eval(space_data, trafo_data);
513 if(need_loc_v || need_conv || need_streamdiff)
516 for(
int i(0); i < num_local_dofs; ++i)
519 loc_v.axpy(space_data.phi[i].value, local_conv_dofs[i]);
522 if(need_loc_grad_v || need_conv_frechet)
525 for(
int i(0); i < num_local_dofs; ++i)
528 loc_grad_v.add_outer_product(local_conv_dofs[i], space_data.phi[i].grad);
535 for(
int i(0); i < num_local_dofs; ++i)
537 streamdiff_coeffs[i] = Tiny::dot(loc_v, space_data.phi[i].grad);
542 strain_rate_tensor_2.set_transpose(loc_grad_v);
543 strain_rate_tensor_2.axpy(DataType(1.0), loc_grad_v);
544 gamma_dot = Math::sqrt(DataType(0.5))*strain_rate_tensor_2.norm_frobenius();
547 nu_loc = visco_func(gamma_dot, aT);
560 dof_mapping.finish();
591 template<
typename Job_,
typename DataType_,
int block_size_,
typename ViscFun_,
typename ViscDerFun_>
592 class BurgersVeloMaterialBlockedAssemblyTaskBase :
593 public BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFun_>
596 typedef BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFun_> BaseClass;
598 typedef DataType_ DataType;
599 typedef ViscDerFun_ ViscosityDerivFunctionType;
601 using BaseClass::max_local_dofs;
602 using BaseClass::num_local_dofs;
606 typedef Tiny::Matrix<DataType_, block_size_, block_size_> MatrixValue;
607 typedef Tiny::Matrix<MatrixValue, max_local_dofs, max_local_dofs> LocalMatrixType;
608 LocalMatrixType local_matrix;
610 ViscosityDerivFunctionType visco_der_func;
619 explicit BurgersVeloMaterialBlockedAssemblyTaskBase(
const Job_& job_) :
622 visco_der_func(job_.visco_der_func)
632 void assemble_burgers_point(
const DataType weight)
640 for(
int i(0); i < this->num_local_dofs; ++i)
643 for(
int j(0); j < this->num_local_dofs; ++j)
646 const DataType
value = this->nu_loc * weight * Tiny::dot(this->space_data.phi[i].grad, this->space_data.phi[j].grad);
649 local_matrix[i][j].add_scalar_main_diag(value);
653 if(this->deformation)
656 for(
int i(0); i < this->num_local_dofs; ++i)
659 for(
int j(0); j < this->num_local_dofs; ++j)
662 local_matrix[i][j].add_outer_product(this->space_data.phi[j].grad, this->space_data.phi[i].grad, this->nu_loc * weight);
666 if(this->need_material_frechet)
668 const DataType fac = this->material_frechet * visco_der_func(this->gamma_dot, this->aT)/(this->gamma_dot + this->reg_eps);
671 for(
int i(0); i < this->num_local_dofs; ++i)
673 Tiny::Vector<DataType, BaseClass::ConvVectorType::BlockSize> du_grad_phi;
674 du_grad_phi.set_mat_vec_mult(this->strain_rate_tensor_2, this->space_data.phi[i].grad);
677 for(
int j(0); j < this->num_local_dofs; ++j)
679 Tiny::Vector<DataType, BaseClass::ConvVectorType::BlockSize> du_grad_psi;
680 du_grad_psi.set_mat_vec_mult(this->strain_rate_tensor_2, this->space_data.phi[j].grad);
682 local_matrix[i][j].add_outer_product(du_grad_phi, du_grad_psi, fac * weight);
693 for(
int i(0); i < this->num_local_dofs; ++i)
696 for(
int j(0); j < this->num_local_dofs; ++j)
699 const DataType
value = this->beta * weight * this->space_data.phi[i].value * Tiny::dot(this->loc_v, this->space_data.phi[j].grad);
702 local_matrix[i][j].add_scalar_main_diag(value);
708 if(this->need_conv_frechet)
711 for(
int i(0); i < this->num_local_dofs; ++i)
714 for(
int j(0); j < this->num_local_dofs; ++j)
717 const DataType
value = this->frechet_beta * weight * this->space_data.phi[i].value * this->space_data.phi[j].value;
720 local_matrix[i][j].axpy(value, this->loc_grad_v);
729 for(
int i(0); i < this->num_local_dofs; ++i)
732 for(
int j(0); j < this->num_local_dofs; ++j)
735 const DataType
value = this->theta * weight * this->space_data.phi[i].value * this->space_data.phi[j].value;
738 local_matrix[i][j].add_scalar_main_diag(value);
750 void assemble_streamline_diffusion(
const DataType weight)
753 if(this->need_streamdiff && (this->local_delta > this->tol_eps))
756 for(
int i(0); i < this->num_local_dofs; ++i)
759 for(
int j(0); j < this->num_local_dofs; ++j)
762 const DataType
value = this->local_delta * weight * this->streamdiff_coeffs[i] * this->streamdiff_coeffs[j];
765 local_matrix[i][j].add_scalar_main_diag(value);
776 local_matrix.format();
779 for(
int point(0); point < this->cubature_rule.get_num_points(); ++point)
782 this->prepare_point(point);
785 const DataType weight = this->trafo_data.jac_det * this->cubature_rule.get_weight(point);
788 this->assemble_burgers_point(weight);
791 this->assemble_streamline_diffusion(weight);
820 template<
typename Matrix_,
typename Space_,
typename ViscoFunc_,
typename ViscoDerFunc_,
typename ConvVector_ =
typename Matrix_::VectorTypeR>
821 class BurgersVeloMaterialBlockedMatrixAssemblyJob :
822 public BurgersVeloMaterialAssemblyJobBase<typename Matrix_::DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_>
826 typedef Matrix_ MatrixType;
828 typedef typename MatrixType::DataType DataType;
831 typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_> BaseClass;
834 static_assert(Matrix_::BlockHeight == Matrix_::BlockWidth,
"only square matrix blocks are supported here");
837 static constexpr int block_size = Matrix_::BlockHeight;
858 explicit BurgersVeloMaterialBlockedMatrixAssemblyJob(Matrix_& matrix_,
const ConvVector_& conv_vector,
859 const Space_& space_,
const String& cubature_name, ViscoFunc_ visc_fun, ViscoDerFunc_ visc_der_func) :
860 BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_func),
868 public BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedMatrixAssemblyJob, DataType, block_size, ViscoFunc_, ViscoDerFunc_>
871 typedef BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedMatrixAssemblyJob, DataType, block_size, ViscoFunc_, ViscoDerFunc_> BaseClass;
875 typename MatrixType::ScatterAxpy scatter_matrix;
879 explicit Task(
const BurgersVeloMaterialBlockedMatrixAssemblyJob& job_) :
881 scatter_matrix(job_.matrix)
890 this->scatter_matrix(this->local_matrix, this->dof_mapping, this->dof_mapping, this->alpha);
919 template<
typename DiagonalVector_,
typename Space_,
typename ViscoFunc_,
typename ViscoDerFunc_,
typename ConvVector_ = DiagonalVector_>
920 class BurgersVeloMaterialBlockedDiagonalAssemblyJob :
921 public BurgersVeloMaterialAssemblyJobBase<typename DiagonalVector_::DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_>
925 typedef DiagonalVector_ VectorType;
927 typedef typename VectorType::DataType DataType;
930 typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_> BaseClass;
933 static constexpr int block_size = VectorType::BlockSize;
954 explicit BurgersVeloMaterialBlockedDiagonalAssemblyJob(DiagonalVector_& vector_,
const ConvVector_& conv_vector,
955 const Space_& space_,
const String& cubature_name, ViscoFunc_ visc_fun, ViscoDerFunc_ visc_der_func) :
956 BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_func),
964 public BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedDiagonalAssemblyJob, DataType, block_size, ViscoFunc_, ViscoDerFunc_>
967 typedef BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedDiagonalAssemblyJob, DataType, block_size, ViscoFunc_, ViscoDerFunc_> BaseClass;
970 DiagonalVector_& vector;
974 explicit Task(
const BurgersVeloMaterialBlockedDiagonalAssemblyJob& job_) :
985 auto* val_vec = vector.elements();
986 for(
int loc_i = 0; loc_i < this->dof_mapping.get_num_local_dofs(); ++loc_i)
988 const Index cur_i = this->dof_mapping.get_index(loc_i);
989 for(
int k = 0; k < block_size; ++k)
990 val_vec[cur_i][k] += this->local_matrix[loc_i][loc_i][k][k] * this->alpha;
1016 template<
typename Vector_,
typename Space_,
typename ViscFunc_,
typename ViscDerFunc_,
typename ConvVector_ = Vector_>
1017 class BurgersVeloMaterialBlockedVectorAssemblyJob :
1018 public BurgersVeloMaterialAssemblyJobBase<typename Vector_::DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_>
1022 typedef Vector_ VectorType;
1024 typedef typename VectorType::DataType DataType;
1027 typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_> BaseClass;
1030 static constexpr int block_size = Vector_::BlockSize;
1033 VectorType& vector_rhs;
1036 const VectorType& vector_sol;
1059 explicit BurgersVeloMaterialBlockedVectorAssemblyJob(Vector_& rhs_vector_,
const Vector_& sol_vector_,
1060 const ConvVector_& conv_vector,
const Space_& space_,
const String& cubature_name,
1061 ViscFunc_ visc_fun, ViscDerFunc_ visc_der_func) :
1062 BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_func),
1063 vector_rhs(rhs_vector_),
1064 vector_sol(sol_vector_)
1066 XASSERTM(&rhs_vector_ != &sol_vector_,
"rhs and solution vectors must not be the same object");
1068 XASSERTM((
void*)&rhs_vector_ != (
void*)&conv_vector,
"rhs and convection vectors must not be the same object");
1074 public BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedVectorAssemblyJob, DataType, block_size, ViscFunc_, ViscDerFunc_>
1077 typedef BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedVectorAssemblyJob, DataType, block_size, ViscFunc_, ViscDerFunc_> BaseClass;
1079 using BaseClass::max_local_dofs;
1083 typename VectorType::GatherAxpy gather_vec_sol;
1085 typename VectorType::ScatterAxpy scatter_vec_rhs;
1087 const bool sol_equals_conv;
1090 Tiny::Vector<Tiny::Vector<DataType, block_size>, max_local_dofs> local_sol_dofs;
1093 Tiny::Vector<Tiny::Vector<DataType, block_size>, max_local_dofs> local_vector;
1097 explicit Task(
const BurgersVeloMaterialBlockedVectorAssemblyJob& job_) :
1099 gather_vec_sol(job_.vector_sol),
1100 scatter_vec_rhs(job_.vector_rhs),
1101 sol_equals_conv((void*)&job_.vector_sol == (void*)&job_.convection_vector),
1107 void prepare(
const Index cell)
1109 BaseClass::prepare(cell);
1112 if(!sol_equals_conv)
1114 this->local_sol_dofs.format();
1115 this->gather_vec_sol(this->local_sol_dofs, this->dof_mapping);
1122 void compute_local_vector()
1124 local_vector.format();
1127 if(!sol_equals_conv)
1129 for(
int i(0); i < this->num_local_dofs; ++i)
1130 for(
int j(0); j < this->num_local_dofs; ++j)
1131 this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_sol_dofs[j]);
1135 for(
int i(0); i < this->num_local_dofs; ++i)
1136 for(
int j(0); j < this->num_local_dofs; ++j)
1137 this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_conv_dofs[j]);
1144 BaseClass::assemble();
1147 compute_local_vector();
1153 this->scatter_vec_rhs(this->local_vector, this->dof_mapping, this->alpha);
1176 template<
typename Job_,
typename DataType_,
typename ViscFunc_,
typename ViscDerFunc_>
1177 class BurgersVeloMaterialScalarAssemblyTaskBase :
1178 public BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFunc_>
1181 typedef BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFunc_> BaseClass;
1183 typedef DataType_ DataType;
1185 using BaseClass::max_local_dofs;
1186 using BaseClass::num_local_dofs;
1190 typedef Tiny::Matrix<DataType, max_local_dofs, max_local_dofs> LocalMatrixType;
1191 LocalMatrixType local_matrix;
1192 ViscDerFunc_ visco_der_fun;
1201 explicit BurgersVeloMaterialScalarAssemblyTaskBase(
const Job_& job_) :
1204 visco_der_fun(job_.visc_der_fun)
1214 void assemble_burgers_point(
const DataType weight)
1222 for(
int i(0); i < this->num_local_dofs; ++i)
1225 for(
int j(0); j < this->num_local_dofs; ++j)
1227 local_matrix[i][j] += this->nu_loc * weight
1228 * Tiny::dot(this->space_data.phi[i].grad, this->space_data.phi[j].grad);
1239 for(
int i(0); i < this->num_local_dofs; ++i)
1242 for(
int j(0); j < this->num_local_dofs; ++j)
1244 local_matrix[i][j] += this->beta * weight
1245 * this->space_data.phi[i].value * Tiny::dot(this->loc_v, this->space_data.phi[j].grad);
1254 for(
int i(0); i < this->num_local_dofs; ++i)
1257 for(
int j(0); j < this->num_local_dofs; ++j)
1259 local_matrix[i][j] += this->theta * weight
1260 * this->space_data.phi[i].value * this->space_data.phi[j].value;
1272 void assemble_streamline_diffusion(
const DataType weight)
1275 if(this->need_streamdiff && (this->local_delta > this->tol_eps))
1278 for(
int i(0); i < this->num_local_dofs; ++i)
1281 for(
int j(0); j < this->num_local_dofs; ++j)
1283 local_matrix[i][j] += this->local_delta * weight
1284 * this->streamdiff_coeffs[i] * this->streamdiff_coeffs[j];
1295 local_matrix.format();
1298 for(
int point(0); point < this->cubature_rule.get_num_points(); ++point)
1301 this->prepare_point(point);
1304 const DataType weight = this->trafo_data.jac_det * this->cubature_rule.get_weight(point);
1307 this->assemble_burgers_point(weight);
1310 this->assemble_streamline_diffusion(weight);
1335 template<
typename Matrix_,
typename Space_,
typename ViscFunc_,
typename ViscDerFunc_,
typename ConvVector_>
1336 class BurgersVeloMaterialScalarMatrixAssemblyJob :
1337 public BurgersVeloMaterialAssemblyJobBase<typename Matrix_::DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_>
1341 typedef Matrix_ MatrixType;
1343 typedef typename MatrixType::DataType DataType;
1346 typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_> BaseClass;
1367 explicit BurgersVeloMaterialScalarMatrixAssemblyJob(Matrix_& matrix_,
const ConvVector_& conv_vector,
1368 const Space_& space_,
const String& cubature_name,
1369 ViscFunc_ visc_fun, ViscDerFunc_ visc_der_fun) :
1370 BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_fun),
1378 public BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarMatrixAssemblyJob, DataType, ViscFunc_, ViscDerFunc_>
1381 typedef BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarMatrixAssemblyJob, DataType, ViscFunc_, ViscDerFunc_> BaseClass;
1385 typename MatrixType::ScatterAxpy scatter_matrix;
1389 explicit Task(
const BurgersVeloMaterialScalarMatrixAssemblyJob& job_) :
1391 scatter_matrix(job_.matrix)
1400 this->scatter_matrix(this->local_matrix, this->dof_mapping, this->dof_mapping, this->alpha);
1425 template<
typename Vector_,
typename Space_,
typename ViscoFunc_,
typename ViscoDerFunc_,
typename ConvVector_>
1426 class BurgersVeloMaterialScalarVectorAssemblyJob :
1427 public BurgersVeloMaterialAssemblyJobBase<typename Vector_::DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_>
1431 typedef Vector_ VectorType;
1433 typedef typename VectorType::DataType DataType;
1436 typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_> BaseClass;
1439 VectorType& vector_rhs;
1442 const VectorType& vector_sol;
1465 explicit BurgersVeloMaterialScalarVectorAssemblyJob(Vector_& rhs_vector_,
const Vector_& sol_vector_,
1466 const ConvVector_& conv_vector,
const Space_& space_,
const String& cubature_name) :
1467 BaseClass(conv_vector, space_, cubature_name),
1468 vector_rhs(rhs_vector_),
1469 vector_sol(sol_vector_)
1471 XASSERTM(&rhs_vector_ != &sol_vector_,
"rhs and solution vectors must not be the same object");
1477 public BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarVectorAssemblyJob, DataType, ViscoFunc_, ViscoDerFunc_>
1480 typedef BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarVectorAssemblyJob, DataType, ViscoFunc_, ViscoDerFunc_> BaseClass;
1482 using BaseClass::max_local_dofs;
1486 typename VectorType::GatherAxpy gather_vec_sol;
1488 typename VectorType::ScatterAxpy scatter_vec_rhs;
1491 Tiny::Vector<DataType, max_local_dofs> local_sol_dofs;
1494 Tiny::Vector<DataType, max_local_dofs> local_vector;
1498 explicit Task(
const BurgersVeloMaterialScalarVectorAssemblyJob& job_) :
1500 gather_vec_sol(job_.vector_sol),
1501 scatter_vec_rhs(job_.vector_rhs),
1507 void prepare(
const Index cell)
1509 BaseClass::prepare(cell);
1512 this->local_sol_dofs.format();
1513 this->gather_vec_sol(this->local_sol_dofs, this->dof_mapping);
1519 void compute_local_vector()
1522 this->local_vector.format();
1523 for(
int i(0); i < this->num_local_dofs; ++i)
1524 for(
int j(0); j < this->num_local_dofs; ++j)
1525 this->local_vector[i] += this->local_matrix(i,j) * this->local_sol_dofs[j];
1532 BaseClass::assemble();
1535 compute_local_vector();
1541 this->scatter_vec_rhs(this->local_vector, this->dof_mapping, this->alpha);
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
T_ sqrt(T_ x)
Returns the square-root of a value.
T_ abs(T_ x)
Returns the absolute value.
T_ eps()
Returns the machine precision constant for a floating-point data type.
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.