Skip to main content

NetLaplace

C++: phynexis::ml::shape::NetLaplace
Python: phynexis.ml.shape.NetLaplace
Header: src/ml/shape/net_laplace.hpp

Description

Neural network-based Laplace field. Supports PDE verification, surface extraction via marching cubes or spherical projection, and fitting from surface point clouds. Inherits from NetField.

Constructors

NetLaplace()

Creates a Laplace field with field_type = FieldType.Laplace.

Methods

init_from_model_files(net_laplace_file)

Initializes from a saved Laplace model file.

Parameters:

ParameterTypeDescription
net_laplace_filestrPath to the model file

laplacian(pos)

Computes the Laplacian (nabla2f\\nabla^2 f) at a single position.

Parameters:

ParameterTypeDescription
posVec3dPosition

Returns: float — Laplacian value

laplacians(points)

Computes Laplacian values for multiple points.

Parameters:

ParameterTypeDescription
pointslist[Vec3d]Positions

Returns: list[float] — Laplacian values

verify_surface_bc(surface_points)

Verifies the surface boundary condition (f=0f=0).

Parameters:

ParameterTypeDescription
surface_pointslist[Vec3d]Surface points

Returns: float — mean squared error

verify_interior_bc(interior_points)

Verifies the interior boundary condition (f=1f=1).

Parameters:

ParameterTypeDescription
interior_pointslist[Vec3d]Interior points

Returns: float — mean squared error

verify_boundary_bc(boundary_points, boundary_value=-1.0)

Verifies a boundary condition with a custom value.

Parameters:

ParameterTypeDefaultDescription
boundary_pointslist[Vec3d]Boundary points
boundary_valuefloat-1.0Target field value

Returns: float — mean squared error

verify_pde_constraint(domain_points)

Verifies the PDE constraint (nabla2f=0\\nabla^2 f = 0).

Parameters:

ParameterTypeDescription
domain_pointslist[Vec3d]Domain points

Returns: float — mean squared error

extract_isosurface(bounds_min, bounds_max, iso_value=NaN)

Extracts an isosurface using marching cubes.

Parameters:

ParameterTypeDefaultDescription
bounds_minVec3dMinimum bounds
bounds_maxVec3dMaximum bounds
iso_valuefloatNaNIsosurface value (default: laplace_config.iso_value)

Returns: STLModel

fit_from_surface_points(surface_points, layers)

Fits the Laplace field model from a surface point cloud using PINN training.

Parameters:

ParameterTypeDescription
surface_pointslist[Vec3d]Surface points
layerslist[int]Network layer sizes (e.g. [3, 64, 64, 64, 1])

get_stl_model(num_nodes=200)

Generates an STL model from the Laplace field.

Parameters:

ParameterTypeDefaultDescription
num_nodesint200Target number of surface nodes

Returns: STLModel

surface_projection(pos)

Projects a point onto the surface using Newton's method.

Parameters:

ParameterTypeDescription
posVec3dPosition to project

Returns: Vec3d — projected surface point

sample_surface_points()

Samples surface points.

compute_bounds_from_points(points)

Computes axis-aligned bounding box with expansion.

Parameters:

ParameterTypeDescription
pointslist[Vec3d]Point cloud

Returns: (Vec3d, Vec3d) — (bounds_min, bounds_max)

Properties

PropertyTypeAccessDescription
laplace_configLaplaceConfigread/writeLaplace-specific configuration

Inherited from NetField

PropertyTypeAccessDescription
net_modelNeuralNetread/writeNeural network model
field_typeFieldTyperead/writeField type (always Laplace)
surface_configSurfaceConfigread/writeSurface extraction configuration