Maxwell.h 1.16 KB
Newer Older
1 2 3 4 5 6 7
#include <memory>
#include <vector>
#include <iostream>

class Component;

/** MaxwellTest is a small utility for testing field objects
8
 *
9 10 11 12 13 14 15 16 17 18 19 20 21
 *  Calculated numerical derivatives for calculating maxwell's equations and
 *  checking that field maps are physical.
 */
class MaxwellTest {

  public:
    MaxwellTest(Vector_t dR, double dt, Component* field);

    Component* getField() const {return field_m.get();}
    void setField(Component* field) {field_m.reset(field);}

    Vector_t getDR() const {return dR_m;}
    void setDR(Vector_t dR) {dR_m = dR;}
22

23 24 25 26 27 28 29 30 31 32 33 34
    std::vector< std::vector<double> > partialsDerivB(const Vector_t &R, double t) const;
    std::vector< std::vector<double> > partialsDerivA(const Vector_t &R, double t) const;
    double divB(const Vector_t &R, double t) const;
    Vector_t curlB(const Vector_t &R, double t) const;
    Vector_t curlA(const Vector_t &R, double t) const;
    Vector_t getB(const Vector_t &R, double t) const;

    std::ostream& printHeading(std::ostream& out) const;
    std::ostream& printLine(std::ostream& out, const Vector_t& R, double t) const;
  private:
    std::unique_ptr<Component> field_m;
    Vector_t dR_m;
35
    //double dt_m;
36
};