get correct mesh direction names for dump

pull/1/head
Thorsten Liebig 2010-04-23 08:17:42 +02:00
parent d81576cedd
commit 5535a386ff
7 changed files with 35 additions and 2 deletions

View File

@ -102,6 +102,14 @@ unsigned int Operator::CalcNyquistNum(double fmax)
return floor(T0/2/dT);
}
string Operator::GetDirName(int ny) const
{
if (ny==0) return "x";
if (ny==1) return "y";
if (ny==2) return "z";
return "";
}
double Operator::GetMeshDelta(int n, const unsigned int* pos, bool dualMesh) const
{
if ((n<0) || (n>2)) return 0.0;

View File

@ -67,6 +67,9 @@ public:
void DumpOperator2File(string filename);
void DumpMaterial2File(string filename);
//! Get the name for the given direction: 0 -> x, 1 -> y, 2 -> z
virtual string GetDirName(int ny) const;
virtual double GetGridDelta() const {return gridDelta;}
//! Get the mesh delta times the grid delta for a 3D position
virtual double GetMeshDelta(int n, const int* pos, bool dualMesh=false) const;

View File

@ -68,6 +68,14 @@ inline unsigned int Operator_Cylinder::GetNumberOfLines(int ny) const
return numLines[ny];
}
string Operator_Cylinder::GetDirName(int ny) const
{
if (ny==0) return "rho";
if (ny==1) return "alpha";
if (ny==2) return "z";
return "";
}
double Operator_Cylinder::GetMeshDelta(int n, int* pos, bool dualMesh) const
{
double delta = Operator::GetMeshDelta(n,pos,dualMesh);

View File

@ -35,6 +35,9 @@ public:
virtual unsigned int GetNumberOfLines(int ny) const;
//! Get the name for the given direction: 0 -> rho, 1 -> alpha, 2 -> z
virtual string GetDirName(int ny) const;
//! Get the mesh delta times the grid delta for a 3D position, including radius corrected alpha-mesh width
virtual double GetMeshDelta(int n, int* pos, bool dualMesh=false) const;

View File

@ -51,7 +51,8 @@ ProcessFields::~ProcessFields()
void ProcessFields::InitProcess()
{
if (Enabled==false) return;
string names[] = {"x","y","z"};
//get the correct direction names for all coordinate systems
string names[] = {Op->GetDirName(0),Op->GetDirName(1),Op->GetDirName(2)};
if (m_fileType==HDF5_FILETYPE)
{
unsigned int* NrLines;

View File

@ -11,7 +11,11 @@ end
mesh = ReadHDF5Mesh(file);
fields = ReadHDF5FieldData(file);
[X Y Z] = meshgrid(double(mesh.lines{1}),double(mesh.lines{2}),double(mesh.lines{3}));
if (mesh.type==0)
[X Y Z] = meshgrid(double(mesh.lines{1}),double(mesh.lines{2}),double(mesh.lines{3}));
else
disp(['PlotHDF5FieldData:: Error: unknown mesh type ' num2str(mesh.type)]);
end
max_amp = 0;

View File

@ -14,3 +14,9 @@ hdf_mesh.names = names;
for n=1:numel(names)
hdf_mesh.lines{n} = hdf5read(file,names{n});
end
if (strcmp(names{1},'/mesh/rho'))
hdf_mesh.type=1;
else
hdf_mesh.type=0;
end