pybFoam.sampling¶
Pydantic config models plus the sampledSurface / sampledSet
factories and interpolationScalar / interpolationVector.
pybFoam.sampling package exports for convenience.
Keep the public API small: import configs in the package namespace so from pybFoam.sampling import SampledPlaneConfig, UniformSetConfig works in examples/tests.
- class pybFoam.sampling.ArraySetConfig(*, type: Literal['array'] = 'array', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, pointsDensity: List[int], spanBox: List[float], origin: List[float] | None = None, **extra_data: Any)[source]¶
Configuration for array (3D grid) sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['array']¶
- class pybFoam.sampling.CellCentreSetConfig(*, type: Literal['cellCentre'] = 'cellCentre', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, start: List[float], end: List[float], **extra_data: Any)[source]¶
Configuration for cellCentre sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['cellCentre']¶
- class pybFoam.sampling.CircleSetConfig(*, type: Literal['circle'] = 'circle', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, origin: List[float], circleAxis: List[float], startPoint: List[float], dTheta: Annotated[float, Gt(gt=0)], **extra_data: Any)[source]¶
Configuration for circle sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['circle']¶
- class pybFoam.sampling.CloudSetConfig(*, type: Literal['cloud'] = 'cloud', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, points: List[List[float]], **extra_data: Any)[source]¶
Configuration for cloud (arbitrary points) sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_foam_dict() dictionary[source]¶
Return OpenFOAM dictionary object.
- type: Literal['cloud']¶
- class pybFoam.sampling.FaceOnlySetConfig(*, type: Literal['face', 'faceOnly'] = 'face', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, start: List[float], end: List[float], **extra_data: Any)[source]¶
Configuration for faceOnly sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['face', 'faceOnly']¶
- class pybFoam.sampling.MidPointAndFaceSetConfig(*, type: Literal['midPointAndFace'] = 'midPointAndFace', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, start: List[float], end: List[float], **extra_data: Any)[source]¶
Configuration for midPointAndFace sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['midPointAndFace']¶
- class pybFoam.sampling.MidPointSetConfig(*, type: Literal['midPoint'] = 'midPoint', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, start: List[float], end: List[float], **extra_data: Any)[source]¶
Configuration for midPoint sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['midPoint']¶
- pybFoam.sampling.OUT_OF_MESH: float = 1.7976931348623157e+308¶
Sentinel value returned by
sampleSetScalar/sampleSetVectorfor sample points that did not land in any cell of the mesh. This mirrors OpenFOAM’spTraits<scalar>::max(i.e.std::numeric_limits<double>::max()). Any value at least an order of magnitude smaller than this is a real interpolated result.
- class pybFoam.sampling.PatchCloudSetConfig(*, type: Literal['patchCloud'] = 'patchCloud', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, patches: str | List[str], points: List[List[float]], maxDistance: Annotated[float | None, Gt(gt=0)] = None, **extra_data: Any)[source]¶
Configuration for patchCloud sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['patchCloud']¶
- class pybFoam.sampling.PatchSeedSetConfig(*, type: Literal['patchSeed'] = 'patchSeed', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, patches: str | List[str], searchDir: List[float], maxDistance: Annotated[float | None, Gt(gt=0)] = None, **extra_data: Any)[source]¶
Configuration for patchSeed sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['patchSeed']¶
- class pybFoam.sampling.PolyLineSetConfig(*, type: Literal['polyLine'] = 'polyLine', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, points: List[List[float]], nPoints: Annotated[int | None, Gt(gt=0)] = None, **extra_data: Any)[source]¶
Configuration for polyLine (multi-segment) sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_foam_dict() dictionary[source]¶
Return OpenFOAM dictionary object.
- type: Literal['polyLine']¶
- class pybFoam.sampling.SampledCuttingPlaneConfig(*, type: Literal['cuttingPlane'] = 'cuttingPlane', name: str | None = None, planeType: str | None = None, point: List[float] | None = None, origin: List[float] | None = None, normal: List[float] | None = None, offsets: List[float] | None = None, isoMethod: Literal['cell', 'topo', 'point'] | None = None, bounds: List[List[float]] | None = None, zone: str | None = None, zones: List[str] | None = None, regularise: bool | None = None, mergeTol: float | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['cuttingPlane']¶
- class pybFoam.sampling.SampledCuttingSurfaceConfig(*, type: Literal['cuttingSurface'] = 'cuttingSurface', name: str | None = None, surfaceType: str, surfaceName: str | None = None, triangulate: bool | None = None, bounds: List[List[float]] | None = None, zone: str | None = None, zones: List[str] | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['cuttingSurface']¶
- class pybFoam.sampling.SampledDistanceSurfaceConfig(*, type: Literal['distanceSurface'] = 'distanceSurface', name: str | None = None, surfaceType: str, surfaceName: str | None = None, distance: float | None = None, signed: bool | None = None, isoMethod: Literal['cell', 'topo', 'point'] | None = None, regularise: bool | None = None, average: bool | None = None, bounds: List[List[float]] | None = None, topology: str | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['distanceSurface']¶
- class pybFoam.sampling.SampledFaceZoneConfig(*, type: Literal['faceZone', 'faceZones'] = 'faceZone', name: str | None = None, zones: List[str], triangulate: bool | None = None, **extra_data: Any)[source]¶
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['faceZone', 'faceZones']¶
- class pybFoam.sampling.SampledIsoSurfaceConfig(*, type: Literal['isoSurface'] = 'isoSurface', name: str | None = None, isoField: str, isoValue: float | None = None, isoValues: List[float] | None = None, isoMethod: Literal['cell', 'topo', 'point'] | None = None, average: bool | None = None, bounds: List[List[float]] | None = None, zone: str | None = None, zones: List[str] | None = None, regularise: bool | None = None, triangulate: bool | None = None, mergeTol: float | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['isoSurface']¶
- class pybFoam.sampling.SampledMeshedSurfaceConfig(*, type: Literal['meshedSurface'] = 'meshedSurface', name: str | None = None, surface: str | None = None, source: Literal['cells', 'insideCells', 'boundaryFaces'] | None = None, patches: List[str] | None = None, maxDistance: float | None = None, interpolate: bool | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['meshedSurface']¶
- class pybFoam.sampling.SampledPatchConfig(*, type: Literal['patch'] = 'patch', name: str | None = None, patches: str | List[str], triangulate: bool | None = None, **extra_data: Any)[source]¶
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_foam_dict() dictionary[source]¶
Return OpenFOAM dictionary object.
- type: Literal['patch']¶
- class pybFoam.sampling.SampledPatchInternalFieldConfig(*, type: Literal['patchInternalField'] = 'patchInternalField', name: str | None = None, patches: str | List[str], offsetMode: Literal['normal', 'uniform', 'nonuniform'] | None = None, distance: float | None = None, offset: List[float] | None = None, offsets: List[List[float]] | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['patchInternalField']¶
- class pybFoam.sampling.SampledPlaneConfig(*, type: Literal['plane'] = 'plane', name: str | None = None, planeType: str | None = None, point: List[float] | None = None, origin: List[float] | None = None, normal: List[float] | None = None, triangulate: bool | None = None, bounds: List[List[float]] | None = None, zone: str | None = None, zones: List[str] | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_foam_dict() dictionary[source]¶
Return OpenFOAM dictionary object.
- type: Literal['plane']¶
- class pybFoam.sampling.SampledSetBaseConfig(*, type: str, axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, **extra_data: Any)[source]¶
Base configuration for all sampledSet types.
- axis: Literal['x', 'y', 'z', 'xyz', 'distance']¶
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pybFoam.sampling.SampledSurfaceBaseConfig(*, type: str, name: str | None = None, **extra_data: Any)[source]¶
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pybFoam.sampling.SampledThresholdCellFacesConfig(*, type: Literal['thresholdCellFaces'] = 'thresholdCellFaces', name: str | None = None, field: str, lowerLimit: float | None = None, upperLimit: float | None = None, triangulate: bool | None = None, **extra_data: Any)[source]¶
-
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['thresholdCellFaces']¶
- class pybFoam.sampling.UniformSetConfig(*, type: Literal['uniform'] = 'uniform', axis: Literal['x', 'y', 'z', 'xyz', 'distance'], name: str | None = None, start: List[float], end: List[float], nPoints: Annotated[int, Gt(gt=0)], tol: Annotated[float | None, Gt(gt=0)] = None, **extra_data: Any)[source]¶
Configuration for uniform (straight line) sampledSet.
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- type: Literal['uniform']¶
- pybFoam.sampling.dict_to_foam(py_dict: Dict[str, Any]) dictionary[source]¶
Convert a Python dictionary to an OpenFOAM dictionary object.
This helper converts nested Python dicts and lists into OpenFOAM dictionary objects that can be passed to C++ bindings.
- Args:
py_dict: Python dictionary with string keys and various value types
- Returns:
OpenFOAM dictionary object