Esempio n. 1
0
def test_tuple(args):
    o, r, s, f = args
    if f == 'complex':
        f = 'std::complex<double>'
    if o == 'FieldMatrix':
        fm = '{}, 10, 10'.format(f)
        fv = '{}, 10'.format(f)
        return (safe_name('{}_{}_{}_{}'.format(o, r, s, f)), commontype(o, fm),
                commontype(r, fv), commontype(s, fv))
    else:
        return (safe_name('{}_{}_{}_{}'.format(o, r, s, f)), latype(o, f),
                latype(r, f), latype(s, f))
Esempio n. 2
0
def common_test_tuple(args, xt):
    typefunc = commontype if xt == 'XT_' else dunetype
    o, r, s, f = args
    fs = f.split(',')
    if len(fs) == 1:
        fvec = f
    elif r.startswith('FieldVector'):
        fvec = '{},{}'.format(fs[0], fs[1] if len(fs) == 3 else int(fs[1]) * int(fs[2]))
    else:
        fvec = '{},{},{}'.format(fs[0], fs[1], fs[2])
    f.replace('complex', 'std::complex<double>')
    return (safe_name('{}{}_{}_{}_{}'.format(xt, o, r, s, f)), typefunc(o, f), typefunc(r, fvec), typefunc(s, fvec))
Esempio n. 3
0
# ~~~
# This file is part of the dune-xt project:
#   https://github.com/dune-community/dune-xt
# Copyright 2009-2018 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   Tobias Leibner  (2019)
# ~~~

from itertools import product
from matrices import matrices, latype, fieldtypes
from dune.xt.codegen import typeid_to_typedef_name as safe_name

testtypes = [(safe_name('{}_{}'.format(m, f)), latype(m, f))
             for m, f in product(matrices(cache), fieldtypes(cache))]
Esempio n. 4
0
def la_test_tuple(args):
    o, r, s, f = args
    if f == 'complex':
        f = 'std::complex<double>'
    return (safe_name('{}_{}_{}_{}'.format(o, r, s, f)), latype(o, f),
            latype(r, f), latype(s, f))
Esempio n. 5
0
# ~~~
# This file is part of the dune-xt project:
#   https://github.com/dune-community/dune-xt
# Copyright 2009-2018 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   René Fritze (2019)
# ~~~

import dune.xt.grid.types as grid_types
from dune.xt.codegen import typeid_to_typedef_name as safe_name

# alberta needs manual flag adding in cmake, so we skip it here
all_grids = ((safe_name(g), g) for g in grid_types.all_types(cache, list(range(1, 4))) if 'Alberta' not in g)
Esempio n. 6
0
# Copyright 2009-2021 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   Felix Schindler (2017)
#   René Fritze     (2017 - 2019)
#   Tobias Leibner  (2017, 2019 - 2020)
# ~~~

from dune.xt.codegen import typeid_to_typedef_name as safe_name, have_eigen

matrix = ['EigenDenseMatrix<double>', 'FieldMatrix<double, 2, 2>']
field = ['double', 'double']
complex_matrix = [
    'EigenDenseMatrix<std::complex<double>>',
    'FieldMatrix<std::complex<double>, 2, 2>'
]
real_matrix = ['EigenDenseMatrix<double>', 'FieldMatrix<double, 2, 2>']


def _ok(ft):
    if 'Eigen' in ft[0]:
        return have_eigen(cache)
    return True


testtypes = [(safe_name('_'.join(ft)), *ft)
             for ft in zip(matrix, field, complex_matrix, real_matrix)
             if _ok(ft)]
# ~~~
# This file is part of the dune-xt project:
#   https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt
# Copyright 2009-2021 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   René Fritze    (2018 - 2019)
#   Tobias Leibner (2018 - 2020)
# ~~~

from dune.xt.codegen import typeid_to_typedef_name as safe_name, have_eigen

matrix = [
    'EigenDenseMatrix<double>', 'FieldMatrix<double, 6, 6>',
    'CommonDenseMatrix<double>', 'CommonSparseMatrix<double>',
    'XT::Common::BlockedFieldMatrix<double, 1, 6, 6>'
]


def _ok(ft):
    if 'Eigen' in ft:
        return have_eigen(cache)
    return True


testtypes = [(safe_name('_'.join(ft)), ft) for ft in matrix if _ok(ft)]
Esempio n. 8
0
# ~~~
# This file is part of the dune-xt-grid project:
#   https://github.com/dune-community/dune-xt-grid
# Copyright 2009-2018 dune-xt-grid developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   René Fritze (2018)
# ~~~

import dune.xt.grid.types as grid_types
from dune.xt.codegen import typeid_to_typedef_name as safe_name

# alberta needs manual flag adding in cmake, so we skip it here
all_grids = ((safe_name(g), g)
             for g in grid_types.all_types(cache, list(range(1, 4)))
             if 'Alberta' not in g)
# ~~~
# This file is part of the dune-xt project:
#   https://github.com/dune-community/dune-xt
# Copyright 2009-2018 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   Felix Schindler (2016)
#   René Fritze     (2017 - 2019)
#   Tobias Leibner  (2015, 2019)
# ~~~

from itertools import product
from matrices import matrices, latype, vectors, fieldtypes, vector_filter
from dune.xt.codegen import typeid_to_typedef_name as safe_name

testtypes = [(safe_name('{}_{}_{}'.format(*mv,
                                          f)), latype(mv[0],
                                                      f), latype(mv[1], f))
             for mv, f in product(product(matrices(cache), vectors(cache)),
                                  fieldtypes(cache))
             if vector_filter(mv[1], f)]
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   Felix Schindler (2017)
#   René Fritze     (2017 - 2019)
#   Tobias Leibner  (2017 - 2020)
# ~~~

from dune.xt.codegen import typeid_to_typedef_name as safe_name, have_eigen

matrix = [
    'EigenDenseMatrix<double>', 'FieldMatrix<double, 2, 2>', 'CommonDenseMatrix<double>', 'CommonSparseMatrix<double>'
]
field = ['double', 'double', 'double', 'double']
complex_matrix = [
    'EigenDenseMatrix<std::complex<double>>', 'FieldMatrix<std::complex<double>, 2, 2>',
    'CommonDenseMatrix<std::complex<double>>', 'CommonSparseMatrix<std::complex<double>>'
]
real_matrix = [
    'EigenDenseMatrix<double>', 'FieldMatrix<double, 2, 2>', 'CommonDenseMatrix<double>', 'CommonSparseMatrix<double>'
]


def _ok(ft):
    if 'Eigen' in ft[0]:
        return have_eigen(cache)
    return True


testtypes = [(safe_name('_'.join(ft)), *ft) for ft in zip(matrix, field, complex_matrix, real_matrix) if _ok(ft)]
Esempio n. 11
0
# ~~~
# This file is part of the dune-xt project:
#   https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt
# Copyright 2009-2021 dune-xt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#      or  GPL-2.0+ (http://opensource.org/licenses/gpl-license)
#          with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
#   Felix Schindler (2016)
#   René Fritze     (2017 - 2019)
#   Tobias Leibner  (2015, 2019 - 2020)
# ~~~

from itertools import product
from vectors import vectortype, vectors, fieldtypes, vector_filter
from dune.xt.codegen import typeid_to_typedef_name as safe_name

testtypes = [(safe_name('{}_{}'.format(mv, f)), vectortype(mv, f))
             for mv, f in product(vectors(cache), fieldtypes(cache))
             if vector_filter(mv, f)]