Skip to content

Commit

Permalink
Merge pull request #57 from pyccel/devel-nonzero-dirichlet
Browse files Browse the repository at this point in the history
Implement non-zero Dirichlet boundary conditions
  • Loading branch information
saidctb authored Jan 14, 2020
2 parents 66a37e3 + d4bfd73 commit 51814f0
Show file tree
Hide file tree
Showing 15 changed files with 1,667 additions and 1,117 deletions.
7 changes: 7 additions & 0 deletions bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Do not check for use of 'assert' statements (which are standard in unit tests)
# See https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
#
# NOTE: ideally, we would like to only skip this check in our unit tests, but
# we do not know if this is possible.
skips:
- B101 # Ignore assert statements
File renamed without changes.
5 changes: 2 additions & 3 deletions psydac/api/ast/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#==============================================================================
class SplBasic(Basic):
_discrete_boundary = None

def __new__(cls, tag, name=None, prefix=None, debug=False, detailed=False,
mapping=None, is_rational_mapping=None):
Expand Down Expand Up @@ -67,8 +66,8 @@ def is_rational_mapping(self):
return self._is_rational_mapping

@property
def discrete_boundary(self):
return self._discrete_boundary
def boundary(self):
return self._boundary

@property
def imports(self):
Expand Down
34 changes: 16 additions & 18 deletions psydac/api/ast/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

from .basic import SplBasic
from .utilities import build_pythran_types_header, variables
from .utilities import filter_loops, filter_product
from .utilities import filter_loops, filter_product, select_loops
from .utilities import rationalize_eval_mapping
from .utilities import compute_atoms_expr_mapping
from .utilities import compute_atoms_expr_field

#==============================================================================
class EvalQuadratureMapping(SplBasic):

def __new__(cls, space, mapping, discrete_boundary=None, name=None,
def __new__(cls, space, mapping, boundary=None, name=None,
boundary_basis=None, nderiv=1, is_rational_mapping=None,
area=None, backend=None):

Expand All @@ -58,7 +58,7 @@ def __new__(cls, space, mapping, discrete_boundary=None, name=None,
is_rational_mapping=is_rational_mapping)

obj._space = space
obj._discrete_boundary = discrete_boundary
obj._boundary = boundary
obj._boundary_basis = boundary_basis
obj._backend = backend

Expand Down Expand Up @@ -254,9 +254,7 @@ def _initialize(self):
# ...

# put the body in tests for loops
body = filter_loops(indices_basis, ranges_basis, body,
self.discrete_boundary,
boundary_basis=self.boundary_basis)
body = select_loops(indices_basis, ranges_basis, body, boundary=None)

if self.is_rational_mapping:
stmts = rationalize_eval_mapping(self.mapping, self.nderiv,
Expand All @@ -266,7 +264,7 @@ def _initialize(self):

# ...
if self.area:
weight = filter_product(indices_quad, weights, self.discrete_boundary)
weight = filter_product(indices_quad, weights, self.boundary)

stmts = area_eval_mapping(self.mapping, self.area, dim, indices_quad, weight)

Expand All @@ -275,7 +273,7 @@ def _initialize(self):

# put the body in for loops of quadrature points
body = filter_loops(indices_quad, ranges_quad, body,
self.discrete_boundary,
self.boundary,
boundary_basis=self.boundary_basis)

# initialization of the matrix
Expand Down Expand Up @@ -308,7 +306,7 @@ def _initialize(self):
#==============================================================================
class EvalQuadratureField(SplBasic):

def __new__(cls, space, fields, discrete_boundary=None, name=None,
def __new__(cls, space, fields, boundary=None, name=None,
boundary_basis=None, mapping=None, is_rational_mapping=None,backend=None):

if not isinstance(fields, (tuple, list, Tuple)):
Expand All @@ -320,7 +318,7 @@ def __new__(cls, space, fields, discrete_boundary=None, name=None,

obj._space = space
obj._fields = Tuple(*fields)
obj._discrete_boundary = discrete_boundary
obj._boundary = boundary
obj._boundary_basis = boundary_basis
obj._backend = backend
obj._func = obj._initialize()
Expand Down Expand Up @@ -412,13 +410,13 @@ def _initialize(self):

# put the body in tests for loops
body = filter_loops(indices_basis, ranges_basis, body,
self.discrete_boundary,
self.boundary,
boundary_basis=self.boundary_basis)


# put the body in for loops of quadrature points
body = filter_loops(indices_quad, ranges_quad, body,
self.discrete_boundary,
self.boundary,
boundary_basis=self.boundary_basis)


Expand Down Expand Up @@ -446,7 +444,7 @@ def _initialize(self):
#==============================================================================
class EvalQuadratureVectorField(SplBasic):

def __new__(cls, space, vector_fields, discrete_boundary=None, name=None,
def __new__(cls, space, vector_fields, boundary=None, name=None,
boundary_basis=None, mapping=None, is_rational_mapping=None, backend = None):

if not isinstance(vector_fields, (tuple, list, Tuple)):
Expand All @@ -458,7 +456,7 @@ def __new__(cls, space, vector_fields, discrete_boundary=None, name=None,

obj._space = space
obj._vector_fields = Tuple(*vector_fields)
obj._discrete_boundary = discrete_boundary
obj._boundary = boundary
obj._boundary_basis = boundary_basis
obj._backend = backend
obj._func = obj._initialize()
Expand Down Expand Up @@ -548,12 +546,12 @@ def _initialize(self):

# put the body in tests for loops
body = filter_loops(indices_basis, ranges_basis, body,
self.discrete_boundary,
self.boundary,
boundary_basis=self.boundary_basis)

# put the body in for loops of quadrature points
body = filter_loops(indices_quad, ranges_quad, body,
self.discrete_boundary,
self.boundary,
boundary_basis=self.boundary_basis)

# initialization of the matrix
Expand Down Expand Up @@ -597,7 +595,7 @@ def _create_loop(indices, ranges, body):
# NOTE: this is used in module 'psydac.api.ast.glt'
class EvalArrayField(SplBasic):

def __new__(cls, space, fields, discrete_boundary=None, name=None,
def __new__(cls, space, fields, boundary=None, name=None,
boundary_basis=None, mapping=None, is_rational_mapping=None,backend=None):

if not isinstance(fields, (tuple, list, Tuple)):
Expand All @@ -609,7 +607,7 @@ def __new__(cls, space, fields, discrete_boundary=None, name=None,

obj._space = space
obj._fields = Tuple(*fields)
obj._discrete_boundary = discrete_boundary
obj._boundary = boundary
obj._boundary_basis = boundary_basis
obj._backend = backend
obj._func = obj._initialize()
Expand Down
Loading

0 comments on commit 51814f0

Please sign in to comment.