updates to GetYeeCoords

the cylindrical multigrid will return false in case of a sub-grid mesh position
This commit is contained in:
Thorsten Liebig 2012-06-06 10:19:30 +02:00
parent 8d10970c3c
commit 08328e62b0
4 changed files with 20 additions and 5 deletions

View File

@ -140,16 +140,16 @@ bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool du
{ {
for (int n=0;n<3;++n) for (int n=0;n<3;++n)
coords[n]=GetDiscLine(n,pos[n],dualMesh); coords[n]=GetDiscLine(n,pos[n],dualMesh);
coords[ny]=GetDiscLine(ny,pos[ny],!dualMesh);
//check if position is inside the FDTD domain
if (dualMesh==false) //main grid if (dualMesh==false) //main grid
{ {
coords[ny]+=0.5*fabs(GetRawDiscDelta(ny,pos[ny]));
if (pos[ny]>=numLines[ny]-1) if (pos[ny]>=numLines[ny]-1)
return false; return false;
} }
else //dual grid else //dual grid
{ {
coords[ny]-=0.5*fabs(GetRawDiscDelta(ny, pos[ny]-1));
int nP = (ny+1)%3; int nP = (ny+1)%3;
int nPP = (ny+2)%3; int nPP = (ny+2)%3;
if ((pos[nP]>=numLines[nP]-1) || (pos[nPP]>=numLines[nPP]-1)) if ((pos[nP]>=numLines[nP]-1) || (pos[nPP]>=numLines[nPP]-1))

View File

@ -97,12 +97,14 @@ string Operator_Cylinder::GetDirName(int ny) const
bool Operator_Cylinder::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const bool Operator_Cylinder::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const
{ {
if (CC_closedAlpha && (coords[1]>GetDiscLine(1,0,false)+2*PI)) bool ret = Operator_Multithread::GetYeeCoords(ny,pos,coords,dualMesh);
if (CC_closedAlpha && (coords[1]>=GetDiscLine(1,0,false)+2*PI))
coords[1]-=2*PI; coords[1]-=2*PI;
if (CC_closedAlpha && (coords[1]<GetDiscLine(1,0,false))) if (CC_closedAlpha && (coords[1]<GetDiscLine(1,0,false)))
coords[1]+=2*PI; coords[1]+=2*PI;
return Operator_Multithread::GetYeeCoords(ny,pos,coords,dualMesh); return ret;
} }
double Operator_Cylinder::GetNodeWidth(int ny, const unsigned int pos[3], bool dualMesh) const double Operator_Cylinder::GetNodeWidth(int ny, const unsigned int pos[3], bool dualMesh) const

View File

@ -143,6 +143,16 @@ void Operator_CylinderMultiGrid::Init()
m_InnerOp = Operator_CylinderMultiGrid::New(m_Split_Radii,m_numThreads); m_InnerOp = Operator_CylinderMultiGrid::New(m_Split_Radii,m_numThreads);
} }
bool Operator_CylinderMultiGrid::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const
{
bool ret = Operator_Cylinder::GetYeeCoords(ny,pos,coords,dualMesh);
if (pos[0]<(m_Split_Pos-1))
ret = false;
return ret;
}
#ifdef MPI_SUPPORT #ifdef MPI_SUPPORT
void Operator_CylinderMultiGrid::SetTag(int tag) void Operator_CylinderMultiGrid::SetTag(int tag)
{ {

View File

@ -41,6 +41,9 @@ public:
virtual bool SetGeometryCSX(ContinuousStructure* geo); virtual bool SetGeometryCSX(ContinuousStructure* geo);
//! Get the coordinates for a given node index and component, according to the cylindrical yee-algorithm. Returns true if inside the FDTD domain.
virtual bool GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool dualMesh) const;
virtual unsigned int GetSplitPos() const {return m_Split_Pos;} virtual unsigned int GetSplitPos() const {return m_Split_Pos;}
virtual bool SetupExcitation(TiXmlElement* Excite, unsigned int maxTS); virtual bool SetupExcitation(TiXmlElement* Excite, unsigned int maxTS);