Skip to content

Commit 2fd31fc

Browse files
author
rois1995
committed
- Fixed CGNS writing
1 parent 843606a commit 2fd31fc

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

SU2_CFD/src/output/filewriter/CCGNSFileWriter.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void CCGNSFileWriter::WriteData(string val_filename) {
3838

3939
/*--- We append the pre-defined suffix (extension) to the filename (prefix) ---*/
4040
val_filename.append(fileExt);
41-
41+
4242
/*--- Open the CGNS file for writing. ---*/
4343
InitializeMeshFile(val_filename);
4444

@@ -132,15 +132,16 @@ void CCGNSFileWriter::WriteField(int iField, const string& FieldName) {
132132
/*--- Coordinate vector is written in blocks, one for each process. ---*/
133133
cgsize_t nodeBegin = 1;
134134
auto nodeEnd = static_cast<cgsize_t>(nLocalPoints);
135-
136-
if (isCoord) {
137-
int CoordinateNumber;
138-
CallCGNS(cg_coord_partial_write(cgnsFileID, cgnsBase, cgnsZone, dataType, FieldName.c_str(), &nodeBegin, &nodeEnd,
139-
sendBufferField.data(), &CoordinateNumber));
140-
} else {
141-
int fieldNumber;
142-
CallCGNS(cg_field_partial_write(cgnsFileID, cgnsBase, cgnsZone, cgnsFields, dataType, FieldName.c_str(), &nodeBegin,
143-
&nodeEnd, sendBufferField.data(), &fieldNumber));
135+
if(nLocalPoints > 0){
136+
if (isCoord) {
137+
int CoordinateNumber;
138+
CallCGNS(cg_coord_partial_write(cgnsFileID, cgnsBase, cgnsZone, dataType, FieldName.c_str(), &nodeBegin, &nodeEnd,
139+
sendBufferField.data(), &CoordinateNumber));
140+
} else {
141+
int fieldNumber;
142+
CallCGNS(cg_field_partial_write(cgnsFileID, cgnsBase, cgnsZone, cgnsFields, dataType, FieldName.c_str(), &nodeBegin,
143+
&nodeEnd, sendBufferField.data(), &fieldNumber));
144+
}
144145
}
145146

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

0 commit comments

Comments
 (0)