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);
 
  915    template<
typename Vector_, 
typename Space_, 
typename ViscFunc_, 
typename ViscDerFunc_, 
typename ConvVector_ = Vector_>
 
  916    class BurgersVeloMaterialBlockedVectorAssemblyJob :
 
  917      public BurgersVeloMaterialAssemblyJobBase<typename Vector_::DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_>
 
  921      typedef Vector_ VectorType;
 
  923      typedef typename VectorType::DataType DataType;
 
  926      typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_> BaseClass;
 
  929      static constexpr int block_size = Vector_::BlockSize;
 
  932      VectorType& vector_rhs;
 
  935      const VectorType& vector_sol;
 
  958      explicit BurgersVeloMaterialBlockedVectorAssemblyJob(Vector_& rhs_vector_, 
const Vector_& sol_vector_,
 
  959        const ConvVector_& conv_vector, 
const Space_& space_, 
const String& cubature_name,
 
  960        ViscFunc_ visc_fun, ViscDerFunc_ visc_der_func) :
 
  961        BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_func),
 
  962        vector_rhs(rhs_vector_),
 
  963        vector_sol(sol_vector_)
 
  965        XASSERTM(&rhs_vector_ != &sol_vector_, 
"rhs and solution vectors must not be the same object");
 
  967        XASSERTM((
void*)&rhs_vector_ != (
void*)&conv_vector, 
"rhs and convection vectors must not be the same object");
 
  973        public BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedVectorAssemblyJob, DataType, block_size, ViscFunc_, ViscDerFunc_>
 
  976        typedef BurgersVeloMaterialBlockedAssemblyTaskBase<BurgersVeloMaterialBlockedVectorAssemblyJob, DataType, block_size, ViscFunc_, ViscDerFunc_> BaseClass;
 
  978        using BaseClass::max_local_dofs;
 
  982        typename VectorType::GatherAxpy gather_vec_sol;
 
  984        typename VectorType::ScatterAxpy scatter_vec_rhs;
 
  986        const bool sol_equals_conv;
 
  989        Tiny::Vector<Tiny::Vector<DataType, block_size>, max_local_dofs> local_sol_dofs;
 
  992        Tiny::Vector<Tiny::Vector<DataType, block_size>, max_local_dofs> local_vector;
 
  996        explicit Task(
const BurgersVeloMaterialBlockedVectorAssemblyJob& job_) :
 
  998          gather_vec_sol(job_.vector_sol),
 
  999          scatter_vec_rhs(job_.vector_rhs),
 
 1000          sol_equals_conv((void*)&job_.vector_sol == (void*)&job_.convection_vector),
 
 1006        void prepare(
const Index cell)
 
 1008          BaseClass::prepare(cell);
 
 1011          if(!sol_equals_conv)
 
 1013            this->local_sol_dofs.format();
 
 1014            this->gather_vec_sol(this->local_sol_dofs, this->dof_mapping);
 
 1021        void compute_local_vector()
 
 1023          local_vector.format();
 
 1026          if(!sol_equals_conv)
 
 1028            for(
int i(0); i < this->num_local_dofs; ++i)
 
 1029              for(
int j(0); j < this->num_local_dofs; ++j)
 
 1030                this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_sol_dofs[j]);
 
 1034            for(
int i(0); i < this->num_local_dofs; ++i)
 
 1035              for(
int j(0); j < this->num_local_dofs; ++j)
 
 1036                this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_conv_dofs[j]);
 
 1043          BaseClass::assemble();
 
 1046          compute_local_vector();
 
 1052          this->scatter_vec_rhs(this->local_vector, this->dof_mapping, this->alpha);
 
 1075    template<
typename Job_, 
typename DataType_, 
typename ViscFunc_, 
typename ViscDerFunc_>
 
 1076    class BurgersVeloMaterialScalarAssemblyTaskBase :
 
 1077      public BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFunc_>
 
 1080      typedef BurgersVeloMaterialAssemblyTaskBase<Job_, DataType_, ViscFunc_> BaseClass;
 
 1082      typedef DataType_ DataType;
 
 1084      using BaseClass::max_local_dofs;
 
 1085      using BaseClass::num_local_dofs;
 
 1089      typedef Tiny::Matrix<DataType, max_local_dofs, max_local_dofs> LocalMatrixType;
 
 1090      LocalMatrixType local_matrix;
 
 1091      ViscDerFunc_ visco_der_fun;
 
 1100      explicit BurgersVeloMaterialScalarAssemblyTaskBase(
const Job_& job_) :
 
 1103        visco_der_fun(job_.visc_der_fun)
 
 1113      void assemble_burgers_point(
const DataType weight)
 
 1121          for(
int i(0); i < this->num_local_dofs; ++i)
 
 1124            for(
int j(0); j < this->num_local_dofs; ++j)
 
 1126              local_matrix[i][j] += this->nu_loc * weight
 
 1127                * Tiny::dot(this->space_data.phi[i].grad, this->space_data.phi[j].grad);
 
 1138          for(
int i(0); i < this->num_local_dofs; ++i)
 
 1141            for(
int j(0); j < this->num_local_dofs; ++j)
 
 1143              local_matrix[i][j] += this->beta * weight
 
 1144                * this->space_data.phi[i].value * Tiny::dot(this->loc_v, this->space_data.phi[j].grad);
 
 1153          for(
int i(0); i < this->num_local_dofs; ++i)
 
 1156            for(
int j(0); j < this->num_local_dofs; ++j)
 
 1158              local_matrix[i][j] += this->theta * weight
 
 1159                * this->space_data.phi[i].value * this->space_data.phi[j].value;
 
 1171      void assemble_streamline_diffusion(
const DataType weight)
 
 1174        if(this->need_streamdiff && (this->local_delta > this->tol_eps))
 
 1177          for(
int i(0); i < this->num_local_dofs; ++i)
 
 1180            for(
int j(0); j < this->num_local_dofs; ++j)
 
 1182              local_matrix[i][j] += this->local_delta * weight
 
 1183                * this->streamdiff_coeffs[i] * this->streamdiff_coeffs[j];
 
 1194        local_matrix.format();
 
 1197        for(
int point(0); point < this->cubature_rule.get_num_points(); ++point)
 
 1200          this->prepare_point(point);
 
 1203          const DataType weight = this->trafo_data.jac_det * this->cubature_rule.get_weight(point);
 
 1206          this->assemble_burgers_point(weight);
 
 1209          this->assemble_streamline_diffusion(weight);
 
 1234    template<
