BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
fn_Create_Truss_Poly.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_CREATE_CUBE_HPP
13
#define BELFEM_FN_CREATE_CUBE_HPP
14
15
#include "
typedefs.hpp
"
16
#include "
cl_Vector.hpp
"
17
namespace
belfem
18
{
19
28
template
<
typename
T >
29
void
30
create_truss_poly
(
31
const
Vector< T >
& aX,
32
const
Vector< T >
& aF,
33
Vector< T >
& aC )
34
{
35
// help variable
36
real
tG = aX( 0 ) - aX( 1 );
37
real
tH = aX( 0 ) + aX( 1 );
38
39
aC.
set_size
( 4 );
40
41
// a
42
aC( 0 ) = ( 2.0*( aF( 2 ) - aF( 0 ) ) + (aF( 1 ) + aF( 3 ) )* tG )*tG;
43
44
// b
45
aC( 1 ) = tG * (3*tH*( aF( 0 ) - aF( 2 ) ) - tG*( aF( 1 )*aX( 0 )
46
+ 2.0*( aF( 3 )*aX( 0 ) + aF( 1 )*aX( 1 ) ) + aF( 3 )*aX( 1 ) ) );
47
48
// c
49
aC( 2 ) = tG * ( aF( 3 )*std::pow( aX( 0 ), 3 ) + aX( 0 )*aX( 1 )*(
50
6.0 * ( aF( 2 ) - aF( 0 ) ) +
51
aX( 0 ) * ( 2.0 * aF( 1 ) + aF( 3 ) )
52
- aX( 1 ) * (aF( 1 ) + 2.0 * aF( 3 ) ) ) - aF( 1 )*std::pow( aX( 1 ), 3 ) );
53
54
// d
55
aC( 3 ) = tG * ( std::pow( aX( 0 ), 2 )
56
*( aF( 2 )*(aX( 0 ) - 3.0*aX( 1 )) - tG*aX( 1 )*aF( 3 ) )
57
- std::pow( aX( 1 ), 2 ) *( aF( 0 )*(aX( 1 ) - 3.0*aX( 0 ) )
58
+ tG*aX( 0 )*aF( 1 ) ) );
59
60
// scale parameters to correct size
61
aC *= std::pow( tG, -4 );
62
}
63
}
64
#endif
//BELFEM_FN_CREATE_CUBE_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
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::create_truss_poly
void create_truss_poly(const Vector< T > &aX, const Vector< T > &aF, Vector< T > &aC)
create a polynomial so that f = a*x^3 + b*x^2 + c*x + d
Definition
fn_Create_Truss_Poly.hpp:30
belfem::real
double real
Definition
typedefs.hpp:36
typedefs.hpp
src
numerics
spline
fn_Create_Truss_Poly.hpp
Generated by
1.18.0