NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
cgnsWriter Class Reference

Detailed Description

Definition at line 57 of file cgnsWriter.H.

Public Member Functions

 cgnsWriter (std::string fname, std::string baseName, int cellDim, int physDim, int mode)
 
 ~cgnsWriter ()
 
void deleteFile ()
 
void setUnits (CGNS_ENUMT(MassUnits_t) mu, CGNS_ENUMT(LengthUnits_t) lu, CGNS_ENUMT(TimeUnits_t) tu, CGNS_ENUMT(TemperatureUnits_t) tpu, CGNS_ENUMT(AngleUnits_t) au)
 
void setBaseItrData (std::string bsitrname, int ntstp, double tval)
 
void setZoneItrData (std::string zitrname, std::string grdptr, std::string slnptr)
 
void setIntData (std::string intname, int intval)
 
void setZone (std::string zName, CGNS_ENUMT(ZoneType_t) zt)
 
int getNSections ()
 
void setTimestamp (std::string trimmed_base_t)
 
void setNVrtx (int nVt)
 
void setNCell (int nCl)
 
void setGlobalNCell (int gnCl)
 
void setGridXYZ (vect1d< double > x, vect1d< double > y, vect1d< double > z)
 
void setCoordRind (int rind)
 
void setVirtElmRind (int rind)
 
void setPconnVec (const vect1d< int > &pConnVec)
 
void setPconnLimits (int pconnProcMin, int pconnProcMax)
 
void setPatchNo (int patchNo)
 
void setBcflag (int bcflag)
 
void setCnstrtype (int cnstr_type)
 
void setVolCellFacesNumber (int nVolCellFaces)
 
void setPconnGhostDescriptor (int ghostDescriptor)
 
void setSection (std::string sName, CGNS_ENUMT(ElementType_t) st, vect1d< cgsize_t > elmConn)
 
void setGlobalSection (std::string sName, CGNS_ENUMT(ElementType_t) st, vect1d< int > elmConn)
 
void setGlobalSection (std::string gsName, CGNS_ENUMT(ElementType_t) gst)
 
void resetSections ()
 
void resetGlobalSections ()
 
void setSolutionNode (std::string ndeName, CGNS_ENUMT(GridLocation_t) slnLoc)
 
void writeSolutionNode (std::string ndeName, CGNS_ENUMT(GridLocation_t) slnLoc, int emptyFlag, int virtFlag)
 
void writeSolutionField (std::string fname, std::string ndeName, CGNS_ENUMT(DataType_t) dt, void *data)
 
void writeGridToFile ()
 
void writeZoneToFile ()
 
void writeWinToFile ()
 
void setFluidUnitsMap ()
 
void setFluidDimMap ()
 
void setFluidMagMap ()
 
void setiFluidUnitsMap ()
 
void setiFluidDimMap ()
 
void setiFluidMagMap ()
 
void setBurnUnitsMap ()
 
void setBurnDimMap ()
 
void setBurnMagMap ()
 
void setTypeFlag (int typeFlag)
 
void writeVolCellFacesNumber ()
 

Private Member Functions

 CGNS_ENUMT (ZoneType_t) zoneType
 
 CGNS_ENUMT (ElementType_t) sectionType
 
 CGNS_ENUMT (MassUnits_t) massU
 
 CGNS_ENUMT (LengthUnits_t) lengthU
 
 CGNS_ENUMT (TimeUnits_t) timeU
 
 CGNS_ENUMT (TemperatureUnits_t) tempU
 
 CGNS_ENUMT (AngleUnits_t) angleU
 

Private Attributes

std::string myCgFileName
 
 gsectionType
 
int rmin [3]
 
int rmax [3]
 
cgsize_t cgCoreSize [9]
 
std::string baseName
 
std::string zoneName
 
std::string sectionName
 
std::string gsectionName
 
int indexFile
 
int indexBase
 
int indexZone
 
int indexCoord
 
int indexSection
 
int cellDim
 
int physDim
 
std::string trimmed_base_t
 
int nBase
 
int nZone
 
int nVrtx
 
int nCell
 
int gnCell
 
int nSection
 
int gnSection
 
int nVrtxElem
 
int coordRind
 
int virtElmRind
 
int pConnGhostDescriptor
 
int typeFlag
 
vect1d< int > pConnVec
 
int pConnMin
 
int pConnMax
 
vect1d< int > elmConn
 
int patchNo
 
int bcflag
 
int cnstr_type
 
int intVal
 
int nVolCellFaces
 
std::string baseItrName
 
std::string zoneItrName
 
std::string intName
 
std::string gridCrdPntr
 
std::string flowSlnPntr
 
int nTStep
 
double timeLabel
 
vect1d< double > xCrd
 
vect1d< double > yCrd
 
vect1d< double > zCrd
 
vect1d< std::string > zoneNames
 
vect1d< CGNS_ENUMT(ZoneType_t)> zoneTypes
 
vect1d< std::string > sectionNames
 
vect1d< std::string > gsectionNames
 
vect1d< CGNS_ENUMT(ElementType_t)> sectionTypes
 
vect1d< CGNS_ENUMT(ElementType_t)> gsectionTypes
 
vect2d< cgsize_t > elmConns
 
vect2d< int > gelmConns
 
vect1d< int > nCells
 
vect1d< int > gnCells
 
int nSlnFld
 
int nVrtxSln
 
int nCellSln
 
int nVrtxFld
 
int nCellFld
 
std::map< std::string, int > slnNameNFld
 
vect1d< int > solutionIdx
 
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
 
std::map< std::string, int > solutionNameSolIdxMap
 
std::map< int, std::pair< int, keyValueList > > solutionMap
 
vect1d< std::string > solutionName
 
vect1d< CGNS_ENUMT(GridLocation_t)> solutionGridLocation
 
std::map< std::string, std::string > fluidUnitsMap
 
std::map< std::string, std::vector< float > > fluidDimMap
 
std::map< std::string, int > fluidMagMap
 
std::map< std::string, std::string > ifluidUnitsMap
 
std::map< std::string, std::vector< float > > ifluidDimMap
 
std::map< std::string, int > ifluidMagMap
 
std::map< std::string, std::string > burnUnitsMap
 
std::map< std::string, std::vector< float > > burnDimMap
 
std::map< std::string, int > burnMagMap
 

Constructor & Destructor Documentation

◆ cgnsWriter()

cgnsWriter::cgnsWriter ( std::string  fname,
std::string  baseName,
int  cellDim,
int  physDim,
int  mode 
)
inline

Definition at line 59 of file cgnsWriter.H.

60  :
61  myCgFileName(std::move(fname)), baseName(std::move(baseName)),
63  nVrtx(0), nCell(0), nSection(0), gnSection(0),
64  coordRind(0), virtElmRind(0),
65  nSlnFld(0), nVrtxSln(0), nCellSln(0), nVrtxFld(0), nCellFld(0)
66  {
67  if (mode == 0) {
68  if (cg_open(myCgFileName.c_str(), CG_MODE_WRITE,
69  &indexFile))
70  cg_error_exit();
71  } else if (mode == 1) {
72  if (cg_open(myCgFileName.c_str(), CG_MODE_MODIFY,
73  &indexFile))
74  cg_error_exit();
75  }
76  int file_type;
77  cg_get_file_type(indexFile, &file_type);
78  };
int nVrtxSln
Definition: cgnsWriter.H:195
int nVrtxFld
Definition: cgnsWriter.H:197
int nCellSln
Definition: cgnsWriter.H:196
int virtElmRind
Definition: cgnsWriter.H:157
int nCellFld
Definition: cgnsWriter.H:198
int nSection
Definition: cgnsWriter.H:153
int gnSection
Definition: cgnsWriter.H:154
std::string myCgFileName
Definition: cgnsWriter.H:137
std::string baseName
Definition: cgnsWriter.H:142
int coordRind
Definition: cgnsWriter.H:156
int indexFile
Definition: cgnsWriter.H:143

◆ ~cgnsWriter()

cgnsWriter::~cgnsWriter ( )
inline

Definition at line 80 of file cgnsWriter.H.

References CGNS_ENUMT(), data, pconnProcMax, pconnProcMin, and trimmed_base_t.

80 { cg_close(indexFile); };
int indexFile
Definition: cgnsWriter.H:143

Member Function Documentation

◆ CGNS_ENUMT() [1/7]

cgnsWriter::CGNS_ENUMT ( ZoneType_t  )
private

◆ CGNS_ENUMT() [2/7]

cgnsWriter::CGNS_ENUMT ( ElementType_t  )
private

◆ CGNS_ENUMT() [3/7]

cgnsWriter::CGNS_ENUMT ( MassUnits_t  )
private

◆ CGNS_ENUMT() [4/7]

cgnsWriter::CGNS_ENUMT ( LengthUnits_t  )
private

◆ CGNS_ENUMT() [5/7]

cgnsWriter::CGNS_ENUMT ( TimeUnits_t  )
private

◆ CGNS_ENUMT() [6/7]

cgnsWriter::CGNS_ENUMT ( TemperatureUnits_t  )
private

◆ CGNS_ENUMT() [7/7]

cgnsWriter::CGNS_ENUMT ( AngleUnits_t  )
private

◆ deleteFile()

void cgnsWriter::deleteFile ( )

Definition at line 38 of file cgnsWriter.C.

References myCgFileName.

39 {
40  std::remove(myCgFileName.c_str());
41 }
std::string myCgFileName
Definition: cgnsWriter.H:137

◆ getNSections()

int cgnsWriter::getNSections ( )

Definition at line 326 of file cgnsWriter.C.

References sectionNames.

327 {
328  return sectionNames.size();
329 }
vect1d< std::string > sectionNames
Definition: cgnsWriter.H:185

◆ resetGlobalSections()

void cgnsWriter::resetGlobalSections ( )

Definition at line 379 of file cgnsWriter.C.

References gelmConns, gnCells, gnSection, gsectionName, gsectionNames, and gsectionTypes.

380 {
381  gnSection = 0;
382  gsectionNames.clear();
383  gsectionName.clear();
384  gsectionTypes.clear();
385  gelmConns.clear();
386  gnCells.clear();
387 }
vect1d< CGNS_ENUMT(ElementType_t)> gsectionTypes
Definition: cgnsWriter.H:188
vect1d< std::string > gsectionNames
Definition: cgnsWriter.H:186
vect1d< int > gnCells
Definition: cgnsWriter.H:192
std::string gsectionName
Definition: cgnsWriter.H:142
int gnSection
Definition: cgnsWriter.H:154
vect2d< int > gelmConns
Definition: cgnsWriter.H:190

◆ resetSections()

void cgnsWriter::resetSections ( )

Definition at line 368 of file cgnsWriter.C.

References elmConns, nCells, nSection, sectionName, sectionNames, and sectionTypes.

369 {
370  nSection = 0;
371  sectionNames.clear();
372  sectionName.clear();
373  sectionTypes.clear();
374  elmConns.clear();
375  nCells.clear();
376 }
vect1d< CGNS_ENUMT(ElementType_t)> sectionTypes
Definition: cgnsWriter.H:187
std::string sectionName
Definition: cgnsWriter.H:142
vect1d< int > nCells
Definition: cgnsWriter.H:191
int nSection
Definition: cgnsWriter.H:153
vect2d< cgsize_t > elmConns
Definition: cgnsWriter.H:189
vect1d< std::string > sectionNames
Definition: cgnsWriter.H:185

