File: datahandle.py

package info (click to toggle)
dune-grid 2.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,472 kB
  • sloc: cpp: 60,883; python: 1,438; perl: 191; makefile: 12; sh: 3
file content (18 lines) | stat: -rw-r--r-- 829 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception

from dune.generator.generator import SimpleGenerator

from dune.common.hashit import hashIt

generator = SimpleGenerator("DataHandle", "Dune::Python")

def load(includes, typeName, *args):
    includes = includes + ["dune/python/common/numpycommdatahandle.hh"]
    moduleName = "numpycommdatahandle_" + hashIt(typeName)
    return generator.load(includes, typeName, moduleName, *args)

def dataHandle(mapper,array,function):
    typeName = "Dune::Python::NumPyCommDataHandle< " + mapper.cppTypeName + ", double, std::function<double(double,double)> >"
    includes = mapper.cppIncludes
    return load(includes, typeName).DataHandle(mapper,array,function)