8#include <kernel/assembly/base.hpp> 
    9#include <kernel/assembly/asm_traits.hpp> 
   10#include <kernel/cubature/dynamic_factory.hpp> 
   11#include <kernel/lafem/dense_vector.hpp> 
   12#include <kernel/lafem/sparse_matrix_bcsr.hpp> 
   13#include <kernel/lafem/dense_vector_blocked.hpp> 
   14#include <kernel/global/vector.hpp> 
  100    template<
typename DataType_, 
typename Space_, 
typename ConvVector_>
 
  183      template<
typename IndexType_, 
int conv_dim_>
 
  186        const auto* vals = convect.
elements();
 
  187        DataType_ r = DataType_(0);
 
  205      template<
typename LocalVector_, 
typename Mirror_>
 
  208        const auto* gate = convect.
get_gate();
 
  221      template<
typename VectorType_>
 
  253    template<
typename Job_, 
typename DataType_>
 
  275      static constexpr int conv_dim = ConvVectorType::BlockSize;
 
  311      const bool need_diff, need_conv, need_conv_frechet, need_reac, need_streamdiff;
 
  386        need_loc_grad_v(need_conv_frechet),
 
  387        need_mean_v(need_streamdiff),
 
  388        need_local_h(need_streamdiff),
 
  394        cubature_rule(Cubature::ctor_factory, job_.cubature_factory),
 
  438        if(need_mean_v || need_local_h || need_streamdiff)
 
  489        if(
need_loc_v || need_conv || need_streamdiff)
 
  498        if(need_loc_grad_v || need_conv_frechet)
 
  559    template<
typename Job_, 
typename DataType_, 
int block_size_>
 
  566      typedef DataType_ DataType;
 
  652        if(this->need_conv_frechet)
 
  723        for(
int point(0); point < this->
cubature_rule.get_num_points(); ++point)
 
  760    template<
typename Matrix_, 
typename Space_, 
typename ConvVector_ = 
typename Matrix_::VectorTypeR>
 
  774      static_assert(Matrix_::BlockHeight == Matrix_::BlockWidth, 
"only square matrix blocks are supported here");
 
  799        const Space_& space_, 
const String& cubature_name) :
 
  800        BaseClass(conv_vector, space_, cubature_name),
 
  855    template<
typename Vector_, 
typename Space_, 
typename ConvVector_ = Vector_>
 
  899        const ConvVector_& conv_vector, 
const Space_& space_, 
const String& cubature_name) :
 
  900        BaseClass(conv_vector, space_, cubature_name),
 
  904        XASSERTM(&rhs_vector_ != &sol_vector_, 
"rhs and solution vectors must not be the same object");
 
  906        XASSERTM((
void*)&rhs_vector_ != (
void*)&conv_vector, 
"rhs and convection vectors must not be the same object");
 
  945        void prepare(
const Index cell)
 
  952            this->local_sol_dofs.
format();
 
  969                this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->local_sol_dofs[j]);
 
  975                this->local_vector[i].add_mat_vec_mult(this->local_matrix(i,j), this->
local_conv_dofs[j]);
 
 1012    template<
typename Job_, 
typename DataType_>
 
 1019      typedef DataType_ DataType;
 
 1061              local_matrix[i][j] += this->
nu * weight
 
 1076              local_matrix[i][j] += this->
beta * weight
 
 1091              local_matrix[i][j] += this->
theta * weight
 
 1130        for(
int point(0); point < this->
cubature_rule.get_num_points(); ++point)
 
 1167    template<
typename Matrix_, 
typename Space_, 
typename ConvVector_>
 
 1200        const Space_& space_, 
const String& cubature_name) :
 
 1201        BaseClass(conv_vector, space_, cubature_name),
 
 1256    template<
typename Vector_, 
typename Space_, 
typename ConvVector_>
 
 1297        const ConvVector_& conv_vector, 
const Space_& space_, 
const String& cubature_name) :
 
 1298        BaseClass(conv_vector, space_, cubature_name),
 
 1302        XASSERTM(&rhs_vector_ != &sol_vector_, 
"rhs and solution vectors must not be the same object");
 
 1338        void prepare(
const Index cell)
 
 1343          this->local_sol_dofs.