◆ setBaseItrData()

void cgnsWriter::setBaseItrData ( std::string  bsitrname,
int  ntstp,
double  tval 
)

Definition at line 293 of file cgnsWriter.C.

References baseItrName, nTStep, and timeLabel.

294 {
295  baseItrName = bsitrname;
296  nTStep = ntstp;
297  timeLabel = tval;
298 }
std::string baseItrName
Definition: cgnsWriter.H:176
double timeLabel
Definition: cgnsWriter.H:180

◆ setBcflag()

void cgnsWriter::setBcflag ( int  bcflag)

Definition at line 472 of file cgnsWriter.C.

References bcflag.

473 {
474  bcflag = _bcflag;
475 }

◆ setBurnDimMap()

void cgnsWriter::setBurnDimMap ( )

Definition at line 244 of file cgnsWriter.C.

References burnDimMap.

245 {
246  // burn, iburn_all
247  std::vector<float> dim1 = {0, 1, 0, 0, 0};
248  std::vector<float> dim2 = {0, 0, 0, 0, 0};
249  burnDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateX", dim1));
250  burnDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateY", dim1));
251  burnDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateZ", dim1));
252  burnDimMap.insert(std::pair<std::string,std::vector<float>>("pf", dim2));
253  burnDimMap.insert(std::pair<std::string,std::vector<float>>("centersX", dim2));
254  burnDimMap.insert(std::pair<std::string,std::vector<float>>("centersY", dim2));
255  burnDimMap.insert(std::pair<std::string,std::vector<float>>("centersZ", dim2));
256  burnDimMap.insert(std::pair<std::string,std::vector<float>>("rb", dim2));
257  burnDimMap.insert(std::pair<std::string,std::vector<float>>("Tflm", dim2));
258  burnDimMap.insert(std::pair<std::string,std::vector<float>>("rb_old", dim2));
259  burnDimMap.insert(std::pair<std::string,std::vector<float>>("pf_old", dim2));
260  burnDimMap.insert(std::pair<std::string,std::vector<float>>("pf_alp", dim2));
261  burnDimMap.insert(std::pair<std::string,std::vector<float>>("Tflm_old", dim2));
262 }
std::map< std::string, std::vector< float > > burnDimMap
Definition: cgnsWriter.H:215

◆ setBurnMagMap()

void cgnsWriter::setBurnMagMap ( )

Definition at line 265 of file cgnsWriter.C.

References burnMagMap.

266 {
267  // burn, iburn_all
268  burnMagMap.insert(std::pair<std::string,int>("CoordinateX", 0));
269  burnMagMap.insert(std::pair<std::string,int>("CoordinateY", 0));
270  burnMagMap.insert(std::pair<std::string,int>("CoordinateZ", 0));
271  burnMagMap.insert(std::pair<std::string,int>("bflag", 0));
272  burnMagMap.insert(std::pair<std::string,int>("pf", 0));
273  burnMagMap.insert(std::pair<std::string,int>("centersX", 1));
274  burnMagMap.insert(std::pair<std::string,int>("centersY", 0));
275  burnMagMap.insert(std::pair<std::string,int>("centersZ", 0));
276  burnMagMap.insert(std::pair<std::string,int>("rb", 0));
277  burnMagMap.insert(std::pair<std::string,int>("Tflm", 0));
278  burnMagMap.insert(std::pair<std::string,int>("rb_old", 0));
279  burnMagMap.insert(std::pair<std::string,int>("pf_old", 0));
280  burnMagMap.insert(std::pair<std::string,int>("Tflm_old", 0));
281 }
std::map< std::string, int > burnMagMap
Definition: cgnsWriter.H:216

◆ setBurnUnitsMap()

void cgnsWriter::setBurnUnitsMap ( )

Definition at line 225 of file cgnsWriter.C.

References burnUnitsMap.

226 {
227  // burn, iburn_all
228  burnUnitsMap.insert(std::pair<std::string,std::string>("CoordinateX", "m"));
229  burnUnitsMap.insert(std::pair<std::string,std::string>("CoordinateY", "m"));
230  burnUnitsMap.insert(std::pair<std::string,std::string>("CoordinateZ", "m"));
231  burnUnitsMap.insert(std::pair<std::string,std::string>("pf", "Pa"));
232  burnUnitsMap.insert(std::pair<std::string,std::string>("centersX", "m"));
233  burnUnitsMap.insert(std::pair<std::string,std::string>("centersY", "m"));
234  burnUnitsMap.insert(std::pair<std::string,std::string>("centersZ", "m"));
235  burnUnitsMap.insert(std::pair<std::string,std::string>("rb", "m/s"));
236  burnUnitsMap.insert(std::pair<std::string,std::string>("Tflm", "K"));
237  burnUnitsMap.insert(std::pair<std::string,std::string>("rb_old", "m/s"));
238  burnUnitsMap.insert(std::pair<std::string,std::string>("pf_old", "Pa"));
239  burnUnitsMap.insert(std::pair<std::string,std::string>("pf_alp", "Pa"));
240  burnUnitsMap.insert(std::pair<std::string,std::string>("Tflm_old", "K"));
241 }
std::map< std::string, std::string > burnUnitsMap
Definition: cgnsWriter.H:214

◆ setCnstrtype()

void cgnsWriter::setCnstrtype ( int  cnstr_type)

Definition at line 478 of file cgnsWriter.C.

References cnstr_type.

479 {
480  cnstr_type = _cnstr_type;
481 }
int cnstr_type
Definition: cgnsWriter.H:166

◆ setCoordRind()

void cgnsWriter::setCoordRind ( int  rind)

Definition at line 428 of file cgnsWriter.C.

References coordRind.

429 {
430  coordRind = rind;
431 }
int coordRind
Definition: cgnsWriter.H:156

◆ setFluidDimMap()

void cgnsWriter::setFluidDimMap ( )

Definition at line 80 of file cgnsWriter.C.

References fluidDimMap.

81 {
82  // fluid
83  std::vector<float> dim1 = {0, 1, 0, 0, 0};
84  std::vector<float> dim2 = {0, 0, 0, 0, 0};
85  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateX", dim1));
86  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateY", dim1));
87  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateZ", dim1));
88  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("gs", dim2));
89  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhof", dim2));
90  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhovfX", dim2));
91  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhovfY", dim2));
92  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhovfZ", dim2));
93  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhoEf", dim2));
94  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("pf", dim2));
95  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("Tf", dim2));
96  fluidDimMap.insert(std::pair<std::string,std::vector<float>>("af", dim2));
97 }
std::map< std::string, std::vector< float > > fluidDimMap
Definition: cgnsWriter.H:209

◆ setFluidMagMap()

void cgnsWriter::setFluidMagMap ( )

Definition at line 103 of file cgnsWriter.C.

References fluidMagMap.

104 {
105  // fluid
106  fluidMagMap.insert(std::pair<std::string,int>("CoordinateX", 0));
107  fluidMagMap.insert(std::pair<std::string,int>("CoordinateY", 0));
108  fluidMagMap.insert(std::pair<std::string,int>("CoordinateZ", 0));
109  fluidMagMap.insert(std::pair<std::string,int>("dispX", 1));
110  fluidMagMap.insert(std::pair<std::string,int>("dispY", 0));
111  fluidMagMap.insert(std::pair<std::string,int>("dispZ", 0));
112  fluidMagMap.insert(std::pair<std::string,int>("gs", 0));
113  fluidMagMap.insert(std::pair<std::string,int>("rhof", 0));
114  fluidMagMap.insert(std::pair<std::string,int>("rhovfX", 1));
115  fluidMagMap.insert(std::pair<std::string,int>("rhovfY", 0));
116  fluidMagMap.insert(std::pair<std::string,int>("rhovfZ", 0));
117  fluidMagMap.insert(std::pair<std::string,int>("rhoEf", 0));
118  fluidMagMap.insert(std::pair<std::string,int>("pf", 0));
119  fluidMagMap.insert(std::pair<std::string,int>("Tf", 0));
120  fluidMagMap.insert(std::pair<std::string,int>("af", 0));
121 }
std::map< std::string, int > fluidMagMap
Definition: cgnsWriter.H:210

◆ setFluidUnitsMap()

void cgnsWriter::setFluidUnitsMap ( )

Definition at line 59 of file cgnsWriter.C.

References fluidUnitsMap.

60 {
61  // fluid
62  fluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateX", "m"));
63  fluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateY", "m"));
64  fluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateZ", "m"));
65  fluidUnitsMap.insert(std::pair<std::string,std::string>("dispX", "none"));
66  fluidUnitsMap.insert(std::pair<std::string,std::string>("dispY", "none"));
67  fluidUnitsMap.insert(std::pair<std::string,std::string>("dispZ", "none"));
68  fluidUnitsMap.insert(std::pair<std::string,std::string>("gs", "m/s"));
69  fluidUnitsMap.insert(std::pair<std::string,std::string>("rhof", "kg/(m^3)"));
70  fluidUnitsMap.insert(std::pair<std::string,std::string>("rhovfX", "kg/(m^2 s)"));
71  fluidUnitsMap.insert(std::pair<std::string,std::string>("rhovfY", "kg/(m^2 s)"));
72  fluidUnitsMap.insert(std::pair<std::string,std::string>("rhovfZ", "kg/(m^2 s)"));
73  fluidUnitsMap.insert(std::pair<std::string,std::string>("rhoEf", "(J/(m^3))"));
74  fluidUnitsMap.insert(std::pair<std::string,std::string>("pf", "N/(m^2)"));
75  fluidUnitsMap.insert(std::pair<std::string,std::string>("Tf", "K"));
76  fluidUnitsMap.insert(std::pair<std::string,std::string>("af", "m/s"));
77 }
std::map< std::string, std::string > fluidUnitsMap
Definition: cgnsWriter.H:208

◆ setGlobalNCell()

void cgnsWriter::setGlobalNCell ( int  gnCl)

Definition at line 409 of file cgnsWriter.C.

References gnCell, and gnCells.

410 {
411  gnCell= gnCl;
412  gnCells.push_back(gnCl);
413 }
vect1d< int > gnCells
Definition: cgnsWriter.H:192

◆ setGlobalSection() [1/2]

void cgnsWriter::setGlobalSection ( std::string  sName,
CGNS_ENUMT(ElementType_t)  st,
vect1d< int >  elmConn 
)

Definition at line 343 of file cgnsWriter.C.

References gelmConns, gnSection, gsectionName, gsectionNames, gsectionType, and gsectionTypes.

344 {
345  gnSection++;
346  gsectionNames.push_back(gsName);
347  gsectionName = gsName;
348  gsectionTypes.push_back(gst);
349  gsectionType = gst;
350  gelmConns.push_back(gelmConn);
351 }
vect1d< CGNS_ENUMT(ElementType_t)> gsectionTypes
Definition: cgnsWriter.H:188
vect1d< std::string > gsectionNames
Definition: cgnsWriter.H:186
std::string gsectionName
Definition: cgnsWriter.H:142
int gnSection
Definition: cgnsWriter.H:154
vect2d< int > gelmConns
Definition: cgnsWriter.H:190

◆ setGlobalSection() [2/2]

void cgnsWriter::setGlobalSection ( std::string  gsName,
CGNS_ENUMT(ElementType_t)  gst 
)

