Loading...
Searching...
No Matches
identity.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "linalg/operator.hpp"
5#include "linalg/vector.hpp"
7
9
10template < typename ScalarT >
12{
13 private:
14 linalg::OperatorApplyMode operator_apply_mode_;
15
16 public:
19 using ScalarType = ScalarT;
20
22 : operator_apply_mode_( operator_apply_mode ) {};
23
24 void apply_impl( const SrcVectorType& src, DstVectorType& dst )
25 {
26 if ( operator_apply_mode_ == linalg::OperatorApplyMode::Replace )
27 {
28 assign( dst, src );
29 }
30 else if ( operator_apply_mode_ == linalg::OperatorApplyMode::Add )
31 {
32 lincomb( dst, { static_cast< ScalarT >( 1.0 ), static_cast< ScalarT >( 1.0 ) }, { dst, src } );
33 }
34 }
35};
36
38
39} // namespace terra::fe::wedge::operators::shell
ScalarT ScalarType
Definition identity.hpp:19
Identity(linalg::OperatorApplyMode operator_apply_mode=linalg::OperatorApplyMode::Replace)
Definition identity.hpp:21
void apply_impl(const SrcVectorType &src, DstVectorType &dst)
Definition identity.hpp:24
Q1 scalar finite element vector on a distributed shell grid.
Definition vector_q1.hpp:21
Concept for types that behave like linear operators.
Definition operator.hpp:57
Definition boundary_mass.hpp:14
OperatorApplyMode
Modes for applying an operator to a vector.
Definition operator.hpp:30
@ Replace
Overwrite the destination vector.
@ Add
Add to the destination vector.