BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
fn_to_vector.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 BELFEM_FN_TO_VECTOR_HPP
23
#define BELFEM_FN_TO_VECTOR_HPP
24
25
#include "
cl_Vector.hpp
"
26
#include "
cl_Cell.hpp
"
27
28
namespace
belfem
29
{
30
//------------------------------------------------------------------------------
31
35
template
<
typename
T >
36
Vector< T >
37
to_vector
(
const
Cell< T >
& aCell )
38
{
39
// get the number of entries
40
size_t
tN = aCell.
size
();
41
42
// allocate the output vector
43
Vector< T >
aResult( tN );
44
45
// raw data pointers (valid for both Armadillo and Blaze backends)
46
T * tTarget = aResult.
data
();
47
const
T * tSource = aCell.
data
();
48
49
for
(
size_t
k = 0; k < tN; ++k )
50
{
51
tTarget[ k ] = tSource[ k ];
52
}
53
54
return
aResult;
55
}
56
57
//------------------------------------------------------------------------------
58
}
59
60
#endif
//BELFEM_FN_TO_VECTOR_HPP
cl_Cell.hpp
cl_Vector.hpp
belfem::Cell
Cell is a wrapper around the standard vector.
Definition
cl_Cell.hpp:42
belfem::Cell::size
size_t size() const
return the size of the Cell
Definition
cl_Cell.hpp:181
belfem::Cell::data
T * data()
Definition
cl_Cell.hpp:120
belfem::Vector
Column vector.
Definition
cl_BZ_Vector.hpp:41
belfem::Vector::data
T * data()
expose the underlying raw pointer ( writable version )
Definition
cl_AR_Vector.hpp:182
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::to_vector
Vector< T > to_vector(const Cell< T > &aCell)
convert a Cell< T > into a Vector< T >
Definition
fn_to_vector.hpp:37
src
linalg
fn_to_vector.hpp
Generated by
1.18.0