Definition at line 356 of file cgnsWriter.C.

References gelmConns, gnSection, gsectionName, gsectionNames, gsectionType, and gsectionTypes.

357 {
358  gnSection++;
359  gsectionNames.push_back(gsName);
360  gsectionName = gsName;
361  gsectionTypes.push_back(gst);
362  gsectionType = gst;
363  std::vector<int> tmp = {0};
364  gelmConns.push_back(tmp);
365 }
vect1d< CGNS_ENUMT(ElementType_t)> gsectionTypes
Definition: cgnsWriter.H:188
vect1d< std::string > gsectionNames
Definition: cgnsWriter.H:186
std::string gsectionName
Definition: cgnsWriter.H:142
int gnSection
Definition: cgnsWriter.H:154
vect2d< int > gelmConns
Definition: cgnsWriter.H:190

◆ setGridXYZ()

void cgnsWriter::setGridXYZ ( vect1d< double >  x,
vect1d< double >  y,
vect1d< double >  z 
)

Definition at line 416 of file cgnsWriter.C.

References xCrd, yCrd, and zCrd.

417 {
418  xCrd.clear();
419  xCrd.insert(xCrd.begin(), x.begin(), x.end());
420  yCrd.clear();
421  yCrd.insert(yCrd.begin(), y.begin(), y.end());
422  zCrd.clear();
423  zCrd.insert(zCrd.begin(), z.begin(), z.end());
424 }
vect1d< double > zCrd
Definition: cgnsWriter.H:182
vect1d< double > yCrd
Definition: cgnsWriter.H:182
vect1d< double > xCrd
Definition: cgnsWriter.H:182

◆ setiFluidDimMap()

void cgnsWriter::setiFluidDimMap ( )

Definition at line 158 of file cgnsWriter.C.

References ifluidDimMap.

159 {
160  // ifluid_ni/ifluid_b/ifluid_nb
161  std::vector<float> dim1 = {0, 1, 0, 0, 0};
162  std::vector<float> dim2 = {0, 0, 0, 0, 0};
163  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateX", dim1));
164  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateY", dim1));
165  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("CoordinateZ", dim1));
166  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("du_alpX", dim2));
167  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("du_alpY", dim2));
168  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("du_alpZ", dim2));
169  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("vmX", dim2));
170  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("vmY", dim2));
171  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("vmZ", dim2));
172  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("mdot_alp", dim2));
173  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhofvf_alpX", dim2));
174  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhofvf_alpY", dim2));
175  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhofvf_alpZ", dim2));
176  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("Tflm_alp", dim2));
177  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("Tb_alp", dim2));
178  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("pf", dim2));
179  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("tfX", dim2));
180  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("tfY", dim2));
181  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("tfZ", dim2));
182  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("qc", dim2));
183  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("qr", dim2));
184  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("rhof_alp", dim2));
185  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("zoomFact", dim2));
186  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("gs", dim2));
187  ifluidDimMap.insert(std::pair<std::string,std::vector<float>>("mdot_old", dim2));
188 }
std::map< std::string, std::vector< float > > ifluidDimMap
Definition: cgnsWriter.H:212

◆ setiFluidMagMap()

void cgnsWriter::setiFluidMagMap ( )

Definition at line 191 of file cgnsWriter.C.

References ifluidMagMap.

192 {
193  // ifluid_ni/ifluid_b/ifluid_nb
194  ifluidMagMap.insert(std::pair<std::string,int>("CoordinateX", 0));
195  ifluidMagMap.insert(std::pair<std::string,int>("CoordinateY", 0));
196  ifluidMagMap.insert(std::pair<std::string,int>("CoordinateZ", 0));
197  ifluidMagMap.insert(std::pair<std::string,int>("du_alpX", 1));
198  ifluidMagMap.insert(std::pair<std::string,int>("du_alpY", 0));
199  ifluidMagMap.insert(std::pair<std::string,int>("du_alpZ", 0));
200  ifluidMagMap.insert(std::pair<std::string,int>("vmX", 1));
201  ifluidMagMap.insert(std::pair<std::string,int>("vmY", 0));
202  ifluidMagMap.insert(std::pair<std::string,int>("vmZ", 0));
203  ifluidMagMap.insert(std::pair<std::string,int>("mdot_alp", 0));
204  ifluidMagMap.insert(std::pair<std::string,int>("rhofvf_alpX", 1));
205  ifluidMagMap.insert(std::pair<std::string,int>("rhofvf_alpY", 0));
206  ifluidMagMap.insert(std::pair<std::string,int>("rhofvf_alpZ", 0));
207  ifluidMagMap.insert(std::pair<std::string,int>("Tflm_alp", 0));
208  ifluidMagMap.insert(std::pair<std::string,int>("Tb_alp", 0));
209  ifluidMagMap.insert(std::pair<std::string,int>("nf_alpX", 1));
210  ifluidMagMap.insert(std::pair<std::string,int>("nf_alpY", 0));
211  ifluidMagMap.insert(std::pair<std::string,int>("nf_alpZ", 0));
212  ifluidMagMap.insert(std::pair<std::string,int>("pf", 0));
213  ifluidMagMap.insert(std::pair<std::string,int>("tfX", 1));
214  ifluidMagMap.insert(std::pair<std::string,int>("tfY", 0));
215  ifluidMagMap.insert(std::pair<std::string,int>("tfZ", 0));
216  ifluidMagMap.insert(std::pair<std::string,int>("qc", 0));
217  ifluidMagMap.insert(std::pair<std::string,int>("qr", 0));
218  ifluidMagMap.insert(std::pair<std::string,int>("rhof_alp", 0));
219  ifluidMagMap.insert(std::pair<std::string,int>("zoomFact", 0));
220  ifluidMagMap.insert(std::pair<std::string,int>("bflag", 0));
221  ifluidMagMap.insert(std::pair<std::string,int>("mdot_old", 0));
222 }
std::map< std::string, int > ifluidMagMap
Definition: cgnsWriter.H:213

◆ setiFluidUnitsMap()

void cgnsWriter::setiFluidUnitsMap ( )

Definition at line 124 of file cgnsWriter.C.

References ifluidUnitsMap.

125 {
126  // ifluid_ni/ifluid_b/ifluid_nb
127  ifluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateX", "m"));
128  ifluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateY", "m"));
129  ifluidUnitsMap.insert(std::pair<std::string,std::string>("CoordinateZ", "m"));
130  ifluidUnitsMap.insert(std::pair<std::string,std::string>("du_alpX", "m"));
131  ifluidUnitsMap.insert(std::pair<std::string,std::string>("du_alpY", "m"));
132  ifluidUnitsMap.insert(std::pair<std::string,std::string>("du_alpZ", "m"));
133  ifluidUnitsMap.insert(std::pair<std::string,std::string>("vmX", "m/s"));
134  ifluidUnitsMap.insert(std::pair<std::string,std::string>("vmY", "m/s"));
135  ifluidUnitsMap.insert(std::pair<std::string,std::string>("vmZ", "m/s"));
136  ifluidUnitsMap.insert(std::pair<std::string,std::string>("mdot_alp", "kg/(m^2s)"));
137  ifluidUnitsMap.insert(std::pair<std::string,std::string>("rhofvf_alpX", "kg/(m^2s)"));
138  ifluidUnitsMap.insert(std::pair<std::string,std::string>("rhofvf_alpY", "kg/(m^2s)"));
139  ifluidUnitsMap.insert(std::pair<std::string,std::string>("rhofvf_alpZ", "kg/(m^2s)"));
140  ifluidUnitsMap.insert(std::pair<std::string,std::string>("Tflm_alp", "K"));
141  ifluidUnitsMap.insert(std::pair<std::string,std::string>("Tb_alp", "K"));
142  ifluidUnitsMap.insert(std::pair<std::string,std::string>("nf_alpX", "none"));
143  ifluidUnitsMap.insert(std::pair<std::string,std::string>("nf_alpY", "none"));
144  ifluidUnitsMap.insert(std::pair<std::string,std::string>("nf_alpZ", "none"));
145  ifluidUnitsMap.insert(std::pair<std::string,std::string>("pf", "Pa"));
146  ifluidUnitsMap.insert(std::pair<std::string,std::string>("tfX", "Pa"));
147  ifluidUnitsMap.insert(std::pair<std::string,std::string>("tfY", "Pa"));
148  ifluidUnitsMap.insert(std::pair<std::string,std::string>("tfZ", "Pa"));
149  ifluidUnitsMap.insert(std::pair<std::string,std::string>("qc", "kgK/(m^2s)"));
150  ifluidUnitsMap.insert(std::pair<std::string,std::string>("qr", "kgK/(m^2s)"));
151  ifluidUnitsMap.insert(std::pair<std::string,std::string>("rhof_alp", "kg/m^3"));
152  ifluidUnitsMap.insert(std::pair<std::string,std::string>("zoomFact", "none"));
153  ifluidUnitsMap.insert(std::pair<std::string,std::string>("gs", "m/s"));
154  ifluidUnitsMap.insert(std::pair<std::string,std::string>("mdot_old", "kg/(m^2 s)"));
155 }
std::map< std::string, std::string > ifluidUnitsMap
Definition: cgnsWriter.H:211

◆ setIntData()

void cgnsWriter::setIntData ( std::string  intname,
int  intval 
)

Definition at line 301 of file cgnsWriter.C.

References intName, and intVal.

302 {
303  intName = intname;
304  intVal = intval;
305 }
std::string intName
Definition: cgnsWriter.H:177

◆ setNCell()

void cgnsWriter::setNCell ( int  nCl)

Definition at line 402 of file cgnsWriter.C.

References nCell, and nCells.

403 {
404  nCell= nCl;
405  nCells.push_back(nCl);
406 }
vect1d< int > nCells
Definition: cgnsWriter.H:191

◆ setNVrtx()

void cgnsWriter::setNVrtx ( int  nVt)

Definition at line 396 of file cgnsWriter.C.

References nVrtx.

397 {
398  nVrtx= nVt;
399 }

◆ setPatchNo()

void cgnsWriter::setPatchNo ( int  patchNo)

Definition at line 459 of file cgnsWriter.C.

References patchNo.

460 {
461  patchNo = _patchNo;
462 }

◆ setPconnGhostDescriptor()

void cgnsWriter::setPconnGhostDescriptor ( int  ghostDescriptor)

Definition at line 440 of file cgnsWriter.C.

References pConnGhostDescriptor.

441 {
442  pConnGhostDescriptor = ghostDescriptor;
443 }
int pConnGhostDescriptor
Definition: cgnsWriter.H:158

◆ setPconnLimits()

void cgnsWriter::setPconnLimits ( int  pconnProcMin,
int  pconnProcMax 
)

Definition at line 452 of file cgnsWriter.C.

References pConnMax, and pConnMin.

453 {
454  pConnMax = _pconnProcMax;
455  pConnMin = _pconnProcMin;
456 }
int pConnMax
Definition: cgnsWriter.H:162
int pConnMin
Definition: cgnsWriter.H:161

◆ setPconnVec()

void cgnsWriter::setPconnVec ( const vect1d< int > &  pConnVec)

Definition at line 446 of file cgnsWriter.C.

References pConnVec.

447 {
448  pConnVec = _pConnVec;
449 }

◆ setSection()

