From 1061873bb7526041ff1a92aee41b437ea768766b Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Fri, 15 Mar 2024 16:36:10 +0100 Subject: [PATCH] move addressOf and RNG to sympyextensions --- src/pystencils/{functions.py => sympyextensions/pointers.py} | 2 +- src/pystencils/{ => sympyextensions}/rng.py | 1 + src/pystencils/sympyextensions/typed_sympy.py | 3 +-- tests/test_address_of.py | 2 +- tests/test_fvm.py | 2 +- tests/test_random.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename src/pystencils/{functions.py => sympyextensions/pointers.py} (95%) rename src/pystencils/{ => sympyextensions}/rng.py (99%) diff --git a/src/pystencils/functions.py b/src/pystencils/sympyextensions/pointers.py similarity index 95% rename from src/pystencils/functions.py rename to src/pystencils/sympyextensions/pointers.py index 76fbb7074..130338c99 100644 --- a/src/pystencils/functions.py +++ b/src/pystencils/sympyextensions/pointers.py @@ -1,5 +1,5 @@ import sympy as sp -from .types import PsPointerType +from ..types import PsPointerType class AddressOf(sp.Function): diff --git a/src/pystencils/rng.py b/src/pystencils/sympyextensions/rng.py similarity index 99% rename from src/pystencils/rng.py rename to src/pystencils/sympyextensions/rng.py index 221505a10..5f1006f0f 100644 --- a/src/pystencils/rng.py +++ b/src/pystencils/sympyextensions/rng.py @@ -7,6 +7,7 @@ from pystencils.sympyextensions import TypedSymbol, CastFunc # from pystencils.backends.cbackend import CustomCodeNode # TODO nbackend: replace from pystencils.sympyextensions import fast_subs + # class RNGBase(CustomCodeNode): TODO nbackend: replace class RNGBase: diff --git a/src/pystencils/sympyextensions/typed_sympy.py b/src/pystencils/sympyextensions/typed_sympy.py index 7e9edaab1..949aa6991 100644 --- a/src/pystencils/sympyextensions/typed_sympy.py +++ b/src/pystencils/sympyextensions/typed_sympy.py @@ -142,8 +142,7 @@ class FieldShapeSymbol(TypedSymbol): def __new_stage2__(cls, field_name: str, coordinate: int): from ..defaults import DEFAULTS - names = "_".join([field_name for field_name in field_names]) - name = f"_size_{names}_{coordinate}" + name = f"_size_{field_name}_{coordinate}" obj = super(FieldShapeSymbol, cls).__xnew__( cls, name, DEFAULTS.index_dtype, positive=True ) diff --git a/tests/test_address_of.py b/tests/test_address_of.py index c0a75e540..0d25be62c 100644 --- a/tests/test_address_of.py +++ b/tests/test_address_of.py @@ -4,7 +4,7 @@ Test of pystencils.data_types.address_of import pytest import pystencils from pystencils.typing import PointerType, CastFunc, BasicType -from pystencils.functions import AddressOf +from pystencils.sympyextensions.pointers import AddressOf from pystencils.simp.simplifications import sympy_cse import sympy as sp diff --git a/tests/test_fvm.py b/tests/test_fvm.py index 0b103e525..e10874cbd 100644 --- a/tests/test_fvm.py +++ b/tests/test_fvm.py @@ -3,7 +3,7 @@ import pystencils as ps import numpy as np import pytest from itertools import product -from pystencils.rng import random_symbol +from pystencils.sympyextensions.rng import random_symbol from pystencils.sympyextensions.astnodes import SympyAssignment from pystencils.node_collection import NodeCollection diff --git a/tests/test_random.py b/tests/test_random.py index 63cd61494..6c3a888db 100644 --- a/tests/test_random.py +++ b/tests/test_random.py @@ -5,7 +5,7 @@ import pytest import pystencils as ps from pystencils.sympyextensions.astnodes import SympyAssignment from pystencils.node_collection import NodeCollection -from pystencils.rng import PhiloxFourFloats, PhiloxTwoDoubles, AESNIFourFloats, AESNITwoDoubles, random_symbol +from pystencils.sympyextensions.rng import PhiloxFourFloats, PhiloxTwoDoubles, AESNIFourFloats, AESNITwoDoubles, random_symbol from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets from pystencils.cpu.cpujit import get_compiler_config from pystencils.typing import TypedSymbol -- GitLab