@@ -92,6 +92,12 @@ int CgnsFile::Impl::initZoneId(bool clearResults)
9292 // zone found!
9393 m_zoneId = Z;
9494
95+ ZoneType_t zt;
96+ ier = cg_zone_type (m_fileId, m_baseId, Z, &zt);
97+ RETURN_IF_ERR;
98+
99+ m_hasFaceSols = (zt == Structured);
100+
95101 if (clearResults) {
96102 ier = clearResultData ();
97103 } else {
@@ -739,7 +745,7 @@ void CgnsFile::Impl::getPolydataSolName(int num, char* name)
739745 sprintf (name, " PolydataSolution%d" , num);
740746}
741747
742- int CgnsFile::Impl::addSolutionNode (int fid, int bid, int zid, int sid, std::vector<std::string>* sols, std::vector<std::string>* cellsols, std::vector<std::string>* ifacesols, std::vector<std::string>* jfacesols)
748+ int CgnsFile::Impl::addSolutionNode (int fid, int bid, int zid, int sid, std::vector<std::string>* sols, std::vector<std::string>* cellsols, std::vector<std::string>* ifacesols, std::vector<std::string>* jfacesols, bool hasFaceSols )
743749{
744750 char solname[NAME_MAXLENGTH];
745751 getSolName (sid, solname);
@@ -763,25 +769,30 @@ int CgnsFile::Impl::addSolutionNode(int fid, int bid, int zid, int sid, std::vec
763769 RETURN_IF_ERR;
764770
765771 ier = cg_sol_write (fid, bid, zid, cellsolname, CellCenter, &S);
766- RETURN_IF_ERR;
767772
768- ier = cg_sol_write (fid, bid, zid, ifacesolname, IFaceCenter, &S);
769773 RETURN_IF_ERR;
770774
771- ier = cg_sol_write (fid, bid, zid, jfacesolname, JFaceCenter, &S);
772- RETURN_IF_ERR;
775+ if (hasFaceSols) {
776+ ier = cg_sol_write (fid, bid, zid, ifacesolname, IFaceCenter, &S);
777+ RETURN_IF_ERR;
778+
779+ ier = cg_sol_write (fid, bid, zid, jfacesolname, JFaceCenter, &S);
780+ RETURN_IF_ERR;
781+ }
773782
774783 ier = writeFlowSolutionPointers (fid, bid, zid, *sols);
775784 RETURN_IF_ERR;
776785
777786 ier = writeFlowCellSolutionPointers (fid, bid, zid, *cellsols);
778787 RETURN_IF_ERR;
779788
780- ier = writeFlowIFaceSolutionPointers (fid, bid, zid, *ifacesols);
781- RETURN_IF_ERR;
789+ if (hasFaceSols) {
790+ ier = writeFlowIFaceSolutionPointers (fid, bid, zid, *ifacesols);
791+ RETURN_IF_ERR;
782792
783- ier = writeFlowJFaceSolutionPointers (fid, bid, zid, *jfacesols);
784- RETURN_IF_ERR;
793+ ier = writeFlowJFaceSolutionPointers (fid, bid, zid, *jfacesols);
794+ RETURN_IF_ERR;
795+ }
785796
786797 ier = addParticleGroupSolutionNode (fid, bid, zid, sid);
787798 RETURN_IF_ERR;
0 commit comments