2010-12-02 12:51:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ENGINE_INTERFACE_BASE_H
|
|
|
|
#define ENGINE_INTERFACE_BASE_H
|
|
|
|
|
|
|
|
#include "tools/global.h"
|
|
|
|
|
2010-12-07 15:47:23 +00:00
|
|
|
class Operator_Base;
|
|
|
|
|
2010-12-02 12:51:34 +00:00
|
|
|
//! This is the abstact base for all Engine Interface classes.
|
|
|
|
/*!
|
|
|
|
This is the abstact base for all Engine Interface classes. It will provide unified access to the field information of the corresponding engine.
|
|
|
|
All processing methods should only access this base class.
|
|
|
|
*/
|
|
|
|
class Engine_Interface_Base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum InterpolationType { NO_INTERPOLATION, NODE_INTERPOLATE, CELL_INTERPOLATE };
|
|
|
|
|
2012-11-15 21:26:13 +00:00
|
|
|
virtual ~Engine_Interface_Base() {;} //!< provide a virtual destructor to correctly delete derived objects
|
|
|
|
|
2010-12-07 15:47:23 +00:00
|
|
|
//! Set the operator used for this engine interface.
|
|
|
|
virtual void SetOperator(Operator_Base* base_op) {m_Op_Base=base_op;}
|
|
|
|
//! Get the operator used for this engine interface.
|
|
|
|
virtual const Operator_Base* GetOperator() const {return m_Op_Base;}
|
|
|
|
|
2010-12-02 12:51:34 +00:00
|
|
|
//! Set the current interpolation type \sa GetInterpolationType
|
|
|
|
void SetInterpolationType(InterpolationType type) {m_InterpolType=type;}
|
|
|
|
//! Set the current interpolation type \sa GetInterpolationType
|
|
|
|
void SetInterpolationType(int type) {m_InterpolType=(InterpolationType)type;}
|
|
|
|
//! Get the current interpolation type as string \sa SetInterpolationType GetInterpolationType GetInterpolationNameByType
|
|
|
|
std::string GetInterpolationTypeString() {return GetInterpolationNameByType(m_InterpolType);}
|
|
|
|
//! Get the current interpolation type \sa SetInterpolationType
|
|
|
|
InterpolationType GetInterpolationType() {return m_InterpolType;}
|
|
|
|
|
|
|
|
//! Get the (interpolated) electric field at \p pos. \sa SetInterpolationType
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double* GetEField(const unsigned int* pos, double* out) const =0;
|
2010-12-02 12:51:34 +00:00
|
|
|
//! Get the (interpolated) magnetic field at \p pos. \sa SetInterpolationType
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double* GetHField(const unsigned int* pos, double* out) const =0;
|
2011-01-07 15:12:07 +00:00
|
|
|
//! Get the (interpolated) electric current density field at \p pos. \sa SetInterpolationType
|
|
|
|
virtual double* GetJField(const unsigned int* pos, double* out) const =0;
|
2011-01-10 10:15:22 +00:00
|
|
|
//! Get the total current density field by rot(H) at \p pos. \sa SetInterpolationType
|
|
|
|
virtual double* GetRotHField(const unsigned int* pos, double* out) const =0;
|
2017-05-28 10:01:04 +00:00
|
|
|
//! Get the (interpolated) electric flux density field at \p pos. \sa SetInterpolationType
|
|
|
|
virtual double* GetDField(const unsigned int* pos, double* out) const =0;
|
|
|
|
//! Get the (interpolated) magnetic flux density field at \p pos. \sa SetInterpolationType
|
|
|
|
virtual double* GetBField(const unsigned int* pos, double* out) const =0;
|
2010-12-02 12:51:34 +00:00
|
|
|
|
2010-12-02 13:29:46 +00:00
|
|
|
//! Calculate the electric field integral along a given line
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double CalcVoltageIntegral(const unsigned int* start, const unsigned int* stop) const =0;
|
2010-12-02 13:29:46 +00:00
|
|
|
|
2010-12-02 12:51:34 +00:00
|
|
|
//! Convert the interpolation type into a string.
|
|
|
|
static std::string GetInterpolationNameByType(InterpolationType mode);
|
|
|
|
|
2010-12-02 13:29:46 +00:00
|
|
|
//! Get the current simulation time
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetTime(bool dualTime=false) const =0;
|
2010-12-02 13:29:46 +00:00
|
|
|
|
|
|
|
//! Get the current number of timesteps
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual unsigned int GetNumberOfTimesteps() const =0;
|
2010-12-02 13:29:46 +00:00
|
|
|
|
2011-11-07 11:07:55 +00:00
|
|
|
//! Calc (roughly) the total energy
|
|
|
|
/*!
|
|
|
|
This method only calculates a very rough estimate of the total energy in the simulation domain.
|
|
|
|
The result may even be roughly proportional to the real system energy only.
|
|
|
|
Primary goal is speed, not accuracy.
|
|
|
|
*/
|
|
|
|
virtual double CalcFastEnergy() const =0;
|
|
|
|
|
2010-12-02 12:51:34 +00:00
|
|
|
protected:
|
2010-12-07 15:47:23 +00:00
|
|
|
Engine_Interface_Base(Operator_Base* base_op);
|
|
|
|
|
|
|
|
Operator_Base* m_Op_Base;
|
2010-12-02 12:51:34 +00:00
|
|
|
|
|
|
|
InterpolationType m_InterpolType;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENGINE_INTERFACE_BASE_H
|