/*
    Copyright 2012 Lumerical Solutions, Inc. All rights reserved.
*/
#ifndef _MAGNETICELECTRICLORENTZ_H
#define _MAGNETICELECTRICLORENTZ_H

#include "imaterialplugin.h"
#include <vector>

class MagneticElectricLorentzPlugin : public IMagneticMaterialPlugin
{
public:
    MagneticElectricLorentzPlugin(){};
    virtual ~MagneticElectricLorentzPlugin(){};

    const char* name() const {return "Magnetic Electric Lorentz (Version 1.0.0)";};
    const char* uniqueId() const {return "{BE39A6B9-33FF-4d75-A87A-54F4FCE572C3}";};
    const char** parameterNames() const { return names;};
    float calculateEx( float U, float V, float Ex, float* storage);
    float calculateEy( float U, float V, float Ey, float* storage);
    float calculateEz( float U, float V, float Ez, float* storage);
    float calculateHx( float U, float V, float Hx, float* storage);
    float calculateHy( float U, float V, float Hy, float* storage);
    float calculateHz( float U, float V, float Hz, float* storage);
    void initialize(const double** parameters, double dt);
    void initializeStorageEx(float* storage) {}
    void initializeStorageEy(float* storage) {}
    void initializeStorageEz(float* storage) {}
    void initializeStorageHx(float* storage) {}
    void initializeStorageHy(float* storage) {}
    void initializeStorageHz(float* storage) {}
    size_t storageSizeE() const {return 2;};
    size_t storageSizeH() const {return 2;};

private:
    float calculateE(int i, float U, float V, float E, float *storage);
    float calculateH(int i, float U, float V, float H, float *storage);

    double oneOverNormalizedWa[3];
    double oneOverNormalizedWb[3];

    float e1[3];
    float e2[3];
    float e3[3];
    
    float h1[3];
    float h2[3];
    float h3[3];

    float chi1e[3];
    float chi1m[3];

    static const char* names[11];
};

#endif


