BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
fn_combine.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
21
22
#ifndef FN_COMBINE_HPP
23
#define FN_COMBINE_HPP
24
25
#include <cstring>
// for std::memcpy
26
#include "
cl_Vector.hpp
"
27
28
namespace
belfem
29
{
30
template
<
typename
T >
31
void
32
combine
(
const
Vector< T >
& aA,
const
Vector< T >
& aB,
Vector< T >
& aC )
33
{
34
#ifdef BELFEM_ARMADILLO
35
aC.
vector_data
() = arma::join_cols( aA.
vector_data
() , aB.
vector_data
() );
36
#else
37
aC.
set_size
( aA.
length
() + aB.
length
() );
38
39
index_t
tCount = 0 ;
40
41
for
( T tVal : aA )
42
{
43
aC( tCount++ ) = tVal ;
44
}
45
for
( T tVal : aB )
46
{
47
aC( tCount++ ) = tVal;
48
}
49
#endif
50
}
51
52
template
<
typename
T >
53
void
54
combine
(
const
Vector< T >
& aA,
const
Vector< T >
& aB,
const
Vector< T >
& aC,
Vector< T >
& aD )
55
{
56
#ifdef BELFEM_ARMADILLO
57
aD.
vector_data
() = arma::join_cols( arma::join_cols( aA.
vector_data
(), aB.
vector_data
() ), aC.
vector_data
() );
58
#else
59
aD.
set_size
( aA.
length
() + aB.
length
() + aC.
length
() );
60
index_t
tCount = 0 ;
61
for
( T tVal : aA )
62
{
63
aD( tCount++ ) = tVal ;
64
}
65
for
( T tVal : aB )
66
{
67
aD( tCount++ ) = tVal;
68
}
69
for
( T tVal : aC )
70
{
71
aD( tCount++ ) = tVal;
72
}
73
#endif
74
}
75
76
template
<
typename
T >
77
void
78
combine
(
const
Vector< T >
& aA,
const
Vector< T >
& aB,
const
Vector< T >
& aC,
const
Vector< T >
& aD,
Vector< T >
& aE )
79
{
80
#ifdef BELFEM_ARMADILLO
81
aE.
vector_data
() = arma::join_cols( arma::join_cols( arma::join_cols( aA.
vector_data
(), aB.
vector_data
() ), aC.
vector_data
() ), aD.
vector_data
() );
82
#else
83
aE.
set_size
( aA.
length
() + aB.
length
() + aC.
length
() + aD.
length
() );
84
index_t
tCount = 0 ;
85
for
( T tVal : aA )
86
{
87
aE( tCount++ ) = tVal ;
88
}
89
for
( T tVal : aB )
90
{
91
aE( tCount++ ) = tVal;
92
}
93
for
( T tVal : aC )
94
{
95
aE( tCount++ ) = tVal;
96
}
97
for
( T tVal : aD )
98
{
99
aE( tCount++ ) = tVal;
100
}
101
#endif
102
}
103
}
104
105
#endif
//FN_COMBINE_HPP
cl_Vector.hpp
belfem::Vector
Column vector.
Definition
cl_BZ_Vector.hpp:41
belfem::Vector::set_size
void set_size(const size_t aNumRows)
change the size of the vector
Definition
cl_AR_Vector.hpp:237
belfem::Vector::length
size_t length() const
get the length of the vector
Definition
cl_AR_Vector.hpp:257
belfem::Vector::vector_data
VectorType & vector_data()
expose the underlying matrix implementation ( writable version )
Definition
cl_AR_Vector.hpp:204
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::combine
void combine(const Vector< T > &aA, const Vector< T > &aB, Vector< T > &aC)
Definition
fn_combine.hpp:32
belfem::index_t
uint32_t index_t
Definition
typedefs.hpp:52
src
linalg
fn_combine.hpp
Generated by
1.18.0