|
Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
|
Combine multiple fields of the same type. More...
#include <Field.hpp>


Public Member Functions | |
| void | AddField (std::shared_ptr< FieldT > field) |
| Add a field to the combination. | |
Public Member Functions inherited from Phyth::Field< FieldT::value_type > | |
| virtual | ~Field ()=default |
| virtual FieldT::value_type | 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) | |
Protected Attributes | |
| std::unordered_set< std::shared_ptr< FieldT > > | fields_ |
Additional Inherited Members | |
Public Types inherited from Phyth::Field< FieldT::value_type > | |
| using | value_type = FieldT::value_type |
Combine multiple fields of the same type.
CombineField aggregates multiple Field objects and presents them as a single field. The combined behavior is determined by subclasses that override GetValueAt.
| FieldT | The field type to combine (must inherit from Field) |
Example: class CombinedElectricField : public CombineField<ElectricField> { [[nodiscard]] value_type GetValueAt(const Vector3<Quantity<Meter>>& point) const override { value_type total = 0_V/m; for (const auto& field : fields_) { total += field->GetValueAt(point); } return total; } }; CombinedElectricField combined; combined.AddField(pointChargeField); combined.AddField(uniformField);
|
inline |
|
protected |