Skip to content
Snippets Groups Projects
Commit 58d88580 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Timo Koch
Browse files

[python] Add velocityoutput

parent 3099299d
No related branches found
No related tags found
1 merge request!2681Feature/python main file
......@@ -30,6 +30,7 @@
#include <dune/python/pybind11/stl.h>
#include <dumux/python/common/volumevariables.hh>
#include <dumux/io/velocityoutput.hh>
namespace Dumux::Python {
......@@ -63,6 +64,13 @@ void registerVtkOutputModule(pybind11::handle scope,
const std::string& name) {
self.addVolumeVariable(std::move(f), name);
});
using VelocityOutputType = Dumux::VelocityOutput<GridVariables>;
cls.def("addVelocityOutput", [](VtkOutputModule& self,
std::shared_ptr<VelocityOutputType> velocityOutput)
{
self.addVelocityOutput(velocityOutput);
});
};
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief TODO: docme!
*/
#ifndef DUMUX_PYTHON_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
#define DUMUX_PYTHON_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
#include <dune/python/pybind11/pybind11.h>
#include <dumux/porousmediumflow/velocityoutput.hh>
namespace Dumux::Python {
// Python wrapper for the PorousMediumFlowVelocityOutput class
template<class GridVariables, class FluxVariables, class... options>
void registerPorousMediumFlowVelocityOutput(pybind11::handle scope,
pybind11::class_<Dumux::PorousMediumFlowVelocityOutput<GridVariables, FluxVariables>, options...> cls)
{
using pybind11::operator""_a;
using namespace Dune::Python;
using VelocityOutput = Dumux::PorousMediumFlowVelocityOutput<GridVariables, FluxVariables>;
cls.def(pybind11::init([](const GridVariables& gridVariables)
{
return std::make_shared<VelocityOutput>(gridVariables);
}));
}
} // end namespace Dumux::Python
#endif
......@@ -34,3 +34,24 @@ def PorousMediumFlowProblem(gridGeometry, spatialParams, enableInternalDirichlet
return createPorousMediumFlowProblem
return PorousMediumFlowProblemDecorator
def PorousMediumFlowVelocityOutput(*, gridVariables):
includes = gridVariables._includes
includes += ["dumux/python/porousmediumflow/velocityoutput.hh", "dumux/io/velocityoutput.hh"]
fluxVarsType = (
f"Dumux::GetPropType<{gridVariables._model.getTypeTag()}, Dumux::Properties::FluxVariables>"
)
typeName = f"Dumux::PorousMediumFlowVelocityOutput<{gridVariables._typeName}, {fluxVarsType}>"
moduleName = "porousmediumflowvelocityoutput_" + hashIt(typeName)
baseClass = [f"Dumux::VelocityOutput<{gridVariables._typeName}>"]
generator = SimpleGenerator("PorousMediumFlowVelocityOutput", "Dumux::Python")
module = generator.load(
includes,
typeName,
moduleName,
holder="std::shared_ptr",
preamble=gridVariables._model.getProperties(),
baseClasses=baseClass,
)
return module.PorousMediumFlowVelocityOutput(gridVariables)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment