[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Tetsuo Koyama |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Tue, 24 Dec 2019 00:23:04 -0500 (EST) |
branch: devel-tetsuo-isort
commit 46ae0a786a7dcf3ed95d168747d350e957e79a56
Author: Tetsuo Koyama <address@hidden>
Date: Mon Dec 23 21:42:48 2019 +0900
:arrow_up: isort import for PEP8
---
bin/rst_to_xml.py | 10 ++--------
.../static_contact_gears/static_contact_planetary.py | 3 ++-
.../conv_test_small_strain_plasticity.py | 8 +++++---
contrib/test_plasticity/test_plasticity.py | 2 +-
.../test_plasticity/test_small_strain_plasticity.py | 8 +++++---
doc/sphinx/source/conf.py | 9 ++++++---
.../python/code_samples/demo_fictitious_domains.py | 5 +++--
.../source/python/code_samples/demo_laplacian.py | 3 ++-
.../source/python/code_samples/demo_step_by_step.py | 3 ++-
doc/sphinx/source/python/code_samples/demo_tripod.py | 3 ++-
.../source/python/code_samples/demo_tripod_alt.py | 3 ++-
interface/tests/python/check_asm.py | 3 +--
interface/tests/python/check_export.py | 3 ++-
interface/tests/python/check_global_functions.py | 3 ++-
interface/tests/python/check_levelset.py | 3 ++-
interface/tests/python/check_mixed_mesh.py | 6 ++++--
interface/tests/python/check_secondary_domain.py | 3 +--
interface/tests/python/demo_Mindlin_Reissner_plate.py | 1 +
.../tests/python/demo_Vector_Potential_Curl_DG.py | 10 ++++++----
.../tests/python/demo_cracked_thermo_elastic_body.py | 1 +
interface/tests/python/demo_dynamic_contact_1D.py | 9 ++++++---
interface/tests/python/demo_elastic_ring_contact.py | 6 ++++--
interface/tests/python/demo_elasticity_HHO.py | 3 ++-
interface/tests/python/demo_fictitious_domains.py | 5 +++--
.../tests/python/demo_finite_strain_plasticity.py | 10 ++++++----
.../tests/python/demo_finite_strain_plasticity_3D.py | 10 ++++++----
interface/tests/python/demo_laplacian.py | 3 ++-
interface/tests/python/demo_laplacian_DG.py | 4 ++--
interface/tests/python/demo_laplacian_HHO.py | 3 ++-
interface/tests/python/demo_laplacian_aposteriori.py | 10 ++--------
interface/tests/python/demo_laplacian_pyramid.py | 3 ++-
interface/tests/python/demo_large_sliding_contact.py | 4 ++--
interface/tests/python/demo_mortar.py | 4 ++--
interface/tests/python/demo_navier_stokes.py | 3 +--
interface/tests/python/demo_nonlinear_elasticity.py | 19 ++-----------------
interface/tests/python/demo_parallel_laplacian.py | 9 +++++----
interface/tests/python/demo_phase_field.py | 10 ++++------
interface/tests/python/demo_plasticity.py | 2 +-
interface/tests/python/demo_plate.py | 2 +-
interface/tests/python/demo_static_contact.py | 4 ++--
interface/tests/python/demo_step_by_step.py | 3 ++-
interface/tests/python/demo_stokes_3D_tank.py | 3 ++-
interface/tests/python/demo_stokes_3D_tank_draw.py | 6 +++---
.../demo_thermo_elasticity_electrical_coupling.py | 13 ++-----------
interface/tests/python/demo_tresca.py | 5 ++---
interface/tests/python/demo_tripod.py | 3 ++-
interface/tests/python/demo_tripod_alt.py | 3 ++-
interface/tests/python/demo_wave.py | 4 +++-
interface/tests/python/demo_wave_equation.py | 4 +++-
interface/tests/python/demo_wheel_contact.py | 5 +++--
interface/tests/python/getfem_tvtk.py | 5 ++++-
interface/tests/python/tutorial1.py | 3 ++-
52 files changed, 139 insertions(+), 131 deletions(-)
diff --git a/bin/rst_to_xml.py b/bin/rst_to_xml.py
index 9ad23c4..e0f32a7 100755
--- a/bin/rst_to_xml.py
+++ b/bin/rst_to_xml.py
@@ -24,10 +24,11 @@
$Id: extract_doc 3304 2009-11-03 13:17:46Z renard $
"""
-import string
import os
+import string
import sys
+
class ParseError(Exception):
def __init__(self, value):
self.value = value
@@ -164,10 +165,3 @@ rfl.close()
print("there were ", count_math_f, " formulaes")
-
-
-
-
-
-
-
diff --git a/contrib/static_contact_gears/static_contact_planetary.py
b/contrib/static_contact_gears/static_contact_planetary.py
index 27140af..840bd5c 100644
--- a/contrib/static_contact_gears/static_contact_planetary.py
+++ b/contrib/static_contact_gears/static_contact_planetary.py
@@ -26,8 +26,9 @@
This program is used to check that python-getfem is working. This is
also a good example of use of GetFEM++.
"""
+from math import cos, pi, sin
+
from getfem import *
-from math import sin,cos,pi
# mesh import
m_1 = Mesh('import', 'gmsh', './static_contact_planetary_1.msh')
diff --git a/contrib/test_plasticity/conv_test_small_strain_plasticity.py
b/contrib/test_plasticity/conv_test_small_strain_plasticity.py
index e84941f..f7f0374 100644
--- a/contrib/test_plasticity/conv_test_small_strain_plasticity.py
+++ b/contrib/test_plasticity/conv_test_small_strain_plasticity.py
@@ -25,11 +25,13 @@
$Id: conv_test_small_strain_plasticity 5189 2015-12-15 10:24:07Z renard $
"""
-import getfem as gf
-import numpy as np
-import matplotlib.pyplot as plt
import os
+import matplotlib.pyplot as plt
+import numpy as np
+
+import getfem as gf
+
NT = 128; NX = 256; option = 3; Hi = 0; Hk = 0; load_type = 1; theta = 0.5;
LX=100.; order = 2; do_export = 1;
resultspath = './exported_solutions'
diff --git a/contrib/test_plasticity/test_plasticity.py
b/contrib/test_plasticity/test_plasticity.py
index da70964..4cebaf6 100644
--- a/contrib/test_plasticity/test_plasticity.py
+++ b/contrib/test_plasticity/test_plasticity.py
@@ -28,9 +28,9 @@
$Id: demo_plasticity.py 5189 2015-12-15 10:24:07Z renard $
"""
-import getfem as gf
import numpy as np
+import getfem as gf
with_graphics=True
try:
diff --git a/contrib/test_plasticity/test_small_strain_plasticity.py
b/contrib/test_plasticity/test_small_strain_plasticity.py
index 880c891..8035c87 100644
--- a/contrib/test_plasticity/test_small_strain_plasticity.py
+++ b/contrib/test_plasticity/test_small_strain_plasticity.py
@@ -25,12 +25,14 @@
$Id: test_small_strain_plasticity.py 5189 2015-12-15 10:24:07Z renard $
"""
-import getfem as gf
-import numpy as np
-import matplotlib.pyplot as plt
import os
import sys
+import matplotlib.pyplot as plt
+import numpy as np
+
+import getfem as gf
+
option = 3 # 1 : without hardening, im_data and plastic multiplier
# 2 : without hardening, with im_data and plastic multiplier
# 3 : with kinematic and isotropic hardening,
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index 1cb9c9f..2376c86 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -12,7 +12,12 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os, time
+import os
+import sys
+import time
+
+###########################################################################
+from getfem import getfem_env
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
@@ -20,8 +25,6 @@ import sys, os, time
sys.path.append(os.path.abspath('../tools/sphinxext')) # sphinx
sys.path.append('../../../interface/src/python/') # getfem
-###########################################################################
-from getfem import getfem_env
user_preamble = '''
\n% begin user_preamble:
\\usepackage{mathrsfs}
diff --git a/doc/sphinx/source/python/code_samples/demo_fictitious_domains.py
b/doc/sphinx/source/python/code_samples/demo_fictitious_domains.py
index 5de5762..a6c6699 100644
--- a/doc/sphinx/source/python/code_samples/demo_fictitious_domains.py
+++ b/doc/sphinx/source/python/code_samples/demo_fictitious_domains.py
@@ -2,9 +2,10 @@
This demo use levelset to impose (weakly) a Dirichlet condition on an
implicit boundary defined by the zero of the levelset
"""
-import getfem as gf
import numpy as np
-from scipy import rand,setdiff1d
+from scipy import rand, setdiff1d
+
+import getfem as gf
NX=40
ls_degree = 2
diff --git a/doc/sphinx/source/python/code_samples/demo_laplacian.py
b/doc/sphinx/source/python/code_samples/demo_laplacian.py
index c1ab19a..0c391e6 100644
--- a/doc/sphinx/source/python/code_samples/demo_laplacian.py
+++ b/doc/sphinx/source/python/code_samples/demo_laplacian.py
@@ -21,9 +21,10 @@
## 2D Poisson problem test.
+import numpy as np
+
# import basic modules
import getfem as gf
-import numpy as np
# boundary names
top = 101 # Dirichlet boundary
diff --git a/doc/sphinx/source/python/code_samples/demo_step_by_step.py
b/doc/sphinx/source/python/code_samples/demo_step_by_step.py
index 3be92c9..66d06d3 100644
--- a/doc/sphinx/source/python/code_samples/demo_step_by_step.py
+++ b/doc/sphinx/source/python/code_samples/demo_step_by_step.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python
# -*- coding: UTF8 -*-
+import numpy as np
+
# import basic modules
import getfem as gf
-import numpy as np
# creation of a simple cartesian mesh
m = gf.Mesh('cartesian', np.arange(0,1.1,0.1), np.arange(0,1.1,0.1))
diff --git a/doc/sphinx/source/python/code_samples/demo_tripod.py
b/doc/sphinx/source/python/code_samples/demo_tripod.py
index 4be1e72..088bbc8 100644
--- a/doc/sphinx/source/python/code_samples/demo_tripod.py
+++ b/doc/sphinx/source/python/code_samples/demo_tripod.py
@@ -28,9 +28,10 @@
$Id$
"""
-import getfem as gf
import numpy as np
+import getfem as gf
+
with_graphics=True
try:
import getfem_tvtk
diff --git a/doc/sphinx/source/python/code_samples/demo_tripod_alt.py
b/doc/sphinx/source/python/code_samples/demo_tripod_alt.py
index 6abae18..a400b8a 100644
--- a/doc/sphinx/source/python/code_samples/demo_tripod_alt.py
+++ b/doc/sphinx/source/python/code_samples/demo_tripod_alt.py
@@ -1,9 +1,10 @@
# This is the "old" tripod demo, which uses the low level approach:
# building the linear system by hand, handling Dirichlet, calling the solver
etc...
-import getfem as gf
import numpy as np
+import getfem as gf
+
# parameters
file_msh = 'tripod.GiD.msh'
degree = 1
diff --git a/interface/tests/python/check_asm.py
b/interface/tests/python/check_asm.py
index c7cca8c..c19f7c6 100644
--- a/interface/tests/python/check_asm.py
+++ b/interface/tests/python/check_asm.py
@@ -28,8 +28,8 @@
$Id$
"""
import numpy as np
-import getfem as gf
+import getfem as gf
NX = 4
m = gf.Mesh('triangles grid', np.arange(0,1+1./NX,1./NX),
@@ -237,4 +237,3 @@ if (res != "(Grad_w(2, 2))"):
str = "Grad(u*Test_u)"; print('\nAssembly string "%s" gives:' % str)
res = gf.asm('expression analysis', str, mim, 1, md)
-
diff --git a/interface/tests/python/check_export.py
b/interface/tests/python/check_export.py
index 9e6350b..68d1e42 100644
--- a/interface/tests/python/check_export.py
+++ b/interface/tests/python/check_export.py
@@ -26,9 +26,10 @@
$Id$
"""
-import getfem as gf
import numpy as np
+import getfem as gf
+
m0 = gf.Mesh('cartesian',[0,1,2,3],[0,1,2],[-3,-2])
m0.add_convex(gf.GeoTrans('GT_QK(2,2)'),[[0,0,0,.4,.6,.5,1.2,1,1],
diff --git a/interface/tests/python/check_global_functions.py
b/interface/tests/python/check_global_functions.py
index 277784d..4e190f3 100644
--- a/interface/tests/python/check_global_functions.py
+++ b/interface/tests/python/check_global_functions.py
@@ -26,9 +26,10 @@
$Id$
"""
-import getfem as gf
import os
+import getfem as gf
+
# mesh fem to export
m = gf.Mesh('triangles grid', [-1, -0.5, 0, 0.5, 1], [-1, -0.5, 0, 0.5, 1])
# m = gf.Mesh('import','gmsh','quad.msh')
diff --git a/interface/tests/python/check_levelset.py
b/interface/tests/python/check_levelset.py
index 0f86843..a67a764 100644
--- a/interface/tests/python/check_levelset.py
+++ b/interface/tests/python/check_levelset.py
@@ -26,10 +26,11 @@
$Id$
"""
-import getfem as gf
import numpy as np
from scipy import rand
+import getfem as gf
+
eps = 1.0/10
m = gf.Mesh('regular_simplices', np.arange(-1,1+eps,eps),
np.arange(-1,1+eps,eps), 'degree', 2, 'noised')
diff --git a/interface/tests/python/check_mixed_mesh.py
b/interface/tests/python/check_mixed_mesh.py
index bf6cd81..338421a 100644
--- a/interface/tests/python/check_mixed_mesh.py
+++ b/interface/tests/python/check_mixed_mesh.py
@@ -28,10 +28,12 @@
$Id$
"""
-import getfem as gf
-import numpy as np
import os
+import numpy as np
+
+import getfem as gf
+
# parameters
E = 1.0e3
Nu = 0.25
diff --git a/interface/tests/python/check_secondary_domain.py
b/interface/tests/python/check_secondary_domain.py
index cebb819..d852b4f 100644
--- a/interface/tests/python/check_secondary_domain.py
+++ b/interface/tests/python/check_secondary_domain.py
@@ -28,8 +28,8 @@
$Id$
"""
import numpy as np
-import getfem as gf
+import getfem as gf
NX = 4
@@ -87,4 +87,3 @@ for i in range(0, V1.size):
for j in range(0, V2.size):
if (abs(M[i,j] - V1[i]*V2[j]) > 1E-8):
print("Bad value for matrix assembly"); exit(1)
-
diff --git a/interface/tests/python/demo_Mindlin_Reissner_plate.py
b/interface/tests/python/demo_Mindlin_Reissner_plate.py
index ffd3790..29c18e1 100644
--- a/interface/tests/python/demo_Mindlin_Reissner_plate.py
+++ b/interface/tests/python/demo_Mindlin_Reissner_plate.py
@@ -27,6 +27,7 @@
"""
import numpy as np
+
import getfem as gf
## Parameters
diff --git a/interface/tests/python/demo_Vector_Potential_Curl_DG.py
b/interface/tests/python/demo_Vector_Potential_Curl_DG.py
index 5ed722f..5b1b852 100644
--- a/interface/tests/python/demo_Vector_Potential_Curl_DG.py
+++ b/interface/tests/python/demo_Vector_Potential_Curl_DG.py
@@ -33,15 +33,17 @@ D.N. Arnold, F. Brezzi, B. Cockburn, L.D. Marini, SIAM J.
Numer. Anal. vol. 39:5
@mail: address@hidden
"""
-import numpy as np
+import datetime
import sys
+import time
+from enum import Enum
+
+import numpy as np
+
try: gf
except NameError: gf = None
if gf is None:
import getfem as gf
-import time
-import datetime
-from enum import Enum
Exact = Enum('Exact', 'BdmExample DotNormalZero CrossNormalZero')
######################################################################
diff --git a/interface/tests/python/demo_cracked_thermo_elastic_body.py
b/interface/tests/python/demo_cracked_thermo_elastic_body.py
index 6fe6015..b94257d 100644
--- a/interface/tests/python/demo_cracked_thermo_elastic_body.py
+++ b/interface/tests/python/demo_cracked_thermo_elastic_body.py
@@ -27,6 +27,7 @@
$Id$
"""
import numpy as np
+
import getfem as gf
np.set_printoptions(threshold=100000)
diff --git a/interface/tests/python/demo_dynamic_contact_1D.py
b/interface/tests/python/demo_dynamic_contact_1D.py
index 16fc8f2..19a901a 100644
--- a/interface/tests/python/demo_dynamic_contact_1D.py
+++ b/interface/tests/python/demo_dynamic_contact_1D.py
@@ -27,10 +27,13 @@
This is also a good example of use of GetFEM++.
"""
-import getfem as gf
-import numpy as np
+import os
+import sys
+
import matplotlib.pyplot as plt
-import os, sys
+import numpy as np
+
+import getfem as gf
# Numerical parameters
NX = 20 # Number of elements
diff --git a/interface/tests/python/demo_elastic_ring_contact.py
b/interface/tests/python/demo_elastic_ring_contact.py
index d172f3e..568c7df 100644
--- a/interface/tests/python/demo_elastic_ring_contact.py
+++ b/interface/tests/python/demo_elastic_ring_contact.py
@@ -21,10 +21,12 @@
#
############################################################################
-import getfem as gf
-import numpy as np
import time
+import numpy as np
+
+import getfem as gf
+
gf.util_trace_level(1)
# Input data
diff --git a/interface/tests/python/demo_elasticity_HHO.py
b/interface/tests/python/demo_elasticity_HHO.py
index b439056..b9a9143 100644
--- a/interface/tests/python/demo_elasticity_HHO.py
+++ b/interface/tests/python/demo_elasticity_HHO.py
@@ -26,9 +26,10 @@
$Id$
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
NX = 40 # Mesh parameter.
diff --git a/interface/tests/python/demo_fictitious_domains.py
b/interface/tests/python/demo_fictitious_domains.py
index 67302af..0eae448 100644
--- a/interface/tests/python/demo_fictitious_domains.py
+++ b/interface/tests/python/demo_fictitious_domains.py
@@ -27,9 +27,10 @@
$Id$
"""
-import getfem as gf
import numpy as np
-from scipy import rand,setdiff1d
+from scipy import rand, setdiff1d
+
+import getfem as gf
eps = 1.0/40
ls_degree = 2
diff --git a/interface/tests/python/demo_finite_strain_plasticity.py
b/interface/tests/python/demo_finite_strain_plasticity.py
index a6d4552..3b19145 100644
--- a/interface/tests/python/demo_finite_strain_plasticity.py
+++ b/interface/tests/python/demo_finite_strain_plasticity.py
@@ -20,12 +20,14 @@
#
############################################################################
-import getfem as gf
-import numpy as np
-import sys
import os
-import time
import shutil
+import sys
+import time
+
+import numpy as np
+
+import getfem as gf
np.set_printoptions(threshold=100000)
gf.util_trace_level(1)
diff --git a/interface/tests/python/demo_finite_strain_plasticity_3D.py
b/interface/tests/python/demo_finite_strain_plasticity_3D.py
index ef4e7ac..a1d867d 100644
--- a/interface/tests/python/demo_finite_strain_plasticity_3D.py
+++ b/interface/tests/python/demo_finite_strain_plasticity_3D.py
@@ -20,12 +20,14 @@
#
############################################################################
-import getfem as gf
-import numpy as np
-import sys
import os
-import time
import shutil
+import sys
+import time
+
+import numpy as np
+
+import getfem as gf
np.set_printoptions(threshold=100000)
gf.util_trace_level(1)
diff --git a/interface/tests/python/demo_laplacian.py
b/interface/tests/python/demo_laplacian.py
index 6e803b6..8090aec 100644
--- a/interface/tests/python/demo_laplacian.py
+++ b/interface/tests/python/demo_laplacian.py
@@ -26,9 +26,10 @@
$Id$
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
NX = 100 # Mesh parameter.
diff --git a/interface/tests/python/demo_laplacian_DG.py
b/interface/tests/python/demo_laplacian_DG.py
index 4810a33..9d18aad 100644
--- a/interface/tests/python/demo_laplacian_DG.py
+++ b/interface/tests/python/demo_laplacian_DG.py
@@ -31,9 +31,10 @@
$Id: demo_laplacian_DG.py 4429 2013-10-01 13:15:15Z renard $
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
NX = 20 # Mesh parameter.
@@ -179,4 +180,3 @@ if (verify_neighbour_computation):
if (H1error > 1e-3):
print('Error too large !')
exit(1)
-
diff --git a/interface/tests/python/demo_laplacian_HHO.py
b/interface/tests/python/demo_laplacian_HHO.py
index 4aa0735..0177b94 100644
--- a/interface/tests/python/demo_laplacian_HHO.py
+++ b/interface/tests/python/demo_laplacian_HHO.py
@@ -26,9 +26,10 @@
$Id$
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
NX = 20 # Mesh parameter.
diff --git a/interface/tests/python/demo_laplacian_aposteriori.py
b/interface/tests/python/demo_laplacian_aposteriori.py
index ea229cd..b83d49e 100644
--- a/interface/tests/python/demo_laplacian_aposteriori.py
+++ b/interface/tests/python/demo_laplacian_aposteriori.py
@@ -26,9 +26,10 @@
$Id: demo_laplacian_aposteriori.py 4429 2013-10-01 13:15:15Z renard $
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
h = 4. # Mesh parameter.
@@ -157,10 +158,3 @@ for refiter in range(5):
mesh.refine(np.where( ETAElt > 0.6*np.max(ETA) ))
mesh.optimize_structure()
-
-
-
-
-
-
-
diff --git a/interface/tests/python/demo_laplacian_pyramid.py
b/interface/tests/python/demo_laplacian_pyramid.py
index c6b4c4e..10a41ec 100644
--- a/interface/tests/python/demo_laplacian_pyramid.py
+++ b/interface/tests/python/demo_laplacian_pyramid.py
@@ -30,9 +30,10 @@
$Id$
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
export_mesh = True;
diff --git a/interface/tests/python/demo_large_sliding_contact.py
b/interface/tests/python/demo_large_sliding_contact.py
index 86494eb..f1cabe2 100644
--- a/interface/tests/python/demo_large_sliding_contact.py
+++ b/interface/tests/python/demo_large_sliding_contact.py
@@ -21,9 +21,10 @@
#
############################################################################
-import getfem as gf
import numpy as np
+import getfem as gf
+
gf.util_trace_level(1)
test_case = 1 # 0 = 2D punch on a rigid obstacle
@@ -353,4 +354,3 @@ for nit in range(load_steps):
if test_case <= 1:
Ddata[N-1] -= 1.
md.set_variable("Ddata1", Ddata)
-
diff --git a/interface/tests/python/demo_mortar.py
b/interface/tests/python/demo_mortar.py
index 43e6e4d..c50a157 100644
--- a/interface/tests/python/demo_mortar.py
+++ b/interface/tests/python/demo_mortar.py
@@ -30,9 +30,10 @@
interface between the two areas
"""
+import numpy as np
+
# import basic modules
import getfem as gf
-import numpy as np
# Parameters
NX = 9
@@ -114,4 +115,3 @@ U = md.get('variable', 'u')
VM = md.compute_isotropic_linearized_Von_Mises_or_Tresca('u', 'lambda', 'mu',
mfdu)
mfd.export_to_vtk('mortar.vtk', 'ascii', mfdu, VM, 'Von Mises Stress', mfu,
U, 'Displacement')
-
diff --git a/interface/tests/python/demo_navier_stokes.py
b/interface/tests/python/demo_navier_stokes.py
index 6dc046c..5592d6b 100644
--- a/interface/tests/python/demo_navier_stokes.py
+++ b/interface/tests/python/demo_navier_stokes.py
@@ -30,9 +30,9 @@
# This example is ported from:
#
http://fenicsproject.org/documentation/dolfin/1.0.1/python/demo/pde/navier-stokes/python/documentation.html
-import getfem as gf
import numpy as np
+import getfem as gf
W1 = 0.5 # _____
H1 = 0.5 # | W1 |
@@ -134,4 +134,3 @@ while t < T+1e-8:
mfp, md.variable("p"), "Pressure")
t += dt
step += 1
-
diff --git a/interface/tests/python/demo_nonlinear_elasticity.py
b/interface/tests/python/demo_nonlinear_elasticity.py
index 82ccf94..f241196 100644
--- a/interface/tests/python/demo_nonlinear_elasticity.py
+++ b/interface/tests/python/demo_nonlinear_elasticity.py
@@ -21,10 +21,11 @@
#
############################################################################
-import getfem as gf
import numpy as np
from numpy import linalg as npla
+import getfem as gf
+
gf.util_trace_level(1)
dirichlet_version = 2 # 1 = simplification, 2 = penalisation
@@ -224,19 +225,3 @@ for step in range(1,nbstep+1):
print('You can vizualize the loading steps by launching for instance')
print('mayavi2 -d demo_nonlinear_elasticity_iter_1.vtk -f WarpVector -m
Surface')
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/interface/tests/python/demo_parallel_laplacian.py
b/interface/tests/python/demo_parallel_laplacian.py
index 3e72cf0..f50fd11 100644
--- a/interface/tests/python/demo_parallel_laplacian.py
+++ b/interface/tests/python/demo_parallel_laplacian.py
@@ -29,11 +29,13 @@
$Id: demo_parallel_laplacian.py 3809 2011-09-26 20:38:56Z logari81 $
"""
-# import basic modules
-import mpi4py.MPI as mpi
+import time
+
import numpy as np
+
import getfem as gf
-import time
+# import basic modules
+import mpi4py.MPI as mpi
rank = mpi.COMM_WORLD.rank
if (rank == 0):
@@ -188,4 +190,3 @@ t = time.process_time()
# U,'Computed solution')
# print('You can view the solution with (for example):')
# print('gmsh laplacian.pos')
-
diff --git a/interface/tests/python/demo_phase_field.py
b/interface/tests/python/demo_phase_field.py
index 90f9eda..4996c7a 100644
--- a/interface/tests/python/demo_phase_field.py
+++ b/interface/tests/python/demo_phase_field.py
@@ -20,10 +20,12 @@
#
############################################################################
-import getfem as gf
-import numpy as np
import os
+import numpy as np
+
+import getfem as gf
+
np.set_printoptions(threshold=100000)
gf.util_trace_level(1)
@@ -228,7 +230,3 @@ with open("%s/demo_phase_field_forces.dat" % resultspath,
"w") as f:
f.write(("step=%i eps=%e fR=(%e,%e)\n") %
(step, eps, dfT[0::N].sum(), dfT[1::N].sum()))
f.flush()
-
-
-
-
diff --git a/interface/tests/python/demo_plasticity.py
b/interface/tests/python/demo_plasticity.py
index d411aae..e6e1fae 100644
--- a/interface/tests/python/demo_plasticity.py
+++ b/interface/tests/python/demo_plasticity.py
@@ -28,9 +28,9 @@
$Id$
"""
-import getfem as gf
import numpy as np
+import getfem as gf
with_graphics=False
try:
diff --git a/interface/tests/python/demo_plate.py
b/interface/tests/python/demo_plate.py
index d8a26ce..a456522 100644
--- a/interface/tests/python/demo_plate.py
+++ b/interface/tests/python/demo_plate.py
@@ -26,9 +26,9 @@
$Id$
"""
-import getfem as gf
import numpy as np
+import getfem as gf
NX=10.0
thickness = 0.01;
diff --git a/interface/tests/python/demo_static_contact.py
b/interface/tests/python/demo_static_contact.py
index 17e0808..bfce1d2 100644
--- a/interface/tests/python/demo_static_contact.py
+++ b/interface/tests/python/demo_static_contact.py
@@ -26,9 +26,10 @@
a good example of use of GetFEM++.
"""
-import getfem as gf
import numpy as np
+import getfem as gf
+
# Import the mesh : disc
# m = gf.Mesh('load', '../../../tests/meshes/disc_P2_h4.mesh')
#m = gf.Mesh('load', '../../../tests/meshes/disc_P2_h2.mesh')
@@ -324,4 +325,3 @@ U = md.get('variable', 'u')
VM = md.compute_isotropic_linearized_Von_Mises_or_Tresca('u', 'clambda',
'cmu', mfvm)
mfd.export_to_vtk('static_contact.vtk', 'ascii', mfvm, VM, 'Von Mises
Stress', mfu, U, 'Displacement')
-
diff --git a/interface/tests/python/demo_step_by_step.py
b/interface/tests/python/demo_step_by_step.py
index d8347d0..4084644 100644
--- a/interface/tests/python/demo_step_by_step.py
+++ b/interface/tests/python/demo_step_by_step.py
@@ -20,9 +20,10 @@
#
############################################################################
+import numpy as np
+
# import basic modules
import getfem as gf
-import numpy as np
# creation of a simple cartesian mesh
m = gf.Mesh('cartesian', np.arange(0,1.1,0.1), np.arange(0,1.1,0.1))
diff --git a/interface/tests/python/demo_stokes_3D_tank.py
b/interface/tests/python/demo_stokes_3D_tank.py
index 603b52d..372686b 100644
--- a/interface/tests/python/demo_stokes_3D_tank.py
+++ b/interface/tests/python/demo_stokes_3D_tank.py
@@ -19,9 +19,10 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
-from getfem import *
from numpy import *
+from getfem import *
+
print('3D stokes demonstration on a quadratic mesh')
viscosity = 10
diff --git a/interface/tests/python/demo_stokes_3D_tank_draw.py
b/interface/tests/python/demo_stokes_3D_tank_draw.py
index a6e2e65..dff4cb3 100644
--- a/interface/tests/python/demo_stokes_3D_tank_draw.py
+++ b/interface/tests/python/demo_stokes_3D_tank_draw.py
@@ -19,9 +19,11 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
-import getfem
from numpy import *
+import getfem
+import getfem_tvtk
+
mfu=getfem.MeshFem('load','tank_3D.mfu')
m=mfu.linked_mesh()
mfp=getfem.MeshFem('load','tank_3D.mfp',m)
@@ -31,7 +33,6 @@ P = fromfile('tank_3D.P', 'd')
sl=getfem.Slice(('boundary',('intersection',('planar',+1,[0,0,0],[0,1,0]),('planar',+1,[0,0,0],[1,0,0]))),m,3);
print("importing tvtk..")
-import getfem_tvtk
print("import done")
fig = getfem_tvtk.Figure(gui='tvtk')
@@ -65,4 +66,3 @@ tsl=getfem.Slice('streamlines', mfu, U, H);
fig.show(tsl, tube_color=(1,1,1));
fig.loop()
-
diff --git
a/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
b/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
index cf6b44c..914fe38 100644
--- a/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
+++ b/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
@@ -21,9 +21,10 @@
#
############################################################################
-import getfem as gf
import numpy as np
+import getfem as gf
+
# Deformation of a plate under the coupling of thermal, elasticity, and
# electric effects.
#
@@ -219,13 +220,3 @@ mft.export_to_vtk('temperature.vtk', mft, THETA,
'Temperature')
print('mayavi2 -d temperature.vtk -f WarpScalar -m Surface')
mft.export_to_vtk('electric_potential.vtk', mft, V, 'Electric potential')
print('mayavi2 -d electric_potential.vtk -f WarpScalar -m Surface')
-
-
-
-
-
-
-
-
-
-
diff --git a/interface/tests/python/demo_tresca.py
b/interface/tests/python/demo_tresca.py
index a9f8dfc..f49802f 100644
--- a/interface/tests/python/demo_tresca.py
+++ b/interface/tests/python/demo_tresca.py
@@ -26,9 +26,10 @@
$Id$
"""
+import numpy as np
+
# Import basic modules
import getfem as gf
-import numpy as np
## Parameters
NX = 100 # Mesh parameter.
@@ -109,5 +110,3 @@ mfu.export_to_vtk('tresca.vtk', U,'Computed solution')
print('You can view the solution with (for example):')
print('gmsh tresca.pos')
print("mayavi2 -d tresca.vtk -f WarpScalar -m Surface")
-
-
diff --git a/interface/tests/python/demo_tripod.py
b/interface/tests/python/demo_tripod.py
index 4be1e72..088bbc8 100644
--- a/interface/tests/python/demo_tripod.py
+++ b/interface/tests/python/demo_tripod.py
@@ -28,9 +28,10 @@
$Id$
"""
-import getfem as gf
import numpy as np
+import getfem as gf
+
with_graphics=True
try:
import getfem_tvtk
diff --git a/interface/tests/python/demo_tripod_alt.py
b/interface/tests/python/demo_tripod_alt.py
index 8f39ec1..886f5c8 100644
--- a/interface/tests/python/demo_tripod_alt.py
+++ b/interface/tests/python/demo_tripod_alt.py
@@ -28,9 +28,10 @@
$Id$
"""
-from getfem import *
from numpy import *
+from getfem import *
+
print('importing the mesh..',)
m=Mesh('import','gid','../meshes/tripod.GiD.msh')
print('done!')
diff --git a/interface/tests/python/demo_wave.py
b/interface/tests/python/demo_wave.py
index 46702cc..93fb32b 100644
--- a/interface/tests/python/demo_wave.py
+++ b/interface/tests/python/demo_wave.py
@@ -26,9 +26,11 @@
$Id$
"""
+import os
+
from numpy import *
+
from getfem import *
-import os
make_check=('srcdir' in os.environ);
diff --git a/interface/tests/python/demo_wave_equation.py
b/interface/tests/python/demo_wave_equation.py
index 693f1d3..2adce92 100644
--- a/interface/tests/python/demo_wave_equation.py
+++ b/interface/tests/python/demo_wave_equation.py
@@ -27,9 +27,11 @@
also a good example of use of GetFEM++.
"""
+import os
+
import numpy as np
+
import getfem as gf
-import os
NX = 10
m = gf.Mesh('cartesian', np.arange(0., 1.+1./NX,1./NX),
diff --git a/interface/tests/python/demo_wheel_contact.py
b/interface/tests/python/demo_wheel_contact.py
index 3dc5071..15c090b 100644
--- a/interface/tests/python/demo_wheel_contact.py
+++ b/interface/tests/python/demo_wheel_contact.py
@@ -25,8 +25,10 @@
#
############################################################################
-import getfem as gf
import numpy as np
+
+import getfem as gf
+
gf.util('trace level', 1) # No trace for mesh generation nor for assembly
export_mesh = True;
@@ -165,4 +167,3 @@ mfvm1.export_to_vtk('displacement_with_von_mises1.vtk',
mfvm1, VM1, 'Von Mises
mfvm2.export_to_vtk('displacement_with_von_mises2.vtk', mfvm2, VM2, 'Von
Mises Stresses', mfu2, U2, 'Displacements')
print('You can view solutions with for instance:\nmayavi2 -d
displacement_with_von_mises1.vtk -f WarpVector -m Surface -d
displacement_with_von_mises2.vtk -f WarpVector -m Surface')
-
diff --git a/interface/tests/python/getfem_tvtk.py
b/interface/tests/python/getfem_tvtk.py
index 2989bcd..14649cb 100644
--- a/interface/tests/python/getfem_tvtk.py
+++ b/interface/tests/python/getfem_tvtk.py
@@ -37,9 +37,12 @@ except:
raise
import sys
-import getfem
+
import numpy
+import getfem
+
+
def gf_colormap(name):
if name == 'tripod':
s=64; s1=20; s2=25; s3=48; s4=55;
diff --git a/interface/tests/python/tutorial1.py
b/interface/tests/python/tutorial1.py
index a8b1da5..2bb2db1 100644
--- a/interface/tests/python/tutorial1.py
+++ b/interface/tests/python/tutorial1.py
@@ -20,9 +20,10 @@
#
############################################################################
-import getfem as gf
import numpy as np
+import getfem as gf
+
NX = 10
m = gf.Mesh('cartesian', np.arange(0,1+1./NX,1./NX),
np.arange(0,1+1./NX,1./NX))
mf = gf.MeshFem(m,1) # create a meshfem of for a field of dimension 1