Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Paraview/VTK XML (*.vtu) and Multiblock (*.vtm) visualization files #845

Merged
merged 69 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
4095025
Adding new config enums and files
talbring Jan 5, 2020
24dfc64
Error checking for multizone and multiblock output
talbring Jan 5, 2020
fd0f845
New filewriter constructor
talbring Jan 5, 2020
a45d7a7
Added new routine to sort specified markers
talbring Jan 5, 2020
3940056
Adding VTM filewriter header
talbring Jan 5, 2020
6fc9e04
Adding VTK XML filewriter header
talbring Jan 5, 2020
dccbb71
Adding files to meson
talbring Jan 5, 2020
598f262
adding new file cases to output class
talbring Jan 5, 2020
8bf4ea1
Adding vtm filewriter implementation
talbring Jan 5, 2020
22b9f0a
Adding vtk xml writer implementation
talbring Jan 5, 2020
ad9969b
Added missing meson entries
talbring Jan 5, 2020
f288783
Added time value and data set writing to vtm output
talbring Jan 6, 2020
b7e1861
Updated vtk xml writer for serial compilation
talbring Jan 6, 2020
faad7dd
Updated WriteToFile routine
talbring Jan 6, 2020
e6c443c
Small fix for AD compilation
talbring Jan 6, 2020
c12c3f9
adding case name field to config
talbring Jan 6, 2020
b1bfc3e
Removed redundant information from filewriter/sorting routines
talbring Jan 6, 2020
348fca0
Adapted allocation of filewriters/sorting routines
talbring Jan 6, 2020
68abcfc
Added more comments to multiblock section and changed filename to be …
talbring Jan 6, 2020
2fa3dfc
Changed folder name to case name and moved zone data to folder
talbring Jan 6, 2020
166ce1a
Added multizone name to vtm file
talbring Jan 6, 2020
08f5f3b
Some fixes
talbring Jan 6, 2020
778a6f0
Adding comments
talbring Jan 7, 2020
37770b4
Fix for windows compilation
talbring Jan 7, 2020
e89a298
Added const and missing windows includes
talbring Jan 7, 2020
52abba3
Used split to determine case name
talbring Jan 9, 2020
43be40e
Made variable names more consistent and shadowing of inherited variables
talbring Jan 9, 2020
9fb5513
Added routine to get type info
talbring Jan 9, 2020
9c47e8e
Replaced some of the pointers with vectors
talbring Jan 9, 2020
2253229
Removed trailing whitespaces
talbring Jan 9, 2020
1708fa3
Added marker specific sorting routine to FEM sorter
talbring Jan 9, 2020
87c8117
Small fix
talbring Jan 9, 2020
81d6264
replacing most map accesses with at function
talbring Jan 10, 2020
32895cd
Disabling per-zone history files by default
talbring Jan 10, 2020
953ada7
Small fix
talbring Jan 10, 2020
69af2bf
Merge branch 'develop' of github.com:su2code/SU2 into feature_multiblock
talbring Jan 14, 2020
156a082
Small fixes and comments
talbring Jan 14, 2020
d1a19c5
Small fix for non-mpi compilation
talbring Jan 14, 2020
09ccf2d
Merge branch 'develop' into feature_multiblock
talbring Jan 15, 2020
5bcc0ba
Fixed whitespaces in all output files
talbring Jan 15, 2020
757898a
Adding const
talbring Jan 15, 2020
dff465c
Adding common routines to write to a file using MPI I/O the CFileWrit…
talbring Jan 17, 2020
52d6eac
use new routines for MPI I/O writing in XML writer
talbring Jan 17, 2020
177545e
use new routines for MPI I/O writing in SU2 binary writer
talbring Jan 17, 2020
ce030e5
Some small refactoring of how the number of elements are stored in th…
talbring Jan 17, 2020
4088ce3
Updating legacy paraview writer to use the new functions
talbring Jan 17, 2020
4946d3b
Updating paraview xml writer
talbring Jan 17, 2020
ce99d3e
Removing redundant member variables
talbring Jan 17, 2020
8609172
changing dyn. allocation to static
talbring Jan 17, 2020
a84ce0b
small fix
talbring Jan 17, 2020
04d0814
Merge branch 'develop' into feature_multiblock
talbring Jan 19, 2020
0750f38
Some refactoring and renaming of variables in data sorter
talbring Jan 20, 2020
b60b84d
Adapting paraview binary writers
talbring Jan 20, 2020
73583dd
Removing #ifdef HAVE_MPI for collective calls in datasorters
talbring Jan 20, 2020
36cbbb2
Adapting tecplot output
talbring Jan 20, 2020
98a7ef8
Another round of fixes
talbring Jan 22, 2020
e3632c1
Merge branch 'develop' of github.com:su2code/SU2 into feature_multiblock
talbring Jan 22, 2020
f03acf7
Adding bandwidth output
talbring Jan 24, 2020
7bdbc1d
Removing some code duplication
talbring Jan 24, 2020
cdef521
Merge branch 'develop' into feature_multiblock
talbring Jan 24, 2020
53847b0
Merge branch 'develop' into feature_multiblock
pcarruscag Jan 24, 2020
a0568f7
Small fixes
talbring Jan 26, 2020
b78b443
Fixed alignment
talbring Jan 26, 2020
b636f09
Fixed memory leak
talbring Jan 26, 2020
253fc16
Fixed some comments and renamed some variables
talbring Jan 27, 2020
a1dbcaa
Fixed alignment
talbring Jan 27, 2020
1871754
Merge branch 'develop' into feature_multiblock
talbring Jan 28, 2020
afc203d
Updating automake files
talbring Jan 28, 2020
318acd1
Merge branch 'feature_multiblock' of github.com:su2code/SU2 into feat…
talbring Jan 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Common/include/config_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ class CConfig {
unsigned short pastix_verb_lvl; /*!< \brief Verbosity level for PaStiX */
unsigned short pastix_fill_lvl; /*!< \brief Fill level for PaStiX ILU */

string caseName; /*!< \brief Name of the current case

/*!
* \brief Set the default values of config options not set in the config file using another config object.
Expand Down Expand Up @@ -9292,6 +9293,12 @@ class CConfig {
* \return <TRUE> if option was set in the config file
*/
bool OptionIsSet(string option);

/*!
* \brief Get the name of the current case
* \return the case name
*/
string GetCaseName();
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
};

