1#ifndef PHYTH_ELECTRIC_FIELD_HPP
2#define PHYTH_ELECTRIC_FIELD_HPP
58 template<
typename...
Args>
124 template<
typename T,
typename = std::enable_if<is_
charge_source_v<T> > >
125 [[
nodiscard]] std::unordered_set<std::shared_ptr<T> >
127 std::unordered_set<std::shared_ptr<T> >
sources;
175 template<
typename...
Args>
191 return "ElectricField{"
197 std::unordered_set<std::shared_ptr<ChargeSource> >
sources_;
Electric field composed of multiple charge sources.
void AddSources(Args &&... args)
Add multiple charge sources.
std::unordered_set< std::shared_ptr< T > > GetChargeSources() const
Get all sources of a specific charge source type.
void Clear()
Remove all sources from the field.
void RemoveSources(Args &&... args)
Remove multiple sources.
Vector3< Quantity< NewtonPerCoulomb > > GetValueAt(const Vector3< Quantity< Meter > > &point) const override
Compute the total electric field at a point.
std::string toString() const
Convert the field to a string representation.
Quantity< Coulomb > GetTotalChargeValue() const
Get the total charge of all sources combined.
Quantity< CoulombPerCubicMeter > GetChargeDensityAt(const Vector3< Quantity< Meter > > &point) const
Compute the total charge density at a point.
void RemoveSource(const std::shared_ptr< ChargeSource > &source)
Remove a specific source from the field.
void AddSource(std::shared_ptr< ChargeSource > source)
Add a single charge source to the field.
std::unordered_set< std::shared_ptr< ChargeSource > > sources_
Quantity< Volt > GetElectricPotential(const Vector3< Quantity< Meter > > &point) const
Compute the total electric potential at a point.
std::unordered_set< std::shared_ptr< ChargeSource > > GetSources() const
Get all sources currently in the field.
Base class for physical fields (scalar or vector)
std::ostream & operator<<(std::ostream &os, const ElectricField &field)
Stream insertion operator for ElectricField.
std::string QuantityToString(const Quantity< UnitT > &q)
Convert a Quantity to a human-readable string.
Physical quantity with a value and a compile-time unit.
3D vector with Quantity components