void cgnsWriter::setSection ( std::string  sName,
CGNS_ENUMT(ElementType_t)  st,
vect1d< cgsize_t >  elmConn 
)

Definition at line 332 of file cgnsWriter.C.

References elmConns, nSection, sectionName, sectionNames, and sectionTypes.

333 {
334  nSection++;
335  sectionNames.push_back(sName);
336  sectionName = sName;
337  sectionTypes.push_back(st);
338  sectionType = st;
339  elmConns.push_back(elmConn);
340 }
vect1d< CGNS_ENUMT(ElementType_t)> sectionTypes
Definition: cgnsWriter.H:187
std::string sectionName
Definition: cgnsWriter.H:142
int nSection
Definition: cgnsWriter.H:153
vect2d< cgsize_t > elmConns
Definition: cgnsWriter.H:189
vect1d< std::string > sectionNames
Definition: cgnsWriter.H:185

◆ setSolutionNode()

void cgnsWriter::setSolutionNode ( std::string  ndeName,
CGNS_ENUMT(GridLocation_t)  slnLoc 
)

Definition at line 484 of file cgnsWriter.C.

References nCellSln, nVrtxSln, slnNameNFld, and solutionNameLocMap.

485 {
486  if (slnLoc == CGNS_ENUMV(Vertex))
487  nVrtxSln++;
488  else if (slnLoc == CGNS_ENUMV(CellCenter))
489  nCellSln++;
490  else
491  std::cerr << "Can not write to requested solution location.\n";
492  solutionNameLocMap[ndeName] = slnLoc;
493  slnNameNFld[ndeName] = 0;
494 }
int nVrtxSln
Definition: cgnsWriter.H:195
int nCellSln
Definition: cgnsWriter.H:196
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
Definition: cgnsWriter.H:201
std::map< std::string, int > slnNameNFld
Definition: cgnsWriter.H:199

◆ setTimestamp()

void cgnsWriter::setTimestamp ( std::string  trimmed_base_t)

Definition at line 390 of file cgnsWriter.C.

References trimmed_base_t.

391 {
392  trimmed_base_t = _trimmed_base_t;
393 }
std::string trimmed_base_t
Definition: cgnsWriter.H:147

◆ setTypeFlag()

void cgnsWriter::setTypeFlag ( int  typeFlag)

Definition at line 287 of file cgnsWriter.C.

References typeFlag.

288 {
289  typeFlag = _typeFlag;
290 }
int typeFlag
Definition: cgnsWriter.H:159

◆ setUnits()

void cgnsWriter::setUnits ( CGNS_ENUMT(MassUnits_t)  mu,
CGNS_ENUMT(LengthUnits_t)  lu,
CGNS_ENUMT(TimeUnits_t)  tu,
CGNS_ENUMT(TemperatureUnits_t)  tpu,
CGNS_ENUMT(AngleUnits_t)  au 
)

Definition at line 43 of file cgnsWriter.C.

45 {
46  massU = mu;
47  lengthU = lu;
48  timeU = tu;
49  tempU = tpu;
50  angleU = au;
51 }

◆ setVirtElmRind()

void cgnsWriter::setVirtElmRind ( int  rind)

Definition at line 434 of file cgnsWriter.C.

References virtElmRind.

435 {
436  virtElmRind = rind;
437 }
int virtElmRind
Definition: cgnsWriter.H:157

◆ setVolCellFacesNumber()

void cgnsWriter::setVolCellFacesNumber ( int  nVolCellFaces)

Definition at line 466 of file cgnsWriter.C.

References nVolCellFaces.

467 {
468  nVolCellFaces = _nVolCellFaces;
469 }
int nVolCellFaces
Definition: cgnsWriter.H:168

◆ setZone()

void cgnsWriter::setZone ( std::string  zName,
CGNS_ENUMT(ZoneType_t)  zt 
)

Definition at line 316 of file cgnsWriter.C.

References nZone, zoneName, zoneNames, and zoneTypes.

317 {
318  nZone++;
319  zoneNames.push_back(zName);
320  zoneName = zName;
321  zoneTypes.push_back(zt);
322  zoneType = zt;
323 }
vect1d< std::string > zoneNames
Definition: cgnsWriter.H:183
std::string zoneName
Definition: cgnsWriter.H:142
vect1d< CGNS_ENUMT(ZoneType_t)> zoneTypes
Definition: cgnsWriter.H:184

◆ setZoneItrData()

void cgnsWriter::setZoneItrData ( std::string  zitrname,
std::string  grdptr,
std::string  slnptr 
)

Definition at line 308 of file cgnsWriter.C.

References flowSlnPntr, gridCrdPntr, and zoneItrName.

309 {
310  zoneItrName = zitrname;
311  gridCrdPntr = grdptr;
312  flowSlnPntr = slnptr;
313 }
std::string gridCrdPntr
Definition: cgnsWriter.H:178
std::string flowSlnPntr
Definition: cgnsWriter.H:178
std::string zoneItrName
Definition: cgnsWriter.H:176

◆ writeGridToFile()

void cgnsWriter::writeGridToFile ( )

Definition at line 773 of file cgnsWriter.C.

References baseItrName, baseName, cellDim, indexBase, indexFile, nTStep, physDim, and timeLabel.

774 {
775  // dummy variables
776  std::ostringstream os;
777  // double min, max;
778  std::string str;
779 
780  // writing base data
781  char basename[33];
782  strcpy(basename, baseName.c_str());
783  if (cg_base_write(indexFile, basename, cellDim, physDim, &indexBase)) cg_error_exit();
784  if (cg_goto(indexFile, indexBase,"end")) cg_error_exit();
785  if (cg_units_write(massU, lengthU, timeU, tempU, angleU)) cg_error_exit();
786  if (cg_biter_write(indexFile, indexBase, baseItrName.c_str(), nTStep)) cg_error_exit();
787  if (cg_goto(indexFile, indexBase, baseItrName.c_str(), 0, "end")) cg_error_exit();
788  cgsize_t tmpDim = 1;
789  if (cg_array_write("TimeValues", CGNS_ENUMV(RealDouble), 1, (const cgsize_t*)
790  &tmpDim, &timeLabel)) cg_error_exit();
791 }
std::string baseItrName
Definition: cgnsWriter.H:176
double timeLabel
Definition: cgnsWriter.H:180
int indexBase
Definition: cgnsWriter.H:143
std::string baseName
Definition: cgnsWriter.H:142
int indexFile
Definition: cgnsWriter.H:143

◆ writeSolutionField()

void cgnsWriter::writeSolutionField ( std::string  fname,
std::string  ndeName,
CGNS_ENUMT(DataType_t)  dt,
void *  data 
)

Definition at line 602 of file cgnsWriter.C.

References burnDimMap, burnUnitsMap, data, fluidDimMap, fluidUnitsMap, ifluidDimMap, ifluidUnitsMap, indexBase, indexFile, indexZone, nCellFld, nSlnFld, nVrtx, nVrtxFld, solutionMap, solutionNameLocMap, solutionNameSolIdxMap, and typeFlag.

603 {
604  int slnIdx=-1;
605  auto is = solutionNameLocMap.begin();
606  while (is!=solutionNameLocMap.end())
607  {
608  slnIdx++;
609  if (!strcmp((is->first).c_str(), ndeName.c_str()))
610  {
611  break;
612  }
613  is++;
614  }
615 
616  // sanity check
617  if (is==solutionNameLocMap.end()){
618  std::cerr << ndeName
619  << " is not an existing solution node.\n";
620  return;
621  }
622 
623  // check vertex or cell based
624  if (is->second == CGNS_ENUMV(Vertex))
625  nVrtxFld++;
626  else
627  nCellFld++;
628 
629  // write solution to file
630  int fldIdx;
631  int currSlnIdx = solutionNameSolIdxMap[ndeName];
632  if (fname == "bflag")
633  {
634  if (cg_field_write(indexFile, indexBase, indexZone, currSlnIdx,
635  dt, fname.c_str(), data, &fldIdx)) cg_error_exit();
636  }
637  else
638  {
639  if (cg_field_write(indexFile, indexBase, indexZone, currSlnIdx,
640  dt, fname.c_str(), data, &fldIdx)) cg_error_exit();
641  }
642 
643  keyValueList fldIdxName;
644  fldIdxName[fldIdx] = fname;
645  std::pair<int, keyValueList> slnPair;
646  slnPair.first = slnIdx;
647  slnPair.second = fldIdxName;
648  solutionMap[++nSlnFld] = slnPair;
649 
650  // finding range of data
651  double* tmpData;
652  int* tmpIntData;
653  double min, max;
654  int intMin, intMax;
655  std::ostringstream os;
656  if (fname == "bflag")
657  {
658  tmpIntData = (int*) data;
659  intMin = tmpIntData[0];
660  intMax = tmpIntData[0];
661  for (int it=0; it<nVrtx; it++) {
662  if (intMin > tmpIntData[it])
663  {
664  intMin = (int) tmpIntData[it];
665  }
666  if (intMax < tmpIntData[it])
667  {
668  intMax = (int) tmpIntData[it];
669  }
670  }
671  os << intMin << ", " << intMax;
672  }
673  else
674  {
675  tmpData = (double*) data;
676  min = tmpData[0];
677  max = tmpData[0];
678  for (int it=0; it<nVrtx; it++)
679  {
680  min = std::min(tmpData[it], min);
681  max = std::max(tmpData[it], max);
682  }
683  os << min << ", " << max;
684  }
685  /*
686  int nItr = 0;
687  if (is->second == CGNS_ENUMV(Vertex))
688  {
689  nItr = nVrtx;
690  } else {
691  nItr = nCell;
692  }
693  */
694 
695  // writing range descriptor
696  std::string range = os.str();
697  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone,
698  "FlowSolution_t", currSlnIdx, "DataArray_t", fldIdx, "end")) cg_error_exit();
699  if (cg_descriptor_write("Range", range.c_str())) cg_error_exit();
700 
701  float* exponents;
702  std::string units;
703 
704  // write DimensionalExponents and units for cell data
705  if (is->second == CGNS_ENUMV(CellCenter))
706  {
707  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, "FlowSolution_t", currSlnIdx,
708  "DataArray_t", fldIdx, "end")) cg_error_exit();
709 
710  // surface (Rocflu fluid)
711  if (typeFlag == 0)
712  {
713  if (fluidUnitsMap.find(fname) != fluidUnitsMap.end())
714  {
715  units = fluidUnitsMap[fname];
716  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
717  }
718  if (fluidDimMap.find(fname) != fluidDimMap.end())
719  {
720  exponents = &fluidDimMap[fname][0];
721  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
722  }
723  }
724  // volume (Rocflu ifluid)
725  else if (typeFlag == 1)
726  {
727  if (ifluidUnitsMap.find(fname) != ifluidUnitsMap.end())
728  {
729  units = ifluidUnitsMap[fname];
730  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
731  }
732  if (ifluidDimMap.find(fname) != ifluidDimMap.end())
733  {
734  exponents = &ifluidDimMap[fname][0];
735  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
736  }
737  }
738  // burn (Rocburn iburn_all, burn)
739  else if (typeFlag == 2)
740  {
741  if (burnUnitsMap.find(fname) != burnUnitsMap.end())
742  {
743  units = burnUnitsMap[fname];
744  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
745  }
746  if (burnDimMap.find(fname) != burnDimMap.end())
747  {
748  exponents = &burnDimMap[fname][0];
749  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
750  }
751  }
752  }
753 
754  // For vertex data only
755  else if (is->second == CGNS_ENUMV(Vertex))
756  {
757  if (typeFlag == 1)
758  {
759  if (ifluidUnitsMap.find(fname) != ifluidUnitsMap.end())
760  {
761  units = ifluidUnitsMap[fname];
762  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
763  }
764  if (ifluidDimMap.find(fname) != ifluidDimMap.end())
765  {
766  exponents = &ifluidDimMap[fname][0];
767  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
768  }
769  }
770  }
771 }
data_type data
Edge/face with sorted point ids (a, b, c, ...) is located at some index i in data[b], with data[b][i].first == [a, c] (for edges, third point id treated as -1).
int nVrtxFld
Definition: cgnsWriter.H:197
std::map< int, std::pair< int, keyValueList > > solutionMap
Definition: cgnsWriter.H:204
std::map< std::string, std::vector< float > > burnDimMap
Definition: cgnsWriter.H:215
std::map< std::string, std::string > burnUnitsMap
Definition: cgnsWriter.H:214
std::map< std::string, std::vector< float > > ifluidDimMap
Definition: cgnsWriter.H:212
std::map< std::string, std::vector< float > > fluidDimMap
Definition: cgnsWriter.H:209
std::map< std::string, std::string > fluidUnitsMap
Definition: cgnsWriter.H:208
int nCellFld
Definition: cgnsWriter.H:198
int typeFlag
Definition: cgnsWriter.H:159
std::map< std::string, int > solutionNameSolIdxMap
Definition: cgnsWriter.H:203
std::map< std::string, std::string > ifluidUnitsMap
Definition: cgnsWriter.H:211
int indexBase
Definition: cgnsWriter.H:143
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
Definition: cgnsWriter.H:201
int indexZone
Definition: cgnsWriter.H:144
std::map< int, std::string > keyValueList
Definition: cgnsAnalyzer.H:61
int indexFile
Definition: cgnsWriter.H:143

