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