|
Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
|
Base class for physical fields (scalar or vector) More...
#include <Field.hpp>
Public Types | |
| using | value_type = T |
Public Member Functions | |
| virtual | ~Field ()=default |
| virtual T | GetValueAt (const Vector3< Quantity< Meter > > &point) const =0 |
| Get the field value at a specific point in space. | |
| virtual void | Update () |
| Update the field state (for time-varying fields) | |
Base class for physical fields (scalar or vector)
Field is an abstract interface for any physical quantity that varies over space, such as:
| T | The value type returned by the field (e.g., Quantity<Voltage> for scalar potential, or Vector3<Quantity<ElectricFieldIntensity>> for vector fields) |
Example: class ElectricField : public Field<Vector3<Quantity<ElectricFieldIntensity>>> { [[nodiscard]] value_type GetValueAt(const Vector3<Quantity<Meter>>& point) const override { // Compute E-field at the given position return {0_V/m, 0_V/m, -1.0_V/m}; // uniform field for demo } };
class TemperatureField : public Field<Quantity<Kelvin>> { [[nodiscard]] value_type GetValueAt(const Vector3<Quantity<Meter>>& point) const override { return 300.0_K; // uniform temperature } };
|
pure virtual |
Get the field value at a specific point in space.
| point | Position in 3D space (Meters) |
This is the core method of any field. Implementations must handle coordinate bounds and interpolation as needed.
Implemented in Phyth::Electromagnetics::ElectricField, and Phyth::Electromagnetics::MagneticField.