2010-12-06 08:59:42 +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 OPERATOR_BASE_H
|
|
|
|
#define OPERATOR_BASE_H
|
|
|
|
|
2011-01-31 11:00:00 +00:00
|
|
|
#include "ContinuousStructure.h"
|
2010-12-06 08:59:42 +00:00
|
|
|
#include "tools/global.h"
|
2010-12-06 09:44:25 +00:00
|
|
|
#include "Common/processing.h"
|
2010-12-06 08:59:42 +00:00
|
|
|
#include "string"
|
|
|
|
|
2010-12-07 13:47:22 +00:00
|
|
|
//! Abstract base-class for a common operator
|
2010-12-06 08:59:42 +00:00
|
|
|
class Operator_Base
|
|
|
|
{
|
|
|
|
public:
|
2011-01-24 10:11:45 +00:00
|
|
|
virtual ~Operator_Base();
|
|
|
|
|
2011-01-31 11:00:00 +00:00
|
|
|
virtual bool SetGeometryCSX(ContinuousStructure* geo);
|
|
|
|
virtual ContinuousStructure* GetGeometryCSX() const {return CSX;}
|
|
|
|
|
2010-12-06 08:59:42 +00:00
|
|
|
//! Get the timestep used by this operator
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetTimestep() const {return dT;};
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the number of cells or nodes defined by this operator
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetNumberCells() const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the number of timesteps satisfying the nyquist condition (may depend on the excitation)
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual unsigned int GetNumberOfNyquistTimesteps() const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Returns the number of lines as needed for post-processing etc. (for the engine, use GetOriginalNumLines())
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual unsigned int GetNumberOfLines(int ny) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the name for the given direction: 0 -> x, 1 -> y, 2 -> z
|
|
|
|
virtual std::string GetDirName(int ny) const;
|
|
|
|
|
|
|
|
//! Get the grid drawing unit in m
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetGridDelta() const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the disc line in \a n direction (in drawing units)
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetDiscLine(int n, unsigned int pos, bool dualMesh=false) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the node width for a given direction \a n and a given mesh position \a pos
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetNodeWidth(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the node area for a given direction \a n and a given mesh position \a pos
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetNodeArea(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the length of an FDTD edge (unit is meter).
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetEdgeLength(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Get the area around an edge for a given direction \a n and a given mesh posisition \a pos
|
|
|
|
/*!
|
|
|
|
This will return the area around an edge with a given direction, measured at the middle of the edge.
|
|
|
|
In a cartesian mesh this is equal to the NodeArea, may be different in other coordinate systems.
|
|
|
|
*/
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual double GetEdgeArea(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Snap the given coodinates to mesh indices
|
2010-12-07 13:47:22 +00:00
|
|
|
virtual bool SnapToMesh(const double* coord, unsigned int* uicoord, bool lower=false, bool* inside=NULL) const =0;
|
2010-12-06 08:59:42 +00:00
|
|
|
|
|
|
|
//! Set the boundary conditions
|
2010-12-06 12:04:37 +00:00
|
|
|
virtual void SetBoundaryCondition(int* BCs) {for (int n=0; n<6; ++n) m_BC[n]=BCs[n];}
|
2010-12-06 08:59:42 +00:00
|
|
|
|
2011-01-07 09:45:26 +00:00
|
|
|
//! Set flags to store material data for post-processing
|
|
|
|
virtual void SetMaterialStoreFlags(int type, bool val);
|
|
|
|
|
|
|
|
//! Check storage flags and cleanup
|
|
|
|
virtual void CleanupMaterialStorage() = 0;
|
|
|
|
|
2011-01-31 11:00:00 +00:00
|
|
|
|
2010-12-06 08:59:42 +00:00
|
|
|
protected:
|
|
|
|
Operator_Base();
|
|
|
|
|
2011-01-31 11:00:00 +00:00
|
|
|
ContinuousStructure* CSX;
|
|
|
|
|
2010-12-06 08:59:42 +00:00
|
|
|
virtual void Init();
|
2011-01-24 10:11:45 +00:00
|
|
|
//! Cleanup data and reset
|
|
|
|
void Delete();
|
2010-12-06 08:59:42 +00:00
|
|
|
virtual void Reset();
|
|
|
|
|
|
|
|
//! boundary conditions
|
|
|
|
int m_BC[6];
|
|
|
|
|
|
|
|
//! The operator timestep
|
|
|
|
double dT;
|
|
|
|
|
2011-01-07 09:45:26 +00:00
|
|
|
//! bool flag array to store material data for post-processing
|
|
|
|
bool m_StoreMaterial[4];
|
|
|
|
|
2010-12-06 08:59:42 +00:00
|
|
|
Processing::MeshType m_MeshType;
|
|
|
|
unsigned int numLines[3];
|
|
|
|
double* discLines[3];
|
|
|
|
double gridDelta;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPERATOR_BASE_H
|