Skip to content

Commit 51814f0

Browse files
authored
Merge pull request #57 from pyccel/devel-nonzero-dirichlet
Implement non-zero Dirichlet boundary conditions
2 parents 66a37e3 + d4bfd73 commit 51814f0

File tree

15 files changed

+1667
-1117
lines changed

15 files changed

+1667
-1117
lines changed

bandit.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Do not check for use of 'assert' statements (which are standard in unit tests)
2+
# See https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
3+
#
4+
# NOTE: ideally, we would like to only skip this check in our unit tests, but
5+
# we do not know if this is possible.
6+
skips:
7+
- B101 # Ignore assert statements

psydac/api/ast/basic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#==============================================================================
88
class SplBasic(Basic):
9-
_discrete_boundary = None
109

1110
def __new__(cls, tag, name=None, prefix=None, debug=False, detailed=False,
1211
mapping=None, is_rational_mapping=None):
@@ -67,8 +66,8 @@ def is_rational_mapping(self):
6766
return self._is_rational_mapping
6867

6968
@property
70-
def discrete_boundary(self):
71-
return self._discrete_boundary
69+
def boundary(self):
70+
return self._boundary
7271

7372
@property
7473
def imports(self):

psydac/api/ast/evaluation.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
from .basic import SplBasic
2525
from .utilities import build_pythran_types_header, variables
26-
from .utilities import filter_loops, filter_product
26+
from .utilities import filter_loops, filter_product, select_loops
2727
from .utilities import rationalize_eval_mapping
2828
from .utilities import compute_atoms_expr_mapping
2929
from .utilities import compute_atoms_expr_field
3030

3131
#==============================================================================
3232
class EvalQuadratureMapping(SplBasic):
3333

34-
def __new__(cls, space, mapping, discrete_boundary=None, name=None,
34+
def __new__(cls, space, mapping, boundary=None, name=None,
3535
boundary_basis=None, nderiv=1, is_rational_mapping=None,
3636
area=None, backend=None):
3737

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

6060
obj._space = space
61-
obj._discrete_boundary = discrete_boundary
61+
obj._boundary = boundary
6262
obj._boundary_basis = boundary_basis
6363
obj._backend = backend
6464

@@ -254,9 +254,7 @@ def _initialize(self):
254254
# ...
255255

256256
# put the body in tests for loops
257-
body = filter_loops(indices_basis, ranges_basis, body,
258-
self.discrete_boundary,
259-
boundary_basis=self.boundary_basis)
257+
body = select_loops(indices_basis, ranges_basis, body, boundary=None)
260258

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

267265
# ...
268266
if self.area:
269-
weight = filter_product(indices_quad, weights, self.discrete_boundary)
267+
weight = filter_product(indices_quad, weights, self.boundary)
270268

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

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

276274
# put the body in for loops of quadrature points
277275
body = filter_loops(indices_quad, ranges_quad, body,
278-
self.discrete_boundary,
276+
self.boundary,
279277
boundary_basis=self.boundary_basis)
280278

281279
# initialization of the matrix
@@ -308,7 +306,7 @@ def _initialize(self):
308306
#==============================================================================
309307
class EvalQuadratureField(SplBasic):
310308

311-
def __new__(cls, space, fields, discrete_boundary=None, name=None,
309+
def __new__(cls, space, fields, boundary=None, name=None,
312310
boundary_basis=None, mapping=None, is_rational_mapping=None,backend=None):
313311

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

321319
obj._space = space
322320
obj._fields = Tuple(*fields)
323-
obj._discrete_boundary = discrete_boundary
321+
obj._boundary = boundary
324322
obj._boundary_basis = boundary_basis
325323
obj._backend = backend
326324
obj._func = obj._initialize()
@@ -412,13 +410,13 @@ def _initialize(self):
412410

413411
# put the body in tests for loops
414412
body = filter_loops(indices_basis, ranges_basis, body,
415-
self.discrete_boundary,
413+
self.boundary,
416414
boundary_basis=self.boundary_basis)
417415

418416

419417
# put the body in for loops of quadrature points
420418
body = filter_loops(indices_quad, ranges_quad, body,
421-
self.discrete_boundary,
419+
self.boundary,
422420
boundary_basis=self.boundary_basis)
423421

424422

@@ -446,7 +444,7 @@ def _initialize(self):
446444
#==============================================================================
447445
class EvalQuadratureVectorField(SplBasic):
448446

449-
def __new__(cls, space, vector_fields, discrete_boundary=None, name=None,
447+
def __new__(cls, space, vector_fields, boundary=None, name=None,
450448
boundary_basis=None, mapping=None, is_rational_mapping=None, backend = None):
451449

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

459457
obj._space = space
460458
obj._vector_fields = Tuple(*vector_fields)
461-
obj._discrete_boundary = discrete_boundary
459+
obj._boundary = boundary
462460
obj._boundary_basis = boundary_basis
463461
obj._backend = backend
464462
obj._func = obj._initialize()
@@ -548,12 +546,12 @@ def _initialize(self):
548546

549547
# put the body in tests for loops
550548
body = filter_loops(indices_basis, ranges_basis, body,
551-
self.discrete_boundary,
549+
self.boundary,
552550
boundary_basis=self.boundary_basis)
553551

554552
# put the body in for loops of quadrature points
555553
body = filter_loops(indices_quad, ranges_quad, body,
556-
self.discrete_boundary,
554+
self.boundary,
557555
boundary_basis=self.boundary_basis)
558556

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

600-
def __new__(cls, space, fields, discrete_boundary=None, name=None,
598+
def __new__(cls, space, fields, boundary=None, name=None,
601599
boundary_basis=None, mapping=None, is_rational_mapping=None,backend=None):
602600

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

610608
obj._space = space
611609
obj._fields = Tuple(*fields)
612-
obj._discrete_boundary = discrete_boundary
610+
obj._boundary = boundary
613611
obj._boundary_basis = boundary_basis
614612
obj._backend = backend
615613
obj._func = obj._initialize()

0 commit comments

Comments
 (0)