BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_sum.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
18
19#ifndef BELFEM_FN_SUM_HPP
20#define BELFEM_FN_SUM_HPP
21
22#include "cl_Vector.hpp"
23
24namespace belfem
25{
26//------------------------------------------------------------------------------
27
28#ifdef BELFEM_ARMADILLO
29 template< typename T>
30 T
31 sum( const arma::Mat< T > & aA )
32 {
33 return arma::as_scalar( arma::accu( aA ) );
34 }
35#elif BELFEM_BLAZE
36 template< typename T>
37 auto
38 sum( const blaze::DynamicVector< T, blaze::columnVector > & aA )
39 -> decltype( blaze::sum( aA ) )
40 {
41 return blaze::sum( aA );
42 }
43#endif
44
45// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46
47 template< typename T>
48 auto
49 sum( const Vector< T > & aA )
50 -> decltype( sum( aA.vector_data() ) )
51 {
52 return sum( aA.vector_data() );
53 }
54
55//------------------------------------------------------------------------------
56}
57
58#endif //BELFEM_FN_SUM_HPP
Column vector.
Definition cl_BZ_Vector.hpp:41
USER GUIDES:
Definition cl_Capacitor.cpp:16
@ T
Definition cl_Material.hpp:122
auto sum(const Vector< T > &aA) -> decltype(sum(aA.vector_data()))
Definition fn_sum.hpp:49