Skip to content

Commit c5a6c5e

Browse files
committed
introduce COMPACT keyword
1 parent b6f23c3 commit c5a6c5e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

SU2_CFD/include/output/COutput.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class COutput {
297297
/*! \brief Minimum required volume fields for restart file. */
298298
std::vector<string> requiredVolumeFields = {"COORDINATES", "SOLUTION", "GRID_VELOCITY"};
299299
/*! \brief Minimum required volume fields for restart file. */
300-
unsigned short nRequiredVolumeFields = 2;
300+
unsigned short nRequiredVolumeFields = requiredVolumeFields.size();
301301

302302
/*----------------------------- Convergence monitoring ----------------------------*/
303303

SU2_CFD/src/output/COutput.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form
414414

415415
/*--- If we have compact restarts, we use only the required fields. ---*/
416416
if (config->GetWrt_Restart_Compact())
417-
surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames);
418-
else
419417
surfaceDataSorter->SetRequiredFieldNames(surfaceDataSorter->GetFieldNames());
418+
else
419+
surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames);
420420

421421

422422
surfaceDataSorter->SortConnectivity(config, geometry);
@@ -1537,16 +1537,21 @@ void COutput::PreprocessVolumeOutput(CConfig *config){
15371537
/*--- If no volume fields were requested, we add the entire SOLUTION field.
15381538
* We also add the solution field if we are not using the compact formulation.
15391539
* This is for backwards compatibility. ---*/
1540-
if ((config->GetWrt_Restart_Compact() == false) || (nRequestedVolumeFields == 1)) {
1541-
requestedVolumeFields.emplace_back("SOLUTION");
1542-
nRequestedVolumeFields++;
1540+
itCoord = std::find(requestedVolumeFields.begin(),
1541+
requestedVolumeFields.end(), "SOLUTION");
1542+
if (itCoord == requestedVolumeFields.end()) {
1543+
auto itCoordCompact = std::find(requestedVolumeFields.begin(),
1544+
requestedVolumeFields.end(), "COMPACT");
1545+
if (itCoordCompact == requestedVolumeFields.end()) {
1546+
requestedVolumeFields.emplace_back("SOLUTION");
1547+
nRequestedVolumeFields++;
1548+
}
15431549
}
15441550

15451551
string RequiredField;
15461552
std::vector<bool> FoundField(nRequestedVolumeFields, false);
15471553
vector<string> FieldsToRemove;
15481554

1549-
15501555
/*--- Loop through all fields defined in the corresponding SetVolumeOutputFields().
15511556
* If it is also defined in the config (either as part of a group or a single field), the field
15521557
* object gets an offset so that we know where to find the data in the Local_Data() array.
@@ -1555,6 +1560,7 @@ void COutput::PreprocessVolumeOutput(CConfig *config){
15551560
for (size_t iField_Output = 0; iField_Output < volumeOutput_List.size(); iField_Output++) {
15561561

15571562
const string &fieldReference = volumeOutput_List[iField_Output];
1563+
15581564
if (volumeOutput_Map.count(fieldReference) > 0) {
15591565

15601566
VolumeOutputField &Field = volumeOutput_Map.at(fieldReference);
@@ -2452,7 +2458,7 @@ void COutput::PrintVolumeFields(){
24522458
}
24532459

24542460
cout << "Available volume output fields for the current configuration in " << multiZoneHeaderString << ":" << endl;
2455-
cout << "Note: COORDINATES and SOLUTION groups are always in the volume output." << endl;
2461+
cout << "Note: COORDINATES and SOLUTION groups are always in the volume output unless WRT_COMPACT_RESTART=YES." << endl;
24562462
VolumeFieldTable.AddColumn("Name", NameSize);
24572463
VolumeFieldTable.AddColumn("Group Name", GroupSize);
24582464
VolumeFieldTable.AddColumn("Description", DescrSize);

0 commit comments

Comments
 (0)