format();
 
 1353          this->local_vector.
format();
 
 1356              this->local_vector[i] += this->local_matrix(i,j) * this->local_sol_dofs[j];
 
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Common single-space assembly traits class template.
TrafoType::template Evaluator< ShapeType, DataType >::Type TrafoEvaluator
trafo evaluator type
SpaceEvaluator::template ConfigTraits< space_config >::EvalDataType SpaceEvalData
space evaluation data types
Intern::CubatureTraits< TrafoEvaluator >::RuleType CubatureRuleType
cubature rule type
SpaceType::TrafoType TrafoType
trafo type
SpaceType::DofMappingType DofMapping
dof-mapping types
TrafoEvaluator::template ConfigTraits< trafo_config >::EvalDataType TrafoEvalData
trafo evaluation data type
SpaceType::template Evaluator< TrafoEvaluator >::Type SpaceEvaluator
space evaluator types
Base class for Burgers assembly jobs.
const ConvVector_ & convection_vector
the convection vector to be used
ConvVector_ ConvVectorType
the convection vector type
DataType_ sd_delta
scaling parameter for streamline diffusion stabilization operator S
static DataType calc_sd_v_norm(const Global::Vector< LocalVector_, Mirror_ > &convect)
Calculates the convection field norm  for the streamline diffusion parameter delta_T.
void set_sd_v_norm(const VectorType_ &convect)
Sets the convection field norm  for the local streamline diffusion parameter delta_T.
DataType_ beta
scaling parameter for convective operator K
DataType_ frechet_beta
scaling parameter for Frechet derivative of convective operator K'
bool deformation
specifies whether to use the deformation tensor
Cubature::DynamicFactory cubature_factory
the cubature factory to use
Space_ SpaceType
the space type
BurgersAssemblyJobBase(const ConvVector_ &conv_vector, const Space_ &space_, const String &cubature)
Constructor.
DataType_ nu
scaling parameter for diffusive operator L (aka viscosity)
static DataType calc_sd_v_norm(const LAFEM::DenseVectorBlocked< DataType_, IndexType_, conv_dim_ > &convect)
Calculates the convection field norm  for the local streamline diffusion parameter delta_T.
DataType_ DataType
the datatype we use here
DataType_ sd_v_norm
velocity norm for streamline diffusion
const Space_ & space
the test-/trial-space to be used
DataType_ sd_nu
viscosity parameter nu_S for streamline diffusion (usually equal to nu)
DataType_ theta
scaling parameter for reactive operator M
Base class for Burgers assembly tasks.
static constexpr int max_local_dofs
maximum number of local dofs
AsmTraits::CubatureRuleType cubature_rule
the cubature rule used for integration
Tiny::Vector< DataType, shape_dim > barycenter
reference element barycenter
const AsmTraits::TrafoType & trafo
the cubature factory used for integration
const DataType tol_eps
tolerance for checks == 0: sqrt(eps)
void prepare(const Index cell)
Prepares the assembly task for a cell/element.
AsmTraits::TrafoEvaluator trafo_eval
the trafo evaluator
AsmTraits1< DataType, SpaceType, TrafoTags::jac_det, SpaceTags::value|SpaceTags::grad > AsmTraits
our assembly traits
ConvVectorType::GatherAxpy gather_conv
convection vector gather-axpy object
void combine()
Finalizes the assembly.
DataType local_delta
local delta for streamline diffusion
const DataType sd_nu
viscosity parameter nu_S for streamline diffusion (usually equal to nu)
const SpaceType & space
the test-/trial-space to be used
void finish()
Finishes the assembly on the current cell.
const DataType sd_delta
scaling parameter for streamline diffusion stabilization operator S
Tiny::Matrix< DataType, conv_dim, conv_dim > loc_grad_v
local convection field gradient
const DataType nu
scaling parameter for diffusive operator L (aka viscosity)
const Job_ & job
a reference to our job object
const DataType theta
scaling parameter for reactive operator M
const bool deformation
specifies whether to use the deformation tensor
Tiny::Vector< DataType, max_local_dofs > streamdiff_coeffs
local streamline diffusion coefficients
BurgersAssemblyTaskBase(const Job_ &job_)
Constructor.
DataType_ DataType
the data type to be used by the assembly
static constexpr bool need_combine
this task doesn't need to combine
static constexpr int conv_dim
the convection vector dimension
Tiny::Vector< Tiny::Vector< DataType, conv_dim >, max_local_dofs > local_conv_dofs
local convection field dofs
int num_local_dofs
actual number of local dofs on current element
AsmTraits::SpaceEvaluator space_eval
the space evaluator
Job_::SpaceType SpaceType
the space type
Tiny::Vector< DataType, conv_dim > loc_v
local convection field value
static constexpr bool need_scatter
this task needs to scatter
bool need_loc_v
enable computation of certain quantities
AsmTraits::DofMapping dof_mapping
the space dof-mapping
AsmTraits::TrafoEvalData trafo_data
the trafo evaluation data
const DataType frechet_beta
scaling parameter for Frechet derivative of convective operator K'
DataType local_h
local mesh width for streamline diffusion
const DataType sd_v_norm
velocity norm for streamline diffusion
void prepare_point(int cubature_point)
Prepares the task for a cubature point.
const bool need_diff
keep track what we need to assemble
Job_::ConvVectorType ConvVectorType
the convection vector type
static constexpr int shape_dim
the shape dimension
AsmTraits::SpaceEvalData space_data
the space evaluation data
const DataType beta
scaling parameter for convective operator K
Base class for blocked Burgers assembly tasks.
static constexpr int max_local_dofs
maximum number of local dofs
BurgersBlockedAssemblyTaskBase(const Job_ &job_)
Constructor.
void assemble()
Performs the assembly of the local matrix.
void assemble_streamline_diffusion(const DataType weight)
Assembles the Streamline Diffusion stabilization operator in a single cubature point.
Tiny::Matrix< DataType_, block_size_, block_size_ > MatrixValue
our local matrix data
void assemble_burgers_point(const DataType weight)
Assembles the Burger operator in a single cubature point.
int num_local_dofs
actual number of local dofs on current element
void scatter()
scatters the local matrix
MatrixType::ScatterAxpy scatter_matrix
matrix scatter-axpy object
Task(const BurgersBlockedMatrixAssemblyJob &job_)
constructor
Burgers assembly job for block matrix.
MatrixType::DataType DataType
the data type
static constexpr int block_size
the block size
Matrix_ MatrixType
the matrix type
BurgersBlockedMatrixAssemblyJob(Matrix_ &matrix_, const ConvVector_ &conv_vector, const Space_ &space_, const String &cubature_name)
Constructor.
MatrixType & matrix
the matrix to be assembled
BurgersAssemblyJobBase< DataType, Space_, ConvVector_ > BaseClass
our base class
void compute_local_vector()
Computes the local vector by multiplying the local matrix by the solution vector.
const bool sol_equals_conv
specifies whether the solution vector and the convection vector are the same object
Task(const BurgersBlockedVectorAssemblyJob &job_)
constructor
Tiny::Vector< Tiny::Vector< DataType, block_size >, max_local_dofs > local_sol_dofs
local solution vector dofs
Tiny::Vector< Tiny::Vector< DataType, block_size >, max_local_dofs > local_vector
local rhs vector dofs
VectorType::ScatterAxpy scatter_vec_rhs
rhs vector scatter-axpy object
VectorType::GatherAxpy gather_vec_sol
sol vector gather-axpy object
void scatter()
scatters the local vector
Burgers assembly job for block right-hand-side vector.
VectorType::DataType DataType
the data type
Vector_ VectorType
the vector type
BurgersBlockedVectorAssemblyJob(Vector_ &rhs_vector_, const Vector_ &sol_vector_, const ConvVector_ &conv_vector, const Space_ &space_, const String &cubature_name)
Constructor.
BurgersAssemblyJobBase< DataType, Space_, ConvVector_ > BaseClass
our base class
VectorType & vector_rhs
the RHS vector to be assembled
const VectorType & vector_sol
the solution vector
static constexpr int block_size
the block size
Base class for scalar Burgers assembly tasks.
static constexpr int max_local_dofs
maximum number of local dofs
void assemble_burgers_point(const DataType weight)
Assembles the Burger operator in a single cubature point.
void assemble_streamline_diffusion(const DataType weight)
Assembles the Streamline Diffusion stabilization operator in a single cubature point.
BurgersScalarAssemblyTaskBase(const Job_ &job_)
Constructor.
int num_local_dofs
actual number of local dofs on current element
void assemble()
Performs the assembly of the local matrix.
Tiny::Matrix< DataType, max_local_dofs, max_local_dofs > LocalMatrixType
our local matrix data
void scatter()
scatters the local matrix
MatrixType::ScatterAxpy scatter_matrix
matrix scatter-axpy object
Task(const BurgersScalarMatrixAssemblyJob &job_)
constructor
Burgers assembly job for scalar matrix.
BurgersScalarMatrixAssemblyJob(Matrix_ &matrix_, const ConvVector_ &conv_vector, const Space_ &space_, const String &cubature_name)
Constructor.
MatrixType::DataType DataType
the data type
BurgersAssemblyJobBase< DataType, Space_, ConvVector_ > BaseClass
our base class
Matrix_ MatrixType
the matrix type
MatrixType & matrix
the matrix to be assembled
Tiny::Vector< DataType, max_local_dofs > local_vector
local rhs vector dofs
VectorType::GatherAxpy gather_vec_sol
sol vector gather-axpy object
void compute_local_vector()
Computes the local vector by multiplying the local matrix by the solution vector.
Tiny::Vector< DataType, max_local_dofs > local_sol_dofs
local solution vector dofs
VectorType::ScatterAxpy scatter_vec_rhs
rhs vector scatter-axpy object
Task(const BurgersScalarVectorAssemblyJob &job_)
constructor
void scatter()
scatters the local vector
Burgers assembly job for scalar right-hand-side vector.
Vector_ VectorType
the vector type
BurgersScalarVectorAssemblyJob(Vector_ &rhs_vector_, const Vector_ &sol_vector_, const ConvVector_ &conv_vector, const Space_ &space_, const String &cubature_name)
Constructor.
VectorType::DataType DataType
the data type
const VectorType & vector_sol
the solution vector
VectorType & vector_rhs
the RHS vector to be assembled
BurgersAssemblyJobBase< DataType, Space_, ConvVector_ > BaseClass
our base class
DataType max(DataType x) const
Computes the maximum of a scalar variable over all processes.
Global vector wrapper class template.
const GateType * get_gate() const
Returns a const pointer to the internal gate of the vector.
LocalVector_ & local()
Returns a reference to the internal local LAFEM vector object.
Blocked Dense data vector class template.
auto elements() const -> const typename Intern::DenseVectorBlockedPerspectiveHelper< DT_, BlockSize_, perspective_ >::Type *
Retrieve a pointer to the data array.
Index size() const
The number of elements.
String class implementation.
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & add_scalar_main_diag(DataType alpha)
Adds a value onto the matrix's main diagonal.
CUDA_HOST_DEVICE Matrix & add_outer_product(const Vector< T_, m_, snx_ > &x, const Vector< T_, n_, sny_ > &y, const DataType alpha=DataType(1))
Adds the outer product of two vectors onto the matrix.
CUDA_HOST_DEVICE Matrix & axpy(DataType alpha, const Matrix< T_, m_, n_, sma_, sna_ > &a)
Adds another scaled matrix onto this matrix.
CUDA_HOST_DEVICE void format(DataType alpha=DataType(0))
Formats the matrix.
Tiny Vector class template.
CUDA_HOST_DEVICE void format(DataType alpha=DataType(0))
Formats the vector.
CUDA_HOST_DEVICE Vector & axpy(DataType alpha, const Vector< T_, n_, snx_ > &x)
Adds another scaled vector onto this vector.
CUDA_HOST_DEVICE DataType norm_euclid() const
Computes the euclid norm of this vector.
T_ max(T_ a, T_ b)
Returns the maximum of two values.
CUDA_HOST_DEVICE T_ dot(const T_ &a, const T_ &b)
Computes the dot-product of two scalars.
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.
Reference cell traits structure.