Skip to content

Commit

Permalink
Merge pull request #203 from mfem/v46_new_ex
Browse files Browse the repository at this point in the history
New translated Python examples
  • Loading branch information
sshiraiwa authored Jan 9, 2024
2 parents 0c12000 + c7a70cf commit 47892af
Show file tree
Hide file tree
Showing 222 changed files with 5,836 additions and 1,122 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/test_with_MFEM_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
#python-version: ["3.10"]
#os: [ubuntu-latest]
#python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.10"]
os: [ubuntu-20.04]
# USE_FLAGS : cuda, parallel, libceed
env:
- { USE_FLAGS: "000"}
- { USE_FLAGS: "100"}
- { USE_FLAGS: "010"}
- { USE_FLAGS: "110"}
# - { USE_FLAGS: "100"}
# - { USE_FLAGS: "010"}
# - { USE_FLAGS: "110"}

include:
- os: macos-latest
python-version: 3.9
python-version: 3.11
env: {USE_FLAGS: "000"}
- os: [ubuntu-20.04]
python-version: 3.9
env: {USE_FLAGS: "001"}
# - os: [ubuntu-20.04]
# python-version: 3.9
# env: {USE_FLAGS: "001"}
#
runs-on: ${{ matrix.os }}
#env: ${{ matrix.env }}
Expand Down Expand Up @@ -64,10 +63,11 @@ jobs:
pip install six numpy --verbose
if [ "${{matrix.python-version}}" = "3.10" ] ; then
pip install numba numba-scipy --verbose
#pip install scipy
#pip install numba numba-scipy --verbose
pip install scipy numba --verbose
else
pip install numba numba-scipy --verbose
#pip install numba numba-scipy --verbose
pip install numba scipy --verbose
fi
if [ -f requirements.txt ]; then
Expand Down
96 changes: 96 additions & 0 deletions data/fichera-mixed.mesh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
MFEM mesh v1.0

#
# MFEM Geometry Types (see mesh/geom.hpp):
#
# POINT = 0
# SEGMENT = 1
# TRIANGLE = 2
# SQUARE = 3
# TETRAHEDRON = 4
# CUBE = 5
# PRISM = 6
#

dimension
3

elements
14
1 4 13 15 21 25
1 4 12 13 15 21
1 4 13 21 22 25
1 4 15 24 21 25
1 4 13 15 25 16
1 5 0 1 4 3 9 10 13 12
1 5 8 9 12 11 17 18 21 20
1 5 2 3 6 5 11 12 15 14
1 6 3 4 6 12 13 15
1 6 4 7 6 13 16 15
1 6 12 13 21 9 10 18
1 6 13 22 21 10 19 18
1 6 11 14 20 12 15 21
1 6 15 21 24 14 20 23

boundary
30
1 3 5 6 3 2
2 2 3 6 4
2 2 4 6 7
3 3 3 4 1 0
4 3 11 12 9 8
5 3 2 3 12 11
6 3 0 1 10 9
7 2 9 10 18
7 2 10 19 18
8 3 8 9 18 17
9 3 1 4 13 10
10 3 4 7 16 13
11 2 13 16 25
11 2 13 25 22
12 3 10 13 22 19
13 3 7 6 15 16
14 3 6 5 14 15
15 3 15 14 23 24
16 2 16 15 25
16 2 15 24 25
17 3 5 2 11 14
18 3 3 0 9 12
19 3 11 8 17 20
20 2 11 20 14
20 2 14 20 23
21 3 17 18 21 20
22 3 18 19 22 21
23 2 21 22 25
23 2 21 25 24
24 3 20 21 24 23

vertices
26
3
0 -1 -1
1 -1 -1
-1 0 -1
0 0 -1
1 0 -1
-1 1 -1
0 1 -1
1 1 -1
-1 -1 0
0 -1 0
1 -1 0
-1 0 0
0 0 0
1 0 0
-1 1 0
0 1 0
1 1 0
-1 -1 1
0 -1 1
1 -1 1
-1 0 1
0 0 1
1 0 1
-1 1 1
0 1 1
1 1 1
2 changes: 1 addition & 1 deletion examples/ex18.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def run(problem=1,
# 10. Compute the L2 solution error summed for all components.
if (t_final == 2.0):
error = sol.ComputeLpError(2., u0)
print("Solution error: " + str(error))
print("Solution error: " + "{:g}".format(error))


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions examples/ex18_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def Mult(self, x, y):
y.SetSubVector(vdofs, ymat.GetData())


class DomainIntegrator(mfem.BilinearFormIntegrator):
class DomainIntegrator(mfem.PyBilinearFormIntegrator):
def __init__(self, dim):
num_equation = globals()['num_equation']
self.flux = mfem.DenseMatrix(num_equation, dim)
Expand Down Expand Up @@ -165,7 +165,7 @@ def AssembleElementMatrix2(self, trial_fe, test_fe, Tr, elmat):
self.dshapedx[j, d]


class FaceIntegrator(mfem.NonlinearFormIntegrator):
class FaceIntegrator(mfem.PyNonlinearFormIntegrator):
def __init__(self, rsolver, dim):
self.rsolver = rsolver
self.shape1 = mfem.Vector()
Expand Down
2 changes: 1 addition & 1 deletion examples/ex23.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def EvalValue(self, x):
visualization = False
print("GLVis visualization disabled.")
else:
sout.precision(precision)
sout.precision(output.precision)
sout << "solution\n" << mesh << dudt_gf
sout << "pause\n"
sout.flush()
Expand Down
2 changes: 1 addition & 1 deletion examples/ex33p.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''
MFEM example 33
MFEM example 33p
See c++ version in the MFEM library for more detail
Expand Down
Loading

0 comments on commit 47892af

Please sign in to comment.