operator: new GetDiscDelta method
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
parent
c8c5541084
commit
410d250995
@ -53,6 +53,9 @@ public:
|
|||||||
//! Get the disc line in \a n direction (in drawing units)
|
//! Get the disc line in \a n direction (in drawing units)
|
||||||
virtual double GetDiscLine(int n, unsigned int pos, bool dualMesh=false) const =0;
|
virtual double GetDiscLine(int n, unsigned int pos, bool dualMesh=false) const =0;
|
||||||
|
|
||||||
|
//! Get the disc line delta in \a n direction (in drawing units)
|
||||||
|
virtual double GetDiscDelta(int n, unsigned int pos, bool dualMesh=false) const =0;
|
||||||
|
|
||||||
//! Get the node width for a given direction \a n and a given mesh position \a pos
|
//! Get the node width for a given direction \a n and a given mesh position \a pos
|
||||||
virtual double GetNodeWidth(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
virtual double GetNodeWidth(int ny, const unsigned int pos[3], bool dualMesh = false) const =0;
|
||||||
|
|
||||||
|
@ -136,6 +136,29 @@ double Operator::GetDiscLine(int n, unsigned int pos, bool dualMesh) const
|
|||||||
return discLines[n][pos] + 0.5*(discLines[n][pos] - discLines[n][pos-1]);
|
return discLines[n][pos] + 0.5*(discLines[n][pos] - discLines[n][pos-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Operator::GetDiscDelta(int n, unsigned int pos, bool dualMesh) const
|
||||||
|
{
|
||||||
|
if ((n<0) || (n>2)) return 0.0;
|
||||||
|
if (pos>=numLines[n]) return 0.0;
|
||||||
|
double delta=0;
|
||||||
|
if (dualMesh==false)
|
||||||
|
{
|
||||||
|
if (pos<numLines[n]-1)
|
||||||
|
delta = GetDiscLine(n,pos+1,false) - GetDiscLine(n,pos,false);
|
||||||
|
else
|
||||||
|
delta = GetDiscLine(n,pos,false) - GetDiscLine(n,pos-1,false);
|
||||||
|
return delta;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pos>0)
|
||||||
|
delta = GetDiscLine(n,pos,true) - GetDiscLine(n,pos-1,true);
|
||||||
|
else
|
||||||
|
delta = GetDiscLine(n,1,false) - GetDiscLine(n,0,false);
|
||||||
|
return delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const
|
bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const
|
||||||
{
|
{
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
@ -160,25 +183,7 @@ bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool du
|
|||||||
|
|
||||||
double Operator::GetEdgeLength(int n, const unsigned int* pos, bool dualMesh) const
|
double Operator::GetEdgeLength(int n, const unsigned int* pos, bool dualMesh) const
|
||||||
{
|
{
|
||||||
if ((n<0) || (n>2)) return 0.0;
|
return GetDiscDelta(n,pos[n],dualMesh)*gridDelta;
|
||||||
if (pos[n]>=numLines[n]) return 0.0;
|
|
||||||
double delta=0;
|
|
||||||
if (dualMesh==false)
|
|
||||||
{
|
|
||||||
if (pos[n]<numLines[n]-1)
|
|
||||||
delta = GetDiscLine(n,pos[n]+1,false) - GetDiscLine(n,pos[n],false);
|
|
||||||
else
|
|
||||||
delta = GetDiscLine(n,pos[n],false) - GetDiscLine(n,pos[n]-1,false);
|
|
||||||
return delta*gridDelta;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pos[n]>0)
|
|
||||||
delta = GetDiscLine(n,pos[n],true) - GetDiscLine(n,pos[n]-1,true);
|
|
||||||
else
|
|
||||||
delta = GetDiscLine(n,1,false) - GetDiscLine(n,0,false);
|
|
||||||
return delta*gridDelta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Operator::GetCellVolume(const unsigned int pos[3], bool dualMesh) const
|
double Operator::GetCellVolume(const unsigned int pos[3], bool dualMesh) const
|
||||||
|
@ -99,6 +99,9 @@ public:
|
|||||||
//! Get the disc line in \a n direction (in drawing units)
|
//! Get the disc line in \a n direction (in drawing units)
|
||||||
virtual double GetDiscLine(int n, unsigned int pos, bool dualMesh=false) const;
|
virtual double GetDiscLine(int n, unsigned int pos, bool dualMesh=false) const;
|
||||||
|
|
||||||
|
//! Get the disc line delta in \a n direction (in drawing units)
|
||||||
|
virtual double GetDiscDelta(int n, unsigned int pos, bool dualMesh=false) const;
|
||||||
|
|
||||||
//! Get the coordinates for a given node index and component, according to the yee-algorithm. Returns true if inside the FDTD domain.
|
//! Get the coordinates for a given node index and component, according to the yee-algorithm. Returns true if inside the FDTD domain.
|
||||||
virtual bool GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const;
|
virtual bool GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user