moved field calculations to ProcessFields for common use in TD and FD field processing
parent
ef65970246
commit
4254337ea0
|
@ -460,3 +460,53 @@ bool ProcessFields::DumpVectorArray2HDF5(string filename, string name, FDTD_FLOA
|
||||||
dataset.write( hdf5array, H5::PredType::NATIVE_FLOAT );
|
dataset.write( hdf5array, H5::PredType::NATIVE_FLOAT );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDTD_FLOAT**** ProcessFields::CalcField()
|
||||||
|
{
|
||||||
|
unsigned int pos[3];
|
||||||
|
unsigned int OpPos[3];
|
||||||
|
double out[3];
|
||||||
|
//create array
|
||||||
|
FDTD_FLOAT**** field = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
||||||
|
if (m_DumpType==E_FIELD_DUMP)
|
||||||
|
{
|
||||||
|
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
|
||||||
|
{
|
||||||
|
OpPos[0]=start[0]+pos[0]*subSample[0];
|
||||||
|
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
|
||||||
|
{
|
||||||
|
OpPos[1]=start[1]+pos[1]*subSample[1];
|
||||||
|
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
|
||||||
|
{
|
||||||
|
OpPos[2]=start[2]+pos[2]*subSample[2];
|
||||||
|
m_Eng_Interface->GetEField(OpPos,out);
|
||||||
|
field[0][pos[0]][pos[1]][pos[2]] = out[0];
|
||||||
|
field[1][pos[0]][pos[1]][pos[2]] = out[1];
|
||||||
|
field[2][pos[0]][pos[1]][pos[2]] = out[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_DumpType==H_FIELD_DUMP)
|
||||||
|
{
|
||||||
|
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
|
||||||
|
{
|
||||||
|
OpPos[0]=start[0]+pos[0]*subSample[0];
|
||||||
|
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
|
||||||
|
{
|
||||||
|
OpPos[1]=start[1]+pos[1]*subSample[1];
|
||||||
|
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
|
||||||
|
{
|
||||||
|
OpPos[2]=start[2]+pos[2]*subSample[2];
|
||||||
|
m_Eng_Interface->GetHField(OpPos,out);
|
||||||
|
field[0][pos[0]][pos[1]][pos[2]] = out[0];
|
||||||
|
field[1][pos[0]][pos[1]][pos[2]] = out[1];
|
||||||
|
field[2][pos[0]][pos[1]][pos[2]] = out[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,9 @@ protected:
|
||||||
//! dump mesh
|
//! dump mesh
|
||||||
unsigned int numLines[3];
|
unsigned int numLines[3];
|
||||||
double* discLines[3];
|
double* discLines[3];
|
||||||
|
|
||||||
|
//! Calculate and return the defined field. Caller has to cleanup the array.
|
||||||
|
FDTD_FLOAT**** CalcField();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROCESSFIELDS_H
|
#endif // PROCESSFIELDS_H
|
||||||
|
|
|
@ -53,50 +53,7 @@ int ProcessFieldsTD::Process()
|
||||||
double discLines_scaling = Op->GetGridDelta();
|
double discLines_scaling = Op->GetGridDelta();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int pos[3];
|
FDTD_FLOAT**** field = CalcField();
|
||||||
unsigned int OpPos[3];
|
|
||||||
double out[3];
|
|
||||||
//create array
|
|
||||||
FDTD_FLOAT**** field = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
|
||||||
if (m_DumpType==E_FIELD_DUMP)
|
|
||||||
{
|
|
||||||
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
|
|
||||||
{
|
|
||||||
OpPos[0]=start[0]+pos[0]*subSample[0];
|
|
||||||
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
|
|
||||||
{
|
|
||||||
OpPos[1]=start[1]+pos[1]*subSample[1];
|
|
||||||
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
|
|
||||||
{
|
|
||||||
OpPos[2]=start[2]+pos[2]*subSample[2];
|
|
||||||
m_Eng_Interface->GetEField(OpPos,out);
|
|
||||||
field[0][pos[0]][pos[1]][pos[2]] = out[0];
|
|
||||||
field[1][pos[0]][pos[1]][pos[2]] = out[1];
|
|
||||||
field[2][pos[0]][pos[1]][pos[2]] = out[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_DumpType==H_FIELD_DUMP)
|
|
||||||
{
|
|
||||||
for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
|
|
||||||
{
|
|
||||||
OpPos[0]=start[0]+pos[0]*subSample[0];
|
|
||||||
for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
|
|
||||||
{
|
|
||||||
OpPos[1]=start[1]+pos[1]*subSample[1];
|
|
||||||
for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
|
|
||||||
{
|
|
||||||
OpPos[2]=start[2]+pos[2]*subSample[2];
|
|
||||||
m_Eng_Interface->GetHField(OpPos,out);
|
|
||||||
field[0][pos[0]][pos[1]][pos[2]] = out[0];
|
|
||||||
field[1][pos[0]][pos[1]][pos[2]] = out[1];
|
|
||||||
field[2][pos[0]][pos[1]][pos[2]] = out[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_fileType==VTK_FILETYPE)
|
if (m_fileType==VTK_FILETYPE)
|
||||||
{
|
{
|
||||||
|
@ -119,6 +76,5 @@ int ProcessFieldsTD::Process()
|
||||||
|
|
||||||
Delete_N_3DArray(field,numLines);
|
Delete_N_3DArray(field,numLines);
|
||||||
|
|
||||||
|
|
||||||
return GetNextInterval();
|
return GetNextInterval();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue