DumpOperator2File now available for all types of operators
parent
d96a592e05
commit
0aada84f80
|
@ -62,8 +62,8 @@ public:
|
|||
|
||||
virtual void ShowStat() const;
|
||||
|
||||
void DumpOperator2File(string filename);
|
||||
void DumpMaterial2File(string filename);
|
||||
virtual void DumpOperator2File(string filename);
|
||||
virtual void DumpMaterial2File(string filename);
|
||||
|
||||
//! Get the name for the given direction: 0 -> x, 1 -> y, 2 -> z
|
||||
virtual string GetDirName(int ny) const;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "engine_sse.h"
|
||||
#include "operator_sse.h"
|
||||
#include "tools/array_ops.h"
|
||||
#include "processfields.h"
|
||||
|
||||
Operator_sse* Operator_sse::New()
|
||||
{
|
||||
|
@ -83,3 +84,55 @@ void Operator_sse::InitOperator()
|
|||
numVectors = ceil((double)numLines[2]/4.0);
|
||||
}
|
||||
|
||||
void Operator_sse::DumpOperator2File(string filename)
|
||||
{
|
||||
ofstream file(filename.c_str(),ios_base::out);
|
||||
if (file.is_open()==false)
|
||||
{
|
||||
cerr << "Operator_sse::DumpOperator2File: Can't open file: " << filename << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
FDTD_FLOAT**** exc = Create_N_3DArray(numLines);
|
||||
if (Exc) {
|
||||
for (unsigned int n=0;n<Exc->E_Count;++n)
|
||||
exc[Exc->E_dir[n]][Exc->E_index[0][n]][Exc->E_index[1][n]][Exc->E_index[2][n]] = Exc->E_amp[n];
|
||||
}
|
||||
|
||||
vv = Create_N_3DArray(numLines);
|
||||
vi = Create_N_3DArray(numLines);
|
||||
iv = Create_N_3DArray(numLines);
|
||||
ii = Create_N_3DArray(numLines);
|
||||
|
||||
unsigned int pos[3];
|
||||
for (pos[0]=0;pos[0]<numLines[0];++pos[0])
|
||||
{
|
||||
for (pos[1]=0;pos[1]<numLines[1];++pos[1])
|
||||
{
|
||||
for (pos[2]=0;pos[2]<numLines[2];++pos[2])
|
||||
{
|
||||
for (int n=0;n<3;++n)
|
||||
{
|
||||
vv[n][pos[0]][pos[1]][pos[2]] = GetVV(n,pos[0],pos[1],pos[2]);
|
||||
vi[n][pos[0]][pos[1]][pos[2]] = GetVI(n,pos[0],pos[1],pos[2]);
|
||||
ii[n][pos[0]][pos[1]][pos[2]] = GetII(n,pos[0],pos[1],pos[2]);
|
||||
iv[n][pos[0]][pos[1]][pos[2]] = GetIV(n,pos[0],pos[1],pos[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string names[] = {"vv", "vi", "iv" , "ii", "exc"};
|
||||
FDTD_FLOAT**** array[] = {vv,vi,iv,ii,exc};
|
||||
|
||||
ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 5, discLines, numLines);
|
||||
|
||||
Delete_N_3DArray(exc,numLines);
|
||||
Delete_N_3DArray(vv,numLines);vv=NULL;
|
||||
Delete_N_3DArray(vi,numLines);vi=NULL;
|
||||
Delete_N_3DArray(iv,numLines);iv=NULL;
|
||||
Delete_N_3DArray(ii,numLines);ii=NULL;
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ public:
|
|||
|
||||
virtual Engine* CreateEngine() const;
|
||||
|
||||
virtual void DumpOperator2File(string filename);
|
||||
|
||||
inline virtual FDTD_FLOAT& GetVV( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_vv[n][x][y][z%numVectors].f[z/numVectors]; }
|
||||
inline virtual FDTD_FLOAT& GetVI( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return f4_vi[n][x][y][z%numVectors].f[z/numVectors]; }
|
||||
|
||||
|
|
|
@ -266,11 +266,8 @@ int openEMS::SetupFDTD(const char* file)
|
|||
{
|
||||
FDTD_Op->DumpMaterial2File("material_dump.vtk");
|
||||
}
|
||||
if (DebugOp && (m_engine == EngineType_Standard))
|
||||
if (DebugOp)
|
||||
FDTD_Op->DumpOperator2File("operator_dump.vtk");
|
||||
if (DebugOp && (m_engine != EngineType_Standard))
|
||||
cerr << "openEMS - Warning: operator dump needs the standard engine." << endl;
|
||||
|
||||
|
||||
time_t OpDoneTime=time(NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue