//------------------------------------------------------ bool saveIsoCells(const sData* data) { const char* cellsName="cells.cfg"; int id=0; std::ofstream cellsFile(cellsName); if(!cellsFile) { return false; } cellsFile.clear(); // cell coordiantes cellsFile << "cells\t" << (data->dimY *data->dimX) << std::endl; cellsFile << "#\tcId \tcType \tx \ty \tface0 \tface1 \tface2 \tface3" << std::endl; // TODO // cell initvalues cellsFile << std::endl; cellsFile << "initvalues\t" << std::endl; cellsFile << "#\tid \tphi" << std::endl; cellsFile << "\t-1 0.0 # default value" << std::endl; // TODO // cell boundaries cellsFile << std::endl; cellsFile << "boundaries\t" << std::endl; cellsFile << "#\tcId \tbType \tvalue0" << std::endl; // TODO cellsFile.close(); return true; }
void sammMesh::readCells() { label nCells = 0; label maxLabel = -1; fileName cellsFileName(casePrefix_ + ".cel"); { IFstream cellsFile(cellsFileName); if (cellsFile.good()) { label lineLabel, cellLabel = -1, pointLabel, regionLabel, typeFlag; maxLabel = -1; while (!(cellsFile >> lineLabel).eof()) { maxLabel = max(maxLabel, lineLabel); for (int i=0; i<8; i++) { cellsFile >> pointLabel; } cellsFile >> regionLabel; cellsFile >> typeFlag; if (lineLabel != cellLabel) { cellLabel = lineLabel; nCells++; } } } else {
void starMesh::readCells() { label nCells = 0; label maxLabel = -1; fileName cellsFileName(casePrefix_ + ".cel"); { IFstream cellsFile(cellsFileName); if (cellsFile.good()) { label lineLabel, pointLabel, regionLabel, typeFlag; maxLabel = -1; while (!(cellsFile >> lineLabel).eof()) { maxLabel = max(maxLabel, lineLabel); for (int i=0; i<8; i++) { cellsFile >> pointLabel; } cellsFile >> regionLabel; cellsFile >> typeFlag; // lines with typeFlag of zero are continuation lines. if (typeFlag != 0) { nCells++; } // backward compatibility: number of trailing rubbish in // STAR is unknown. // Fixed to cope with missing \n on last line. readToNl(cellsFile); } } else {