◆ writeSolutionNode()

void cgnsWriter::writeSolutionNode ( std::string  ndeName,
CGNS_ENUMT(GridLocation_t)  slnLoc,
int  emptyFlag,
int  virtFlag 
)

Definition at line 497 of file cgnsWriter.C.

References burnDimMap, burnUnitsMap, coordRind, fluidDimMap, fluidUnitsMap, ifluidDimMap, ifluidUnitsMap, indexBase, indexFile, indexZone, nCellSln, nVrtxSln, slnNameNFld, solutionIdx, solutionNameLocMap, solutionNameSolIdxMap, typeFlag, and virtElmRind.

498 {
499  // emptyFlag
500  // 0 = write
501  // 1 = don't write; node is empty
502 
503  // virtFlag
504  // 0 = only write real
505  // 1 = write real and virtual
506 
507  if (slnLoc == CGNS_ENUMV(Vertex))
508  nVrtxSln++;
509  else if (slnLoc == CGNS_ENUMV(CellCenter))
510  nCellSln++;
511  else
512  {
513  std::cerr << "Can not write to requested solution location of type " << slnLoc <<".\n";
514  throw;
515  }
516  solutionNameLocMap[ndeName] = slnLoc;
517  slnNameNFld[ndeName] = 0;
518  int slnIdx;
519  if (cg_sol_write(indexFile, indexBase, indexZone,
520  ndeName.c_str(), slnLoc, &slnIdx)) cg_error_exit();
521  float* exponents;
522  std::string units;
523 
524  // volume (Rocflu fluid)
525  if (typeFlag == 0)
526  {
527  if (fluidDimMap.find(ndeName) != fluidDimMap.end())
528  {
529  exponents = &fluidDimMap[ndeName.c_str()][0];
530  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
531  }
532  if (fluidUnitsMap.find(ndeName) != fluidUnitsMap.end())
533  {
534  units = fluidUnitsMap[ndeName.c_str()];
535  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
536  }
537  }
538 
539  // surface (Rocflu ifluid)
540  else if (typeFlag == 1)
541  {
542  if (ifluidDimMap.find(ndeName) != ifluidDimMap.end())
543  {
544  exponents = &ifluidDimMap[ndeName.c_str()][0];
545  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
546  }
547  if (ifluidUnitsMap.find(ndeName) != ifluidUnitsMap.end())
548  {
549  units = ifluidUnitsMap[ndeName.c_str()];
550  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
551  }
552  }
553 
554  // burn (Rocburn iburn_all, burn)
555  else if (typeFlag == 2)
556  {
557  if (burnDimMap.find(ndeName) != burnDimMap.end())
558  {
559  exponents = &burnDimMap[ndeName.c_str()][0];
560  std::vector<float> test;
561  test = burnDimMap[ndeName.c_str()];
562  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
563  }
564  if (burnUnitsMap.find(ndeName) != burnUnitsMap.end())
565  {
566  units = burnUnitsMap[ndeName.c_str()];
567  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
568  }
569  }
570 
571  if (!emptyFlag)
572  {
573  solutionIdx.push_back(slnIdx);
574  solutionNameSolIdxMap[ndeName] = slnIdx;
575  cg_goto(indexFile, indexBase, "Zone_t", indexZone, "FlowSolution_t", slnIdx, "end");
576  cg_gridlocation_write(slnLoc);
577 
578  // Write virtual
579  if (virtFlag)
580  {
581  int rindArr[2];
582  rindArr[0] = 0;
583  if (coordRind && slnLoc == CGNS_ENUMV(Vertex))
584  {
585  rindArr[1] = coordRind;
586  }
587  if (virtElmRind && slnLoc == CGNS_ENUMV(CellCenter))
588  {
589  rindArr[1] = virtElmRind;
590  }
591  if (virtElmRind || coordRind)
592  {
593  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,"FlowSolution_t",slnIdx,"end")) cg_error_exit();
594  if (cg_rind_write(rindArr)) cg_error_exit();
595  }
596  }
597  }
598 }
int nVrtxSln
Definition: cgnsWriter.H:195
int nCellSln
Definition: cgnsWriter.H:196
int virtElmRind
Definition: cgnsWriter.H:157
std::map< std::string, std::vector< float > > burnDimMap
Definition: cgnsWriter.H:215
std::map< std::string, std::string > burnUnitsMap
Definition: cgnsWriter.H:214
std::map< std::string, std::vector< float > > ifluidDimMap
Definition: cgnsWriter.H:212
std::map< std::string, std::vector< float > > fluidDimMap
Definition: cgnsWriter.H:209
std::map< std::string, std::string > fluidUnitsMap
Definition: cgnsWriter.H:208
int typeFlag
Definition: cgnsWriter.H:159
std::map< std::string, int > solutionNameSolIdxMap
Definition: cgnsWriter.H:203
std::map< std::string, std::string > ifluidUnitsMap
Definition: cgnsWriter.H:211
int indexBase
Definition: cgnsWriter.H:143
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
Definition: cgnsWriter.H:201
vect1d< int > solutionIdx
Definition: cgnsWriter.H:200
int indexZone
Definition: cgnsWriter.H:144
std::map< std::string, int > slnNameNFld
Definition: cgnsWriter.H:199
int coordRind
Definition: cgnsWriter.H:156
int indexFile
Definition: cgnsWriter.H:143

◆ writeVolCellFacesNumber()

void cgnsWriter::writeVolCellFacesNumber ( )

Definition at line 820 of file cgnsWriter.C.

References fluidDimMap, fluidUnitsMap, indexBase, indexFile, nVolCellFaces, and trimmed_base_t.

821 {
822  // create pane data node
823  std::string paneName("PaneData");
824  paneName += this->trimmed_base_t;
825 
826  // only for volume
827  cgsize_t tmpDim[1];
828  tmpDim[0] = nVolCellFaces;
829  //double gsArray[nVolCellFaces];
830  std::vector<double> gsArray;
831  gsArray.resize(nVolCellFaces, 0.);
832  memset(&gsArray[0], 0.0, nVolCellFaces*sizeof(double));
833  indexBase = 1;
834  if (cg_goto(indexFile, indexBase, "Zone_t", 1, paneName.c_str(),0,"end")) cg_error_exit();
835  if (cg_array_write("gs", CGNS_ENUMV(RealDouble), 1, tmpDim, &gsArray[0])) cg_error_exit();
836  if (cg_goto(indexFile, indexBase, "Zone_t", 1, paneName.c_str(),0,"gs",0,"end"))
837  cg_error_exit();
838  if (cg_descriptor_write("Range", "0, 0")) cg_error_exit();
839  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
840 
841  // dummy exponents
842  if (cg_exponents_write(CGNS_ENUMV(RealSingle), &fluidDimMap["gs"][0])) cg_error_exit();
843  if (cg_descriptor_write("Units", fluidUnitsMap["gs"].c_str())) cg_error_exit();
844 }
std::string trimmed_base_t
Definition: cgnsWriter.H:147
std::map< std::string, std::vector< float > > fluidDimMap
Definition: cgnsWriter.H:209
std::map< std::string, std::string > fluidUnitsMap
Definition: cgnsWriter.H:208
int nVolCellFaces
Definition: cgnsWriter.H:168
int indexBase
Definition: cgnsWriter.H:143
int indexFile
Definition: cgnsWriter.H:143

◆ writeWinToFile()

void cgnsWriter::writeWinToFile ( )

Definition at line 793 of file cgnsWriter.C.

References baseName, ifluidDimMap, ifluidUnitsMap, indexBase, indexFile, intName, and intVal.

794 {
795  intVal = 1;
796  char basename[33];
797  strcpy(basename, baseName.c_str());
798  cgsize_t tmpDim[1] = {1};
799 
800  // create Integral data for window
801  if (cg_goto(indexFile, indexBase, "end")) cg_error_exit();
802  if (cg_integral_write(intName.c_str())) cg_error_exit();
803  if (cg_goto(indexFile, indexBase, intName.c_str(), 0, "end")) cg_error_exit();
804  double zoomFact_arr[1] = {static_cast<double>(intVal)};
805  if (cg_array_write("zoomFact", CGNS_ENUMV(RealDouble), 1, tmpDim, zoomFact_arr)) cg_error_exit();
806  if (cg_goto(indexFile, indexBase, intName.c_str(), 0,"zoomFact",0,"end")) cg_error_exit();
807  std::ostringstream os;
808  std::string str;
809  os.str("");
810  os.clear();
811  os << std::to_string(intVal) << ", " << std::to_string(intVal);
812  str = os.str();
813  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
814  // float dimUnits[5] = {0, 0, 0, 0, 0};
815  if (cg_exponents_write(CGNS_ENUMV(RealSingle), &ifluidDimMap["zoomFact"][0])) cg_error_exit();
816  if (cg_descriptor_write("Units", ifluidUnitsMap["zoomFact"].c_str())) cg_error_exit();
817  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
818 }
std::string intName
Definition: cgnsWriter.H:177
std::map< std::string, std::vector< float > > ifluidDimMap
Definition: cgnsWriter.H:212
std::map< std::string, std::string > ifluidUnitsMap
Definition: cgnsWriter.H:211
int indexBase
Definition: cgnsWriter.H:143
std::string baseName
Definition: cgnsWriter.H:142
int indexFile
Definition: cgnsWriter.H:143

◆ writeZoneToFile()

void cgnsWriter::writeZoneToFile ( )

