From 1669b747585ba10bad4f3f25b5308db5b64e34a4 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 6 May 2020 22:43:30 -0500 Subject: [PATCH 1/4] Fix compilation bugs: not using self.* in constructors --- contrib/meshgen11_dealii/CMakeLists.txt | 2 +- contrib/meshgen11_dealii/meshgen.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/meshgen11_dealii/CMakeLists.txt b/contrib/meshgen11_dealii/CMakeLists.txt index 2c8f2f2..b7c9ea9 100644 --- a/contrib/meshgen11_dealii/CMakeLists.txt +++ b/contrib/meshgen11_dealii/CMakeLists.txt @@ -69,7 +69,7 @@ else() COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" ) SET_PROPERTY(TARGET meshgen11 APPEND_STRING PROPERTY - LINK_FLAGS " ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" + LINK_FLAGS " ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}} $ENV{DEAL_II_LINKER_FLAGS}" ) SET_PROPERTY(TARGET meshgen11 APPEND PROPERTY COMPILE_DEFINITIONS "${DEAL_II_USER_DEFINITIONS};${DEAL_II_USER_DEFINITIONS_${_build}}" diff --git a/contrib/meshgen11_dealii/meshgen.cpp b/contrib/meshgen11_dealii/meshgen.cpp index b7cdcef..9028992 100644 --- a/contrib/meshgen11_dealii/meshgen.cpp +++ b/contrib/meshgen11_dealii/meshgen.cpp @@ -145,9 +145,9 @@ public: d::GridGenerator::hyper_cube(triangulation, box_a, box_b); // initial number of levels must be compatible - assert(level > self.min_grid_level); - assert(level <= self.max_grid_level + 1); - assert(std::pow(std::pow(2, dimension), level - 1) <= self.max_n_cells); + assert(level > min_grid_level); + assert(level <= max_grid_level + 1); + assert(std::pow(std::pow(2, dimension), level - 1) <= max_n_cells); if (level > 1) { triangulation.refine_global(level - 1); @@ -168,9 +168,9 @@ public: d::GridGenerator::hyper_cube(triangulation, box_a, box_b); // initial number of levels must be compatible - assert(level > self.min_grid_level); - assert(level <= self.max_grid_level + 1); - assert(std::pow(std::pow(2, dimension), level - 1) <= self.max_n_cells); + assert(level > min_grid_level); + assert(level <= max_grid_level + 1); + assert(std::pow(std::pow(2, dimension), level - 1) <= max_n_cells); if (level > 1) { triangulation.refine_global(level - 1); -- GitLab From b34ed5a75b5216f5857f9f82c8a796d4efcf9696 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 6 May 2020 22:52:09 -0500 Subject: [PATCH 2/4] Supress some flake8 errors --- test/test_singular_integral_2d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_singular_integral_2d.py b/test/test_singular_integral_2d.py index 09dcf9d..59d9051 100644 --- a/test/test_singular_integral_2d.py +++ b/test/test_singular_integral_2d.py @@ -69,7 +69,7 @@ def test_quadrature_2d_box(): def test_affine_mapping(): tria1 = ((1, 1), (2, 3), (0, 4)) tria2 = ((0, 0), (1, 0), (0, 1)) - mp, J, imp, iJ = sint.solve_affine_map_2d(tria1, tria2) + mp, J, imp, iJ = sint.solve_affine_map_2d(tria1, tria2) # noqa: N806 assert np.isclose(J * iJ, 1) for i in range(3): assert np.allclose(mp(tria1[i]), tria2[i]) @@ -99,7 +99,7 @@ def test_is_in_r(): def test_tria2rect_map(): - t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() + t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() # noqa: N806 assert np.allclose(t2r((0, 0)), (0, 0)) assert np.allclose(t2r((1, 0)), (1, 0)) assert np.allclose(t2r((0, 1)), (1, np.pi / 2)) @@ -110,7 +110,7 @@ def test_tria2rect_map(): def test_tria2rect_jacobian(): - t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() + t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() # noqa: N806 p1 = (0.1, 0.1) assert np.isclose(J_t2r(p1) * J_r2t(t2r(p1)), 1) assert np.isclose(J_r2t(p1) * J_t2r(r2t(p1)), 1) -- GitLab From 5ec7dd95fcddc2ebc75860eb9b7daf8e1c98bbd3 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 6 May 2020 23:12:07 -0500 Subject: [PATCH 3/4] More pylint fixes --- examples/volume_potential_2d.py | 6 +++--- examples/volume_potential_3d.py | 4 ++-- volumential/function_extension.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/volume_potential_2d.py b/examples/volume_potential_2d.py index 5eed2ad..9fa3476 100644 --- a/examples/volume_potential_2d.py +++ b/examples/volume_potential_2d.py @@ -29,7 +29,7 @@ import logging logger = logging.getLogger(__name__) -if 0: +if 1: # verbose logging.basicConfig(level=logging.INFO) else: @@ -322,7 +322,7 @@ def main(): import time queue.finish() - t0 = time.clock() + t0 = time.process_time() pot, = drive_volume_fmm( trav, @@ -333,7 +333,7 @@ def main(): ) queue.finish() - t1 = time.clock() + t1 = time.process_time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/examples/volume_potential_3d.py b/examples/volume_potential_3d.py index 2997e85..3317e42 100644 --- a/examples/volume_potential_3d.py +++ b/examples/volume_potential_3d.py @@ -334,7 +334,7 @@ def main(): import time queue.finish() - t0 = time.clock() + t0 = time.process_time() pot, = drive_volume_fmm( trav, @@ -344,7 +344,7 @@ def main(): direct_evaluation=force_direct_evaluation, list1_only=False) - t1 = time.clock() + t1 = time.process_time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/volumential/function_extension.py b/volumential/function_extension.py index 1612d60..9644725 100644 --- a/volumential/function_extension.py +++ b/volumential/function_extension.py @@ -528,7 +528,7 @@ def compute_biharmonic_extension(queue, target_discr, omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), GS1)(queue, mu=mu).real - omega_S2 = - bind( # noqa: N806 + omega_S2 = - bind( # noqa: N806,E1130 (qbx_stick_out, target_discr), GS2)(queue, mu=mu).real omega_S3 = (z_conj * int_rho).real # noqa: N806 omega_S = -(omega_S1 + omega_S2 + omega_S3) # noqa: N806 @@ -536,14 +536,14 @@ def compute_biharmonic_extension(queue, target_discr, grad_omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), sym.grad(dim, GS1))(queue, mu=mu).real - grad_omega_S2 = - bind( # noqa: N806 + grad_omega_S2 = - bind( # noqa: N806,E1130 (qbx_stick_out, target_discr), sym.grad(dim, GS2))(queue, mu=mu).real grad_omega_S3 = (int_rho * make_obj_array([1., -1.])).real # noqa: N806 grad_omega_S = -(grad_omega_S1 + grad_omega_S2 + grad_omega_S3) # noqa: N806 omega_S1_bdry = bind(qbx, GS1_bdry)(queue, mu=mu).real # noqa: N806 - omega_S2_bdry = - bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806 + omega_S2_bdry = - bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806,E1130 omega_S3_bdry = (z_conj_bdry * int_rho).real # noqa: N806 omega_S_bdry = -(omega_S1_bdry + omega_S2_bdry + omega_S3_bdry) # noqa: N806 -- GitLab From bba43749154575c9524c4030e44502fb3424515a Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 6 May 2020 23:43:52 -0500 Subject: [PATCH 4/4] Supress some pylint messages --- volumential/function_extension.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/volumential/function_extension.py b/volumential/function_extension.py index 9644725..00a31ee 100644 --- a/volumential/function_extension.py +++ b/volumential/function_extension.py @@ -424,6 +424,7 @@ def compute_biharmonic_extension(queue, target_discr, """Biharmoc extension. Currently only support interior domains in 2D (i.e., extension is on the exterior). """ + # pylint: disable=invalid-unary-operand-type dim = 2 queue = setup_command_queue(queue=queue) qbx_forced_limit = 1 @@ -528,7 +529,7 @@ def compute_biharmonic_extension(queue, target_discr, omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), GS1)(queue, mu=mu).real - omega_S2 = - bind( # noqa: N806,E1130 + omega_S2 = - bind( # noqa: N806 (qbx_stick_out, target_discr), GS2)(queue, mu=mu).real omega_S3 = (z_conj * int_rho).real # noqa: N806 omega_S = -(omega_S1 + omega_S2 + omega_S3) # noqa: N806 @@ -536,14 +537,14 @@ def compute_biharmonic_extension(queue, target_discr, grad_omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), sym.grad(dim, GS1))(queue, mu=mu).real - grad_omega_S2 = - bind( # noqa: N806,E1130 + grad_omega_S2 = - bind( # noqa: N806 (qbx_stick_out, target_discr), sym.grad(dim, GS2))(queue, mu=mu).real grad_omega_S3 = (int_rho * make_obj_array([1., -1.])).real # noqa: N806 grad_omega_S = -(grad_omega_S1 + grad_omega_S2 + grad_omega_S3) # noqa: N806 omega_S1_bdry = bind(qbx, GS1_bdry)(queue, mu=mu).real # noqa: N806 - omega_S2_bdry = - bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806,E1130 + omega_S2_bdry = - bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806 omega_S3_bdry = (z_conj_bdry * int_rho).real # noqa: N806 omega_S_bdry = -(omega_S1_bdry + omega_S2_bdry + omega_S3_bdry) # noqa: N806 -- GitLab