MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / test_function_grad

Function test_function_grad

scripts/fem_check.py:30–37  ·  view source on GitHub ↗

[ -1.0*x/(x**2 + y**2 + z**2)**(3/2) ] grad(x,y,z) = [ -1.0*y/(x**2 + y**2 + z**2)**(3/2) ] [ -1.0*z/(x**2 + y**2 + z**2)**(3/2) ]

(charges)

Source from the content-addressed store, hash-verified

28 for c in charges], axis=0);
29
30def test_function_grad(charges):
31 """
32 [ -1.0*x/(x**2 + y**2 + z**2)**(3/2) ]
33 grad(x,y,z) = [ -1.0*y/(x**2 + y**2 + z**2)**(3/2) ]
34 [ -1.0*z/(x**2 + y**2 + z**2)**(3/2) ]
35 """
36 return lambda pts: np.sum([-(pts-c) / np.power(numpy.linalg.norm(pts-c, axis=1), 3)[:,np.newaxis]
37 for c in charges], axis=0);
38
39def get_quadrature_pts(mesh):
40 """ Generate second degree Gaussian quadrature points for tets.

Callers 1

mainFunction · 0.85

Calls 1

normMethod · 0.80

Tested by

no test coverage detected