Definition at line 846 of file cgnsWriter.C.

References baseName, bcflag, burnDimMap, burnUnitsMap, cgCoreSize, cnstr_type, coordRind, elmConns, flowSlnPntr, fluidDimMap, fluidUnitsMap, gelmConns, gnCells, gnSection, gridCrdPntr, gsectionNames, ifluidDimMap, ifluidUnitsMap, indexBase, indexCoord, indexFile, indexSection, indexZone, nCells, nSection, nVrtx, patchNo, pConnGhostDescriptor, pConnMax, pConnMin, pConnVec, sectionNames, sectionTypes, trimmed_base_t, typeFlag, virtElmRind, xCrd, yCrd, zCrd, zoneItrName, and zoneName.

847 {
848  // dummy variables
849  std::ostringstream os;
850  double min, max;
851  std::string str;
852 
853  // define zone name
854  char zonename[33];
855  strcpy(zonename, zoneName.c_str());
856  if (zoneType == CGNS_ENUMV(Unstructured)) {
857  cgCoreSize[0]=nVrtx;
858  cgCoreSize[1]=nCells[0];
859  cgCoreSize[2]=0;
860  } else {
861  std::cerr << "Format is not supported.\n";
862  cg_error_exit();
863  }
864 
865  // create zone
866  if (cg_zone_write(indexFile, indexBase, zonename,
867  cgCoreSize, CGNS_ENUMV(Unstructured), &indexZone)) cg_error_exit();
868 
869  // write zone iterative data
870  if (cg_ziter_write(indexFile, indexBase, indexZone, zoneItrName.c_str())) cg_error_exit();
871  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone,
872  zoneItrName.c_str(), 0, "end")) cg_error_exit();
873 
874  cgsize_t tmpDim2[2];
875  tmpDim2[0] = 32;
876  tmpDim2[1] = 1;
877  if (cg_array_write("GridCoordinatesPointers", CGNS_ENUMV(Character), 2, tmpDim2,
878  gridCrdPntr.c_str())) cg_error_exit();
879  if (cg_array_write("FlowSolutionsPointers", CGNS_ENUMV(Character), 2, tmpDim2,
880  flowSlnPntr.c_str())) cg_error_exit();
881 
882  // create grid coordinates node
883  int indexGrid = 1;
884  if (cg_grid_write(indexFile, indexBase, indexZone, "GridCoordinates", &indexGrid)) cg_error_exit();
885 
886  // write rind
887  if (coordRind)
888  {
889  int rindArr[2] = {0,coordRind};
890  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,"GridCoordinates",0,"end")) cg_error_exit();
891  if (cg_rind_write(rindArr)) cg_error_exit();
892  }
893 
894  // write coordinates + range, dimensional exponent, units
895  // float dimUnits[5] = {0, 1, 0, 0, 0};
896 
897  float* exponents;
898  std::string units;
899  std::vector<float> test;
900 
901  // x-coordinates
902  min = *std::min_element(xCrd.begin(), xCrd.begin()+nVrtx);
903  max = *std::max_element(xCrd.begin(), xCrd.begin()+nVrtx);
904  os.str("");
905  os.clear();
906  os << min << ", " << max;
907  str = os.str();
908 
909  // Get units and dimension information for volume, surface and burning fields
910  if (typeFlag == 0)
911  {
912  units = fluidUnitsMap["CoordinateX"];
913  exponents = &fluidDimMap["CoordinateX"][0];
914  test = fluidDimMap["CoordinateX"];
915  }
916  else if (typeFlag == 1)
917  {
918  units = ifluidUnitsMap["CoordinateX"];
919  exponents = &ifluidDimMap["CoordinateX"][0];
920  test = ifluidDimMap["CoordinateX"];
921  }
922  else if (typeFlag == 2)
923  {
924  units = burnUnitsMap["CoordinateX"];
925  exponents = &burnDimMap["CoordinateX"][0];
926  test = burnDimMap["CoordinateX"];
927  }
928  if (cg_coord_write(indexFile,indexBase,indexZone,CGNS_ENUMV(RealDouble),"CoordinateX",
929  &xCrd[0],&indexCoord)) cg_error_exit();
930  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, "GridCoordinates", 0,
931  "CoordinateX", 0, "end")) cg_error_exit();
932  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
933  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
934  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
935 
936  // y-coordinates
937  min = *std::min_element(yCrd.begin(), yCrd.begin()+nVrtx);
938  max = *std::max_element(yCrd.begin(), yCrd.begin()+nVrtx);
939  os.str("");
940  os.clear();
941  os << min << ", " << max;
942  str = os.str();
943 
944  // Get units and dimension information for volume, surface and burning fields
945  if (typeFlag == 0)
946  {
947  units = fluidUnitsMap["CoordinateY"];
948  exponents = &fluidDimMap["CoordinateY"][0];
949  }
950  else if (typeFlag == 1)
951  {
952  units = ifluidUnitsMap["CoordinateY"];
953  exponents = &ifluidDimMap["CoordinateY"][0];
954  }
955  else if (typeFlag == 2)
956  {
957  units = burnUnitsMap["CoordinateY"];
958  exponents = &burnDimMap["CoordinateY"][0];
959  }
960  if (cg_coord_write(indexFile,indexBase,indexZone,CGNS_ENUMV(RealDouble),"CoordinateY",
961  &yCrd[0],&indexCoord)) cg_error_exit();
962  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, "GridCoordinates", 0,
963  "CoordinateY", 0, "end")) cg_error_exit();
964  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
965  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
966  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
967 
968  // z-coordinates
969  min = *std::min_element(zCrd.begin(), zCrd.begin()+nVrtx);
970  max = *std::max_element(zCrd.begin(), zCrd.begin()+nVrtx);
971  os.str("");
972  os.clear();
973  os << min << ", " << max;
974  str = os.str();
975 
976  // Get units and dimension information for volume, surface and burning fields
977  if (typeFlag == 0)
978  {
979  units = fluidUnitsMap["CoordinateZ"];
980  exponents = &fluidDimMap["CoordinateZ"][0];
981  }
982  else if (typeFlag == 1)
983  {
984  units = ifluidUnitsMap["CoordinateZ"];
985  exponents = &ifluidDimMap["CoordinateZ"][0];
986  }
987  else if (typeFlag == 2)
988  {
989  units = burnUnitsMap["CoordinateZ"];
990  exponents = &burnDimMap["CoordinateZ"][0];
991  }
992  if (cg_coord_write(indexFile,indexBase,indexZone,CGNS_ENUMV(RealDouble),"CoordinateZ",
993  &zCrd[0],&indexCoord)) cg_error_exit();
994  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, "GridCoordinates", 0,
995  "CoordinateZ", 0, "end")) cg_error_exit();
996  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
997  if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
998  if (cg_descriptor_write("Units", units.c_str())) cg_error_exit();
999 
1000  // create link to the grid coordinates
1001  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, "end")) cg_error_exit();
1002  os.str("");
1003  os.clear();
1004  os <<"/"<<baseName<<"/"<<zoneName<<"/GridCoordinates";
1005  str = os.str();
1006  if (cg_link_write(gridCrdPntr.c_str(), "", str.c_str())) cg_error_exit();
1007 
1008  // write Sections (real and virtual cells)
1009  int elm_start;
1010  int elm_end;
1011  // int nBdy;
1012  for (int iSec=0; iSec<nSection; iSec++)
1013  {
1014  elm_start = (iSec == 0 ? 1 : elm_start+nCells[iSec-1]);
1015  int elm_end = elm_start + nCells[iSec] - 1;
1016  int nBdy = 0;
1017  if (!sectionNames[iSec].compare("Empty:t3:virtual"))
1018  {
1019  cgsize_t tmp_arr[3] = {0, 0, 0};
1020  if (cg_section_write(indexFile, indexBase, indexZone, (sectionNames[iSec]).c_str(),
1021  sectionTypes[iSec], elm_start, elm_end, nBdy,
1022  &tmp_arr[0], &indexSection)) cg_error_exit();
1023  }
1024  else
1025  {
1026  if (elmConns[iSec].size() > 0)
1027  {
1028  if (cg_section_write(indexFile, indexBase, indexZone, (sectionNames[iSec]).c_str(),
1029  sectionTypes[iSec], elm_start, elm_end, nBdy,
1030  &elmConns[iSec][0], &indexSection)) cg_error_exit();
1031  }
1032  }
1033  // Write virtual elements
1034  if (virtElmRind)
1035  {
1036  int rindArr[2] = {0,virtElmRind};
1037 
1038  if (!sectionNames[iSec].compare(":T4:virtual"))
1039  {
1040  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,":T4:virtual",0,"end")) cg_error_exit();
1041  if (cg_rind_write(rindArr)) cg_error_exit();
1042  }
1043  else if (!sectionNames[iSec].compare(":T3:virtual"))
1044  {
1045  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,":T3:virtual",0,"end")) cg_error_exit();
1046  if (cg_rind_write(rindArr)) cg_error_exit();
1047  }
1048  else if (!sectionNames[iSec].compare(":t3:virtual"))
1049  {
1050  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,":t3:virtual",0,"end")) cg_error_exit();
1051  if (cg_rind_write(rindArr)) cg_error_exit();
1052  }
1053  }
1054  }
1055 
1056  // create pane data node
1057  std::string paneName("PaneData");
1058  paneName += this->trimmed_base_t;
1059  if (cg_goto(indexFile, indexBase, "Zone_t",indexZone,0,"end")) cg_error_exit();
1060  if (cg_integral_write(paneName.c_str())) cg_error_exit();
1061 
1062  // write pconn (and ridges)
1063  cgsize_t tmpDim[1];
1064  if (!pConnVec.empty())
1065  {
1066  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1067  tmpDim[0] = {(cgsize_t) pConnVec.size()};
1068  if (cg_array_write("pconn",CGNS_ENUMV(Integer),1, tmpDim, &pConnVec[0])) cg_error_exit();
1069  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0, "pconn",0,"end"))
1070  cg_error_exit();
1071  min = pConnMin;
1072  max = pConnMax;
1073 
1074  os.str("");
1075  os.clear();
1076  os << min << ", " << max;
1077  str = os.str();
1078  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
1079  os.str("");
1080  os.clear();
1081  os << pConnGhostDescriptor;
1082  str = os.str();
1083  if (cg_descriptor_write("Ghost", str.c_str())) cg_error_exit();
1084  tmpDim[0] = 1;
1085  int ridge[1] = {0};
1086  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1087  if (cg_array_write("ridges#1of2", CGNS_ENUMV(Integer),1,tmpDim,ridge)) cg_error_exit();
1088  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"ridges#1of2",0,"end"))
1089  cg_error_exit();
1090  if (cg_descriptor_write("Range", "EMPTY")) cg_error_exit();
1091  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1092  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"end")) cg_error_exit();
1093  if (cg_array_write("ridges#2of2", CGNS_ENUMV(Integer),1,tmpDim,ridge)) cg_error_exit();
1094  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"ridges#2of2",0,"end"))
1095  cg_error_exit();
1096  if (cg_descriptor_write("Range", "EMPTY")) cg_error_exit();
1097  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1098 
1099  // only for surface
1100  if (typeFlag == 1)
1101  {
1102  // bcflag
1103  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1104  int bcflag_arr[1] = {bcflag};
1105  if (cg_array_write("bcflag", CGNS_ENUMV(Integer),1,tmpDim,bcflag_arr)) cg_error_exit();
1106  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"bcflag",0,"end"))
1107  cg_error_exit();
1108  os.str("");
1109  os.clear();
1110  os << std::to_string(bcflag) << ", " << std::to_string(bcflag);
1111  str = os.str();
1112  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
1113  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1114 
1115  // patchNo
1116  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1117  int patchNo_arr[1] = {patchNo};
1118  if (cg_array_write("patchNo", CGNS_ENUMV(Integer),1,tmpDim,patchNo_arr)) cg_error_exit();
1119  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"patchNo",0,"end"))
1120  cg_error_exit();
1121  os.str("");
1122  os.clear();
1123  os << std::to_string(patchNo) << ", " << std::to_string(patchNo);
1124  str = os.str();
1125  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
1126  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1127 
1128  // cnstr_type
1129  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1130  int cnstr_type_arr[1] = {cnstr_type};
1131  if (cg_array_write("cnstr_type", CGNS_ENUMV(Integer),1,tmpDim,cnstr_type_arr)) cg_error_exit();
1132  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"cnstr_type",0,"end"))
1133  cg_error_exit();
1134  os.str("");
1135  os.clear();
1136  os << std::to_string(cnstr_type) << ", " << std::to_string(cnstr_type);
1137  str = os.str();
1138  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
1139  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1140  }
1141 
1142  }
1143  // only for burn
1144  else if (typeFlag == 2)
1145  {
1146  // write blank Pane Data
1147  tmpDim[0] = 1;
1148  // int pconn[1] = {0};
1149  int ridge[1] = {0};
1150 
1151  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1152  if (cg_array_write("pconn", CGNS_ENUMV(Integer),1,tmpDim,ridge)) cg_error_exit();
1153  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0, "pconn",0,"end"))
1154  cg_error_exit();
1155  if (cg_descriptor_write("Range", "EMPTY")) cg_error_exit();
1156  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1157 
1158  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1159  if (cg_array_write("ridges#1of2", CGNS_ENUMV(Integer),1,tmpDim,ridge)) cg_error_exit();
1160  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"ridges#1of2",0,"end"))
1161  cg_error_exit();
1162  if (cg_descriptor_write("Range", "EMPTY")) cg_error_exit();
1163  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1164 
1165  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"end")) cg_error_exit();
1166  if (cg_array_write("ridges#2of2", CGNS_ENUMV(Integer),1,tmpDim,ridge)) cg_error_exit();
1167  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(),0,"ridges#2of2",0,"end"))
1168  cg_error_exit();
1169  if (cg_descriptor_write("Range", "EMPTY")) cg_error_exit();
1170  if (cg_descriptor_write("Ghost", "0")) cg_error_exit();
1171  }
1172 
1173  // Write global sections. Global here means indexing according to partition, instead of local to
1174  // patch (as above).
1175  // Note: There are a lot of conditional statements below because the output format of the global
1176  // surface sections is inconsistent. How much of this does Rocstar actually require?
1177  for (int igSec=0; igSec<gnSection; igSec++)
1178  {
1179  elm_start = 1;
1180  if (gnCells[igSec] == 0)
1181  {
1182  elm_end = elm_start;
1183  }
1184  else
1185  {
1186  elm_end = gnCells[igSec];
1187  }
1188  // nBdy = 0;
1189 
1190  if (gsectionNames[igSec] == "t3g:virtual#1of3" ||
1191  gsectionNames[igSec] == "t3g:virtual#2of3" ||
1192  gsectionNames[igSec] == "t3g:virtual#3of3")
1193  {
1194  min = gelmConns[igSec][0];
1195  max = gelmConns[igSec][0];
1196  os.str("");
1197  os.clear();
1198  if (min == 0 && max == 0)
1199  {
1200  os << "EMPTY";
1201  }
1202  else
1203  {
1204  os << min << ", " << max;
1205  }
1206  str = os.str();
1207  }
1208  else if (gsectionNames[igSec] == "q4g:real#1of4" ||
1209  gsectionNames[igSec] == "q4g:real#2of4" ||
1210  gsectionNames[igSec] == "q4g:real#3of4" ||
1211  gsectionNames[igSec] == "q4g:real#4of4" ||
1212  gsectionNames[igSec] == "q4g:virtual#1of4" ||
1213  gsectionNames[igSec] == "q4g:virtual#2of4" ||
1214  gsectionNames[igSec] == "q4g:virtual#3of4" ||
1215  gsectionNames[igSec] == "q4g:virtual#4of4")
1216  {
1217  os.str("");
1218  os.clear();
1219  os << "EMPTY";
1220  str = os.str();
1221  }
1222  else
1223  {
1224  min = *std::min_element(gelmConns[igSec].begin(),gelmConns[igSec].end());
1225  max = *std::max_element(gelmConns[igSec].begin(),gelmConns[igSec].end());
1226  os.str("");
1227  os.clear();
1228  os << min << ", " << max;
1229  str = os.str();
1230  }
1231 
1232  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0,"end")) cg_error_exit();
1233  tmpDim[0] = {(cgsize_t) gelmConns[igSec].size()};
1234  if (cg_array_write((gsectionNames[igSec]).c_str(),CGNS_ENUMV(Integer),1, tmpDim, &gelmConns[igSec][0])) cg_error_exit();
1235  if (cg_goto(indexFile, indexBase, "Zone_t", indexZone, paneName.c_str(), 0, (gsectionNames[igSec]).c_str(),0,"end"))
1236  cg_error_exit();
1237  if (cg_descriptor_write("Range", str.c_str())) cg_error_exit();
1238 
1239  if (gsectionNames[igSec] == "t3g:virtual#1of3" ||
1240  gsectionNames[igSec] == "t3g:virtual#2of3" ||
1241  gsectionNames[igSec] == "t3g:virtual#3of3")
1242  {
1243  os.str("");
1244  os.clear();
1245  if (gnCells[igSec] == 1 && (min == 0 && max == 0))
1246  {
1247  os << 0;
1248  }
1249  else
1250  {
1251  os << elm_end;
1252  }
1253  str = os.str();
1254  }
1255  else
1256  {
1257  os.str("");
1258  os.clear();
1259  os << 0;
1260  str = os.str();
1261  }
1262  if (cg_descriptor_write("Ghost", str.c_str() )) cg_error_exit();
1263  }
1264 }
vect1d< std::string > gsectionNames
Definition: cgnsWriter.H:186
std::string gridCrdPntr
Definition: cgnsWriter.H:178
int virtElmRind
Definition: cgnsWriter.H:157
std::string flowSlnPntr
Definition: cgnsWriter.H:178
vect1d< int > gnCells
Definition: cgnsWriter.H:192
vect1d< int > pConnVec
Definition: cgnsWriter.H:160
std::string trimmed_base_t
Definition: cgnsWriter.H:147
std::map< std::string, std::vector< float > > burnDimMap
Definition: cgnsWriter.H:215
std::map< std::string, std::string > burnUnitsMap
Definition: cgnsWriter.H:214
int indexCoord
Definition: cgnsWriter.H:144
std::map< std::string, std::vector< float > > ifluidDimMap
Definition: cgnsWriter.H:212
std::map< std::string, std::vector< float > > fluidDimMap
Definition: cgnsWriter.H:209
std::map< std::string, std::string > fluidUnitsMap
Definition: cgnsWriter.H:208
int indexSection
Definition: cgnsWriter.H:145
vect1d< CGNS_ENUMT(ElementType_t)> sectionTypes
Definition: cgnsWriter.H:187
vect1d< double > zCrd
Definition: cgnsWriter.H:182
vect1d< double > yCrd
Definition: cgnsWriter.H:182
int typeFlag
Definition: cgnsWriter.H:159
vect1d< double > xCrd
Definition: cgnsWriter.H:182
std::map< std::string, std::string > ifluidUnitsMap
Definition: cgnsWriter.H:211
std::string zoneName
Definition: cgnsWriter.H:142
int indexBase
Definition: cgnsWriter.H:143
vect1d< int > nCells
Definition: cgnsWriter.H:191
int nSection
Definition: cgnsWriter.H:153
int indexZone
Definition: cgnsWriter.H:144
vect2d< cgsize_t > elmConns
Definition: cgnsWriter.H:189
int pConnMax
Definition: cgnsWriter.H:162
int pConnMin
Definition: cgnsWriter.H:161
int gnSection
Definition: cgnsWriter.H:154
vect2d< int > gelmConns
Definition: cgnsWriter.H:190
vect1d< std::string > sectionNames
Definition: cgnsWriter.H:185
std::string zoneItrName
Definition: cgnsWriter.H:176
int cnstr_type
Definition: cgnsWriter.H:166
cgsize_t cgCoreSize[9]
Definition: cgnsWriter.H:141
int pConnGhostDescriptor
Definition: cgnsWriter.H:158
std::string baseName
Definition: cgnsWriter.H:142
int coordRind
Definition: cgnsWriter.H:156
int indexFile
Definition: cgnsWriter.H:143

