From 87fed34826587ee4b9f2732d71942fb403c09ac2 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Wed, 8 Dec 2021 17:37:11 +0100 Subject: [PATCH] [python][component] Add Constant component --- python/dumux/material/components/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/dumux/material/components/__init__.py b/python/dumux/material/components/__init__.py index 12b1989a07..eb09790713 100644 --- a/python/dumux/material/components/__init__.py +++ b/python/dumux/material/components/__init__.py @@ -11,6 +11,7 @@ _components = { "SimpleH2O": "dumux/material/components/simpleh2o.hh", "N2": "dumux/material/components/n2.hh", "Calcite": "dumux/material/components/calcite.hh", + "Constant": "dumux/material/components/constant.hh", } @@ -21,10 +22,12 @@ def listComponents(): @cppWrapperCreator -def _createComponent(name, *, scalar="double"): +def _createComponent(name, *, scalar="double", componentId=0): """Create a new component of the given name""" - - typeName = f"Dumux::Components::{name} <{scalar}>" + if name == "Constant": + typeName = f"Dumux::Components::{name} <{componentId}, {scalar}>" + else: + typeName = f"Dumux::Components::{name} <{scalar}>" moduleName = f"{name.lower()}_{hashIt(typeName)}" includes = ["dumux/python/material/components/component.hh"] includes += [_components[name]] -- GitLab