BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Switch.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_CL_SWITCH_HPP
13#define BELFEM_CL_SWITCH_HPP
14
15#include "cl_TwoTerminals.hpp"
16#include "Component_Enums.hpp"
17
18namespace belfem
19{
20 namespace electronics
21 {
22//-----------------------------------------------------------------------------
23
24 class Switch : public TwoTerminals
25 {
27 bool mIsClosed ;
28
30 real mSwitchTime ;
31
33 bool mIsSwitched = false ;
34
36 bool mPrevIsClosed ;
37 bool mPrevIsSwitched = false ;
38
39
40
41//------------------------------------------------------------------------------
42 public:
43//------------------------------------------------------------------------------
44
45 Switch( const bool aIsClosed , const real aSwitchTime, Cell < ElectricNode* > & aTerminals, string aLabel = "" ) ;
46
47//------------------------------------------------------------------------------
48
50 component_type() const override ;
51
52//-----------------------------------------------------------------------------
53
54 bool
55 is_closed() const override ;
56
57//------------------------------------------------------------------------------
58
59 void
60 switch_state() override ;
61
62//------------------------------------------------------------------------------
63
64 void
65 shift( const real aTime, const real aDeltaTime ) override ;
66
67//------------------------------------------------------------------------------
68
69 void
70 shift_back() override ;
71
72//------------------------------------------------------------------------------
73
74 void
75 save_state( hid_t aGroup, const string & aPrefix ) override ;
76
77//------------------------------------------------------------------------------
78
79 void
80 load_state( hid_t aGroup, const string & aPrefix ) override ;
81
82//------------------------------------------------------------------------------
83
84 };
85
86 inline ComponentType
88 {
90 }
91
92//-----------------------------------------------------------------------------
93 }
94}
95
96#endif //BELFEM_CL_SWITCH_HPP
void switch_state() override
Definition cl_Switch.cpp:39
void shift(const real aTime, const real aDeltaTime) override
Definition cl_Switch.cpp:47
void shift_back() override
Definition cl_Switch.cpp:63
void load_state(hid_t aGroup, const string &aPrefix) override
restore the state written by save_state().
Definition cl_Switch.cpp:85
Switch(const bool aIsClosed, const real aSwitchTime, Cell< ElectricNode * > &aTerminals, string aLabel="")
Definition cl_Switch.cpp:23
ComponentType component_type() const override
Definition cl_Switch.hpp:87
void save_state(hid_t aGroup, const string &aPrefix) override
write this component's time-stepping state into the restart group, dataset names prefixed with aPrefi...
Definition cl_Switch.cpp:73
bool is_closed() const override
Definition cl_Switch.cpp:31
TwoTerminals(Cell< ElectricNode * > &aTerminals, string aLabel="")
Definition cl_TwoTerminals.cpp:20
Definition cl_Capacitor.cpp:18
ComponentType
Definition Component_Enums.hpp:22
@ SWITCH
Definition Component_Enums.hpp:28
USER GUIDES:
Definition cl_Capacitor.cpp:16
int hid_t
Definition hdf5_types.hpp:20
double real
Definition typedefs.hpp:36