BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_JcFunction_UserDefined.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, through
4 * 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_CL_JCFUNCTION_USERDEFINED_HPP
13#define BELFEM_CL_JCFUNCTION_USERDEFINED_HPP
14
15#include "cl_JcFunction.hpp"
16#include "cl_Material.hpp"
17
18namespace belfem
19{
20 namespace material
21 {
22//------------------------------------------------------------------------------
23
69 {
70 Material * mMaterial ;
71
72 MatFunc2 * mUserJcFunction2 = nullptr ;
73 MatFunc3 * mUserJcFunction3 = nullptr ;
74
75 public:
76
81 JcFunctionUserDefined( Material * Mat ) : mMaterial( Mat ) {};
82
85
86 ~JcFunctionUserDefined() override = default;
87
94 real
95 eval( const real normB, const real angle ) const override ;
96
104 real
105 eval( const real normB, const real angle, const real T ) const override ;
106
111 void
113 {
114 mUserJcFunction2 = Function ;
117 }
118
123 void
125 {
126 mUserJcFunction3 = Function ;
130 }
131
132 private:
133
137 real
138 jc_user_2( const real normB, const real angle ) const
139 {
140 return mUserJcFunction2( mMaterial, normB, angle );
141 }
142
146 real
147 jc_user_3( const real normB, const real angle, const real T ) const
148 {
149 return mUserJcFunction3( mMaterial, normB, angle, T );
150 }
151 };
152
153 inline real
154 JcFunctionUserDefined::eval( const real normB, const real angle ) const
155 {
156 BELFEM_ERROR( mUserJcFunction2 != nullptr,
157 "2-parameter user function is not set" );
158
159 return jc_user_2( normB, angle );
160 }
161
162 inline real
163 JcFunctionUserDefined::eval( const real normB, const real angle, const real T ) const
164 {
165 BELFEM_ERROR( mUserJcFunction3 != nullptr,
166 "3-parameter user function is not set" );
167
168 return jc_user_3( normB, angle, T );
169 }
170
171//------------------------------------------------------------------------------
172 }
173}
174#endif //BELFEM_CL_JCFUNCTION_USERDEFINED_HPP
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
Base class hierarchy for critical current density (Jc) and n-value functions.
Definition petsctools.hpp:27
Base class for all materials in BELFEM.
Definition cl_Material.hpp:279
void set_dependency(const JcParameter aParameter)
Mark function as depending on a parameter.
Definition cl_JcFunction.cpp:20
JcFunction()=default
Default constructor.
void set_jc_function(MatFunc3 *Function)
Set the user-defined function pointer (3-parameter version).
Definition cl_JcFunction_UserDefined.hpp:124
real eval(const real normB, const real angle) const override
Evaluate the function (2-parameter version).
Definition cl_JcFunction_UserDefined.hpp:154
JcFunctionUserDefined(Material *Mat)
Constructor.
Definition cl_JcFunction_UserDefined.hpp:81
void set_jc_function(MatFunc2 *Function)
Set the user-defined function pointer (2-parameter version).
Definition cl_JcFunction_UserDefined.hpp:112
JcFunctionUserDefined(const JcFunctionUserDefined &)=delete
JcFunctionUserDefined & operator=(const JcFunctionUserDefined &)=delete
Definition cl_BhCurve.cpp:19
@ angleNxB
Definition cl_JcFunction.hpp:82
@ normB
Definition cl_JcFunction.hpp:81
@ T
Definition cl_JcFunction.hpp:83
USER GUIDES:
Definition cl_Capacitor.cpp:16
real MatFunc3(const Material *, const real, const real, const real)
Definition cl_Material.hpp:243
real MatFunc2(const Material *, const real, const real)
Definition cl_Material.hpp:242
double real
Definition typedefs.hpp:36