From d040347f85fbd979d7da356cce7b0c7342588194 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 17 Apr 2024 23:02:01 +0200 Subject: [PATCH 1/3] fix profile writer --- SU2_CFD/src/CMarkerProfileReaderFVM.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp index b9b27a176aa..2ddf3745cf3 100644 --- a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp +++ b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp @@ -38,7 +38,6 @@ CMarkerProfileReaderFVM::CMarkerProfileReaderFVM(CGeometry *val_geometry, vector val_columnValues) { /*--- Store input values and pointers to class data. ---*/ - rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); @@ -51,7 +50,6 @@ CMarkerProfileReaderFVM::CMarkerProfileReaderFVM(CGeometry *val_geometry, numberOfVars = val_number_vars; columnNames = std::move(val_columnNames); columnValues = std::move(val_columnValues); - /* Attempt to open the specified file. */ ifstream profile_file; profile_file.open(filename.data(), ios::in); @@ -302,6 +300,10 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { by the master and sorted by marker tag in one large n-dim. array. ---*/ su2double *Coords_Local; jPoint = 0; + + /*--- Index to the string in columNames and columnValues ---*/ + unsigned short columnIndex=0; + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if (config->GetMarker_All_KindBC(iMarker) == markerType) { @@ -334,16 +336,12 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { SPRINTF(&Buffer_Send_Str[jPoint*MAX_STRING_SIZE], "%s", config->GetMarker_All_TagBound(iMarker).c_str()); - /*--- Store the column names ---*/ - SPRINTF(&Buffer_Send_Name[jPoint*MAX_STRING_SIZE], "%s", - columnNames[iMarker].c_str()); - + columnNames[columnIndex].c_str()); /*--- Store the column values ---*/ - SPRINTF(&Buffer_Send_Value[jPoint*MAX_STRING_SIZE], "%s", - columnValues[iMarker].c_str()); + columnValues[columnIndex].c_str()); /*--- Increment jPoint as the counter. We need this because iPoint may include halo nodes that we skip over during this loop. ---*/ From db295b3e9181947ffd7e7ff27b9e55e0c39ff981 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 17 Apr 2024 23:06:48 +0200 Subject: [PATCH 2/3] fix formatting --- SU2_CFD/src/CMarkerProfileReaderFVM.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp index 2ddf3745cf3..d941c86c59c 100644 --- a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp +++ b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp @@ -38,6 +38,7 @@ CMarkerProfileReaderFVM::CMarkerProfileReaderFVM(CGeometry *val_geometry, vector val_columnValues) { /*--- Store input values and pointers to class data. ---*/ + rank = SU2_MPI::GetRank(); size = SU2_MPI::GetSize(); @@ -50,6 +51,7 @@ CMarkerProfileReaderFVM::CMarkerProfileReaderFVM(CGeometry *val_geometry, numberOfVars = val_number_vars; columnNames = std::move(val_columnNames); columnValues = std::move(val_columnValues); + /* Attempt to open the specified file. */ ifstream profile_file; profile_file.open(filename.data(), ios::in); @@ -336,10 +338,14 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { SPRINTF(&Buffer_Send_Str[jPoint*MAX_STRING_SIZE], "%s", config->GetMarker_All_TagBound(iMarker).c_str()); + /*--- Store the column names ---*/ + SPRINTF(&Buffer_Send_Name[jPoint*MAX_STRING_SIZE], "%s", columnNames[columnIndex].c_str()); + /*--- Store the column values ---*/ + SPRINTF(&Buffer_Send_Value[jPoint*MAX_STRING_SIZE], "%s", columnValues[columnIndex].c_str()); From 95992b19858d0a3090f192bd5177dd7d11d1f266 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Wed, 17 Apr 2024 23:08:15 +0200 Subject: [PATCH 3/3] increment index --- SU2_CFD/src/CMarkerProfileReaderFVM.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp index d941c86c59c..b6b1e36479f 100644 --- a/SU2_CFD/src/CMarkerProfileReaderFVM.cpp +++ b/SU2_CFD/src/CMarkerProfileReaderFVM.cpp @@ -356,6 +356,7 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() { } } + columnIndex++; } }