From 8d8759cb1b1c17b187f17cc1aa4cbe16521d04e9 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 27 Mar 2013 12:02:08 +0100 Subject: [PATCH] Operator: add optional range to DumpPEC2File to allow for separated dump in case of a multi grid cylindrical operator Signed-off-by: Thorsten Liebig --- FDTD/operator.cpp | 19 +++++++++++++++---- FDTD/operator.h | 2 +- FDTD/operator_cylindermultigrid.cpp | 23 +++++++++++++++++++++++ FDTD/operator_cylindermultigrid.h | 2 ++ FDTD/operator_mpi.cpp | 4 ++-- FDTD/operator_mpi.h | 2 +- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index e01030c..f9cdff1 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -574,7 +574,7 @@ void Operator::DumpOperator2File(string filename) //! \brief dump PEC (perfect electric conductor) information (into VTK-file) //! visualization via paraview //! visualize only one component (x, y or z) -void Operator::DumpPEC2File( string filename ) +void Operator::DumpPEC2File(string filename , unsigned int *range) { cout << "Operator: Dumping PEC information to vtk file: " << filename << " ..." << flush; @@ -584,6 +584,16 @@ void Operator::DumpPEC2File( string filename ) double scaling = GetGridDelta();; #endif + unsigned int start[3] = {0, 0, 0}; + unsigned int stop[3] = {numLines[0]-1,numLines[1]-1,numLines[2]-1}; + + if (range!=NULL) + for (int n=0;n<3;++n) + { + start[n] = range[2*n]; + stop[n] = range[2*n+1]; + } + vtkPolyData* polydata = vtkPolyData::New(); vtkCellArray *poly = vtkCellArray::New(); vtkPoints *points = vtkPoints::New(); @@ -602,15 +612,15 @@ void Operator::DumpPEC2File( string filename ) double coord[3]; unsigned int pos[3],rpos[3]; unsigned int mesh_idx=0; - for (pos[2]=0;pos[2]Delete(); polydata->Delete(); + cout << " done." << endl; } void Operator::DumpMaterial2File(string filename) diff --git a/FDTD/operator.h b/FDTD/operator.h index bf6c845..f690a44 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -178,7 +178,7 @@ protected: // debug virtual void DumpOperator2File(string filename); virtual void DumpMaterial2File(string filename); - virtual void DumpPEC2File( string filename ); + virtual void DumpPEC2File( string filename, unsigned int *range = NULL ); unsigned int m_Nr_PEC[3]; //count PEC edges virtual bool CalcPEC(); diff --git a/FDTD/operator_cylindermultigrid.cpp b/FDTD/operator_cylindermultigrid.cpp index 4100430..1d58061 100644 --- a/FDTD/operator_cylindermultigrid.cpp +++ b/FDTD/operator_cylindermultigrid.cpp @@ -19,6 +19,7 @@ #include "engine_cylindermultigrid.h" #include "extensions/operator_ext_cylinder.h" #include "tools/useful.h" +#include "CSUseful.h" Operator_CylinderMultiGrid::Operator_CylinderMultiGrid(vector Split_Radii, unsigned int level) : Operator_Cylinder() { @@ -266,6 +267,28 @@ int Operator_CylinderMultiGrid::CalcECOperator( DebugFlags debugFlags ) return retCode; } +void Operator_CylinderMultiGrid::DumpPEC2File( string filename, unsigned int *range) +{ + if (range!=NULL) + return Operator_Cylinder::DumpPEC2File(filename, range); + + range = new unsigned int[6]; + for (int n=0;n<3;++n) + { + range[2*n] = 0; + range[2*n+1] = numLines[n]-1; + } + range[0] = m_Split_Pos; + Operator_Cylinder::DumpPEC2File(filename + "_S" + ConvertInt(m_MultiGridLevel), range); + delete[] range; + range=NULL; + + if (dynamic_cast(m_InnerOp)) + m_InnerOp->DumpPEC2File(filename); + else // base cylindrical grid + m_InnerOp->DumpPEC2File(filename + "_S" + ConvertInt(m_MultiGridLevel+1)); +} + void Operator_CylinderMultiGrid::SetupInterpolation() { // n==0 --> interpolation in r&z-direction diff --git a/FDTD/operator_cylindermultigrid.h b/FDTD/operator_cylindermultigrid.h index 1174e56..25d63af 100644 --- a/FDTD/operator_cylindermultigrid.h +++ b/FDTD/operator_cylindermultigrid.h @@ -72,6 +72,8 @@ protected: virtual int CalcECOperator( DebugFlags debugFlags = None ); + virtual void DumpPEC2File( string filename, unsigned int *range = NULL ); + //! The material data storage in the sub-grid area's will not be filled by the base-operator. Check and do this here! void FillMissingDataStorage(); diff --git a/FDTD/operator_mpi.cpp b/FDTD/operator_mpi.cpp index 040c6d0..7526433 100644 --- a/FDTD/operator_mpi.cpp +++ b/FDTD/operator_mpi.cpp @@ -202,7 +202,7 @@ void Operator_MPI::DumpMaterial2File(string filename) Operator_SSE_Compressed::DumpMaterial2File(PrependRank(filename)); } -void Operator_MPI::DumpPEC2File( string filename ) +void Operator_MPI::DumpPEC2File(string filename , unsigned int *range) { - Operator_SSE_Compressed::DumpPEC2File(PrependRank(filename)); + Operator_SSE_Compressed::DumpPEC2File(PrependRank(filename), range); } diff --git a/FDTD/operator_mpi.h b/FDTD/operator_mpi.h index a97f79b..18b1403 100644 --- a/FDTD/operator_mpi.h +++ b/FDTD/operator_mpi.h @@ -84,7 +84,7 @@ protected: virtual void DumpOperator2File(string filename); virtual void DumpMaterial2File(string filename); - virtual void DumpPEC2File( string filename ); + virtual void DumpPEC2File( string filename, unsigned int *range = NULL ); }; #endif // OPERATOR_MPI_H