Operator: add optional range to DumpPEC2File to allow for separated dump in case of a multi grid cylindrical operator

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2013-03-27 12:02:08 +01:00
parent 70ff8634f4
commit 8d8759cb1b
6 changed files with 44 additions and 8 deletions

View File

@ -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]<numLines[2]-1;++pos[2])
for (pos[2]=start[2];pos[2]<stop[2];++pos[2])
{ // each xy-plane
for (unsigned int n=0;n<numLines[0]*numLines[1];++n)
{
pointIdx[0][n]=pointIdx[1][n];
pointIdx[1][n]=-1;
}
for (pos[0]=0;pos[0]<numLines[0]-1;++pos[0])
for (pos[1]=0;pos[1]<numLines[1]-1;++pos[1])
for (pos[0]=start[0];pos[0]<stop[0];++pos[0])
for (pos[1]=start[1];pos[1]<stop[1];++pos[1])
{
for (int n=0;n<3;++n)
{
@ -669,6 +679,7 @@ void Operator::DumpPEC2File( string filename )
writer->Delete();
polydata->Delete();
cout << " done." << endl;
}
void Operator::DumpMaterial2File(string filename)

View File

@ -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();

View File

@ -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<double> 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<Operator_CylinderMultiGrid*>(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

View File

@ -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();

View File

@ -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);
}

View File

@ -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