BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
fn_symrationspace.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_FN_SYMRATIONSPACE_HPP
13
#define BELFEM_FN_SYMRATIONSPACE_HPP
14
15
#include "
typedefs.hpp
"
16
#include "
cl_Vector.hpp
"
17
#include "
assert.hpp
"
18
19
namespace
belfem
20
{
21
template
<
typename
T >
22
void
23
symratiospace
(
const
T & aXmin,
const
T & aXmax,
const
T & aRatio,
const
index_t
aN,
Vector< T >
& aX )
24
{
25
// check input
26
BELFEM_ASSERT
( aN % 2 == 1 ,
"aN must be odd"
);
27
28
// set size of vector
29
aX.
set_size
( aN );
30
31
// number of steps per height
32
index_t
tN = 0.5 * ( aN - 1 ) ;
33
34
// stepper
35
T tDeltaX = 1.0 ;
36
T tX = 0.0 ;
37
for
(
index_t
k=0; k<tN; ++k )
38
{
39
tX = tX + tDeltaX ;
40
tDeltaX *= aRatio ;
41
}
42
43
// populate beginning, end and middle point
44
aX( 0 ) = aXmin ;
45
aX( aN - 1 ) = aXmax ;
46
aX( tN ) = aXmin + 0.5 * ( aXmax - aXmin );
47
48
// adapt scale
49
tDeltaX = aX( tN ) / tX ;
50
51
// populate the rest
52
for
(
index_t
k=1; k<tN; ++k )
53
{
54
aX( k ) = aX( k - 1 ) + tDeltaX ;
55
aX( aN - k - 1 ) = aX( aN - k ) - tDeltaX ;
56
tDeltaX *= aRatio ;
57
}
58
}
59
60
}
61
#endif
//BELFEM_FN_SYMRATIONSPACE_HPP
assert.hpp
BELFEM_ASSERT
#define BELFEM_ASSERT(aCheck,...)
Definition
assert.hpp:244
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
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::index_t
uint32_t index_t
Definition
typedefs.hpp:52
belfem::symratiospace
void symratiospace(const T &aXmin, const T &aXmax, const T &aRatio, const index_t aN, Vector< T > &aX)
Definition
fn_symrationspace.hpp:23
typedefs.hpp
src
math
tools
fn_symrationspace.hpp
Generated by
1.18.0