diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index d8a60b3..1c219d9 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -320,6 +320,12 @@ void Operator::ShowExtStat() const void Operator::DumpOperator2File(string filename) { +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = GetGridDelta(); +#endif + ofstream file(filename.c_str(),ios_base::out); if (file.is_open()==false) { @@ -338,7 +344,7 @@ void Operator::DumpOperator2File(string filename) string names[] = {"vv", "vi", "iv" , "ii", "exc"}; FDTD_FLOAT**** array[] = {vv,vi,iv,ii,exc}; - ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 5, discLines, numLines, 6, "Operator dump" , (ProcessFields::MeshType)m_MeshType); + ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 5, discLines, numLines, 6, "Operator dump" , (ProcessFields::MeshType)m_MeshType, discLines_scaling); Delete_N_3DArray(exc,numLines); @@ -376,7 +382,12 @@ void Operator::DumpPEC2File( string filename ) } } - ProcessFields::DumpVectorArray2VTK( file, "PEC", pec, discLines, numLines, 6, "PEC dump" , (ProcessFields::MeshType)m_MeshType ); +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = GetGridDelta(); +#endif + ProcessFields::DumpVectorArray2VTK( file, "PEC", pec, discLines, numLines, 6, "PEC dump" , (ProcessFields::MeshType)m_MeshType, discLines_scaling ); file.close(); @@ -385,6 +396,12 @@ void Operator::DumpPEC2File( string filename ) void Operator::DumpMaterial2File(string filename) { +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = GetGridDelta(); +#endif + ofstream file(filename.c_str(),ios_base::out); if (file.is_open()==false) { @@ -429,7 +446,7 @@ void Operator::DumpMaterial2File(string filename) string names[] = {"epsilon","mue","kappa","sigma"}; FDTD_FLOAT*** array[] = {epsilon,mue,kappa,sigma}; - ProcessFields::DumpMultiScalarArray2VTK(file, names, array, 4, discLines, numLines, 6, "Material dump" , (ProcessFields::MeshType)m_MeshType); + ProcessFields::DumpMultiScalarArray2VTK(file, names, array, 4, discLines, numLines, 6, "Material dump" , (ProcessFields::MeshType)m_MeshType, discLines_scaling); Delete3DArray(epsilon,numLines); Delete3DArray(mue,numLines); Delete3DArray(kappa,numLines); diff --git a/FDTD/operator_sse.cpp b/FDTD/operator_sse.cpp index 6420724..9a705d1 100644 --- a/FDTD/operator_sse.cpp +++ b/FDTD/operator_sse.cpp @@ -86,6 +86,12 @@ void Operator_sse::InitOperator() void Operator_sse::DumpOperator2File(string filename) { +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = GetGridDelta(); +#endif + ofstream file(filename.c_str(),ios_base::out); if (file.is_open()==false) { @@ -128,7 +134,7 @@ void Operator_sse::DumpOperator2File(string filename) string names[] = {"vv", "vi", "iv" , "ii", "exc"}; FDTD_FLOAT**** array[] = {vv,vi,iv,ii,exc}; - ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 5, discLines, numLines, 6, "Operator dump" , (ProcessFields::MeshType)m_MeshType); + ProcessFields::DumpMultiVectorArray2VTK(file, names , array , 5, discLines, numLines, 6, "Operator dump" , (ProcessFields::MeshType)m_MeshType, discLines_scaling); Delete_N_3DArray(exc,numLines); Delete_N_3DArray(vv,numLines);vv=NULL; diff --git a/FDTD/processfields.cpp b/FDTD/processfields.cpp index b6c99b7..6314311 100644 --- a/FDTD/processfields.cpp +++ b/FDTD/processfields.cpp @@ -91,7 +91,13 @@ void ProcessFields::InitProcess() //convert to float... float* array = new float[NrLines[n]]; for (unsigned int i=0;iGetGridDelta(); +#endif + } //write to dataset dataset.write( array, H5::PredType::NATIVE_FLOAT ); } @@ -255,17 +261,17 @@ void ProcessFields::SetSubSampling(unsigned int subSampleRate, int dir) else subSample[dir]=subSampleRate; } -void ProcessFields::WriteVTKHeader(ofstream &file, double const* const* discLines, unsigned int const* numLines, unsigned int precision, string header_info, MeshType meshT) +void ProcessFields::WriteVTKHeader(ofstream &file, double const* const* discLines, unsigned int const* numLines, unsigned int precision, string header_info, MeshType meshT, double discLines_scaling) { if (meshT==CARTESIAN_MESH) - WriteVTKCartesianGridHeader(file, discLines, numLines, precision, header_info); + WriteVTKCartesianGridHeader(file, discLines, numLines, precision, header_info, discLines_scaling); else if (meshT==CYLINDRICAL_MESH) - WriteVTKCylindricalGridHeader(file, discLines, numLines, precision, header_info); + WriteVTKCylindricalGridHeader(file, discLines, numLines, precision, header_info, discLines_scaling); else cerr << "ProcessFields::WriteVTKHeader: Warning: unknown mesh type, skipping header -> file will be invalid..." << endl; } -void ProcessFields::WriteVTKCartesianGridHeader(ofstream &file, double const* const* discLines, unsigned int const* numLines, unsigned int precision, string header_info) +void ProcessFields::WriteVTKCartesianGridHeader(ofstream &file, double const* const* discLines, unsigned int const* numLines, unsigned int precision, string header_info, double discLines_scaling) { file << "# vtk DataFile Version 2.0" << endl; file << "Rectilinear Grid openEMS_ProcessFields"; @@ -277,20 +283,20 @@ void ProcessFields::WriteVTKCartesianGridHeader(ofstream &file, double const* co file << "DIMENSIONS " << numLines[0] << " " << numLines[1] << " " << numLines[2] << endl; file << "X_COORDINATES " << numLines[0] << " float" << endl; for (unsigned int i=0;iGetGridDelta(); +#endif + if (m_DumpType==H_FIELD_DUMP) { //create array @@ -77,7 +83,7 @@ void ProcessFieldsTD::DumpNodeInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("H-Field"),H_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("H-Field"),H_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) @@ -133,7 +139,7 @@ void ProcessFieldsTD::DumpNodeInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("E-Field"),E_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("E-Field"),E_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) @@ -151,6 +157,12 @@ void ProcessFieldsTD::DumpNodeInterpol(string filename) void ProcessFieldsTD::DumpCellInterpol(string filename) { +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = Op->GetGridDelta(); +#endif + if (m_DumpType==E_FIELD_DUMP) { //create array @@ -197,7 +209,7 @@ void ProcessFieldsTD::DumpCellInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("E-Field"),E_T,discDLines,numDLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("E-Field"),E_T,discDLines,numDLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) @@ -253,7 +265,7 @@ void ProcessFieldsTD::DumpCellInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("H-Field"),H_T,discDLines,numDLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("H-Field"),H_T,discDLines,numDLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) @@ -271,6 +283,12 @@ void ProcessFieldsTD::DumpCellInterpol(string filename) void ProcessFieldsTD::DumpNoInterpol(string filename) { +#ifdef OUTPUT_IN_DRAWINGUNITS + double discLines_scaling = 1; +#else + double discLines_scaling = Op->GetGridDelta(); +#endif + unsigned int pos[3]; unsigned int OpPos[3]; double delta[3]; @@ -303,7 +321,7 @@ void ProcessFieldsTD::DumpNoInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("E-Field"),E_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("E-Field"),E_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) @@ -349,7 +367,7 @@ void ProcessFieldsTD::DumpNoInterpol(string filename) { ofstream file(filename.c_str()); if (file.is_open()==false) { cerr << "ProcessFieldsTD::Process: can't open file '" << filename << "' for writing... abort! " << endl;}; - DumpVectorArray2VTK(file,string("H-Field"),H_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type); + DumpVectorArray2VTK(file,string("H-Field"),H_T,discLines,numLines,m_precision,GetInterpolationNameByType(m_DumpMode), m_Mesh_Type, discLines_scaling); file.close(); } else if (m_fileType==HDF5_FILETYPE) diff --git a/openEMS.pro b/openEMS.pro index 1296cd8..32f7ba3 100644 --- a/openEMS.pro +++ b/openEMS.pro @@ -12,10 +12,20 @@ INCLUDEPATH += ../CSXCAD \ ../tinyxml LIBS += -L../CSXCAD -lCSXCAD +############################################################################### +# CONFIG SECTION + # the SSE engine defaults to flush-to-zero mode, because of speed advantages # to restore the correct handling of denormals and to comply to IEEE 754 uncomment: # DEFINES += SSE_CORRECT_DENORMALS +# openEMS defaults to output length in unit meters; to recover the old behaviour +# to output length in terms of the drawing unit, uncomment: +# DEFINES += OUTPUT_IN_DRAWINGUNITS + +# CONFIG SECTION +############################################################################### + win32 { INCLUDEPATH += ../hdf5/include ../boost/include/boost-1_42 LIBS += ../hdf5/lib/libhdf5_cpp.a ../hdf5/lib/libhdf5.a