#include "config_structure.inl"
2 changes: 2 additions & 0 deletions Common/include/config_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2073,3 +2073,5 @@ inline unsigned short* CConfig::GetVolumeOutputFiles() {return VolumeOutputFiles
inline unsigned short CConfig::GetnVolumeOutputFiles() {return nVolumeOutputFiles;}

inline bool CConfig::OptionIsSet(string option){ return all_options.find(option) == all_options.end();}

inline string CConfig::GetCaseName(){ return caseName;}
12 changes: 9 additions & 3 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,10 @@ enum ENUM_OUTPUT {
MESH = 11, /*!< \brief SU2 mesh format. */
RESTART_BINARY = 12, /*!< \brief SU2 binary restart format. */
RESTART_ASCII = 13, /*!< \brief SU2 ASCII restart format. */
CGNS = 14 /*!< \brief CGNS format. */
CGNS = 14, /*!< \brief CGNS format. */
PARAVIEW_XML = 15, /*!< \brief Paraview XML with binary data format */
SURFACE_PARAVIEW_XML = 16, /*!< \brief Surface Paraview XML with binary data format */
PARAVIEW_MULTIBLOCK = 17 /*!< \brief Paraview XML Multiblock */
};
static const map<string, ENUM_OUTPUT> Output_Map = CCreateMap<string, ENUM_OUTPUT>
("TECPLOT_ASCII", TECPLOT)
Expand All @@ -1501,9 +1504,12 @@ static const map<string, ENUM_OUTPUT> Output_Map = CCreateMap<string, ENUM_OUTPU
("CSV", CSV)
("SURFACE_CSV", SURFACE_CSV)
("PARAVIEW_ASCII", PARAVIEW)
("PARAVIEW", PARAVIEW_BINARY)
("PARAVIEW_LEGACY", PARAVIEW_BINARY)
("SURFACE_PARAVIEW_ASCII", SURFACE_PARAVIEW)
("SURFACE_PARAVIEW", SURFACE_PARAVIEW_BINARY)
("SURFACE_PARAVIEW_LEGACY", SURFACE_PARAVIEW_BINARY)
("PARAVIEW", PARAVIEW_XML)
("SURFACE_PARAVIEW", SURFACE_PARAVIEW_XML)
("PARAVIEW_MULTIBLOCK", PARAVIEW_MULTIBLOCK)
("RESTART_ASCII", RESTART_ASCII)
("RESTART", RESTART_BINARY)
("CGNS", CGNS);
Expand Down
43 changes: 42 additions & 1 deletion Common/src/config_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ vector<double> GEMM_Profile_MaxTime; /*!< \brief Maximum time spent for thi

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, bool verb_high) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = string(case_filename);
unsigned short lastindex = caseName.find_last_of(".");
caseName = caseName.substr(0, lastindex);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have this kind of common operation in a toolbox (whatever the stl does not offer).

base_config = true;

/*--- Store MPI rank and size ---*/
Expand Down Expand Up @@ -102,6 +108,8 @@ CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_softwar

CConfig::CConfig(CConfig* config, char case_filename[MAX_STRING_SIZE], unsigned short val_software, unsigned short val_iZone, unsigned short val_nZone, bool verb_high) {

caseName = config->GetCaseName();

unsigned short val_nDim;

base_config = false;
Expand Down Expand Up @@ -157,6 +165,12 @@ CConfig::CConfig(CConfig* config, char case_filename[MAX_STRING_SIZE], unsigned

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = string(case_filename);
unsigned short lastindex = caseName.find_last_of(".");
caseName = caseName.substr(0, lastindex);

base_config = true;

nZone = 1;
Expand Down Expand Up @@ -203,6 +217,12 @@ CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_softwar

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], CConfig *config) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = string(case_filename);
unsigned short lastindex = caseName.find_last_of(".");
caseName = caseName.substr(0, lastindex);

base_config = true;

/*--- Store MPI rank and size ---*/
Expand Down Expand Up @@ -9464,7 +9484,28 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){
SU2_MPI::Error("Option MULTIZONE_MESH must be the same in all zones.", CURRENT_FUNCTION);
}
}


