BELFEM 0.9.3
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
67 {
68 Material * mMaterial ;
69
70 MatFunc2 * mUserJcFunction2 = nullptr ;
71 MatFunc3 * mUserJcFunction3 = nullptr ;
72
73 public:
74
79 JcFunctionUserDefined( Material * Mat ) : mMaterial( Mat ) {};
80
83
84 ~JcFunctionUserDefined() override = default;
85
92 real
93 eval( const real normB, const real angle ) const override ;
94
102 real
103 eval( const real normB, const real angle, const real T ) const override ;
104
109 void
111 {
112 mUserJcFunction2 = Function ;
115 }
116
121 void
123 {
124 mUserJcFunction3 = Function ;
128 }
129
130 private:
131
135 real
136 jc_user_2( const real normB, const real angle ) const
137 {
138 return mUserJcFunction2( mMaterial, normB, angle );
139 }
140
144 real
145 jc_user_3( const real normB, const real angle, const real T ) const
146 {
147 return mUserJcFunction3( mMaterial, normB, angle, T );
148 }
149 };
150
151 inline real
152 JcFunctionUserDefined::eval( const real normB, const real angle ) const
153 {
154 BELFEM_ERROR( mUserJcFunction2 != nullptr,
155 "2-parameter user function is not set" );
156
157 return jc_user_2( normB, angle );
158 }
159
160 inline real
161 JcFunctionUserDefined::eval( const real normB, const real angle, const real T ) const
162 {
163 BELFEM_ERROR( mUserJcFunction3 != nullptr,
164 "3-parameter user function is not set" );
165
166 return jc_user_3( normB, angle, T );
167 }
168
169//------------------------------------------------------------------------------
170 }
171}
172#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:270
void set_dependency(const JcParameter aParameter)
Mark function as depending on a parameter.
Definition cl_JcFunction.cpp:20
void set_jc_function(MatFunc3 *Function)
Set the user-defined function pointer (3-parameter version).
Definition cl_JcFunction_UserDefined.hpp:122
real eval(const real normB, const real angle) const override
Evaluate the function (2-parameter version).
Definition cl_JcFunction_UserDefined.hpp:152
JcFunctionUserDefined(Material *Mat)
Constructor.
Definition cl_JcFunction_UserDefined.hpp:79
void set_jc_function(MatFunc2 *Function)
Set the user-defined function pointer (2-parameter version).
Definition cl_JcFunction_UserDefined.hpp:110
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:234
real MatFunc2(const Material *, const real, const real)
Definition cl_Material.hpp:233
double real
Definition typedefs.hpp:36