@@ -108,6 +108,19 @@ template <typename T> class EnergyDriver {
108108 }
109109};
110110
111+ // Forward declarations if needed
112+ template <typename T> class Layer ;
113+ template <typename T> class Junction ;
114+
115+ // Typedef declarations outside the class
116+ template <typename T>
117+ using SolverFn = bool (Layer<T>::*)(T t, T &timeStep, const CVector<T> &bottom,
118+ const CVector<T> &top);
119+
120+ template <typename T>
121+ using RunnerFn = void (Junction<T>::*)(SolverFn<T> &functor, T &t, T &timeStep,
122+ bool &step_accepted);
123+
111124template <typename T> struct AdaptiveIntegrationParams {
112125 T abs_tol = 1e-6 ; // Absolute error tolerance
113126 T rel_tol = 1e-3 ; // Relative error tolerance
@@ -1641,10 +1654,6 @@ template <typename T> class Junction {
16411654 logFile.close ();
16421655 }
16431656
1644- typedef bool (Layer<T>::*solverFn)(T t, T &timeStep, const CVector<T> &bottom,
1645- const CVector<T> &top);
1646- typedef void (Junction<T>::*runnerFn)(solverFn &functor, T &t, T &timeStep,
1647- bool &step_accepted);
16481657 /* *
16491658 * @brief Run Euler-Heun or RK4 method for a single layer.
16501659 *
@@ -1655,7 +1664,7 @@ template <typename T> class Junction {
16551664 * @param t: current time
16561665 * @param timeStep: integration step
16571666 */
1658- void runSingleLayerSolver (solverFn &functor, T &t, T &timeStep,
1667+ void runSingleLayerSolver (SolverFn<T> &functor, T &t, T &timeStep,
16591668 bool &step_accepted) {
16601669 const CVector<T> dummy (0 , 0 , 0 );
16611670 step_accepted = (layers[0 ].*functor)(t, timeStep, dummy, dummy);
@@ -1669,7 +1678,7 @@ template <typename T> class Junction {
16691678 * @param t: current time
16701679 * @param timeStep: integration step
16711680 * */
1672- void runMultiLayerSolver (solverFn &functor, T &t, T &timeStep,
1681+ void runMultiLayerSolver (SolverFn<T> &functor, T &t, T &timeStep,
16731682 bool &step_accepted) {
16741683 // Run solver for each layer and check if all steps were accepted
16751684 step_accepted = true ;
@@ -1696,7 +1705,7 @@ template <typename T> class Junction {
16961705 }
16971706 }
16981707
1699- void eulerHeunSolverStep (solverFn &functor, T &t, T &timeStep,
1708+ void eulerHeunSolverStep (SolverFn<T> &functor, T &t, T &timeStep,
17001709 bool &step_accepted) {
17011710 /*
17021711 Euler Heun method (stochastic heun)
@@ -1743,7 +1752,7 @@ template <typename T> class Junction {
17431752 }
17441753 }
17451754
1746- void heunSolverStep (solverFn &functor, T &t, T &timeStep,
1755+ void heunSolverStep (SolverFn<T> &functor, T &t, T &timeStep,
17471756 bool &step_accepted) {
17481757 /*
17491758 Heun method
@@ -1878,7 +1887,7 @@ template <typename T> class Junction {
18781887 }
18791888 }
18801889
1881- std::tuple<runnerFn, solverFn , SolverMode>
1890+ std::tuple<RunnerFn<T>, SolverFn<T> , SolverMode>
18821891 getSolver (SolverMode mode, unsigned int totalIterations) {
18831892 SolverMode localMode = mode;
18841893 for (auto &l : this ->layers ) {
0 commit comments