bool multiblockDriver = false;
for (unsigned short iFiles = 0; iFiles < driver_config->GetnVolumeOutputFiles(); iFiles++){
if (driver_config->GetVolumeOutputFiles()[iFiles] == PARAVIEW_MULTIBLOCK){
multiblockDriver = true;
}
}
Comment on lines +9481 to +9485
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do std::any_of if you want to be more c++11


bool multiblockZone = false;
for (unsigned short iZone = 0; iZone < nZone; iZone++){
multiblockZone = false;
for (unsigned short iFiles = 0; iFiles < config_container[iZone]->GetnVolumeOutputFiles(); iFiles++){
if (config_container[iZone]->GetVolumeOutputFiles()[iFiles] == PARAVIEW_MULTIBLOCK){
multiblockZone = true;
}
}
if (multiblockZone != multiblockDriver){
SU2_MPI::Error("To enable PARAVIEW_MULTIBLOCK output, add it to OUTPUT_FILES option in main config and\n"
"remove option from sub-config files.", CURRENT_FUNCTION);
}
}

/*--- Set the Restart iter for time dependent problems ---*/
if (driver_config->GetRestart()){
Unst_RestartIter = driver_config->GetRestart_Iter();
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CCSVFileWriter final: public CFileWriter{
* \param[in] fields - A list of field names
* \param[in] nDim - Physical dimension
*/
CCSVFileWriter(vector<string> fields, unsigned short nDim, string fileName, CParallelDataSorter* data_sorter);
CCSVFileWriter(string fileName, CParallelDataSorter* data_sorter);

/*!
* \brief Destructor
Expand Down
4 changes: 2 additions & 2 deletions SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class CFEMDataSorter final: public CParallelDataSorter{
* \brief Constructor
* \param[in] config - Pointer to the current config structure
* \param[in] geometry - Pointer to the current geometry
* \param[in] nFields - Number of output fields
* \param[in] fieldNames - Vector containing the field names
*/
CFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields);
CFEMDataSorter(CConfig *config, CGeometry *geometry, vector<string> fieldNames);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pass fieldNames by const&


/*!
* \brief Destructor
Expand Down
4 changes: 2 additions & 2 deletions SU2_CFD/include/output/filewriter/CFVMDataSorter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class CFVMDataSorter final: public CParallelDataSorter{
* \brief Constructor
* \param[in] config - Pointer to the current config structure
* \param[in] geometry - Pointer to the current geometry
* \param[in] nFields - Number of output fields
* \param[in] fieldNames - Vector containing the field names
*/
CFVMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields);
CFVMDataSorter(CConfig *config, CGeometry *geometry, vector<string> fieldNames);

