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

Method WriteCaseFile

IO/Parallel/vtkEnSightWriter.cxx:894–1080  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

892
893//------------------------------------------------------------------------------
894void vtkEnSightWriter::WriteCaseFile(int TotalTimeSteps)
895{
896
897 vtkUnstructuredGrid* input = this->GetInput();
898 int i;
899
900 this->ComputeNames();
901
902 if (!this->BaseName)
903 {
904 vtkErrorMacro("A FileName or Path/BaseName must be specified.");
905 return;
906 }
907
908 char charBuffer[1024];
909 auto result = vtk::format_to_n(charBuffer, sizeof(charBuffer), "{:s}/{:s}.{:d}.case", this->Path,
910 this->BaseName, this->ProcessNumber);
911 *result.out = '\0';
912
913 // open the geometry file
914 FILE* fd = nullptr;
915 if (!(fd = OpenFile(charBuffer)))
916 {
917 return;
918 }
919
920 this->WriteTerminatedStringToFile("FORMAT\n", fd);
921 this->WriteTerminatedStringToFile("type: ensight gold\n\n", fd);
922 this->WriteTerminatedStringToFile("\nGEOMETRY\n", fd);
923
924 // write the geometry file
925 if (!this->TransientGeometry)
926 {
927 result = vtk::format_to_n(charBuffer, sizeof(charBuffer), "model: {:s}.{:d}.00000.geo\n",
928 this->BaseName, this->ProcessNumber);
929 *result.out = '\0';
930 this->WriteTerminatedStringToFile(charBuffer, fd);
931 }
932 else
933 {
934 result = vtk::format_to_n(charBuffer, sizeof(charBuffer), "model: 1 {:s}.{:d}.*****.geo\n",
935 this->BaseName, this->ProcessNumber);
936 *result.out = '\0';
937 this->WriteTerminatedStringToFile(charBuffer, fd);
938 }
939
940 this->WriteTerminatedStringToFile("\nVARIABLE\n", fd);
941
942 char fileBuffer[256];
943
944 // write the Node variable files
945 for (i = 0; i < input->GetPointData()->GetNumberOfArrays(); i++)
946 {
947
948 strcpy(fileBuffer, input->GetPointData()->GetArray(i)->GetName());
949 // skip arrays that were not written
950 if (strcmp(fileBuffer, "GlobalElementId") == 0)
951 {

Calls 12

GetInputMethod · 0.95
ComputeNamesMethod · 0.95
SanitizeFileNameMethod · 0.95
format_to_nFunction · 0.50
OpenFileFunction · 0.50
GetNumberOfArraysMethod · 0.45
GetPointDataMethod · 0.45
GetNameMethod · 0.45
GetArrayMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected