Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier:

Commit d1d8e71e authored by Niklas Eiling's avatar Niklas Eiling
Browse files

add parameter to MnaSolver which allows chosing between solver implementation...

add parameter to MnaSolver which allows chosing between solver implementation (GPU/Eigen, Dense/Sparse) at runtime rather than only allowing this at compile time.
Signed-off-by: Niklas Eiling's avatarNiklas Eiling <>
parent f88d07d5
......@@ -38,6 +38,15 @@
namespace DPsim {
/// \brief The implementations of the MNA solvers MnaSolver can support.
enum MnaSolverImpl {
/// Solver class using Modified Nodal Analysis (MNA).
template <typename VarType>
class MnaSolver : public Solver, public CPS::AttributeList {
......@@ -64,6 +73,11 @@ namespace DPsim {
/// List of simulation nodes
typename CPS::SimNode<VarType>::List mNodes;
/// MNA implementations supported by this compilation
static const std::vector<MnaSolverImpl> mSupportedSolverImpls;
/// MNA implementation chosen for this instance
MnaSolverImpl mSolverImpl;
// #### MNA specific attributes ####
/// List of MNA components with static stamp into system matrix
CPS::MNAInterface::List mMNAComponents;
......@@ -155,9 +169,11 @@ namespace DPsim {
/// Constructor should not be called by users but by Simulation
/// sovlerImpl: choose the most advanced solver implementation available by default
MnaSolver(String name,
CPS::Domain domain = CPS::Domain::DP,
CPS::Logger::Level logLevel = CPS::Logger::Level::info);
CPS::Logger::Level logLevel = CPS::Logger::Level::info,
MnaSolverImpl solverImpl = *mSupportedSolverImpls.end());
/// Destructor
virtual ~MnaSolver() { };
......@@ -16,8 +16,22 @@ using namespace CPS;
namespace DPsim {
template <typename VarType>
MnaSolver<VarType>::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Level logLevel) :
Solver(name, logLevel), mDomain(domain) {
const std::vector<MnaSolverImpl> MnaSolver<VarType>::mSupportedSolverImpls = {
#endif //WITH_SPARSE
#ifdef WITH_CUDA
#endif //WITH_SPARSE
#endif //WITH_CUDA
template <typename VarType>
MnaSolver<VarType>::MnaSolver(String name, CPS::Domain domain, CPS::Logger::Level logLevel, MnaSolverImpl solverImpl) :
Solver(name, logLevel), mDomain(domain), mSolverImpl(solverImpl) {
// Raw source and solution vector logging
mLeftVectorLog = std::make_shared<DataLogger>(name + "_LeftVector", logLevel != CPS::Logger::Level::off);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment