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

Fix error in CGNS writing #2178

Merged
merged 10 commits into from
Dec 5, 2023
20 changes: 10 additions & 10 deletions SU2_CFD/src/output/filewriter/CCGNSFileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void CCGNSFileWriter::WriteData(string val_filename) {

/*--- We append the pre-defined suffix (extension) to the filename (prefix) ---*/
val_filename.append(fileExt);

/*--- Open the CGNS file for writing. ---*/
InitializeMeshFile(val_filename);

Expand Down Expand Up @@ -132,15 +131,16 @@ void CCGNSFileWriter::WriteField(int iField, const string& FieldName) {
/*--- Coordinate vector is written in blocks, one for each process. ---*/
cgsize_t nodeBegin = 1;
auto nodeEnd = static_cast<cgsize_t>(nLocalPoints);

if (isCoord) {
int CoordinateNumber;
CallCGNS(cg_coord_partial_write(cgnsFileID, cgnsBase, cgnsZone, dataType, FieldName.c_str(), &nodeBegin, &nodeEnd,
sendBufferField.data(), &CoordinateNumber));
} else {
int fieldNumber;
CallCGNS(cg_field_partial_write(cgnsFileID, cgnsBase, cgnsZone, cgnsFields, dataType, FieldName.c_str(), &nodeBegin,
&nodeEnd, sendBufferField.data(), &fieldNumber));
if (nLocalPoints > 0) {
if (isCoord) {
int CoordinateNumber;
CallCGNS(cg_coord_partial_write(cgnsFileID, cgnsBase, cgnsZone, dataType, FieldName.c_str(), &nodeBegin, &nodeEnd,
sendBufferField.data(), &CoordinateNumber));
} else {
int fieldNumber;
CallCGNS(cg_field_partial_write(cgnsFileID, cgnsBase, cgnsZone, cgnsFields, dataType, FieldName.c_str(), &nodeBegin,
&nodeEnd, sendBufferField.data(), &fieldNumber));
}
}

for (int i = 0; i < size; ++i) {
Expand Down