/*!
* \brief Destructor
Expand Down
28 changes: 12 additions & 16 deletions SU2_CFD/include/output/filewriter/CFileWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ using namespace std;
class CFileWriter{
protected:

/*!
* \brief Vector containing the field names
*/
std::vector<std::string> fieldnames;

/*!
* \brief The physical dimension of the problem
*/
unsigned short nDim;

/*!
* \brief The MPI rank
*/
Expand Down Expand Up @@ -88,21 +78,27 @@ class CFileWriter{
* \brief Filename
*/
string fileName;

/*!
* \brief The parallel data sorter
*/
CParallelDataSorter* dataSorter;

public:
/*!
* \brief Construct a file writer using field names, file extension and dimension.
* \param[in] fields - A list of field names
* \param[in] fileName - The name of the file
* \param[in] file_ext - The file extension to be attached to the filename
* \param[in] nDim - Physical dimension
*/
CFileWriter(std::vector<std::string> fields, string fileName, CParallelDataSorter* dataSorter, string file_ext, unsigned short nDim);

CFileWriter(string fileName, CParallelDataSorter* dataSorter, string file_ext);

/*!
* \brief Construct a file writer using field names, file extension and dimension.
* \param[in] fileName - The name of the file
* \param[in] fileExt - The file extension to be attached to the filename
*/
CFileWriter(string fileName, string fileExt);

/*!
* \brief Destructor
*/
Expand Down
32 changes: 30 additions & 2 deletions SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class CParallelDataSorter{
unsigned long *idSend; //!< Send buffer holding global indices that will be send to other processors
int nSends, //!< Number of sends
nRecvs; //!< Number of receives

vector<string> fieldNames; //!< Vector with names of the output fields

unsigned short nDim; //!< Spatial dimension of the data

/*!
* \brief Prepare the send buffers by filling them with the global indices.
Expand All @@ -100,9 +104,9 @@ class CParallelDataSorter{
/*!
* \brief Constructor
* \param[in] config - Pointer to the current config structure
* \param[in] nFields - Number of output fields
* \param[in] fieldNames - Vector containing the field names
*/
CParallelDataSorter(CConfig *config, unsigned short nFields);
CParallelDataSorter(CConfig *config, vector<string> fieldNames);

/*!
* \brief Destructor
Expand All @@ -121,6 +125,14 @@ class CParallelDataSorter{
* \param[in] val_sort - boolean controlling whether the elements are sorted or simply loaded by their owning rank.
*/
virtual void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort = true){}

/*!
* \brief Sort the connectivities into data structures (only for surface data sorters).
* \param[in] config - Definition of the particular problem.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] markerList - A list of marker names that should be sorted.
*/
virtual void SortConnectivity(CConfig *config, CGeometry *geometry, vector<string> markerList){}

/*!
* \brief Get the number of points the local rank owns.
Expand Down Expand Up @@ -232,4 +244,20 @@ class CParallelDataSorter{
su2double GetUnsorted_Data(unsigned long iPoint, unsigned short iField){
return connSend[Index[iPoint] + iField];
}

/*!
* \brief Get the vector containing the names of the output fields
* \return Vector of strings containing the field names
*/
vector<string> GetFieldNames(){
return fieldNames;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be returned by const&, it will still allow a local copy to be created if necessary.


/*!
* \brief Get the spatial dimension
* \return The spatial dimension
*/
unsigned short GetnDim(){
return nDim;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class CParaviewBinaryFileWriter final: public CFileWriter{
* \param[in] fileName - The name of the file
* \param[in] data_sorter - The parallel sorted data to write
*/
CParaviewBinaryFileWriter(vector<string> fields, unsigned short nDim,
string fileName, CParallelDataSorter* data_sorter);
CParaviewBinaryFileWriter(string fileName, CParallelDataSorter* data_sorter);

/*!
* \brief Destructor
Expand Down
3 changes: 1 addition & 2 deletions SU2_CFD/include/output/filewriter/CParaviewFileWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class CParaviewFileWriter final: public CFileWriter{
* \param[in] fileName - The name of the file
* \param[in] data_sorter - The parallel sorted data to write
*/
CParaviewFileWriter(vector<string> fields, unsigned short nDim,
string fileName, CParallelDataSorter* data_sorter);
CParaviewFileWriter(string fileName, CParallelDataSorter* data_sorter);

/*!
* \brief Destructor
Expand Down
Loading