Skip to content

Commit 3e962b8

Browse files
Merge pull request #1806 from tylercollins5737/tyler/bp1_python
Python PETSc Example BP1
1 parent 7106361 commit 3e962b8

6 files changed

Lines changed: 950 additions & 1 deletion

File tree

examples/python/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ setup:
1515

1616
TEST_OPTS ?= --ceed /cpu/self/ref/serial
1717
test: setup
18-
$(PYTHON) -m pytest ex_test.py $(TEST_OPTS)
18+
$(PYTHON) -m pytest ex_test.py bps_test.py $(TEST_OPTS)
1919

2020
.PHONY: clean setup test

examples/python/bps_test.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors
3+
# All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
4+
#
5+
# SPDX-License-Identifier: BSD-2-Clause
6+
#
7+
# This file is part of CEED: http://github.com/ceed
8+
9+
import pytest
10+
from argparse import Namespace
11+
12+
# The BP examples use PETSc, unlike ex1-ex3, so skip them where it is unavailable
13+
pytest.importorskip("petsc4py")
14+
import bpsraw # noqa: E402
15+
16+
# -------------------------------------------------------------------------------
17+
18+
19+
def test_bp1_degree_1(ceed_resource):
20+
args = Namespace(
21+
ceed=ceed_resource,
22+
problem='bp1',
23+
degree=1,
24+
q_extra=None,
25+
local=1000,
26+
test=True,
27+
benchmark=False,
28+
write_solution=False,
29+
ksp_max_it_clip=[15, 15],
30+
)
31+
bpsraw.example_bps(args)
32+
33+
# -------------------------------------------------------------------------------
34+
35+
36+
def test_bp1_degree_2(ceed_resource):
37+
args = Namespace(
38+
ceed=ceed_resource,
39+
problem='bp1',
40+
degree=2,
41+
q_extra=None,
42+
local=1000,
43+
test=True,
44+
benchmark=False,
45+
write_solution=False,
46+
ksp_max_it_clip=[15, 15],
47+
)
48+
bpsraw.example_bps(args)
49+
50+
# -------------------------------------------------------------------------------
51+
52+
53+
def test_bp1_degree_3(ceed_resource):
54+
args = Namespace(
55+
ceed=ceed_resource,
56+
problem='bp1',
57+
degree=3,
58+
q_extra=None,
59+
local=1000,
60+
test=True,
61+
benchmark=False,
62+
write_solution=False,
63+
ksp_max_it_clip=[15, 15],
64+
)
65+
bpsraw.example_bps(args)
66+
67+
# -------------------------------------------------------------------------------

0 commit comments

Comments
 (0)