Member Data Documentation

◆ baseItrName

std::string cgnsWriter::baseItrName
private

Definition at line 176 of file cgnsWriter.H.

Referenced by setBaseItrData(), and writeGridToFile().

◆ baseName

std::string cgnsWriter::baseName
private

Definition at line 142 of file cgnsWriter.H.

Referenced by writeGridToFile(), writeWinToFile(), and writeZoneToFile().

◆ bcflag

int cgnsWriter::bcflag
private

Definition at line 165 of file cgnsWriter.H.

Referenced by setBcflag(), and writeZoneToFile().

◆ burnDimMap

std::map<std::string, std::vector<float> > cgnsWriter::burnDimMap
private

◆ burnMagMap

std::map<std::string, int> cgnsWriter::burnMagMap
private

Definition at line 216 of file cgnsWriter.H.

Referenced by setBurnMagMap().

◆ burnUnitsMap

std::map<std::string, std::string> cgnsWriter::burnUnitsMap
private

◆ cellDim

int cgnsWriter::cellDim
private

Definition at line 146 of file cgnsWriter.H.

Referenced by writeGridToFile().

◆ cgCoreSize

cgsize_t cgnsWriter::cgCoreSize[9]
private

Definition at line 141 of file cgnsWriter.H.

Referenced by writeZoneToFile().

◆ cnstr_type

int cgnsWriter::cnstr_type
private

Definition at line 166 of file cgnsWriter.H.

Referenced by setCnstrtype(), and writeZoneToFile().

◆ coordRind

int cgnsWriter::coordRind
private

Definition at line 156 of file cgnsWriter.H.

Referenced by setCoordRind(), writeSolutionNode(), and writeZoneToFile().

◆ elmConn

vect1d<int> cgnsWriter::elmConn
private

Definition at line 163 of file cgnsWriter.H.

◆ elmConns

vect2d<cgsize_t> cgnsWriter::elmConns
private

Definition at line 189 of file cgnsWriter.H.

Referenced by resetSections(), setSection(), and writeZoneToFile().

◆ flowSlnPntr

std::string cgnsWriter::flowSlnPntr
private

Definition at line 178 of file cgnsWriter.H.

Referenced by setZoneItrData(), and writeZoneToFile().

◆ fluidDimMap

std::map<std::string, std::vector<float> > cgnsWriter::fluidDimMap
private

◆ fluidMagMap

