MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadBladeHeader

Method ReadBladeHeader

IO/Geometry/vtkWindBladeReader.cxx:1695–1748  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1693
1694//------------------------------------------------------------------------------
1695void vtkWindBladeReader::ReadBladeHeader(
1696 const std::string& fileName, std::stringstream& inStr, int& numColumns)
1697{
1698 char inBuf[LINE_SIZE];
1699 // File is ASCII text so read until EOF
1700 float hubHeight, bladeLength, maxRPM, xPos, yPos, yawAngle;
1701 float angularVelocity, angleBlade1;
1702 int numberOfBlades;
1703 int towerID;
1704 // all header stuff is here to deal with wind data format changes
1705 // number of columns tells us if the turbine tower file has at least 13
1706 // columns. if so then we are dealing with a wind data format that has
1707 // an extra header in the turbine blade files
1708 numColumns = 0;
1709
1710 // test first line in turbine tower file to see if it has at least 13th column
1711 // if so then this is indication of "new" format
1712 if (inStr.getline(inBuf, LINE_SIZE))
1713 {
1714 size_t len = strlen(inBuf);
1715 // number of lines corresponds to number of spaces
1716 for (size_t j = 0; j < len; j++)
1717 {
1718 if (inBuf[j] == ' ')
1719 {
1720 numColumns++;
1721 }
1722 }
1723 }
1724 else
1725 {
1726 std::cout << fileName << " is empty!\n";
1727 }
1728 // reset seek position
1729 inStr.seekg(0, std::ios_base::beg);
1730 inStr.clear();
1731
1732 // make sure we skip lines with one character (\n)
1733 while (inStr.getline(inBuf, LINE_SIZE) && inStr.gcount() > 1)
1734 {
1735 std::istringstream line(inBuf);
1736 line >> towerID >> hubHeight >> bladeLength >> numberOfBlades >> maxRPM;
1737 line >> xPos >> yPos;
1738 line >> yawAngle >> angularVelocity >> angleBlade1;
1739
1740 this->XPosition->InsertNextValue(xPos);
1741 this->YPosition->InsertNextValue(yPos);
1742 this->HubHeight->InsertNextValue(hubHeight);
1743 this->BladeCount->InsertNextValue(numberOfBlades);
1744 this->BladeLength->InsertNextValue(bladeLength);
1745 this->AngularVeloc->InsertNextValue(angularVelocity);
1746 }
1747 this->NumberOfBladeTowers = XPosition->GetNumberOfTuples();
1748}
1749
1750//------------------------------------------------------------------------------
1751void vtkWindBladeReader::ReadBladeData(std::stringstream& inStr)

Callers 2

SetupBladeDataMethod · 0.95
SetupBladeDataMethod · 0.80

Calls 3

clearMethod · 0.45
InsertNextValueMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected