------------------------------------------------------------------------------
| 2065 | |
| 2066 | //------------------------------------------------------------------------------ |
| 2067 | void vtkMFIXReader::GetVariableAtTimestep(int vari, int tstep, vtkFloatArray* v) |
| 2068 | { |
| 2069 | // This routine opens and closes the file for each request. |
| 2070 | // Maybe keep all SPX files open, and just perform relative |
| 2071 | // moves to get to the correct location in the file |
| 2072 | // get filename that variable # vari is located in |
| 2073 | // assumptions : there are <10 solid phases, |
| 2074 | // <10 scalars and <10 ReactionRates (need to change this) |
| 2075 | |
| 2076 | char variableName[256]; |
| 2077 | strncpy(variableName, this->VariableNames->GetValue(vari).c_str(), sizeof(variableName)); |
| 2078 | variableName[sizeof(variableName) - 1] = '\0'; // guarantee a NUL terminator |
| 2079 | int spx = this->VariableIndexToSPX->GetValue(vari); |
| 2080 | char fileName[VTK_MAXPATH]; |
| 2081 | |
| 2082 | strncpy(fileName, this->FileName, sizeof(fileName) - 1); |
| 2083 | fileName[sizeof(fileName) - 1] = '\0'; // guarantee a NUL terminator |
| 2084 | size_t fileNameLength = strlen(fileName); |
| 2085 | if (fileNameLength >= 4) |
| 2086 | { |
| 2087 | fileName[fileNameLength - 4] = '\0'; |
| 2088 | } |
| 2089 | |
| 2090 | if (spx == 1) |
| 2091 | { |
| 2092 | strcat(fileName, ".SP1"); |
| 2093 | } |
| 2094 | else if (spx == 2) |
| 2095 | { |
| 2096 | strcat(fileName, ".SP2"); |
| 2097 | } |
| 2098 | else if (spx == 3) |
| 2099 | { |
| 2100 | strcat(fileName, ".SP3"); |
| 2101 | } |
| 2102 | else if (spx == 4) |
| 2103 | { |
| 2104 | strcat(fileName, ".SP4"); |
| 2105 | } |
| 2106 | else if (spx == 5) |
| 2107 | { |
| 2108 | strcat(fileName, ".SP5"); |
| 2109 | } |
| 2110 | else if (spx == 6) |
| 2111 | { |
| 2112 | strcat(fileName, ".SP6"); |
| 2113 | } |
| 2114 | else if (spx == 7) |
| 2115 | { |
| 2116 | strcat(fileName, ".SP7"); |
| 2117 | } |
| 2118 | else if (spx == 8) |
| 2119 | { |
| 2120 | strcat(fileName, ".SP8"); |
| 2121 | } |
| 2122 | else if (spx == 9) |
| 2123 | { |
| 2124 | strcat(fileName, ".SP9"); |
no test coverage detected