Skip to content

Commit

Permalink
Moved MinMaxFieldList to ArithmeticFieldList module
Browse files Browse the repository at this point in the history
  • Loading branch information
ldowen committed Jun 7, 2024
1 parent 32559e2 commit c5459b2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/PYB11/FieldList/ArithmeticFieldList.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from PYB11Generator import *
from FieldList import *
import FieldList
import FieldListBase

#-------------------------------------------------------------------------------
# FieldList with numeric operations
#-------------------------------------------------------------------------------
@PYB11template("Dimension", "Value")
@PYB11pycppname("FieldList")
class ArithmeticFieldList(FieldListBase):
class ArithmeticFieldList(FieldListBase.FieldListBase):

PYB11typedefs = """
typedef FieldList<%(Dimension)s, %(Value)s> FieldListType;
Expand Down Expand Up @@ -138,4 +139,4 @@ def localMax(self):
#-------------------------------------------------------------------------------
# Inject FieldList
#-------------------------------------------------------------------------------
PYB11inject(FieldList, ArithmeticFieldList)
PYB11inject(FieldList.FieldList, ArithmeticFieldList)
11 changes: 11 additions & 0 deletions src/PYB11/FieldList/ArithmeticFieldList_PYB11.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
dims = spheralDimensions()

from ArithmeticFieldList import *
from MinMaxFieldList import *

#-------------------------------------------------------------------------------
# Includes
Expand Down Expand Up @@ -46,6 +47,16 @@
("Dim<%i>::FifthRankTensor" % ndim, "FifthRankTensor")):
exec('''
%(label)sFieldList%(ndim)sd = PYB11TemplateClass(ArithmeticFieldList, template_parameters=("Dim<%(ndim)i>", "%(value)s"))
''' % {"ndim" : ndim,
"value" : value,
"label" : label})

#...........................................................................
# A few fields can apply the min/max with a scalar additionally
for (value, label) in (("double", "Scalar"),
("Dim<%i>::SymTensor" % ndim, "SymTensor")):
exec('''
%(label)sFieldList%(ndim)sd = PYB11TemplateClass(MinMaxFieldList, template_parameters=("Dim<%(ndim)i>", "%(value)s"))
''' % {"ndim" : ndim,
"value" : value,
"label" : label})
11 changes: 0 additions & 11 deletions src/PYB11/FieldList/FieldList_PYB11.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from FieldListBase import *
from FieldList import *
from MinMaxFieldList import *
from FieldListSet import *

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -57,16 +56,6 @@
("RKCoefficients<Dim<%i>>" % ndim, "RKCoefficients")):
exec('''
%(label)sFieldList%(ndim)sd = PYB11TemplateClass(FieldList, template_parameters=("Dim<%(ndim)i>", "%(value)s"))
''' % {"ndim" : ndim,
"value" : value,
"label" : label})

#...........................................................................
# A few fields can apply the min/max with a scalar additionally
for (value, label) in (("double", "Scalar"),
("Dim<%i>::SymTensor" % ndim, "SymTensor")):
exec('''
%(label)sFieldList%(ndim)sd = PYB11TemplateClass(MinMaxFieldList, template_parameters=("Dim<%(ndim)i>", "%(value)s"))
''' % {"ndim" : ndim,
"value" : value,
"label" : label})
Expand Down
4 changes: 3 additions & 1 deletion src/PYB11/FieldList/MinMaxFieldList.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from PYB11Generator import *
import FieldList
import FieldListBase
from ArithmeticFieldList import *

#-------------------------------------------------------------------------------
# Add min/max operations to a Field
#-------------------------------------------------------------------------------
@PYB11template("Dimension", "Value")
@PYB11pycppname("FieldList")
class MinMaxFieldList(FieldListBase):
class MinMaxFieldList(FieldListBase.FieldListBase):

PYB11typedefs = """
typedef FieldList<%(Dimension)s, %(Value)s> FieldListType;
Expand Down

0 comments on commit c5459b2

Please sign in to comment.