2010-03-11 15:47:40 +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/>.
|
|
|
|
*/
|
|
|
|
|
2010-03-02 13:54:50 +00:00
|
|
|
#ifndef PROCESSFIELDS_H
|
|
|
|
#define PROCESSFIELDS_H
|
|
|
|
|
|
|
|
#include "processing.h"
|
2010-04-28 09:15:59 +00:00
|
|
|
#include "tools/array_ops.h"
|
2010-03-02 13:54:50 +00:00
|
|
|
|
2010-10-04 07:30:24 +00:00
|
|
|
#define __VTK_DATA_TYPE__ "double"
|
|
|
|
|
2012-02-02 09:20:49 +00:00
|
|
|
class VTK_File_Writer;
|
|
|
|
class HDF5_File_Writer;
|
2011-04-01 13:29:56 +00:00
|
|
|
|
2010-03-02 13:54:50 +00:00
|
|
|
class ProcessFields : public Processing
|
|
|
|
{
|
|
|
|
public:
|
2010-12-07 15:47:23 +00:00
|
|
|
ProcessFields(Engine_Interface_Base* eng_if);
|
2010-03-02 13:54:50 +00:00
|
|
|
virtual ~ProcessFields();
|
|
|
|
|
2011-01-07 15:12:07 +00:00
|
|
|
//! File type definition.
|
2010-04-05 18:22:03 +00:00
|
|
|
enum FileType { VTK_FILETYPE, HDF5_FILETYPE};
|
2011-01-07 15:12:07 +00:00
|
|
|
|
|
|
|
//! Dump type definitions.
|
|
|
|
/*!
|
2011-01-10 10:15:22 +00:00
|
|
|
Current dump types are electric field (E_FIELD_DUMP), magnetic field (H_FIELD_DUMP),
|
|
|
|
(conduction) electric current density (kappa*E) (J_FIELD_DUMP) and total current density (rotH)
|
2011-01-07 15:12:07 +00:00
|
|
|
*/
|
2017-05-28 10:01:04 +00:00
|
|
|
enum DumpType { E_FIELD_DUMP=0, H_FIELD_DUMP=1, J_FIELD_DUMP=2, ROTH_FIELD_DUMP=3, D_FIELD_DUMP=4, B_FIELD_DUMP=5, SAR_LOCAL_DUMP=20, SAR_1G_DUMP=21, SAR_10G_DUMP=22, SAR_RAW_DATA=29};
|
2010-04-05 18:22:03 +00:00
|
|
|
|
2015-06-18 19:45:22 +00:00
|
|
|
virtual std::string GetProcessingName() const {return "common field processing";}
|
2011-01-18 09:34:13 +00:00
|
|
|
|
2010-12-27 20:23:51 +00:00
|
|
|
virtual void InitProcess();
|
|
|
|
|
2010-03-02 13:54:50 +00:00
|
|
|
virtual void DefineStartStopCoord(double* dstart, double* dstop);
|
|
|
|
|
2010-07-16 08:41:12 +00:00
|
|
|
//! Define a field dump sub sampling rate for a given direction (default: \a dir = -1 means all directions)
|
2010-04-07 10:57:45 +00:00
|
|
|
virtual void SetSubSampling(unsigned int subSampleRate, int dir=-1);
|
2010-03-09 20:35:57 +00:00
|
|
|
|
2010-12-28 10:15:08 +00:00
|
|
|
//! Define a field dump optimal resolution for a given direction (default: \a dir = -1 means all directions)
|
|
|
|
virtual void SetOptResolution(double optRes, int dir=-1);
|
|
|
|
|
2010-07-16 08:41:12 +00:00
|
|
|
//! Set the filename for a hdf5 data group file (HDF5 FileType only) \sa SetFileType()
|
2015-06-18 19:45:22 +00:00
|
|
|
void SetFileName(std::string fn) {m_filename=fn;}
|
|
|
|
std::string SetFileName() const {return m_filename;}
|
2010-04-05 18:22:03 +00:00
|
|
|
|
2010-03-10 11:15:14 +00:00
|
|
|
//! Define the Dump-Mode
|
2010-12-27 20:23:51 +00:00
|
|
|
void SetDumpMode(Engine_Interface_Base::InterpolationType mode);
|
2010-05-11 18:38:58 +00:00
|
|
|
//! This methode will dump all fields on a main cell node using 2 E-field and 4 H-fields per direction.
|
2010-12-27 20:23:51 +00:00
|
|
|
void SetDumpMode2Node() {SetDumpMode(Engine_Interface_Base::NODE_INTERPOLATE);}
|
2010-05-11 18:38:58 +00:00
|
|
|
//! This methode will dump all fields in the center of a main cell (dual-node) using 4 E-field and 2 H-fields per direction.
|
2010-12-27 20:23:51 +00:00
|
|
|
void SetDumpMode2Cell() {SetDumpMode(Engine_Interface_Base::CELL_INTERPOLATE);}
|
2010-03-02 13:54:50 +00:00
|
|
|
|
|
|
|
//! Set dump type: 0 for E-fields, 1 for H-fields, 2 for D-fields, 3 for B-fields, 4 for J-fields, etc...
|
2012-11-29 15:45:48 +00:00
|
|
|
virtual void SetDumpType(DumpType type) {m_DumpType=type;}
|
2010-03-02 13:54:50 +00:00
|
|
|
|
2011-11-07 11:07:55 +00:00
|
|
|
double CalcTotalEnergyEstimate() const;
|
2010-03-15 15:59:37 +00:00
|
|
|
|
2010-04-05 18:22:03 +00:00
|
|
|
void SetFileType(FileType fileType) {m_fileType=fileType;}
|
|
|
|
|
2015-06-18 19:45:22 +00:00
|
|
|
static std::string GetFieldNameByType(DumpType type);
|
2010-05-11 19:03:16 +00:00
|
|
|
|
2012-11-29 15:45:48 +00:00
|
|
|
virtual bool NeedConductivity() const;
|
2017-05-28 10:01:04 +00:00
|
|
|
virtual bool NeedPermittivity() const;
|
|
|
|
virtual bool NeedPermeability() const;
|
2012-11-29 15:45:48 +00:00
|
|
|
|
2010-03-02 13:54:50 +00:00
|
|
|
protected:
|
2010-04-05 18:22:03 +00:00
|
|
|
DumpType m_DumpType;
|
|
|
|
FileType m_fileType;
|
2010-03-02 13:54:50 +00:00
|
|
|
|
2012-02-02 09:20:49 +00:00
|
|
|
VTK_File_Writer* m_Vtk_Dump_File;
|
|
|
|
HDF5_File_Writer* m_HDF5_Dump_File;
|
2011-04-01 13:29:56 +00:00
|
|
|
|
2010-12-28 10:15:08 +00:00
|
|
|
enum SampleType {NONE, SUBSAMPLE, OPT_RESOLUTION} m_SampleType;
|
2010-12-27 20:23:51 +00:00
|
|
|
virtual void CalcMeshPos();
|
|
|
|
|
|
|
|
//! field dump sub-sampling (if enabled)
|
2010-04-07 10:57:45 +00:00
|
|
|
unsigned int subSample[3];
|
2010-03-09 20:35:57 +00:00
|
|
|
|
2010-12-28 10:15:08 +00:00
|
|
|
//! field dump optimal resolution (if enabled)
|
|
|
|
double optResolution[3];
|
|
|
|
|
2010-12-27 20:23:51 +00:00
|
|
|
//! dump mesh information
|
|
|
|
unsigned int numLines[3]; //number of lines to dump
|
|
|
|
unsigned int* posLines[3]; //grid positions to dump
|
|
|
|
double* discLines[3]; //mesh disc lines to dump
|
2010-12-17 14:14:34 +00:00
|
|
|
|
|
|
|
//! Calculate and return the defined field. Caller has to cleanup the array.
|
|
|
|
FDTD_FLOAT**** CalcField();
|
2010-03-02 13:54:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROCESSFIELDS_H
|