typename Matrix_, 
typename Space_, 
typename ViscFunc_, 
typename ViscDerFunc_, 
typename ConvVector_>
 
 1235    class BurgersVeloMaterialScalarMatrixAssemblyJob :
 
 1236      public BurgersVeloMaterialAssemblyJobBase<typename Matrix_::DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_>
 
 1240      typedef Matrix_ MatrixType;
 
 1242      typedef typename MatrixType::DataType DataType;
 
 1245      typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscFunc_, ViscDerFunc_, ConvVector_> BaseClass;
 
 1266      explicit BurgersVeloMaterialScalarMatrixAssemblyJob(Matrix_& matrix_, 
const ConvVector_& conv_vector,
 
 1267        const Space_& space_, 
const String& cubature_name,
 
 1268        ViscFunc_ visc_fun, ViscDerFunc_ visc_der_fun) :
 
 1269        BaseClass(conv_vector, space_, cubature_name, visc_fun, visc_der_fun),
 
 1277        public BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarMatrixAssemblyJob, DataType, ViscFunc_, ViscDerFunc_>
 
 1280        typedef BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarMatrixAssemblyJob, DataType, ViscFunc_, ViscDerFunc_> BaseClass;
 
 1284        typename MatrixType::ScatterAxpy scatter_matrix;
 
 1288        explicit Task(
const BurgersVeloMaterialScalarMatrixAssemblyJob& job_) :
 
 1290          scatter_matrix(job_.matrix)
 
 1299          this->scatter_matrix(this->local_matrix, this->dof_mapping, this->dof_mapping, this->alpha);
 
 1324    template<
typename Vector_, 
typename Space_, 
typename ViscoFunc_, 
typename ViscoDerFunc_, 
typename ConvVector_>
 
 1325    class BurgersVeloMaterialScalarVectorAssemblyJob :
 
 1326      public BurgersVeloMaterialAssemblyJobBase<typename Vector_::DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_>
 
 1330      typedef Vector_ VectorType;
 
 1332      typedef typename VectorType::DataType DataType;
 
 1335      typedef BurgersVeloMaterialAssemblyJobBase<DataType, Space_, ViscoFunc_, ViscoDerFunc_, ConvVector_> BaseClass;
 
 1338      VectorType& vector_rhs;
 
 1341      const VectorType& vector_sol;
 
 1364      explicit BurgersVeloMaterialScalarVectorAssemblyJob(Vector_& rhs_vector_, 
const Vector_& sol_vector_,
 
 1365        const ConvVector_& conv_vector, 
const Space_& space_, 
const String& cubature_name) :
 
 1366        BaseClass(conv_vector, space_, cubature_name),
 
 1367        vector_rhs(rhs_vector_),
 
 1368        vector_sol(sol_vector_)
 
 1370        XASSERTM(&rhs_vector_ != &sol_vector_, 
"rhs and solution vectors must not be the same object");
 
 1376        public BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarVectorAssemblyJob, DataType, ViscoFunc_, ViscoDerFunc_>
 
 1379        typedef BurgersVeloMaterialScalarAssemblyTaskBase<BurgersVeloMaterialScalarVectorAssemblyJob, DataType, ViscoFunc_, ViscoDerFunc_> BaseClass;
 
 1381        using BaseClass::max_local_dofs;
 
 1385        typename VectorType::GatherAxpy gather_vec_sol;
 
 1387        typename VectorType::ScatterAxpy scatter_vec_rhs;
 
 1390        Tiny::Vector<DataType, max_local_dofs> local_sol_dofs;
 
 1393        Tiny::Vector<DataType, max_local_dofs> local_vector;
 
 1397        explicit Task(
const BurgersVeloMaterialScalarVectorAssemblyJob& job_) :
 
 1399          gather_vec_sol(job_.vector_sol),
 
 1400          scatter_vec_rhs(job_.vector_rhs),
 
 1406        void prepare(
const Index cell)
 
 1408          BaseClass::prepare(cell);
 
 1411          this->local_sol_dofs.format();
 
 1412          this->gather_vec_sol(this->local_sol_dofs, this->dof_mapping);
 
 1418        void compute_local_vector()
 
 1421          this->local_vector.format();
 
 1422          for(
int i(0); i < this->num_local_dofs; ++i)
 
 1423            for(
int j(0); j < this->num_local_dofs; ++j)
 
 1424              this->local_vector[i] += this->local_matrix(i,j) * this->local_sol_dofs[j];
 
 1431          BaseClass::assemble();
 
 1434          compute_local_vector();
 
 1440          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