DPsim
Loading...
Searching...
No Matches
Utils.h
Go to the documentation of this file.
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8#pragma once
9
10#include <DPsim.h>
11#include <iomanip>
12#include <pybind11/eigen.h>
13#include <pybind11/functional.h>
14#include <pybind11/pybind11.h>
15#include <pybind11/stl.h>
16
17namespace py = pybind11;
18
19template <typename T>
20py::cpp_function createAttributeSetter(const std::string name) {
21 return [name](CPS::IdentifiedObject &object, T &value) {
22 object.attributeTyped<T>(name)->set(value);
23 };
24}
25
26template <typename T>
27py::cpp_function createAttributeGetter(const std::string name) {
28 return [name](CPS::IdentifiedObject &object) {
29 return object.attributeTyped<T>(name)->get();
30 };
31}
32
33CPS::Matrix zeroMatrix(int dim);
34
37void printAttribute(CPS::IdentifiedObject &obj, std::string attr);
void printAttribute(CPS::IdentifiedObject &obj, std::string attr)
Definition Utils.cpp:74
CPS::Matrix zeroMatrix(int dim)
Definition Utils.cpp:11
py::cpp_function createAttributeGetter(const std::string name)
Definition Utils.h:27
std::string getAttributeList(CPS::IdentifiedObject &obj)
Definition Utils.cpp:13
py::cpp_function createAttributeSetter(const std::string name)
Definition Utils.h:20
void printAttributes(CPS::IdentifiedObject &obj)
Definition Utils.cpp:70
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81