------------------------------------------------------------------------------ Build the turbine towers Parse a blade file to set the number of cells and points in blades ------------------------------------------------------------------------------
| 1096 | // Parse a blade file to set the number of cells and points in blades |
| 1097 | //------------------------------------------------------------------------------ |
| 1098 | void vtkWindBladeReader::SetupBladeData() |
| 1099 | { |
| 1100 | // Load the tower information |
| 1101 | std::ostringstream fileName; |
| 1102 | fileName << this->RootDirectory << "/" << this->TurbineDirectory << "/" << this->TurbineTowerName; |
| 1103 | char inBuf[LINE_SIZE]; |
| 1104 | |
| 1105 | vtksys::ifstream inStr(fileName.str().c_str()); |
| 1106 | |
| 1107 | if (!inStr) |
| 1108 | { |
| 1109 | vtkWarningMacro("Could not open " << fileName.str() << endl); |
| 1110 | } |
| 1111 | |
| 1112 | int numColumns = 0; |
| 1113 | std::stringstream inStrSS; |
| 1114 | std::copy(std::istreambuf_iterator<char>(inStr), std::istreambuf_iterator<char>(), |
| 1115 | std::ostreambuf_iterator<char>(inStrSS)); |
| 1116 | this->ReadBladeHeader(fileName.str(), inStrSS, numColumns); |
| 1117 | |
| 1118 | inStr.close(); |
| 1119 | |
| 1120 | // Calculate the number of cells in unstructured turbine blades |
| 1121 | std::ostringstream fileName2; |
| 1122 | fileName2 << this->RootDirectory << "/" << this->TurbineDirectory << "/" << this->TurbineBladeName |
| 1123 | << this->TimeStepFirst; |
| 1124 | |
| 1125 | vtksys::ifstream inStr2(fileName2.str().c_str()); |
| 1126 | |
| 1127 | if (!inStr2) |
| 1128 | { |
| 1129 | vtkWarningMacro( |
| 1130 | "Could not open blade file: " << fileName2.str() << " to calculate blade cells."); |
| 1131 | for (int j = this->TimeStepFirst + this->TimeStepDelta; j <= this->TimeStepLast; |
| 1132 | j += this->TimeStepDelta) |
| 1133 | { |
| 1134 | std::ostringstream fileName3; |
| 1135 | fileName3 << this->RootDirectory << "/" << this->TurbineDirectory << "/" |
| 1136 | << this->TurbineBladeName << j; |
| 1137 | // std::cout << "Trying " << fileName3.str() << "..."; |
| 1138 | |
| 1139 | inStr2.open(fileName3.str().c_str()); |
| 1140 | |
| 1141 | if (inStr2.good()) |
| 1142 | { |
| 1143 | vtkWarningMacro("Success with " << fileName3.str()); |
| 1144 | break; |
| 1145 | } |
| 1146 | else |
| 1147 | { |
| 1148 | vtkWarningMacro("Failure with " << fileName3.str()); |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | this->NumberOfBladeCells = 0; |
| 1154 | // if we have at least 13 columns, then this is the new format with a header in the |
| 1155 | // turbine blade file |
no test coverage detected