use new CSXCAD optimal resolution dump options
parent
533a0163d6
commit
14aa47b3c5
|
@ -29,6 +29,9 @@ ProcessFields::ProcessFields(Engine_Interface_Base* eng_if) : Processing(eng_if)
|
|||
subSample[0]=1;
|
||||
subSample[1]=1;
|
||||
subSample[2]=1;
|
||||
optResolution[0]=0;
|
||||
optResolution[1]=0;
|
||||
optResolution[2]=0;
|
||||
m_SampleType = NONE;
|
||||
SetPrecision(6);
|
||||
m_dualTime = false;
|
||||
|
@ -137,6 +140,19 @@ void ProcessFields::SetSubSampling(unsigned int subSampleRate, int dir)
|
|||
m_SampleType = SUBSAMPLE;
|
||||
}
|
||||
|
||||
void ProcessFields::SetOptResolution(double optRes, int dir)
|
||||
{
|
||||
if (dir>2) return;
|
||||
if (dir<0)
|
||||
{
|
||||
optResolution[0]=optRes;
|
||||
optResolution[1]=optRes;
|
||||
optResolution[2]=optRes;
|
||||
}
|
||||
else optResolution[dir]=optRes;
|
||||
m_SampleType = OPT_RESOLUTION;
|
||||
}
|
||||
|
||||
void ProcessFields::CalcMeshPos()
|
||||
{
|
||||
if ((m_SampleType==SUBSAMPLE) || (m_SampleType==NONE))
|
||||
|
@ -162,6 +178,38 @@ void ProcessFields::CalcMeshPos()
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((m_SampleType==OPT_RESOLUTION))
|
||||
{
|
||||
vector<unsigned int> tmp_pos;
|
||||
double oldPos=0;
|
||||
for (int n=0; n<3; ++n)
|
||||
{
|
||||
// construct new discLines
|
||||
tmp_pos.clear();
|
||||
tmp_pos.push_back(start[n]);
|
||||
oldPos=Op->GetDiscLine(n,start[n],m_dualMesh);
|
||||
for (unsigned int i=start[n]+1; i<=stop[n]-1; ++i)
|
||||
{
|
||||
if ( (Op->GetDiscLine(n,i+1,m_dualMesh)-oldPos) >= optResolution[n])
|
||||
{
|
||||
tmp_pos.push_back(i);
|
||||
oldPos=Op->GetDiscLine(n,i,m_dualMesh);
|
||||
}
|
||||
}
|
||||
if (start[n]!=stop[n])
|
||||
tmp_pos.push_back(stop[n]);
|
||||
numLines[n] = tmp_pos.size();
|
||||
delete[] discLines[n];
|
||||
discLines[n] = new double[numLines[n]];
|
||||
delete[] posLines[n];
|
||||
posLines[n] = new unsigned int[numLines[n]];
|
||||
for (unsigned int i=0; i<numLines[n]; ++i)
|
||||
{
|
||||
posLines[n][i] = tmp_pos.at(i);
|
||||
discLines[n][i] = Op->GetDiscLine(n,tmp_pos.at(i),m_dualMesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessFields::WriteVTKHeader(ofstream &file, double const* const* discLines, unsigned int const* numLines, unsigned int precision, string header_info, MeshType meshT, double discLines_scaling)
|
||||
|
|
|
@ -39,6 +39,9 @@ public:
|
|||
//! Define a field dump sub sampling rate for a given direction (default: \a dir = -1 means all directions)
|
||||
virtual void SetSubSampling(unsigned int subSampleRate, int dir=-1);
|
||||
|
||||
//! Define a field dump optimal resolution for a given direction (default: \a dir = -1 means all directions)
|
||||
virtual void SetOptResolution(double optRes, int dir=-1);
|
||||
|
||||
//! Used file pattern e.g. pattern="tmp/efield_" --> "tmp/efield_000045.vtk" for timestep 45 or "tmp/efield_2.40000e9.vtk" for 2.4GHz E-field dump. (VTK FileType only) \sa SetFileType()
|
||||
void SetFilePattern(string fp) {m_filename=filePattern=fp;}
|
||||
|
||||
|
@ -91,12 +94,15 @@ protected:
|
|||
string filePattern;
|
||||
FileType m_fileType;
|
||||
|
||||
enum SampleType {NONE, SUBSAMPLE} m_SampleType;
|
||||
enum SampleType {NONE, SUBSAMPLE, OPT_RESOLUTION} m_SampleType;
|
||||
virtual void CalcMeshPos();
|
||||
|
||||
//! field dump sub-sampling (if enabled)
|
||||
unsigned int subSample[3];
|
||||
|
||||
//! field dump optimal resolution (if enabled)
|
||||
double optResolution[3];
|
||||
|
||||
//! dump mesh information
|
||||
unsigned int numLines[3]; //number of lines to dump
|
||||
unsigned int* posLines[3]; //grid positions to dump
|
||||
|
|
|
@ -555,6 +555,9 @@ int openEMS::SetupFDTD(const char* file)
|
|||
if (db->GetSubSampling())
|
||||
for (int n=0; n<3; ++n)
|
||||
ProcField->SetSubSampling(db->GetSubSampling(n),n);
|
||||
if (db->GetOptResolution())
|
||||
for (int n=0; n<3; ++n)
|
||||
ProcField->SetOptResolution(db->GetOptResolution(n),n);
|
||||
ProcField->SetFilePattern(db->GetName());
|
||||
ProcField->SetFileName(db->GetName());
|
||||
ProcField->DefineStartStopCoord(start,stop);
|
||||
|
|
Loading…
Reference in New Issue