diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 27cee11..54cc532 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -187,6 +187,14 @@ bool Operator::GetYeeCoords(int ny, unsigned int pos[3], double* coords, bool du return true; } +bool Operator::GetNodeCoords(unsigned int pos[3], double* coords, bool dualMesh, CoordinateSystem c_system) const +{ + for (int n=0;n<3;++n) + coords[n]=GetDiscLine(n,pos[n],dualMesh); + TransformCoordSystem(coords,coords,m_MeshType,c_system); + return true; +} + double Operator::GetEdgeLength(int n, const unsigned int* pos, bool dualMesh) const { return GetDiscDelta(n,pos[n],dualMesh)*gridDelta; diff --git a/FDTD/operator.h b/FDTD/operator.h index 1901998..97137f2 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -101,6 +101,8 @@ public: //! 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 GetNodeCoords(unsigned int pos[3], double* coords, bool dualMesh=false, CoordinateSystem c_system=UNDEFINED_CS) const; + //! 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 {return GetEdgeLength(ny,pos,!dualMesh);} //! Get the node width for a given direction \a n and a given mesh position \a pos