BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
op_VectorPlus.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_OP_VECTORPLUS_HPP
13#define BELFEM_OP_VECTORPLUS_HPP
14
15#include "cl_Vector.hpp"
16
17namespace belfem
18{
19//------------------------------------------------------------------------------
20
21 template< typename T >
22 inline auto
23 operator+( const Vector<T> & aA,
24 const Vector<T> & aB )
25 -> decltype( aA.vector_data() + aB.vector_data() )
26 {
27 BELFEM_ASSERT( aA.length() == aB.length(),
28 "Length of vectors does not match ( %lu and %lu ).",
29 ( long unsigned int ) aA.length(),
30 ( long unsigned int ) aB.length() );
31
32 return aA.vector_data() + aB.vector_data();
33 }
34
35// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36
37 template< typename A, typename B >
38 inline auto
40 const B & aB )
41 -> decltype( aA.vector_data() + aB )
42 {
43
44 return aA.vector_data() + aB ;
45 }
46
47// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48
49 template< typename A, typename B >
50 inline auto
51 operator+( const A & aA,
52 const Vector< B > & aB )
53 -> decltype( aA + aB.vector_data() )
54 {
55
56 return aA + aB.vector_data() ;
57 }
58
59//------------------------------------------------------------------------------
60
61}
62#endif //BELFEM_OP_VECTORPLUS_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Column vector.
Definition cl_BZ_Vector.hpp:41
USER GUIDES:
Definition cl_Capacitor.cpp:16
auto operator+(const Matrix< T > &aA, const Matrix< T > &aB) -> decltype(aA.matrix_data()+aB.matrix_data())
Definition op_MatrixPlus.hpp:23