std::map<std::string, int> cgnsWriter::fluidMagMap
private

Definition at line 210 of file cgnsWriter.H.

Referenced by setFluidMagMap().

◆ fluidUnitsMap

std::map<std::string, std::string> cgnsWriter::fluidUnitsMap
private

◆ gelmConns

vect2d<int> cgnsWriter::gelmConns
private

Definition at line 190 of file cgnsWriter.H.

Referenced by resetGlobalSections(), setGlobalSection(), and writeZoneToFile().

◆ gnCell

int cgnsWriter::gnCell
private

Definition at line 152 of file cgnsWriter.H.

Referenced by setGlobalNCell().

◆ gnCells

vect1d<int> cgnsWriter::gnCells
private

Definition at line 192 of file cgnsWriter.H.

Referenced by resetGlobalSections(), setGlobalNCell(), and writeZoneToFile().

◆ gnSection

int cgnsWriter::gnSection
private

Definition at line 154 of file cgnsWriter.H.

Referenced by resetGlobalSections(), setGlobalSection(), and writeZoneToFile().

◆ gridCrdPntr

std::string cgnsWriter::gridCrdPntr
private

Definition at line 178 of file cgnsWriter.H.

Referenced by setZoneItrData(), and writeZoneToFile().

◆ gsectionName

std::string cgnsWriter::gsectionName
private

Definition at line 142 of file cgnsWriter.H.

Referenced by resetGlobalSections(), and setGlobalSection().

◆ gsectionNames

vect1d<std::string> cgnsWriter::gsectionNames
private

Definition at line 186 of file cgnsWriter.H.

Referenced by resetGlobalSections(), setGlobalSection(), and writeZoneToFile().

◆ gsectionType

cgnsWriter::gsectionType
private

Definition at line 139 of file cgnsWriter.H.

Referenced by setGlobalSection().

◆ gsectionTypes

vect1d<CGNS_ENUMT(ElementType_t)> cgnsWriter::gsectionTypes
private

Definition at line 188 of file cgnsWriter.H.

Referenced by resetGlobalSections(), and setGlobalSection().

◆ ifluidDimMap

std::map<std::string, std::vector<float> > cgnsWriter::ifluidDimMap
private

◆ ifluidMagMap

std::map<std::string, int> cgnsWriter::ifluidMagMap
private

Definition at line 213 of file cgnsWriter.H.

Referenced by setiFluidMagMap().

◆ ifluidUnitsMap

std::map<std::string, std::string> cgnsWriter::ifluidUnitsMap
private

◆ indexBase

int cgnsWriter::indexBase
private

◆ indexCoord

int cgnsWriter::indexCoord
private

Definition at line 144 of file cgnsWriter.H.

Referenced by writeZoneToFile().

◆ indexFile

int cgnsWriter::indexFile
private

◆ indexSection

int cgnsWriter::indexSection
private

Definition at line 145 of file cgnsWriter.H.

Referenced by writeZoneToFile().

◆ indexZone

int cgnsWriter::indexZone
private

Definition at line 144 of file cgnsWriter.H.

Referenced by writeSolutionField(), writeSolutionNode(), and writeZoneToFile().

◆ intName

std::string cgnsWriter::intName
private

Definition at line 177 of file cgnsWriter.H.

Referenced by setIntData(), and writeWinToFile().

◆ intVal

int cgnsWriter::intVal
private

Definition at line 167 of file cgnsWriter.H.

Referenced by setIntData(), and writeWinToFile().

◆ myCgFileName

std::string cgnsWriter::myCgFileName
private

Definition at line 137 of file cgnsWriter.H.

Referenced by deleteFile().

◆ nBase

int cgnsWriter::nBase
private

Definition at line 148 of file cgnsWriter.H.

◆ nCell

int cgnsWriter::nCell
private

Definition at line 151 of file cgnsWriter.H.

Referenced by setNCell().

◆ nCellFld

int cgnsWriter::nCellFld
private

Definition at line 198 of file cgnsWriter.H.

Referenced by writeSolutionField().

◆ nCells

vect1d<int> cgnsWriter::nCells
private

Definition at line 191 of file cgnsWriter.H.

Referenced by resetSections(), setNCell(), and writeZoneToFile().

◆ nCellSln

int cgnsWriter::nCellSln
private

Definition at line 196 of file cgnsWriter.H.

Referenced by setSolutionNode(), and writeSolutionNode().

◆ nSection

int cgnsWriter::nSection
private

Definition at line 153 of file cgnsWriter.H.

Referenced by resetSections(), setSection(), and writeZoneToFile().

◆ nSlnFld

int cgnsWriter::nSlnFld
private

Definition at line 194 of file cgnsWriter.H.

Referenced by writeSolutionField().

◆ nTStep

int cgnsWriter::nTStep
private

Definition at line 179 of file cgnsWriter.H.

Referenced by setBaseItrData(), and writeGridToFile().

◆ nVolCellFaces

int cgnsWriter::nVolCellFaces
private

Definition at line 168 of file cgnsWriter.H.

Referenced by setVolCellFacesNumber(), and writeVolCellFacesNumber().

◆ nVrtx

int cgnsWriter::nVrtx
private

Definition at line 150 of file cgnsWriter.H.

Referenced by setNVrtx(), writeSolutionField(), and writeZoneToFile().

◆ nVrtxElem

int cgnsWriter::nVrtxElem
private

Definition at line 155 of file cgnsWriter.H.

◆ nVrtxFld

int cgnsWriter::nVrtxFld
private

Definition at line 197 of file cgnsWriter.H.

Referenced by writeSolutionField().

◆ nVrtxSln

int cgnsWriter::nVrtxSln
private

Definition at line 195 of file cgnsWriter.H.

Referenced by setSolutionNode(), and writeSolutionNode().

◆ nZone

int cgnsWriter::nZone
private

Definition at line 149 of file cgnsWriter.H.

Referenced by setZone().

◆ patchNo

int cgnsWriter::patchNo
private

Definition at line 164 of file cgnsWriter.H.

Referenced by setPatchNo(), and writeZoneToFile().

◆ pConnGhostDescriptor

int cgnsWriter::pConnGhostDescriptor
private

Definition at line 158 of file cgnsWriter.H.

Referenced by setPconnGhostDescriptor(), and writeZoneToFile().

◆ pConnMax

int cgnsWriter::pConnMax
private

Definition at line 162 of file cgnsWriter.H.

Referenced by setPconnLimits(), and writeZoneToFile().

◆ pConnMin

int cgnsWriter::pConnMin
private

Definition at line 161 of file cgnsWriter.H.

Referenced by setPconnLimits(), and writeZoneToFile().

◆ pConnVec

vect1d<int> cgnsWriter::pConnVec
private

Definition at line 160 of file cgnsWriter.H.

Referenced by setPconnVec(), and writeZoneToFile().

◆ physDim

int cgnsWriter::physDim
private

Definition at line 146 of file cgnsWriter.H.

Referenced by writeGridToFile().

◆ rmax

int cgnsWriter::rmax[3]
private

Definition at line 140 of file cgnsWriter.H.

◆ rmin

int cgnsWriter::rmin[3]
private

Definition at line 140 of file cgnsWriter.H.

◆ sectionName

std::string cgnsWriter::sectionName
private

Definition at line 142 of file cgnsWriter.H.

Referenced by resetSections(), and setSection().

◆ sectionNames

vect1d<std::string> cgnsWriter::sectionNames
private

Definition at line 185 of file cgnsWriter.H.

Referenced by getNSections(), resetSections(), setSection(), and writeZoneToFile().

◆ sectionTypes

vect1d<CGNS_ENUMT(ElementType_t)> cgnsWriter::sectionTypes
private

Definition at line 187 of file cgnsWriter.H.

Referenced by resetSections(), setSection(), and writeZoneToFile().

◆ slnNameNFld

std::map<std::string, int> cgnsWriter::slnNameNFld
private

Definition at line 199 of file cgnsWriter.H.

Referenced by setSolutionNode(), and writeSolutionNode().

◆ solutionGridLocation

vect1d<CGNS_ENUMT(GridLocation_t)> cgnsWriter::solutionGridLocation
private

Definition at line 206 of file cgnsWriter.H.

◆ solutionIdx

vect1d<int> cgnsWriter::solutionIdx
private

Definition at line 200 of file cgnsWriter.H.

Referenced by writeSolutionNode().

◆ solutionMap

std::map<int, std::pair<int, keyValueList> > cgnsWriter::solutionMap
private

Definition at line 204 of file cgnsWriter.H.

Referenced by writeSolutionField().

◆ solutionName

vect1d<std::string> cgnsWriter::solutionName
private

Definition at line 205 of file cgnsWriter.H.

◆ solutionNameLocMap

std::map<std::string, CGNS_ENUMT(GridLocation_t)> cgnsWriter::solutionNameLocMap
private

Definition at line 201 of file cgnsWriter.H.

Referenced by setSolutionNode(), writeSolutionField(), and writeSolutionNode().

◆ solutionNameSolIdxMap

std::map<std::string, int> cgnsWriter::solutionNameSolIdxMap
private

Definition at line 203 of file cgnsWriter.H.

Referenced by writeSolutionField(), and writeSolutionNode().

◆ timeLabel

double cgnsWriter::timeLabel
private

Definition at line 180 of file cgnsWriter.H.

Referenced by setBaseItrData(), and writeGridToFile().

◆ trimmed_base_t

std::string cgnsWriter::trimmed_base_t
private

Definition at line 147 of file cgnsWriter.H.

Referenced by setTimestamp(), writeVolCellFacesNumber(), and writeZoneToFile().

◆ typeFlag

int cgnsWriter::typeFlag
private

Definition at line 159 of file cgnsWriter.H.

Referenced by setTypeFlag(), writeSolutionField(), writeSolutionNode(), and writeZoneToFile().

◆ virtElmRind

int cgnsWriter::virtElmRind
private

Definition at line 157 of file cgnsWriter.H.

Referenced by setVirtElmRind(), writeSolutionNode(), and writeZoneToFile().

◆ xCrd

vect1d<double> cgnsWriter::xCrd
private

Definition at line 182 of file cgnsWriter.H.

Referenced by setGridXYZ(), and writeZoneToFile().

◆ yCrd

vect1d<double> cgnsWriter::yCrd
private

Definition at line 182 of file cgnsWriter.H.

Referenced by setGridXYZ(), and writeZoneToFile().

◆ zCrd

vect1d<double> cgnsWriter::zCrd
private

Definition at line 182 of file cgnsWriter.H.

Referenced by setGridXYZ(), and writeZoneToFile().

◆ zoneItrName

std::string cgnsWriter::zoneItrName
private

Definition at line 176 of file cgnsWriter.H.

Referenced by setZoneItrData(), and writeZoneToFile().

◆ zoneName

std::string cgnsWriter::zoneName
private

Definition at line 142 of file cgnsWriter.H.

Referenced by setZone(), and writeZoneToFile().

◆ zoneNames

vect1d<std::string> cgnsWriter::zoneNames
private

Definition at line 183 of file cgnsWriter.H.

Referenced by setZone().

◆ zoneTypes

vect1d<CGNS_ENUMT(ZoneType_t)> cgnsWriter::zoneTypes
private

Definition at line 184 of file cgnsWriter.H.

Referenced by setZone().


The documentation for this class was generated from the following files: