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

Method ReadRigidBodyGeometryFile

IO/EnSight/vtkEnSightReader.cxx:1753–2084  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1751
1752//------------------------------------------------------------------------------
1753int vtkEnSightReader::ReadRigidBodyGeometryFile()
1754{
1755 if (strcmp(this->GetClassName(), "vtkEnSightGoldReader") != 0 &&
1756 strcmp(this->GetClassName(), "vtkEnSightGoldBinaryReader") != 0)
1757 {
1758 vtkErrorMacro("Rigid Body files are only supported for EnSight Gold readers.");
1759 return 0;
1760 }
1761
1762 vtkDebugMacro("Reading rigid body geometry file (erb)");
1763
1764 char line[256];
1765 line[0] = '\0';
1766
1767 std::string filename(this->RigidBodyFileName);
1768 std::string sfilename;
1769 this->SanitizeFileName(filename);
1770 if (this->FilePath)
1771 {
1772 sfilename = this->FilePath;
1773 if (sfilename.at(sfilename.length() - 1) != '/')
1774 {
1775 sfilename += "/";
1776 }
1777 }
1778 sfilename += filename;
1779 vtkDebugMacro("full path to rigid body geometry file: " << sfilename);
1780
1781 this->IS = new vtksys::ifstream(sfilename.c_str(), ios::in);
1782 if (this->IS->fail())
1783 {
1784 vtkErrorMacro("Unable to open file: " << sfilename);
1785 delete this->IS;
1786 this->IS = nullptr;
1787 return 0;
1788 }
1789
1790 this->RigidBodyTransforms.clear();
1791 this->EulerTransformsMap.clear();
1792 this->UseEulerTimeSteps = false;
1793 if (this->EulerTimeSteps)
1794 {
1795 this->EulerTimeSteps->SetNumberOfTuples(0);
1796 }
1797
1798 // this should be EnSight Rigid Body
1799 if (this->ReadNextDataLine(line) == 0 || strncmp(line, "EnSight Rigid Body", 18) != 0)
1800 {
1801 vtkErrorMacro("The first line " << line << " is not 'EnSight Rigid Body'.");
1802 delete this->IS;
1803 this->IS = nullptr;
1804 return 0;
1805 }
1806
1807 // read the version now
1808 if (this->ReadNextDataLine(line) == 0 || strncmp(line, "version", 7) != 0)
1809 {
1810 vtkErrorMacro("The second line " << line << " does not include 'version'.");

Callers 2

RequestInformationMethod · 0.95
RequestInformationMethod · 0.45

Calls 15

ReadNextDataLineMethod · 0.80
backMethod · 0.80
RotateXMethod · 0.80
RotateYMethod · 0.80
RotateZMethod · 0.80
PartTransformsClass · 0.70
to_stringFunction · 0.50
NewFunction · 0.50
GetClassNameMethod · 0.45
SanitizeFileNameMethod · 0.45

Tested by

no test coverage detected